akhauriyash/Code-Regression huggingface dataset:
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

//0に注意

void solve() {
	int x, y; cin >> x >> y;
    int ans = INF;
    if(x <= y) {
        chmin(ans, y - x);
    } 
    if(-x <= y) {
        chmin(ans, y + x + 1);
    }
    if(x <= -y) {
        chmin(ans, -y - x + 1);
    }
    if(-x <= -y) {
        chmin(ans, -y + x + 2);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, m, q = [int(item) for item in input().split()]

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.size = [1] * n
        self.rank = [0] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    
Forest = UnionFind(n)
circles = []
group_num = n
edge_num = 0
seen = set()
for i in range(q):
    a, b, c = [int(item) for item in input().split()]
    if a > b:
        a, b = b, a
    if (a, b, c) in seen:
        continue
    if c == 0:
        # loop with simple path
        if not Forest.same_check(a, b):
            Forest.union(a, b)
            group_num -= 1
            edge_num += 1
    else:
        circles.append((a, b, c))
    seen.add((a, b, c))

for a, b, c in circles:
    # multipath in tree
    if Forest.same_check(a, b):
        print("No")
        exit()
    if group_num == 2:
        print("No")
        exit()

if len(circles) > 0:
    edge_min = edge_num + group_num
    edge_max = edge_num + group_num * (group_num - 1) // 2
else:
    edge_min = edge_num + group_num - 1
    edge_max = edge_num + group_num * (group_num - 1) // 2

if edge_min <= m <= edge_max:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 34080
import Text.Printf

conA n =
  if n `mod` 3 == 0
  then True
  else False

conB 0 = False
conB n =
  if n `mod` 10 == 3
  then True
  else conB (n `div` 10)

judge :: Int -> Bool
judge n = (conA n) || (conB n)

main = do
  l <- getLine
  let i = read l
      o = filter judge $ [1..i] 

  mapM_ (printf " %d") o
  putStrLn ""

Measured memory_bytes: 4116
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  int n;
  while(scanf("%d",&n),n){
    vector<int> v(n,0);
    REP(i,n) REP(j,5){
      int t; scanf("%d",&t);
      v[i]+=t;
    }
    sort(v.begin(), v.end());
    printf("%d %d\n",v.back(),v.front());
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	
	static int[][] s;
	static int m, n, d, S;
	
	static boolean gauss(int[][] A) {
		for(int i=0; i<S; i++) {
			int pivot=i;
			for(int j=i; j<S; j++) {
				if(A[j][i]!=0) {
					pivot=j;
					break;
				}
			}
			
			for(int j=0; j<S+1; j++) {
				int a=A[i][j];
				A[i][j]=A[pivot][j];
				A[pivot][j]=a;
			}
			
			if(Math.abs(A[i][i])<0.000000001) {
				continue;
			}
			
			for(int j=0; j<S; j++) {
				if(i!=j && A[j][i]==1) {
					for(int k=0; k<S+1; k++) {
						A[j][k]+=A[i][k];
						A[j][k]%=2;
					}
				}
			}
		}
		for(int i=0; i<S; i++) {
			if(A[i][i]==0 && A[i][S]>0) {
				return false;
			}
		}
		
		return true;
	}
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				m=sc.nextInt();//width
				n=sc.nextInt();//hight
				d=sc.nextInt();
				if(m==0) break;
				s=new int[n][m];
				
				
				for(int i=0; i<n; i++) {
					for(int j=0; j<m; j++) {
						s[i][j]=sc.nextInt();
					}
				}
				
				S=n*m;
				int[][] field=new int[S][S+1];
				//行列式を作る
				for(int i=0; i<n; i++) {
					for(int j=0; j<m; j++) {
						field[i*m+j][i*m+j]=1;
						if(s[i][j]==1) {
							field[i*m+j][S]=1;
						}
						for(int y=0; y<n; y++) {
							for(int x=0; x<m; x++) {
								if(Math.abs(j-x)+Math.abs(i-y)==d ) {
									field[y*m+x][i*m+j]=1;
								}
							}
						}
					}
				}
				System.out.println(gauss(field)? 1:0);
				
				
				
			}
		}
	}
}


Measured memory_bytes: 75252
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int result = 1 + ((x - (y + 2 * z)) / (y + z));
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 22868
from __future__ import print_function
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N = I()
    a = LI()
    s = a[0]

    for i in range(1, N):
        s ^= a[i]

    ans = []
    for i in range(N):
        ans.append(a[i] ^ s)
    print(*ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 115128
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int BIT[SIZE];
void ins(int x,int v){
    for(;x<SIZE;x+=x&-x)BIT[x]=max(BIT[x],v);
}
int qq(int x){
    int res=0;
    for(;x;x-=x&-x)res=max(BIT[x],res);
    return res;
}
int LIS(int a[],int N){
    static int d[SIZE];
    REP(i,N)
        d[i]=a[i];
    sort(d,d+N);
    int m=unique(d,d+N)-d;
    REP(i,N){
        a[i]=lower_bound(d,d+m,a[i])-d+1;
    }
    int an=0;
    REP(i,N){
        int me=qq(a[i])+1;
        an=max(an,me);
        ins(a[i],me);
    }
    return an;
}
int AA[SIZE];
int main(){
    int N; R(N);
    REP(i,N){
        R(AA[i]);
        AA[i]=1000000000-AA[i];
    }
    W(LIS(AA,N));
    return 0;
}


Measured memory_bytes: 8832
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

const int INF =110000;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
string BinaryNum(int N)
{
        string S;
        while (N != 0)
        {
                if (N % 2 == 1)
                {
                        N--;
                        S = '1' + S;
                }
                else
                {
                        S = '0' + S;
                }
                N /= 2;
        }
        return S;
}

int main() //input->compute->output
{
        int N;
        cin >> N;


        int dp[100010];

        dp[0] = 0;

        rep2(i,1,100000+1){
                dp[i] = N;
                int power=1;
                while(power<=i){
                        dp[i]=min(dp[i],1+dp[i-power]);
                        power*=6;
                }

                power=1;
                while(power<=i){
                        dp[i]=min(dp[i],1+dp[i-power]);
                        power*=9;
                }
        }

        cout << dp[N] << endl;

        return 0;
}

Measured memory_bytes: 640
use std::io;
use std::cmp::min;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("can't read");
	let mut iter = buf.split_whitespace();
	
	let n:u64 = match iter.next().unwrap().parse() {
		Ok(num) => num,
		_ => panic!("error"),
	};
	let a:u64 = match iter.next().unwrap().parse() {
		Ok(num) => num,
		_ => panic!("error"),
	};
	let b:u64 = match iter.next().unwrap().parse() {
		Ok(num) => num,
		_ => panic!("error"),
	};
	let mut ans = (n/(a+b))*a;
	let rem = n%(a+b);
	ans += min(rem, a);
	println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n,m; cin >> n >> m;
    vector<P> data(m);
    vector<vector<int> > num(n);

    rep(i,m){
        int p,y; cin >> p >> y;
        p--;
        data[i].first=p;
        data[i].second=y;
        num[p].push_back(y);
    }
    
    rep(i,n){
        sort(all(num[i]));
    }

    rep(i,m){
        int p,y;
        p=data[i].first;
        y=data[i].second;
        auto it=lower_bound(all(num[p]),y);
        int ans=it-num[p].begin();
        ans++;
        p++;
        int tmpp=p;
        int tmpans=ans;
        int pmod=0;
        int ansmod=0;
        while(tmpp){
            tmpp/=10;
            pmod++;
        }
        while(tmpans){
            tmpans/=10;
            ansmod++;
        }
        rep(j,6-pmod) printf("0");
        printf("%d",p);
        rep(j,6-ansmod) printf("0");
        printf("%d",ans);
        puts("");
    }
    return 0;
}


Measured memory_bytes: 9512
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
point = {"r":P, "s":R, "p":S}
dp = [point[T[0]]] + [0] * (N - 1)

for i in range(1, len(T)):
    if i < K:
        dp[i] = dp[i - 1] + point[T[i]]
    else:
        if T[i] == T[i - K]:
            dp[i] = dp[i - 1]
            T[i] = None
        else:
            dp[i] = dp[i - 1] + point[T[i]]

print(dp[N - 1])

Measured memory_bytes: 55920
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
      
    int n;
    cin >> n;
    
    vector<int64_t> Lucas(n + 1);
    
    Lucas.at(0) = 2;
    Lucas.at(1) = 1;
    
    for (int i = 2; i < n + 1; i++) {
        Lucas.at(i) = Lucas.at(i - 1) + Lucas.at(i - 2);
    }
    
    cout << Lucas.at(n) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

bool is_prime(const long long int num)
{
    if(num < 2) return false;
    else if(num <= 3) return true;
    else if(num % 2 == 0) return false;
    else
    {
        for(int i = 3; i * i <= num; i += 2)
        {
            if(num % i == 0) return false;
        }
    }
    return true;
}

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int Q; cin >> Q;

    vector<pair<int,int>> query(Q);
    REP(i,Q)
    {
        int tmpl, tmpr; cin >> tmpl >> tmpr;
        query[i] = make_pair(tmpl,tmpr);
    }

    int acc[(int)1e5+10] = {};
    FOR(i, 1,1e5+1)
    {
        if(i == 1)
        {
            acc[i] = 0;
        }
        else
        {
            if(i % 2 == 0) acc[i] = acc[i-1];
            else
            {
                if(is_prime(i) && is_prime((i+1)/2)) acc[i] = acc[i-1] + 1;
                else acc[i] = acc[i-1];
            }
        }
    }

    dump(is_prime(3))
    dump(is_prime(2))
    FOR(i,1, 12)
    {
        dump(acc[i])
    }

    for(auto q : query)
    {
        int tmpl = q.first;
        int tmpr = q.second;
        if(tmpl == 1) cout << acc[tmpr] << endl;
        else
        {
            cout << acc[tmpr] - acc[tmpl-1] << endl;
        }
    }


}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  long long n,ans=0;cin>>n;
  ans+=(n/11)*2;
  n%=11;
  if(n>0){
    if(n<=6) ans++;
    else ans+=2;
  }
  
  cout<<ans;
}

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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else if (n == 2) {
        int a, b;
        cin >> a >> b;
        cout << (a+b) << endl;
    }

}

Measured memory_bytes: 256
import itertools
H, W = list(map(int,input().strip().split(' ')))
pict = [[0]*W]*H
for i in range(H):
    pict[i] = list(map(str,input().strip().split(' ')))
now = [['.' for i in range(W)] for j in range(H)]
for i,j in itertools.product(range(H),range(W)):
    if pict[i][0][j] == '#':
        if j < W-1:
            if pict[i][0][j+1]== '#':
                now[i][j],now[i][j+1] = '#','#'
        if i < H-1:
            if pict[i+1][0][j] == '#':
                now[i][j],now[i+1][j] = '#','#'
flg = 'Yes'

for i,j in itertools.product(range(H),range(W)):
    if pict[i][0][j] != now[i][j]:
        flg = 'No'
print(flg)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int x,y;
  scanf("%d%d", &x, &y);
  int ans = x + y / 2;
  printf("%d\n", ans);
  return 0;
}


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

int main() {
  long long N;
  cin >> N;
  int con = 1;
  for(int i = 2; i <= sqrt(N); i++) {
    if(N % i == 0 && i < N/2) con = i;
  }
  if(con == 1) cout << N - 1 << endl;
  else cout << (N / con - 1) + (con - 1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define mod 1e9 +7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(ll n){
    stringstream ss;
    ss << bitset<8>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
map<ll, ll> mp;
int main()
{
    ll n; cin >> n;
    vll a(n);
    rep(i,n)cin >> a[i];
    sort(rall(a));

    ll c = 0, d = 0;
    REP(i,1,n){
        if(c != 0 && d != 0)break;
        if(a[i] == a[i-1]){
            if(c == 0)c = a[i];
            else d = a[i];
            //cout << a[i] << " ";
            i++;
        }
    }
    //cout << endl;

    cout << c * d << endl;
    return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll h,w,k;
  cin >> h >> w >> k;
  ll ans = INFLONG;
  vector<vector<ll>> vec(h,vector<ll>(w)),sum(h,vector<ll>(w));
  char c;
  rep(i,h){
    rep(j,w){
      cin >> c;
      if(c == '1'){
        vec[i][j] = 1;
      }else{
        vec[i][j] = 0;
      }
    }
  }
  rep(i,h){
    ll t1 = 0;
    rep(j,w){
      if(vec[i][j]){
        t1++;
      }
      sum[i][j] = t1;
    }
  }
  vector<ll> cou(h),flag(h,0);
  ll mini;
  ll pivsum;
  rep(i,1 << (h-1)){
    t1 = i;
    mini = 0;
    rep(j,h-1){
      if(t1%2 == 0){
        flag[j+1] = 1;
        mini++;
      }else{
        flag[j+1] = 0;
      }
      t1 /= 2;
    }
    rep(p,h){
      cou[p] = 0;
    }

    rep(q,w){
      t2 = 0;
      bool can = false;
      rep(p,h){
        if(flag[p] == 0){
          t2 += vec[p][q];
        }else{
          t2 = vec[p][q];
        }
        if(t2 > k){
          can = true;
        }
      }
      if(can){
        mini = INFLONG;
        break;
      }

      rep(p,h){
        cou[p] = cou[p] + vec[p][q];
      }
      t2 = 0;
      can = false;
      rep(p,h){
        if(flag[p] == 0){
          t2 += cou[p];
        }else{
          t2 = cou[p];
        }
        if(t2 > k){
          can = true;
        }
      }
      if(can){
        mini++;
        rep(p,h){
          cou[p] = vec[p][q];
        }
      }
    }

    chmin(ans,mini);
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_m = 100000+10;

int N,M;

int main(void) {
    cin>>N>>M;
    vector<vector<int> > job(M);
    for(int i = 0;i < N;i++) {
        int a,b;
        cin>>a>>b;
        if(a <= M)
            job[a-1].push_back(b);
    }

    Int ans = 0;
    priority_queue<int> candidate;
    for(int i = 0;i < M;i++) {
        for(auto u: job[i]) {
            candidate.push(u);
        }

        if(!candidate.empty()) {
            ans += candidate.top();candidate.pop();
        }
    }

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 5504
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 105
#define maxM 10005
#define MOD 1000000007
#define EPS 1e-9
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, k;
ll cnt[maxN][maxM], sum[maxN][maxM];

void add(ll &a, ll b) {a = (a+b)%MOD;}

int main () {
    scanf("%d%d", &n, &k);
    cnt[n][0] = 1; sum[n][0] = 0;
    fdto(i, n, 1) {
        fto(m, 0, maxM-1) {
            if (cnt[i][m] > 0) {
                fto(x, 0, k) {
                    if (x > i) {
                        add(cnt[i-1][m], cnt[i][m]);
                        add(sum[i-1][m], sum[i][m]+cnt[i][m]*(x+m));
                    } else {
                        add(cnt[i-1][m+(x+m)/i], cnt[i][m]);
                        add(sum[i-1][m+(x+m)/i], sum[i][m]+cnt[i][m]*((x+m)%i));
                    }
                }
            }
        }
    }

    ll ans = 0;
    fto(m, 0, maxM-1) add(ans, sum[0][m]);
    cout << ans;

    return 0;
}


Measured memory_bytes: 14848
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define Int int64_t
using ll = long long;

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	if (k <= a) {
		cout << k << endl;
	}
	else if (k <= a + b) {
		cout << a << endl;
	}
	else {
		cout << 2 * a + b - k << endl;
	}

	

}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#define fs first
#define sc second
using namespace std;
const int maxn = 1e5+10;
using pii = pair<int,int>;

int N,M;
vector<pii> G[maxn];
vector<int> ans;
pii arr[maxn];
bool vis[maxn];
int ca[maxn];

int dfs(int u){
    vis[u] = true;
    int st = ca[u];
    for(auto v:G[u]){
        if(vis[v.fs]) continue;
        int r = dfs(v.fs);
        if(r) {
            ans.push_back(v.sc);
            st ^= 1;
        }
    }
    return st;
}
int main(){
    cin>>N>>M;
    for(int i = 1;i<=N;i++) scanf("%d %d",&arr[i].fs,&arr[i].sc);
    sort(arr+1,arr+N+1);
    ca[1] = arr[1].sc;
    for(int i = 2;i<=N+1;i++) ca[i] = arr[i].sc^arr[i-1].sc;
    for(int i = 1;i<=M;i++){
        int a,b;
        scanf("%d %d",&a,&b);
        int l = lower_bound(arr+1,arr+N+1,pii(a,0))-arr;
        int r = upper_bound(arr+1,arr+N+1,pii(b,1))-arr;
        if(l == r) continue;
        G[l].emplace_back(r,i);
        G[r].emplace_back(l,i);
    }
    for(int i = 1;i<=N;i++){
        if(vis[i]) continue;
        if(dfs(i)){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans.size()<<endl;
    sort(ans.begin(),ans.end());
    for(auto v:ans) cout<<v<<" ";

    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)1e5+111;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        cin>>n;
        cout<<n+n*n+n*n*n<<endl;
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	fx(5) {
		int a;
		cin >> a;
		if (a==0) {
			ce(x + 1);
			return 0;
		}
	}
    return 0;
}



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

int main()
{
    string S;
    ll K, cnt = 0, ans = 0, same = 0;
    cin >> S >> K;

    for (int i = 0; i < S.length(); i++)
    {
        if (S[0] == S[i])
        {
            same++;
        }
    }

    if (same == S.length())
    {
        cout << S.length() * K / 2 << endl;
        return 0;
    }

    string tmp = S;

    for (int i = 0; i < tmp.length() - 1; i++)
    {
        if (tmp[i] == tmp[i + 1])
        {
            tmp[i + 1] = '#';
            cnt++;
        }
    }

    ans += cnt;

    ll cnt2 = 0;

    if (K >= 2)
    {
        S += S;

        for (int i = 0; i < S.length() - 1; i++)
        {
            if (S[i] == S[i + 1])
            {
                S[i + 1] = '#';
                cnt2++;
            }
        }
        ans += (cnt2 - cnt) * (K - 1);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
MOD = 10**9 + 7
U = 10**6 + 10

is_prime = np.zeros(U,np.bool) #素数列挙(エラトステネス)
is_prime[2] = 1
is_prime[3::2] = 1
# print(is_prime)
for p in range(3,U,2):
    if p*p > U:
        break
    if is_prime[p]:
        is_prime[p*p::p+p] = 0

M = 10**3
small_primes = np.where(is_prime[:M])[0].tolist()
B = A.copy()
lcm = 1
for p in small_primes:
    e = 0
    while np.any(A % p == 0):
        e += 1
        A[A%p == 0] //= p
    lcm *= p**e
    lcm %= MOD

# Mより大きい数は、ここに現れる
for x in set(A.tolist()):
    lcm *= x
    lcm %= MOD

ans = sum(pow(x, MOD-2, MOD) for x in B.tolist()) % MOD
ans *= lcm
ans %= MOD
print(ans)


Measured memory_bytes: 14284
#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#define INF 2e+9
#define EPS 1e-14
#define mp make_pair
using namespace std;

struct edge{ int to,cost,limit; };
typedef pair<int,int> SV;//prev,vertex
typedef pair<int,SV> VV;//speed
typedef pair<double,VV> P;//cost

int main(){
	int n,m,s,g;
	while(cin >> n >> m,n){
		cin >> s >> g; s--;g--;
		vector<edge> G[30];
		double d[30][31][30];
		bool used[30][31][30] = {};
		for(int i = 0;i < n;i++){
			for(int j = 0;j <= 30;j++) {
				for(int k = 0;k < 30;k++){
					d[i][j][k] = INF;
				}
			}
		}
		d[s][0][s] = 0.0;
		for(int i = 0;i < m;i++) {
			int x,y,d,c;
			cin >> x >> y >> d >> c; x--;y--;
			G[x].push_back({y,d,c});
			G[y].push_back({x,d,c});
		}
		priority_queue<P,vector<P>,greater<P> > que;
		que.push(mp(0.0,mp(0,mp(s,s))));
		while(!que.empty()){
			P p = que.top();que.pop();
			double cost = p.first;
			int speed = p.second.first,prev = p.second.second.first,v = p.second.second.second;
			if(used[v][speed][prev]) continue;
			used[v][speed][prev] = false;
			for(int i = 0;i < G[v].size();i++){
				edge e = G[v][i];
				if(e.to == prev) continue;
				for(int j = max(1,speed - 1);j <= min(e.limit,speed + 1);j++){
					if(!used[e.to][j][v] && d[v][speed][prev] + (double)e.cost / (double)j < d[e.to][j][v]){
						d[e.to][j][v] = d[v][speed][prev] + (double)e.cost / (double)j;
						que.push(mp(d[e.to][j][v],mp(j,mp(v,e.to))));
					}
				}
			}
		}
		double mi = INF;
		for(int i = 0;i < n;i++) mi = min(d[g][1][i],mi);
		if(mi > (1e+9)) cout << "unreachable" << endl;
		else printf("%.8f\n",mi);
	}
	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int c = A * B;
  if (c % 2 == 1) {
  	cout << "Odd" << endl;
  } 
  else {
    cout << "Even" << endl;
  }
}
 

Measured memory_bytes: 256
n,m=list(map(int,input().split()))
switch=[]
for i in range(2**n):
    kouho=[]
    for j in range(n):
        if (i>>j & 1):
            kouho.append(1)
        else:
            kouho.append(0)
    switch.append(kouho)

kyu=[]
for i in range(m):
    kyu.append(list(map(int,input().split())))
p=list(map(int,input().split()))

ans=0
num=0
q=[]
for i in range(len(switch)):
    for j in range(m):
        for k in range(1,len(kyu[j])):
            num=num+switch[i][kyu[j][k]-1]   
        q.append(num%2)
        num=0
    #q.reverse()
    if p==q:
      ans=ans+1
    q=[]
    
        
            
print(ans)    
    
    
    
    
        
        
        

Measured memory_bytes: 3188
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
 
        int a = scanner.nextInt(); 
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        if(a==b&&c==d||a==c&&b==d||a==d&&b==c)
            System.out.println("yes");
        else
        System.out.println("no");
        
    }
}
 



Measured memory_bytes: 26272
n = int(input())
ints = list(map(int, input().split()))
m = max(ints)
x = [0] * m
cnt = 0

for i in ints:
    if x[i-1] >= 2:
        continue
    for j in range(m // i):

        x[i * (j + 1) - 1] += 1

for i in ints:
    if x[i - 1] == 1:
        cnt += 1

print(cnt)


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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* 
  //エラトステネスのふるい
  int maxNum = 100000;
  char isNotPrime[maxNum+1] = {};
  isNotPrime[0]=isNotPrime[1]=1;
  for(int i=2;i<maxNum;i++){
    if(isNotPrime[i]==1) continue;
    int num = i+i;
    while(num<=maxNum){
      isNotPrime[num]=1;
      num += i;
    }
  }
*/
// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 降順ソート vector<int> v;
// sort(v.begin(),v.end(),greater<int>());

signed main() {
  ull n;
  cin >> n;
  
  ull a = 0;
  for(ull i=sqrt(n);i>=1;i--){
    if(n%i==0){
      a = i;
      break;
    }
  }
  if(a==1){
    a = n;
  }
  if(a<n/a){
    a = n/a;
  }
  //cout << a << ":" << n/a << endl;
  int count = 0;
  while(a>0){
    a /= 10;
    count++;
  }
  
  cout << count << endl;
  return 0;
}




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

int main(void){
    int x,y,z;
    cin >> x ;
    cin >> y ;
    cin >> z ;
    if(x>y){
        int temp = x;
        x=y;
        y=temp;
    }
     if(y>z){
        int temp = y;
        y=z;
        z=temp;
    }  
       if(x>y){
        int temp = x;
        x=y;
        y=temp;
    }
    cout  << x;
    cout  <<" ";
    cout  << y;
    cout  <<" ";
    cout  << z;
    cout  << endl;
}



Measured memory_bytes: 3088
#include <iostream>

void out(int n, int* a);

int main() {
	int n;
	int a[100];
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	// Insertion Sort
	out(n, a);
	for (int i = 1; i < n; i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		out(n, a);
	}
	return 0;
}

void out(int n, int* a) {
	std::cout << a[0];
	for (int i = 1; i < n; i++) {
		std::cout << " " << a[i];
	}
	std::cout << std::endl;
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
int st[20],tot;
int n;
int main( ){
	int sum=0,digit=0;
	cin>>n;
	int x=n;
	while(x) {
		if(x>10&&x%10) digit=1;
		sum+=x%10;
		x/=10;
	}
	if(!digit&&sum==1) puts("10");
	else cout<<sum<<endl; 
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc160/tasks/abc160_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N, X, Y;
  cin >> N >> X >> Y;

  VVL edge_list(N, VL(0));

  rep(i, N - 1) {
    edge_list[i].emplace_back(i + 1);
    edge_list[i + 1].emplace_back(i);
  }

  edge_list[X - 1].emplace_back(Y - 1);
  edge_list[Y - 1].emplace_back(X - 1);

  VVL dist(N, VL(N, INF));
  rep(i, N) dist[i][i] = 0;

  // ダイクストラ
  rep(i, N) {
    priority_queue<PL, V<PL>, greater<PL>> q;
    q.emplace(0, i);

    while (!q.empty()) {
      PL pa = q.top();
      q.pop();
      ll cost = pa.fi;
      ll p = pa.se;

      if (cost > dist[i][p]) continue;

      for (auto np : edge_list[p]) {
        ll nc = cost + 1;
        if (chmin(dist[i][np], nc)) {
          q.emplace(nc, np);
        }
      }
    }
  }

  VL dist_ct(N + 1);

  rep(j, N) rep(i, j) { ++dist_ct[dist[i][j]]; }
  rep1(i, N - 1) { cout << dist_ct[i] << endl; }
}

void solve2() {
  ll N, X, Y;
  cin >> N >> X >> Y;
  --X, --Y;

  VL dist_ct(N);

  rep(j, N) rep(i, j) {
    ll dist = min(j - i, abs(i - X) + 1 + abs(j - Y));

    ++dist_ct[dist];
  }

  rep1(i, N - 1) cout << dist_ct[i] << "\n";
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve2();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
import sys
from itertools import accumulate
input = sys.stdin.readline

n,q = map(int,input().split())
s = input()
lr = []
for _ in range(q):
    lr.append(list(map(int,input().split())))

count = [0]
for i in range(0,n-1):
    if s[i] == 'A' and s[i+1] == "C":
        count.append(1)
    else:
        count.append(0)
count.append(0)

flag = list(accumulate(count))

for slr in lr:
    l = slr[0]
    r = slr[1]
    print(flag[r-1] - flag[l-1])


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int a, b, c;
    string s;
    cin >> a >> b >> c;
    cout << min(a * b, c) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second

int main()
{
    ll n;cin >> n;
    if(n%1000==0)
    {
        cout << 0 << endl;
        return 0;
    }
    cout << 1000-(n%1000) << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    ll n, k;
    cin >> n >> k;

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }
    
    rep(loop, k) {
        bool flag = true;  // 全ての電球の強さがnならtrue
        rep(i, n) {
            if(a[i] < n) {
                flag = false;
            }
        }
        if(flag) {
            break;
        }
        vl b(n+1);  // b[i] : 座標iを照らす電球の個数
        rep(i, n) {
            b[max(0LL, i - a[i])]++;
            b[min(n, i + a[i] + 1)]--;
        }
        rep(i, n) {
            b[i+1] += b[i]; 
        }
        rep(i, n) {
            a[i] = b[i];
        }
    }

    rep(i, n) {
        cout << a[i];
        if(i < n-1) {
            cout << " ";
        }
    }

    cout << endl;
    re0;
}

Measured memory_bytes: 6412
#include<iostream>
#include<cstdlib>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<bitset>
using namespace std;
int main(){
    bool flag;
    bool blue[200][200];
    bool red[200][200];
    int N,x,y,count=0,pointy=199,pointx=199;
    cin >> N;
    for(int i=0;i<200;i++){
        for(int j=0;j<200;j++){
            blue[j][i] = false;
            red[j][i] = false;
        }
    }
    for(int i=0;i<N;i++){
        cin >> x >> y;
        red[y][x] = true;
    }
    for(int i=0;i<N;i++){
        cin >> x >> y;
        blue[y][x] = true;
    }
    for(int y=199;y>=0;y--){
        for(int x=199;x>=0;x--){
            flag = true;
            if(red[y][x]==true){
                for(int x2=x;x2<200;x2++){
                    for(int y2=y;y2<200;y2++){
                        if(blue[y2][x2]==true){
                            blue[y2][x2]=false;
                            count++;
                            flag = false;
                            break;
                        }
                    }
                    if(flag==false) break;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 384