akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Solve.Answer();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var S = ReadLine();

            var S1 = S.Substring(0, (S.Length - 1) / 2);
            var S2 = S.Substring((S.Length + 3) / 2 - 1, S.Length - (S.Length + 3) / 2 + 1);

            bool flag = false;
            flag = KaibunHantei(S);
            if (flag) flag = KaibunHantei(S1);
            if (flag) flag = KaibunHantei(S2);
            IO_ShortCut.WriteLineYes_or_No(flag);

        }

        public static bool KaibunHantei(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != s[s.Length - 1 - i])
                    break;
                if (i >= s.Length - 1 - i)
                    return true;
            }
            return false;
        }
    }

    public class IO_ShortCut
    {
        #region Input
        public static string ReadString => ReadLine();
        public static int ReadInt => int.Parse(ReadLine());
        public static long ReadLong => long.Parse(ReadLine());
        public static double ReadDouble => double.Parse(ReadLine());

        public static List<string> ReadSplitString => ReadLine().Split().ToList();
        public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
        public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
        public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");

        #endregion
    }

    /// <summary>
    /// 正の数の四則演算のみ対応
    /// </summary>
    public class Mod
    {
        // 割る数の定義
        private readonly static long M = 1000000007;

        // 足し算
        public static long Add(long a, long b) => (a * b) % M;
        // 引き算
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        // 掛け算
        public static long Multi(long a, long b) => (a * b) % M;
    }

    public class MathLib
    {
        public static int Cmb(int n, int k)
        {
            var a = 1;
            for (int i = 0; i < k; i++)
            {
                a *= n;
                n--;
            }
            return k == 0 ? 1 : a / k;
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,a,b;cin>>n>>a>>b;
  int res=0;
  res+=(n/(a+b))*b;
  res+=max(n%(a+b)-a,(int)0);
  cout<<n-res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,Y;
    cin>>N>>Y;

    int count=0;
    bool flag=true;
    int n1000;
    for(int n10000=0;n10000<=N;n10000++){
        for(int n5000=0;n5000<=N-n10000;n5000++){
            n1000=N-n10000-n5000;
            int X=10000*n10000+5000*n5000+1000*n1000;
            if(X==Y){
                cout<<n10000<<" "<<n5000<<" "<<n1000<<endl;
                flag=false;
                break;
            }
        }
        if(flag==false) break;
    }
    if(flag==true) cout<<-1<<" "<<-1<<" "<<-1<<endl;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
if a > b:  
    if a > c: 
        if b > c:
            num_1 = a
            num_2 = b
            num_3 = c
        else:  
            num_1 = a
            num_2 = c
            num_3 = b
    else:  
        num_1 = c
        num_2 = a
        num_3 = b
else:  
    if c > b:  
        num_1 = c
        num_2 = b
        num_3 = a
    else:  
        if a > c:  
            num_1 = b
            num_2 = a
            num_3 = c
        else:  
            num_1 = b
            num_2 = c
            num_3 = a
print(num_1*10 + num_2 + num_3)

Measured memory_bytes: 3064
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
h = [I() for _ in range(n)]
h.sort()
ans = inf
for i in range(n-k+1):
    ans = min(ans, h[i+k-1]-h[i])
print(ans)

Measured memory_bytes: 44508
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int) (n); i++)
#define _GLIBCXX_DEBUG

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

typedef long long ll;
const int max_n = 5010;
const ll INF = 1e15;
ll n, ans = -INF;
int k;
int p[max_n];
ll c[max_n];

int main(){
    cin >> n >> k;
    rep(i, n) cin >> p[i], p[i]--;
    rep(i, n) cin >> c[i];

    rep(i, n){
        vector<int> v;
        int now = i;
        while(true){
            now = p[now];
            v.push_back(c[now]);
            if(now == i) break;
        }
        int sz = v.size();
        ll sum = accumulate(v.begin(), v.end(), 0LL);
        ll cur = 0;
        rep(j, min(sz, k)){
            cur += v[j];
            ans = max(ans, cur + (k-j-1) / sz * max(sum, 0LL));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3692
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;

for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to prod*a[i] <=10ˆ18
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}


Measured memory_bytes: 2472
import java.io.*;
import java.io.IOException;
import java.util.*;

@SuppressWarnings({"rawtypes", "unchecked"})
class Main {
    final static int INF = 1 << 28;
    final static long LNF = 1L << 60;
    final static double EPS = 1e-9;
    final static double GOLDEN_RATIO = (1.0 + Math.sqrt(5)) / 2.0;

    static final long MOD = 1000000007;

    public static void main(String[] args) throws Exception {
        final MyScanner sc = new MyScanner();
        long N;
        N = sc.nextLong();
        long[] A = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextLong();
        }
        solve(N, A);
    }

    static void solve(long N, long[] A){
        long ans = 0;
        for (int i = 0; i < 60; i++) {
            long[] num = new long[2];
            for (int j = 0; j < N; j++) {
                long n = A[j] >> i & 1;
                num[(int)n]++;
            }
            ans += num[0] * num[1] * Math.pow(2, i) % MOD;
            ans %= MOD;
        }
        System.out.println(ans);
    }


    static class MyScanner {
 
        BufferedReader br;
        StringTokenizer st;
 
        MyScanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }
 
        MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String nn() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        String next() {
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }
 
        char nextChar() {
            return nn().charAt(0);
        }
 
        int nextInt() {
            return Integer.parseInt(nn());
        }
 
        long nextLong() {
            return Long.parseLong(nn());
        }
 
        double nextDouble() {
            return Double.parseDouble(nn());
        }
 
        Integer[] niArr0(int n) {
            Integer[] ar = new Integer[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Integer[] niArr1(int n) {
            Integer[] ar = new Integer[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Long[] nlArr0(int n) {
            Long[] ar = new Long[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
 
        Long[] nlArr1(int n) {
            Long[] ar = new Long[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
    }

}


Measured memory_bytes: 80012
#include <iostream>


using namespace std;

int main()
{
	int n;
	cin >> n;
	int arr[n];
	int arr1[n];
	for ( int i = 0 ; i < n ; i++ ) cin >> arr[i];
	for ( int i = 0 ; i < n ; i++ ) cin >> arr1[i];

	int sum = 0;
	for ( int i = 0 ; i < n ; i++ )
	{
		if ( arr[i] - arr1[i] > 0 ) sum += arr[i]-arr1[i];
	}

	cout << sum << endl;


	return 0;
}


Measured memory_bytes: 256
S = input()

odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

count = 0
for i in range(len(S)):
    if (i+1)%2 == 1 and S[i] in odd:
        count += 1
    elif (i+1)%2 == 0 and S[i] in even:
        count += 1

if count == len(S):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <set>
#include <map>
#include <stdlib.h>
#include <cctype>
#include <bitset>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3556
N,K = map(int,input().split())
A = list(map(int,input().split()))
MOD = 10**9+7

inv = 0
for i in range(N-1):
    for j in range(i+1,N):
        if A[i] > A[j]:
            inv += 1
ans = (inv * K) % MOD

from collections import Counter
ctr = Counter(A)
inv2 = 0
s = 0
for _,v in sorted(ctr.items()):
    inv2 += v * s
    s += v
ans += inv2 * K*(K-1)//2
ans %= MOD
print(ans)

Measured memory_bytes: 9464
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

int main(void)
{
  int N;
  cin >> N;
  vector<int> a(3);
  for (int i = 0; i < 3; i++) {
    a[i] = N % 10;
    N /= 10;
  }

  // 0: 1 の位
  // 1: 10 の位
  // 2: 100 の位
  if (a[2] < a[1] || ((a[2] == a[1]) && a[1] < a[0])) a[2]++;
  a[1] = a[2];
  a[0] = a[2];
  for (int i = 2; i >= 0; i--) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	abc := strings.Split(sc.Text(), " ")
	a, _ := strconv.Atoi(abc[0])
	b, _ := strconv.Atoi(abc[1])
	c, _ := strconv.Atoi(abc[2])
	arr := [3]int{a, b, c}

	for i := range arr {
		for j := range arr {
			if arr[i] < arr[j] {
				tmp := arr[i]
				arr[i] = arr[j]
				arr[j] = tmp
			}
		}
	}

	fmt.Printf("%v %v %v\n", arr[0], arr[1], arr[2])
}



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


#define FOR(i,a,b) for(ll i = a ; i < b ; i++) // for i in range(a,b)
#define REP(i,n) for(ll i = 0 ; i < n ; i++) // for i in range(b)
#define FORD(i,a,b) for(ll i = a ; i > b ; i--) // for i in range(a,b,-1)
#define ALL(x) x.begin(),x.end()
#define debug(x) cerr << #x << ": " << x << '\n'

const int IINF = 1'001'001'001;
const ll INF = 1'001'001'001'001'001'001ll;
const int MOD = 1'000'000'007;


void solve(){
    string s; cin >> s;
    int ans = 0;
    int cnt = 0;
    REP(i,s.size()){
        // debug(i);
        if(i%2==0 && s[i]=='0') cnt+=1;
        else if(i%2==1 && s[i]=='1') cnt+=1;
    }
    ans = cnt;
    cnt = 0;
    REP(i,s.size()){
        if(i%2==0 && s[i]=='1') cnt+=1;
        else if(i%2==1 && s[i]=='0') cnt+=1;
    }
    ans = min(ans,cnt);
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n+1), y(m+1);
  cin >> x.at(0) >> y.at(0);
  for(int i=0; i<n; i++)
    cin >> x.at(i+1);
  for(int i=0; i<m; i++)
    cin >> y.at(i+1);
  
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  
  if(x.at(n) < y.at(0))
    cout << "No War" << endl;
  else
    cout << "War" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n,m;
  cin>>n>>m;
  vector<int64_t> l(m);
  vector<int64_t> r(m);
  for(int i=0;i<m;i++){
    cin>>l.at(i)>>r.at(i);
  }
  int64_t lmax=0;
  int64_t rmin=r.at(0);
  for(int i=0;i<m;i++){
    lmax=max(lmax,l.at(i));
    rmin=min(rmin,r.at(i));
  }
  if((rmin-lmax)<0){
    cout<<0;
  }
  else{
    cout<<(rmin-lmax)+1;
  }
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(5<a && a<13)
    {
        cout << b / 2 << endl;
    }
    else if (a<6)
    {
        cout << 0 << endl;      
    }

    else
    {
        cout << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    a = int(S[:2])
    b = int(S[2:])
    if 1 <= a <= 12 and 1 <= b <= 12:
        ans = 'AMBIGUOUS'
    elif 1 <= a <= 12:
        ans = 'MMYY'
    elif 1 <= b <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'
    return ans

print(main())

Measured memory_bytes: 3064
#include<stdio.h>

int main() {
	int N; 
	scanf("%d", &N);
	int v[50];
	for (int i = 0; i < N; i++) {
		scanf("%d", &v[i]);
	}

	int flag = 1;
	while (flag == 1) {
		flag = 0;
		for (int i = 0; i < N-1; i++) {
			if (v[i] > v[i+1]) {
				flag = 1;
				int tmp = v[i];
				v[i] = v[i + 1];
				v[i + 1] = tmp;
			}
		}
	}

	double ans = 0;
	for (int i = 0; i < N-1; i++) {
		if (i == 0) {
			ans = (v[i] + v[i + 1]) / 2.0;
		}
		else ans = (ans + v[i + 1])/2.0;
	}

	printf("%.16f", ans);
}	

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

struct UnionFind {
    vector<int> par, rank, size;

    UnionFind(int n) {
        par.resize(n);
        for (int i = 0; i < n; i++) par[i] = i;
        rank.resize(n);
        size.resize(n, 1);
    }

    int find(int x) {
        if (par[x] == x) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        if (rank[x] < rank[y]) {
            par[x] = y;
            size[y] += size[x];
        } else {
            par[y] = x;
            size[x] += size[y];
            if (rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int get_size(int x) {
        return size[find(x)];
    }
};

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

    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    for (int i = 0; i < q; i++) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            uf.unite(x, y);
        } else {
            cout << (uf.same(x, y) ? 1 : 0) << '\n';
        }
    }
}


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

#define	ON		(1)
#define	OFF		(0)

#define MAX_STR_LEN	(1000)
#define MAX_DIGITS	(80)

int main(void)
{
	int dataset_no;
	int loop;
	char in_str[MAX_STR_LEN];
	int num1[MAX_DIGITS + 1], num2[MAX_DIGITS];
	int i;
	int flag_print;
	
	scanf("%d", &dataset_no);
	
	for (loop = 0; loop < dataset_no; loop++){

		//@zñú»
		memset(num1, 0, sizeof(num1));
		memset(num2, 0, sizeof(num2));
		
		// ÅÌÌüÍ
		scanf("%s", in_str);
		if (strlen(in_str) > MAX_DIGITS){		// üÍµ½ª80ð´¦Ä¢é©H
			scanf("%s", in_str);				// 2ÔÚÌÌóÇÝ
			printf("overflow\n");
			continue;
		}
		for (i = strlen(in_str) - 1; i >= 0; i--){
			num1[strlen(in_str) - 1 - i] = (in_str[i] - '0');
		}
		

		// 2ÔÚÌÌüÍ
		scanf("%s", in_str);
		if (strlen(in_str) > MAX_DIGITS){		// üÍµ½ª80ð´¦Ä¢é©H
			printf("overflow\n");
			continue;
		}
		for (i = strlen(in_str) - 1; i >= 0; i--){
			num2[strlen(in_str) - 1 - i] = (in_str[i] - '0');
		}

		// vZ
		for(i = 0; i < MAX_DIGITS; i++){
			num1[i] += num2[i];
			num1[i + 1] += num1[i] / 10;
			num1[i] %= 10;
		}
		
		if (num1[MAX_DIGITS] == 0){		// vZÊª80ð´¦Ä¢é©H
			flag_print = OFF;
			for (i = MAX_DIGITS - 1; i >= 0; i--){
				if (num1[i] != 0){
					flag_print = ON;
				}
				if (flag_print == ON){
					printf("%d", num1[i]);
				}
			}
			if (flag_print == OFF){
				printf("0");
			}
			printf("\n");
		}
		else {
			printf("overflow\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
while 1:
	n,m=map(int,raw_input().split())
	if n==m==0:break
	p=[[0,i] for i in xrange(m)]
	st=[map(int,raw_input().split()) for _ in xrange(n)]
	for i in xrange(n):
		for j in xrange(m):
			p[j][0]+=st[i][j]
	p.sort(key=lambda x:(x[0],-x[1]))
	ans=[]
	for i in xrange(m-1,-1,-1):
		ans.append(str(p[i][1]+1))
	print(" ".join(ans))

Measured memory_bytes: 7500
N = int(input())
num_list = list(map(int, input().split()))

length = len(num_list)
num_list_devided = num_list
factor2 = [0]

while num_list_devided[0] % 2 == 0:
    num_list_devided[0] = num_list_devided[0] / 2
    factor2[0] += 1

for i in range(1, length):
    min_factor2 = min(factor2)
    factor2.append(0)
    for j in range(min_factor2):
        while num_list_devided[i] % 2 == 0:
            num_list_devided[i] = num_list_devided[i] / 2
            factor2[i] += 1
            
print(min(factor2))


Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int c, min = 10, sum = 0;
    for (int i = 0; i < 5; ++i) {
        cin >> c;
        sum += (c % 10 == 0) ? c : (c / 10 * 10 + 10);
        if ((c % 10) < min && c % 10 != 0) {
            min = c % 10;
        }
    }
    cout << ((min == 0) ? sum : (sum - 10 + min)) << endl;
}


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

int main(){

  int x,a,b;
  cin >> x >> a >> b;
  if(b-a<=x){
    if(b>a){
      cout << "safe" << endl;
    }else{
      cout << "delicious" << endl;
    }
  }else{
    cout << "dangerous" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll x; cin >> x;

    ll cnt = 0;
    ll now = 100;
    while (true) {
        cnt++;
        double d = (double)now * 1.01;
        ll ld = d;
        if (ld >= x) {
            cout << cnt << endl;
            return 0;
        }
        now = ld;
    }
}


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

#define SZ(a) (int)a.size()
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;

struct edge {
  int u,v,i;
  
  edge(int u, int v, int i): u(u), v(v), i(i) {}
  edge() {}
};

void dfs(vector<vector<edge>>& G, int v, vector<bool>& vis, int colour, vector<int>& c, int K) {
  vis[v] = true;
  
  int C = colour;
  for(edge e : G[v]) {
    if(vis[e.v]) continue;
    C++;
    if(C > K) C = 1;
    c[e.i] = C;
    dfs(G, e.v, vis, C, c, K);
  }
}

int main() {

  int N;
  scanf("%d", &N);
  
  vector<int> c(N-1);
  vector<vector<edge>> G(N+1);
  
  for(int i = 0; i < N-1; i++) {
    int a,b;
    scanf("%d%d", &a, &b);
    G[a].PB(edge(a,b,i));
    G[b].PB(edge(b,a,i));
  }
  
  int K = 0;
  
  for(vector<edge>& g : G) K = max(K, SZ(g));
  
  vector<bool> vis(N+1);
  
  dfs(G, 1, vis, 1, c, K);
  
  printf("%d\n", K);
  for(int colour : c) {
    printf("%d\n", colour);
  }

  return 0;
}


Measured memory_bytes: 8320
fun main(args: Array<String>) {
    val (N, K, C) = listOfInt()
    val S = next().map { it == 'o'}
    val L = IntArray(N)
    val R = IntArray(N)
    var cnt = 1
    var s = 0
    while (s < N && cnt <= K) {
        if (S[s]) {
            L[s] = cnt++
            s += C + 1
        } else s += 1
    }
    cnt = K
    s = S.size - 1
    while (s >= 0 && cnt > 0) {
        if (S[s]) {
            R[s] = cnt--
            s -= C + 1
        } else s -= 1
    }
    val sb = StringBuilder()
    (0 until N).forEach { n ->
        if (L[n] > 0 && L[n] == R[n]) sb.appendln(n + 1)
    }
    println(sb.toString())
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)




Measured memory_bytes: 44568
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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


int main() {

  int N;
  cin >> N;

  vector<ll> A(N + 1), B(N + 1);
  REP(i, N + 1) cin >> A[i];
  REP(i, N) cin >> B[i];

  ll tmp = 0;
  ll ans = 0;
  REP(i, N){
    if (A[i] > tmp + B[i]) {
      ans += tmp + B[i];
      tmp = 0;
    }
    else{
      ans += A[i];
      tmp = B[i] - max(A[i] - tmp, 0LL);
    }
  }
  if (A[N] >= tmp) ans += tmp;
  else ans += A[N];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for(int i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int main(int argc, char* argv[]) {

	int n;
	int ans = 0;

	cin >> n;

	std::vector<int> r;

	for(int i=1 ; i<=n ; i+=2){
		r.clear();
		r = enum_div(i);
		if(r.size() + 1 == 8){
			ans++;
		}
	}

	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define f first
#define s second
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vi vector<int>
#define vll vector<ll>
#define be begin
#define en end
#define endl '\n'
#define SIZE 100000000
#define w(t) int t;cin>>t;while(t--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define value_at_idx find_by_order
#define idx order_of_key
#define MOD 1e9 + 7

typedef long long ll;
using namespace std;
using namespace __gnu_pbds; 
 
map<int,list<int>> l ;
bool vis[SIZE]={0};

int dp[SIZE];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin>>s;
	if(s == "ABC")
		cout<<"ARC";
	else 
		cout<<"ABC";

	

	return 0;
	
	
	
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}


int main(){
  ll H, W;
  cin >> H >> W;
  
  ll res;
  if(H != 1 && W != 1){
    if(H*W%2 == 0){
      res = H*W/2;
    }else{
      res = (H*W + 1)/2;
    }
  }else{
    res = 1;
  }
  
  
  cout << res;
  
  
  
}

Measured memory_bytes: 256
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan=new Scanner(System.in);
    		int a=Integer.parseInt(scan.next());
    		int b=Integer.parseInt(scan.next());
    		
    		System.out.print(a+b<24?a+b:a+b-24);

    		
    	
  
    				
    	}
     
    }

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout<<'\n';
#define MOD 1000000007
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << (#x) << "=" << x << "]" << '\n';
#define deb2(x,y) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "]" << '\n';
#define deb3(x,y,z) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "] [" << (#z) << "=" << z << "]" << '\n';

void solve(){
  int n; cin>>n;
  vector<int> v(n);
  for(int i=0 ; i<n ; i++) cin>>v[i];
  int cnt=0;
  for(int i=0 ; i<n ; i++){
    for(int j=i+1 ; j<n ; j++){
      for(int k=j+1 ; k<n ; k++){
        if(v[i]+v[j]>v[k] && v[i]+v[k]>v[j] && v[j]+v[k]>v[i] && v[i]!=v[j] && v[j]!=v[k] && v[i]!=v[k]){
            cnt++;
        }
      }
    }
  }
  cout<<cnt;LOL
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int _=1; //cin>>_;
  while(_--) solve();
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>

int main()
{
    unsigned long n , first = 1 , second = 2;
    std::cin >> n;
    unsigned long L = first + second;
    if(n == 1){
        std::cout<<1<<std::endl;
        return 0;
    }
    int count = 2;
    while (count < n) {
        second = first;
        first = L;
        L = first + second;
        count++;
    }
    std::cout<<L<<std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> c[i][j];
    vector<vector<int>> dp(h, vector<int>(w, 1e8));
    dp[0][0] = 0;
    rep(i, h) rep(j, w) {
        if ( i == 0 && j == 0 && c[i][j] == '#' ) {
            dp[0][0] = 1;
        }
        if ( i - 1 >= 0 ) {
            if ( c[i][j] == '#' && c[i-1][j] == '.' || c[i][j] == '.' && c[i-1][j] == '#' ) {
                dp[i][j] = min(dp[i][j], dp[i-1][j] + 1 );
            }
            else {
                dp[i][j] = min(dp[i][j], dp[i-1][j]);
            }
        }
        if ( j - 1 >= 0 ) {
            if ( c[i][j] == '#' && c[i][j-1] == '.' || c[i][j] == '.' && c[i][j-1] == '#' ) {
                dp[i][j] = min(dp[i][j], dp[i][j-1] + 1 );
            }
            else {
                dp[i][j] = min(dp[i][j], dp[i][j-1]);
            }
        }
        if ( i == h - 1 && j == w - 1 && c[i][j] == '#' ) {
            dp[i][j] += 1;
        }
    }
//    rep(i, h) {
//        rep(j, w) cout << dp[i][j] << " ";
//        cout << endl;
//    }
    cout << dp[h-1][w-1] / 2 << endl;
    return 0;
}

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

//入力
int n, W;
int weight[110], value[110];
//DPテーブル
int dp[110][10010];
//DP[i][w]：i個目までの品物を考慮した場合の大きさｗのナップサックに入れる場合の価値の最大値のメモリ

int main() {
  cin >> n >> W;
  REP(i,n) cin >> value[i] >> weight[i];

  //DPの初期化
  //DP[0][w] = 0 (品物が０個のとき，価値の最大値は０)
  for(int w = 0; w <= W; ++w) dp[0][w] = 0;

  //   //DPループ
  //   // 品物を増やすリープ｛
  //   //   ナップサックの容量を増やすループ{
  //         DPの最大値を求める
  // }
  //   // ｝
  for(int i = 0; i < n; ++i){
    for(int w = 0; w <= W; ++w){

      if(w >= weight[i]){
        dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
        //最大値の判定
      }
      else{
        dp[i+1][w] = dp[i][w];   //ナップサックｗに品物iが入らないとき
      }

    }
  }
  cout << dp[n][W] << endl;

}


Measured memory_bytes: 7032
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int a,b;
    cin>>a>>b;
    if(a<=b) cout<<a;
    else cout<<a-1;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    string s;
    cin >> s;
    sort(all(s));
    if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n,m,i[101],j,b,a[1000][101],ans[1000]={},ai,ue,oka;
    scanf("%d %d",&n,&m);
    for(ai=0;ai<n;ai++){
        for(ue=0;ue<m;ue++){
            scanf("%d",&a[ai][ue]);
        }
    }
    for(oka=0;oka<m;oka++){
        scanf("%d",&i[oka]);
    }
    for(ai=0;ai<n;ai++){
        for(ue=0;ue<m;ue++){
            ans[ai]+=i[ue]*a[ai][ue];
        }
    }
     
    for(oka=0;oka<n;oka++){
        printf("%d\n",ans[oka]);
    }
     
     
     
     
     
     
     
    return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
//#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200000];
vll v;
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            v.push(p);
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
ll lcm(ll a,ll b)
{
    ll ans=mymod(a*b,num);
    ans=mymod(modInverse(__gcd(a,b),num)*ans,num);
    return ans;
}
ll find_lcm(ll A[10005], ll n)
{
    if(n==1)
    return A[0];
    ll a=lcm(A[0],A[1]);
    REP(i,2,n)
    {
        a=lcm(a,A[i]);
    }
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll h[n],dp[n];
    REP(i,0,n)
    {
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    REP(i,2,n)
    {
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
    }
    cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define ar array
#define mxn 200006
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e9+5
#define fi first
#define se second
typedef long long int ll;
using namespace std;
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("randin.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	ll n;
	cin>>n;
	if(n==1LL)
	cout<<0<<endl;
	else{
		ll a=1LL,b=1LL,c=1LL;
		for(int i=1;i<=n;i++){
			a*=10;
			a%=mod;
		}
		for(int i=1;i<=n;i++){
			b*=9;
			c*=8;
			b%=mod;
			c%=mod;
		}
		ll ans=0LL+a-b;
		ans-=b;
		ans+=c;
		cout<<(ans+mod+mod)%mod;
	}
}


Measured memory_bytes: 3644
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> ds = new ArrayList<>();
        List<Integer> ans = new ArrayList<>();

        for(int i=0; i<n; i++){
            ds.add(sc.nextInt());
        }

        ds = ds.stream().sorted((x,y)->x-y).collect(Collectors.toList());

        for(Integer item:ds){
            if(ans.indexOf(item) == -1){
                ans.add(item);
            }
        }

        System.out.println(ans.size());


    }
}


Measured memory_bytes: 27216
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<ll> v;
    for (int i = 0; i < n; ++i) {
        int k;
        scanf("%d", &k);
        v.emplace_back(k);
    }

    partial_sum(v.begin(), v.end(), v.begin());

    ll p = 0, q = 0, k = 0;
    for (int i = 0; i < n; ++i) {
        k ^= 1;
        if(k){
            if(v[i]+ p < 1){
                q += abs(1-v[i]-p);
                p = 1 -v[i];
            }
        }else{
            if(v[i]+ p > -1){
                q += abs(-1-v[i]-p);
                p = -1 -v[i];
            }
        }
    }
    ll q2 = q;
    k = 1, q = 0, p = 0;
    for (int i = 0; i < n; ++i) {
        k ^= 1;
        if(k){
            if(v[i]+ p < 1){
                q += abs(1-v[i]-p);
                p = 1 -v[i];
            }
        }else{
            if(v[i]+ p > -1){
                q += abs(-1-v[i]-p);
                p = -1 -v[i];
            }
        }
    }
    cout << min(q, q2) << "\n";

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main() {
	long long n, m;
	cin >> n >> m;
	if (n == 1 && m == 1) {
		cout << 1 << endl;
		return 0;
	}
	else {
		if (n == 1 || m == 1) {
			cout << n*m - 2 << endl;
			return 0;
		}
	}
	cout << (n - 2)*(m - 2) << endl;

	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range;
import std.bigint;

class Node{
	Edge[] edges;
	int id;
	int flag;
	this(int i){
		this.id = i;
		}
	void add(Edge e){
		edges ~= e;
		}
	}
class Edge{
	Node[] nodes;
	this(Node n1, Node n2){
		this.nodes = [n1, n2];
		n1.add(this);
		n2.add(this);
		}
	}

void main(){
	
	int[] ins = readln.chomp.split.map!(to!int).array;
	
	int n = ins[0], k = ins[1];
	
	Edge[] edges;
	Node[] nodes;
	foreach(i; 0 .. n) nodes ~= new Node(i);
	for(int i = 0; i < n - 1; i ++){
		int[] ab = readln.chomp.split.map!(to!int).map!(a => a - 1).array;
		edges ~= new Edge(nodes[ab[0]], nodes[ab[1]]);
		}
	
	
	int ans;
	
	int getCnt(Node[] ns0, int r){ // count of nodes within radius r
		foreach(n2; nodes) n2.flag = 0;
		int cnt;
		foreach(n0; ns0) n0.flag = 1;
		Node[] ns1 = ns0;
		for(int d = 0; d <= r; d ++){
			cnt += ns1.length;
			Node[] ns2;
			foreach(n1; ns1){
				foreach(e; n1.edges){
					foreach(n2; e.nodes){
						if(!n2.flag) n2.flag = 1, ns2 ~= n2;
						}
					}
				}
			ns1 = ns2;
			}
		return cnt;
		}
	
	if(k % 2 == 0){
		int max = 0;
		int r = k / 2;
		foreach(n0; nodes){ // center node
			int cnt = getCnt([n0], r);
			if(cnt > max) max = cnt;
			}
		ans = n - max;
		}
	else{ // center edge
		int max = 0;
		int r = k / 2;
		foreach(e0; edges){
			int cnt = getCnt(e0.nodes, r);
			if(cnt > max) max = cnt;
			}
		ans = n - max;
		}
	
	ans.writeln;
	
	}


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

int main(){
    long long N,M;
    cin >> N >> M;
    if(N>M) swap(N,M);
    long long ans;
    if(N==1 && M==1){
        ans = 1;
    } else if(N == 1){
        ans = M -2;
    } else{
        ans = (N-2) * (M-2);
    }
    cout << ans << endl;
    return 0;

}

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

bool check(int n)
{
  int c = 0;
  while(n){
    c++;
    n /= 10;
  }
  return c%2 ==1;
}
  
int main()
{
  int n, k = 0;
  scanf("%d", &n);
  for(int i = 1; i <= n; ++i)
    if (check(i)) k++;
  printf("%d", k);
  return 0;
}

Measured memory_bytes: 256
import collections
Sa = collections.deque([ i for i in input()])
Sb = collections.deque([ i for i in input()])
Sc = collections.deque([ i for i in input()])
prv = Sa.popleft()
win = 0
flag = True
while flag:
    if prv == 'a':
        if not Sa:
            flag = False
            win = 'A'
        else:
            prv = Sa.popleft()
    elif prv == 'b':
        if not Sb:
            flag = False
            win = 'B'
        else:
            prv = Sb.popleft()
            
    else:
        if not Sc:
            flag = False
            win = 'C'
        else:
            prv = Sc.popleft()
            
print(win)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				return;
			}
			String[][] cv = new String[n][2];
			for(int i=0;i<n;i++){
				cv[i][0] = stdIn.next();
				cv[i][1] = stdIn.next();
			}
			int m = stdIn.nextInt();
			for(int i=0;i<m;i++){
				String x = stdIn.next();
				boolean flag = true;
				for(int j=0;j<n;j++){
					if(x.equals(cv[j][0])){
						System.out.print(cv[j][1]);
						flag = false;
						break;
					}
				}
				if(flag){
					System.out.print(x);
				}
			}
			System.out.println();
		}
	}
}

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

using namespace std;

int main()
{
    long long n;
    cin>>n;
    long long ttl=0ll;
    for(long long i=1ll;i*i<=n-1ll;i++){
        if((n-1ll)%i==0ll){
            if(i!=1ll&&(n)%i!=0)
                ttl++;
            if(n%((n-1)/i)!=0&&(n-1)/i!=i)
            ttl++;
        }
    }
    for(long long i=1ll;i*i<=n;i++){
        if(n%i==0ll){
            if(i!=1ll){
                long long tmn=n;
                while(tmn%i==0)
                    tmn/=i;
                if((tmn-1)%i==0)
                    ttl++;
            }
            if(i==(n/i))
                continue;
            long long tmn=n;
            while(tmn%(n/i)==0){
                tmn/=(n/i);
            }
            if((tmn-1)%(n/i)==0)
                ttl++;
        }
    }
    cout<<ttl<<'\n';
    return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

ll t10( int t ){
    ll ret = 1;
    Rep(i,t) ret *= 10;
    return ret;
}

int main() {

    int N;
    Scd(N);

    ll ans = 0;

    Repe(i,N+1,1){
        ll a1 = i;
        while( a1/10 ) a1 /= 10;
        ll an = i%10;
        if( an == 0 ) continue;
        if( a1 == an ){ if( a1 <= N ) ans++; }
        Repe(j,10,1){
            ll b = an*t10(j)+a1;
            if( N>=b ) {
                ans += min( t10(j-1), ( N - b ) / 10 + 1 );
            }
        }
    }

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

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
signed main(){int a,b,c,d,e,f,g,h,i;return scanf("%d%d%d",&a,&b,&c),printf("%d %d %d\n%d %d %d\n%d %d %d\n",a,b,d,f,c,g,e,c*2-b,c*3-(d=c*3-a-b)-(g=c*2-(f=c*3-a-(e=c*2-d)))),0;}

Measured memory_bytes: 128
N =int(input().strip())

target = N
output_str = ""

while target != 0:
    if target % 2 == 1:
        output_str = "1" + output_str
        target = (target - 1) / (-2)
    else:
        output_str = "0" + output_str
        target = (target) / (-2)

if output_str != "" :
    print(output_str)
else:
    print("0")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int a,b,k;
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>a>>b>>k)
    {
        for(int i=1;i<=k;i++)
        {
            if(i%2!=0)
            {
                if(a%2!=0)
                {
                    a-=1;
                }
                a/=2;
                b+=a;
            }
            else
            {
                if(b%2!=0)
                {
                    b-=1;
                }
                b/=2;
                a+=b;
            }
        }
        cout<<a<<" "<<b<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    bool flag = true;
    int ans = 0;
    while (flag) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) a[i] /= 2;
            else flag = false;
        }
        if (flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextInt()
    val s = sc.next().toCharArray()
    val chars = Array(26) { TreeSet<Int>() }

    for (x in 0 until n) {
        chars[s[x] - 'a'].add(x)
    }

    repeat(sc.nextInt()) {
        val op = sc.nextInt()
        when (op) {
            1 -> {
                val i = sc.nextInt() - 1
                val c = sc.next()
                chars[s[i] - 'a'].remove(i)
                s[i] = c[0]
                chars[s[i] - 'a'].add(i)
            }
            2 -> {
                val l = sc.nextInt() - 1
                val r = sc.nextInt() - 1
                println(chars.count { (it.ceiling(l) ?: n) <= r })
            }
        }
    }


}


class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 106832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String C1 = scan.nextLine();
		String C2 = scan.nextLine();
		if(C1.substring(0, 1).equals(C2.substring(2, 3)) && C1.substring(2, 3).equals(C2.substring(0, 1)) && C1.substring(1, 2).equals(C2.substring(1, 2))) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		scan.close();

	}

}


Measured memory_bytes: 23252