akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	str := sc.Text()
	a := strings.Split(str, " ")
	b := make([]int, n)
	for i, v := range a {
		b[i], _ = strconv.Atoi(v)
	}

	sort.Ints(b)
	ans := float64(b[0])
	for i := 1; i < len(b); i++ {
		ans = (ans + float64(b[i])) / 2.0
	}
	fmt.Println(ans)
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long prime = 1000000007;
    auto mod = [&](int a) {
        return (a % prime + prime) % prime;
    };
    int n, m;
    cin >> n >> m;
    vector<int> xs(n), ys(m);
    for (int& x : xs) {
        cin >> x;
    }
    for (int& y : ys) {
        cin >> y;
    }
    vector<vector<long long>> count(n+1, vector<long long>(m+1, -1));
    // count[i][j] is the number of equal subsequences between xs[0], .., xs[i-1] and ys[0], .., ys[j-1]
    for (int i = 0; i <= n; ++i) {
        count[i][0] = 1;
    }
    for (int j = 0; j <= m; ++j) {
        count[0][j] = 1;
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (xs[i-1] == ys[j-1]) {
                count[i][j] = mod(count[i-1][j] + count[i][j-1]);
            } else {
                count[i][j] = mod(count[i-1][j] + count[i][j-1] - count[i-1][j-1]);
            }
        }
    }
    cout << count[n][m] << endl;
    return 0;
}


Measured memory_bytes: 31616
/*  -*- coding: utf-8 -*-
 *
 * 2717.cc: Where is the Boundary
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000;
const int MAX_M = 100;
const int INF = 1 << 30;

/* typedef */

/* global variables */

char cs[MAX_N + 1];
int es[MAX_N], esums[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < m; i++) {
    scanf("%s", cs);
    for (int j = 0; j < n; j++)
      if (cs[j] == 'E') es[j]++;
  }

  esums[0] = 0;
  for (int i = 0; i < n; i++) esums[i + 1] = esums[i] + es[i];
  //for (int i = 0; i < n; i++) printf("%d ", es[i]); putchar('\n');

  int minsum = INF, mini = -1;
  for (int i = 0; i <= n; i++) {
    int sum = esums[i] + (m * (n - i) - (esums[n] - esums[i]));
    if (minsum > sum) minsum = sum, mini = i;
  }

  printf("%d %d\n", mini, mini + 1);
  return 0;
}

Measured memory_bytes: 3292
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split(" ");
var num=0;
for(var i=0;i<Arr.length;i++){
   var str=Arr[i];
   str=str.replace(/\d+/g,function(s){
      num+=(s-0);
      return s;
   });
}
console.log(num);

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  long long a,b,c,d,ans;
  
  cin >> a >> b >> c >> d;
  ans = a*c;
  ans = MAX(ans, a*d);
  ans = MAX(ans, b*c);
  ans = MAX(ans, b*d);
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3604
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():


    s = "#" + S()
    t = "#" + S()

    dp = [[0 for _ in range(len(s) + 1)] for _ in range(len(t) + 1)]

    for i in range(len(t)-1):
        for j in range(len(s)-1):
            if t[i+1] == s[j+1]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])


    ans = ""
    now = dp[len(t)-1][len(s)-1]
    zahyo = [len(t)-1, len(s)-1]
    while now != 0:
        while dp[zahyo[0]][zahyo[1]-1]==now:
            zahyo[1]-=1
        while dp[zahyo[0]-1][zahyo[1]]==now:
            zahyo[0]-=1

        ans += t[zahyo[0]]

        now -= 1
        zahyo = [zahyo[0]-1, zahyo[1]-1]

    ans = ans[::-1]

    print(ans)

main()


Measured memory_bytes: 148820
import java.io.*;
import java.util.*;

public class Main{
	static int h;
	static int w;
	static char[][] map;
	static Long[][] memo;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		h = sc.nextInt();
		w = sc.nextInt();
		memo = new Long[h][w];
		map = new char[h][w];

		for (int i = 0; i < h; i++) {
			String x=sc.nextLine();
			for (int j = 0; j < w; j++) {
				map[i][j] = x.charAt(j);
				memo[i][j] = -1l;
			}
		}

		out.println(dp(0, 0)%(1000000000+7));

		out.flush();
	}

	public static Long dp(int i, int j) {
		if (i >= h || j >= w) {
			return 0l;
		}
		
		if (i == h - 1 && j == w - 1) {
			return 1l;
		}
		if (memo[i][j] != -1l) {
			return memo[i][j];
		}
		if (map[i][j] == '#') {
			return memo[i][j]=0l;
		}
		Long right = dp(i , j+1);
		Long left = dp(i+1, j);
		return memo[i][j] = ((right + left)%((1000000000+7)));
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 84308
#include <cstdio>
#include <cstring>

using namespace std;

int dp[5][4444];

int solve(int a,int b)
{
  if(a*1000<b)return 0;
  if(a==0 && b==0)return dp[a][b]=1;
  if(dp[a][b]>=0)return dp[a][b];
  int res = 0;
  for(int i = 0; i <= 1000; i++) {
    if(b<i)break;
    res += solve(a-1,b-i);
  }
  return dp[a][b] = res;
}

int main(void)
{
  int n;
  memset(dp,-1,sizeof(dp));
  for(int i = 0; i <= 4000; i++) {
    solve(4,i);
  }
  while(scanf("%d",&n) == 1) {
    printf("%d\n",dp[4][n]);
  }
}

Measured memory_bytes: 1120
#include<stdio.h>
int main(void){
    int suc[5]={0},i,n,m;
    for(i=1;i<6;i++){
    scanf("%d",&suc[i]);
    if(suc[i]<40)suc[i]=40;
    }
    n=suc[1]+suc[2]+suc[3]+suc[4]+suc[5];
    m=n/5;
    printf("%d\n",m);
    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <math.h>
int main(){
  double x1,x2,y1,y2,a;
  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
  a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
  printf("%lf\n",sqrt(a));
  return 0;
}

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


template <int mod>
struct ModInt {
  int val;
  int trim(int x) const { return x >= mod ? x - mod : x < 0 ? x + mod : x; }
  ModInt(int v = 0) : val(trim(v % mod)) {}
  ModInt(long long v) : val(trim(v % mod)) {}
  ModInt &operator=(int v) { return val = trim(v % mod), *this; }
  ModInt &operator=(const ModInt &oth) { return val = oth.val, *this; }
  ModInt operator+(const ModInt &oth) const { return trim(val + oth.val); }
  ModInt operator-(const ModInt &oth) const { return trim(val - oth.val); }
  ModInt operator*(const ModInt &oth) const { return 1LL * val * oth.val % mod; }
  ModInt operator/(const ModInt &oth) const {
    function<int(int, int, int, int)> modinv = [&](int a, int b, int x, int y) {
      if (b == 0) return trim(x);
      return modinv(b, a - a / b * b, y, x - a / b * y);
    };
    return *this * modinv(oth.val, mod, 1, 0);
  }
  bool operator==(const ModInt &oth) const { return val == oth.val; }
  ModInt operator-() const { return trim(mod - val); }
  template<typename T> ModInt pow(T pw) {
    bool sgn = false;
    if (pw < 0) pw = -pw, sgn = true;
    ModInt ans = 1;
    for (ModInt cur = val; pw; pw >>= 1, cur = cur * cur) {
      if (pw&1) ans = ans * cur;
    }
    return sgn ? ModInt{1} / ans : ans;
  }
};

using mint = ModInt<int(1e9 + 7)>;
mint dp[3100][3100];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  dp[0][0] = 1;
  int n; cin >> n;
  string s; cin >> s;
  for (int i = 1; i < n; ++i) {
    vector<mint> psum(i + 1, mint(0));
    for (int j = 1; j <= i; ++j) psum[j] = psum[j - 1] + dp[i - 1][j - 1];
    for (int j = 0; j <= i; ++j) {
      if (s[i - 1] == '>') {
        dp[i][j] = psum[i] - psum[j];
      }
      else {
        dp[i][j] = psum[j];
      }
    }
  }
  mint ans = 0;
  for (int i = 0; i < n; ++i) ans = ans + dp[n - 1][i];
  cout << ans.val << '\n';
}


Measured memory_bytes: 37760
#include <stdio.h>
int main(void) {
  int num[5];
  int fir = -99999, sec = -99999, thr = -99999, fou = -99999, fif = -99999, i;

  for( i = 0 ; i < 5 ; i++ ) {
    scanf("%d",&num[i]);
  }
  fir = num[0];
  for( i = 1 ; i < 5 ; i++ ) {
    if(fir < num[i]) {
      fif = fou; fou = thr; thr = sec; sec = fir; fir = num[i];
    } else if (sec < num[i]) {
      fif = fou; fou = thr; thr = sec; sec = num[i];      
    } else if (thr < num[i]) {
      fif = fou; fou = thr; thr = num[i];
    } else if (fou < num[i]) {
      fif = fou; fou = num[i];
    } else if (fif < num[i]) {
      fif = num[i];
    }
  }
  printf("%d %d %d %d %d\n",fir,sec,thr,fou,fif);
  return(0);
}

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

namespace Program
{
    public class ABC051C
    {
        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static public void Main(string[] args)
        {
            var sx = Console_.NextInt();
            var sy = Console_.NextInt();
            var tx = Console_.NextInt();
            var ty = Console_.NextInt();

            var fixMoveUp = new string(Enumerable.Repeat('U', ty - sy).ToArray());
            var fixMoveRight = new string(Enumerable.Repeat('R', tx - sx).ToArray());
            var fixMoveDown = new string(Enumerable.Repeat('D', ty - sy).ToArray());
            var fixMoveLeft = new string(Enumerable.Repeat('L', tx - sx).ToArray());
            Console.Write(fixMoveUp);
            Console.Write(fixMoveRight);
            Console.Write(fixMoveDown);
            Console.Write(fixMoveLeft);
            Console.Write("LU");
            Console.Write(fixMoveUp);
            Console.Write(fixMoveRight);
            Console.Write("RD");
            Console.Write("RD");
            Console.Write(fixMoveDown);
            Console.Write(fixMoveLeft);
            Console.Write("LU");
        }
    }
}


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


#define dhai_machli ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)



using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    dhai_machli;

   ll x;

   long double y;

   cin>>x>>y;

  ll z = y*100 + 0.5;

   cout<< (x*z)/100<<endl;





    return 0;
}

Measured memory_bytes: 3744
package main

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

type Scanner struct {
	innerScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := new(Scanner)
	innerScanner := bufio.NewScanner(os.Stdin)
	innerScanner.Split(bufio.ScanWords)
	sc.innerScanner = innerScanner
	return sc
}

func (sc Scanner) scan() {
	sc.innerScanner.Scan()
}

func (sc Scanner) next() string {
	return sc.innerScanner.Text()
}

func (sc Scanner) nextInt() int {
	sc.scan()
	i, _ := strconv.Atoi(sc.next())
	return i
}

func (sc Scanner) nextFloat() float64 {
	sc.scan()
	f, _ := strconv.ParseFloat(sc.next(), 64)
	return f
}

func main() {
	sc := NewScanner()
	n := sc.nextInt()
	ans := 0
	for i := 1; i <= n; i += 2 {
		count := 0
		for j := 1; j <= n; j += 2 {
			if i % j == 0 {
				count++
			}
		}
		if count == 8 {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 640
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	A := sc.nextInt()
	B := sc.nextInt()
	C := sc.nextInt()
	K := sc.nextInt()

	ans := 0
	fn := func(k int, c int, n int) int {
		if k <= 0 {
			return 0
		}
		if k <= c {
			ans += k * n
			return 0
		}
		ans += c * n
		return k - c
	}

	fn(fn(fn(K, A, 1), B, 0), C, -1)

	fmt.Println(ans)

	return 0
}

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


Measured memory_bytes: 1756
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int N,K;
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		sc.close();
		int pattern = K;
		for(int i=0;i<N-1;i++){
			pattern *= (K-1);
		}
		System.out.println(pattern);
	}

}


Measured memory_bytes: 9680
#include <stdio.h>

int main(){

    int num;

    scanf("%d", &num);

    int D1[num], D2[num];
    
    for(int i=0; i<num; i++){
        scanf("%d", &D1[i]);
        scanf("%d", &D2[i]);
    }

    int max = 0, cnt = 0;

    int allFlag = 1;

    for(int i=0; i<num; i++){
        if(D1[i] == D2[i]){
            cnt++;
        }else{
            if(max<cnt){
                max = cnt;
            }
            allFlag = 0;
            cnt = 0;
        }
    }

    if(allFlag == 1){
        max = cnt;
    }

    if(max >= 3){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

string s;

bool judge(ll x) //x文字
{

    vector<tuple<string, ll, ll>> v;
    for (int j = 0; j + x <= siz(s); j++)
    {
        v.pb(make_tuple(s.substr(j, x), j, j + x - 1));
    }

    sort(all(v));

    rep(k, siz(v) - 1)
    {
        ll s1 = get<1>(v[k]), s2 = get<1>(v[k + 1]);
        ll g1 = get<2>(v[k]), g2 = get<2>(v[k + 1]);

        if (get<0>(v[k]) == get<0>(v[k + 1]) ){
            if (min(g1, g2) < max(s1, s2)){
                return true;
            }else{
                v.erase(v.begin()+k+1);
                k--;
            }
        }
        
    }

    return false;
}

signed main()
{
    ll n;
    cin >> n;
    cin >> s;

    ll ng = n/2  + 1, ok = -1;

    while (abs(ok - ng) > 1)
    {
        ll mid = (ok + ng) / 2;

        if (judge(mid))
            ok = mid;
        else
            ng = mid;
        //cout<<ok<<" "<<ng<<endl;
    }

    if (ok == -1)
    {
        cout << 0 << endl;
        return 0;
    }
    cout << ok << endl;
}

Measured memory_bytes: 6596
#include <iostream>

using namespace std;

class Dice {
    public:
    int face[6];
    Dice() {}
    void rotateX () {
        rotate(0, 1, 5, 4);
    }
    void rotateY () {
        rotate(0, 2, 5, 3);
    }
    void rotateZ () {
        rotate(1, 2, 4, 3);
    }
    void rotate (int a, int b, int c, int d) {
        int t = face[a];
        face[a] = face[b];
        face[b] = face[c];
        face[c] = face[d];
        face[d] = t;
    }
};

bool eq(Dice d1, Dice d2) {
    for (int i = 0; i < 6; i++)
        if (d1.face[i] != d2.face[i]) return false;
    return true;
}

bool equal(Dice d1, Dice d2) {
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 4; j++) {
            if (eq(d1, d2)) return true;
            d1.rotateZ();
        }
        if (i % 2 == 0) d1.rotateY();
        else d1.rotateX();
    }
    return false;
}

Dice d[100];
int n;

bool check () {
    for (int i = 0; i < n - 1; i++)
        for (int j = i + 1; j < n; j++) if (equal(d[i], d[j])) return false;
    return true;
}

int main () {
    cin >> n;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < 6; j++) cin >> d[i].face[j];
    
    if (check()) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
    int n;cin>>n;
    int pf[100]{};
    int c[1000]{};
    for (int i=2;i<=n;i++) {
        int t=i;
        for (int j=2;j*j<=t&&t>1;j++)
            while (t%j==0) {
                t/=j;
                pf[j]++;
                c[pf[j]]++;
            }
        if (t>1) {
            pf[t]++;
            c[pf[t]]++;
        }
    }
    cout<<c[74]+c[24]*(c[2]-1)+c[14]*(c[4]-1)+c[4]*(c[4]-1)/2*(c[2]-2)<<endl;
    return 0;
}

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

def num2alpha(num):
  if num <= 26:
  	return chr(96+num)
  elif num%26 == 0:
    return num2alpha(num//26-1) + chr(122)
  else:
    return num2alpha(num//26) + chr(96+num%26)

print(num2alpha(n))

Measured memory_bytes: 9172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int x = sc.nextInt();

        int[] zahyo = new int[n + 1];

        for (int i = 0; i < n; i++) {
            zahyo[i] = sc.nextInt();
        }
        zahyo[n] = x;
        Arrays.sort(zahyo);

        BigInteger prev = BigInteger.valueOf(zahyo[1] - zahyo[0]);

        for (int i = 1; i< n; i++) {
            BigInteger now = BigInteger.valueOf(zahyo[i+1] - zahyo[i]);
            BigInteger g = prev.gcd(now);
            prev = g;
        }

        out.println(prev.intValue());
        out.flush();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 44492
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
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 (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    // ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    //vector<ll> X(N);
    //string s;
    //in >> s;
    //vector<string> s;
    //s.resize(N);
    ll X;
    in >> X;
    
    ll ans=100;
    ll c=1;
    for(ll i=1;ans<X;i++){
        
        ans=ll(ans*1.01);
        //out<< ans<<endl;
        c++;
    }
    out << c-1 << endl;
    
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n, m, x; cin >> n >> m >> x;
    int ans = INT_MAX;
    vector<int> c(n);
    vector<vector<int>> A(n, vector<int>());
    rep(i, n){
        cin >> c[i];
        rep(j, m){
            int Aij; cin >> Aij;
            A[i].push_back(Aij);
        }
    }
    rep(i, 1<<n){
        vector<int> sum(m, 0); int money = 0;
        rep(j, n){
            if (1 & (i>>j)){
                rep(k, m)sum[k]+=A[j][k];
                money += c[j];
            }
        }
        bool flag = true;
        rep(j, m)if (sum[j] < x)flag = false;
        if (flag)ans = min(ans, money);
    }
    if (ans == INT_MAX)cout << -1 << endl;
    else cout << ans << endl;

}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define clr(a) memset(a, 0x00, sizeof(a))
#define Error(x) cout << #x << " = " << x << endl
#define iDEBUG freopen("in.txt", "r", stdin)
#define oDEBUG freopen("out.txt","w",stdout)
#define pb push_back
#define pp pop_back
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define hi cout << "hi" << endl
typedef long long ll;

using namespace std;

int main()
{
    //iDEBUG;
    int n;
    cin >> n;
    int *tree = new int[n];
    for(int i=0; i<n; i++)
        cin >> tree[i];

    for(int i=0; i<n; i++)
    {
        cout << "node " << i+1 << ": key = " << tree[i] << ", ";
        if(i != 0)
        {
            if(i%2 == 0)
                cout << "parent key = " << tree[i/2-1] << ", ";
            else
                cout << "parent key = " << tree[i/2] << ", ";
        }
        if(i*2+1 < n)
            cout << "left key = " << tree[i*2+1] << ", ";
        if(i*2+2 < n)
            cout << "right key = " << tree[i*2+2] << ", ";
        cout << endl;
    }
    return 0;
}



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


using namespace std;

int main()
{
    int a , b , c , d;

    cin >> a >> b >> c >> d;

    int x = c - a, y = d - b;
    //cout << x << ' ' << y ;

    cout << c - y << ' ' << d + x << ' ' << a - y << ' ' << b + x <<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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 (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vector<string> W(N);
        rep(i, 0, N) cin >> W[i];
        map<string, ll> mp;
        rep(i, 0, N) {
                if (mp[W[i]] > 0) {
                        cout << "No" << endl;
                        return 0;
                }
                mp[W[i]]++;
        }

        rep(i, 1, N) {
                if (W[i-1].back() != W[i].front()) {
                        cout << "No" << endl;
                        return 0;
                }
        }
        
        cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
const ll mod = 998244353;
#define int ll
int n, k;
int a[100005], b[100005], c[100005], dp[3][2];

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n;
    for(int i=1; i<=n; i++) cin>>a[i]>>b[i]>>c[i];
    //dp[0]=0, dp[1]=0, dp[2]=0;
    for(int i=1; i<=n; i++){
        dp[0][1]=max(dp[1][0], dp[2][0])+a[i];
        dp[1][1]=max(dp[0][0], dp[2][0])+b[i];
        dp[2][1]=max(dp[0][0], dp[1][0])+c[i];
        for(int xd=0; xd<=2; xd++) dp[xd][0]=dp[xd][1];
    }
    cout<<max(max(dp[1][0], dp[2][0]), dp[0][0]);
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      if (a == 0 && b == 0) break;
      else {
        for (int i = 0; i < a; i++) {
          for (int j = 0; j < b; j++) {
            if (i == 0 || j == 0 || i == a-1 || j == b-1) System.out.printf("#");
            else System.out.printf(".");
          }
          System.out.printf("\n");
        }
      }
      System.out.printf("\n");
    }
  }
}



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

int main() {
	int count = 0;
	int N;
	cin >> N;

	for (int i = 0; i < N; i++) {
		int aN;
		cin >> aN;
		while (aN % 2 == 0) {
			aN = aN / 2;
			count ++;

		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
	static void Main(string[] args) {
		new Calc().Solve();
	}
	public class Calc {
		public Calc() { }
		public void Solve() {
			string[] str = Utils.ReadLine<string>(' ');
			var ans=str.Select(_ => _.ToUpper()).Select(_ => _[0]).ToArray();
			Console.WriteLine(ans[0] + "" + ans[1] + "" + ans[2]);


            return;
		}
	}
    

}
public static class Utils {
	public static T ReadLine<T>() {
		return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
	}

	public static T[] ReadLine<T>(params char[] separators) {
		return Console.ReadLine()
			.Split(separators)
			.Where(_ => _.Length > 0)
			.Select(_ => (T)Convert.ChangeType(_, typeof(T)))
			.ToArray();
	}

	public static List<T> ReadLines<T>(int readCount) {
		List<T> rt = new List<T>();
		for (int i = 0; i < readCount; i++) {
			rt.Add(ReadLine<T>());
		}
		return rt;
	}

	public static string Docking<T>(this IEnumerable<T> s, int sequenceRange, Func<T, string> filter = null) {
		string str = "";
		int c = 0;
		foreach (var item in s) {
			str += filter == null ? item.ToString() : filter(item);
			c++;
			if (c == sequenceRange) break;
		}
		return str;
	}

	public static string Docking<T>(this IEnumerable<T> s, Func<T, string> filter = null) {
		return s.Docking(s.Count(), filter);
	}

	public static string RangeDocking<T>(this IEnumerable<T> s, int start, int end, Func<T, string> filter = null) {
		string str = "";
		end = end < s.Count() ? end : s.Count();
		var items = s.ToArray();
		for (int i = start; i < end; i++) {
			str += filter == null ? items[i].ToString() : filter(items[i]);
		}
		return str;
	}
	public static int IntParse(this string n) {
		return int.Parse(n);
	}
	public static void WriteLine<T>(this IEnumerable<T> list) {
		foreach (var item in list) {
			item.WriteLine();
		}
	}

	public static void WriteLine(this object obj) {
		Console.WriteLine(obj);
	}
	public static void AddTo<T>(this T obj,List<T> list) {
		list.Add(obj);
	}
}

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

int main(){//main_program
  int X,N;
  int a,b,c,d;
  cin >> X >> N;
  vector<int> P(N+1);
  
  a = X;
  b = X;
  if(N != 0){
    for(int i = 1; i <= N ; i++){
      cin >> P.at(i);
    }
    //cout << "a" << endl;
    
    for(int i = 1; i <= N ; i++){
      if(P.at(i) == X){
        a++;b--;
        break;
      }
    }
    
    //cout << "a" << endl;
    
    if(a != X){
      //cout << "b" << endl;
      c = 0;d = 0;
      while(c != a && d != b){
        //cout << "c" << endl;
        c = a;d = b;
        for(int i = 1; i <= N ; i++){
          if(a == P.at(i)){
            //cout << a << endl;
            a++;
          }
          if(b == P.at(i)){
            //cout << b << endl;
            b--;
          }
        }
      }
    }
    if(d == b){
      cout << b << endl;
    }else{
      cout << a << endl;
    }
    
  }else{
    cout << X << endl;
  }    
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{   
    string s;
    cin >> s;
    for(int i = 0; s[i] != '\0'; i++)
    {
        if(s[i]=='A'&&s[i+1]=='C')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

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

        String[] s = br.readLine().split(" ");
        int[] a = new int[6];

        for(int i = 0; i < s.length; i++){
            a[i] = Integer.parseInt(s[i]);
        }

        Dice dice = new Dice(a);

        String order = br.readLine();

        for(int i = 0; i < order.length(); i++){
            char c = order.charAt(i);
            switch(c){
                case 'S':
                    dice.turnS();
                    break;
                case 'N':
                    dice.turnN();
                    break;
                case 'W':
                    dice.turnW();
                    break;
                case 'E':
                    dice.turnE();
                    break;
            }
        }

        System.out.println(dice.TOP);
    }
}
class Dice{
    int TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK;

    Dice(int[] a){
        this.TOP = a[0];
        this.FRONT = a[1];
        this.RIGHT = a[2];
        this.LEFT = a[3];
        this.BACK = a[4];
        this.BOTTOM = a[5];
    }

    void turnS(){
        int tmp = this.TOP;
        this.TOP = this.BACK;
        this.BACK = this.BOTTOM;
        this.BOTTOM = this.FRONT;
        this.FRONT = tmp;
    }

    void turnN(){
        int tmp = this.TOP;
        this.TOP = this.FRONT;
        this.FRONT = this.BOTTOM;
        this.BOTTOM = this.BACK;
        this.BACK = tmp;
    }

    void turnW(){
        int tmp = this.TOP;
        this.TOP = this.RIGHT;
        this.RIGHT = this.BOTTOM;
        this.BOTTOM = this.LEFT;
        this.LEFT = tmp;
    }

    void turnE(){
        int tmp = this.TOP;
        this.TOP = this.LEFT;
        this.LEFT = this.BOTTOM;
        this.BOTTOM = this.RIGHT;
        this.RIGHT = tmp;
    }
}



Measured memory_bytes: 24464
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
using namespace std;

using P = pair<string, int>;

int main()
{
	P p[100];
	int i = 0;
	while (cin >> p[i].first >> p[i].second) i++;
	int n = i;

	sort(p, p + n);
	for (int i = 0; i < n; i++)
	{
		cout << p[i].first << endl << p[i].second;
		while (p[i].first == p[i + 1].first)
		{
			i++;
			cout << ' ' << p[i].second;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3140
def main():
    import sys
    from collections import Counter

    N = int(input())
    S = [sys.stdin.readline().rstrip('\n') for _ in range(N)]
    c = Counter(S)
    _max = max(c.values())
    keys = [k for k, v in c.items() if v == _max]
    print('\n'.join(sorted(keys)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 35936
#include <iostream>

using namespace std;

int main()
{
    char B;
    cin >> B;
    switch(B)
    {
    case 'A':
        cout << 'T';
        break;
    case 'C':
        cout << 'G';
        break;
    case 'G':
        cout << 'C';
        break;
    case 'T':
        cout << 'A';
    }

    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

d = {}
for k in s:
    if k in d.keys():
        d[k] += 1
    else:
        d[k] = 1
for k in t:
    if k in d.keys():
        d[k] -= 1
    else:
        d[k] = -1
print(max(max(d.values()),0))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int MAX = 100001;
        int[] counter = new int[MAX];
        long total=0;
        for(int i=0;i<N;i++) {
            int num = sc.nextInt()-1;
            counter[num]++;
            total+=num+1;
        }

        int Q=sc.nextInt();
        long[] answers = new long[Q];
        for(int i=0;i<Q;i++) {
            int B=sc.nextInt()-1;
            int C=sc.nextInt()-1;
            total+=(C-B)*counter[B];
            answers[i] = total;
            counter[C] += counter[B];
            counter[B]=0;
        }
        for(long inside:answers) {
            System.out.println(inside);
        }
    }
}


Measured memory_bytes: 61380
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>

using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f

//std::ios::sync_with_stdio(0); std::cin.tie(0);
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 3; ++i)cout << s[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

auto fl = [](auto a, auto b) { assert(b != 0); return a / b - (a % b != 0 && ((a >= 0) != (b >= 0)) ? 1 : 0); };
auto ce = [](auto a, auto b) { assert(b != 0); return a / b + (a % b != 0 && ((a >= 0) == (b >= 0)) ? 1 : 0); };
auto mo = [](auto a, auto b) { assert(b != 0); a %= b; if(a < 0) { a += abs(b); } return a; };

int main() {
	IN(LL, a, v, b, w, t);
	OUT(v <= w || ce(abs(a - b), v - w) > t ? "NO" : "YES");
}


Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(200002)

def dfs(s):
	global x, G
	for t, d in G[s]:
		if x[t] is None:
			x[t] = x[s] + d
			if not dfs(t):
				return False
		else:
			if x[t] != x[s] + d:
				return False
	return True

N,M = map(int,input().split())
x = [None] * N
G = [[] for _ in range(N)]
for _ in range(M):
	L, R, D = map(int,input().split())
	G[L-1].append([R-1,D])
	G[R-1].append([L-1,-D])

res = True
for i in range(N):
	if x[i] is None:
		x[i] = 0
		res &= dfs(i)

print("Yes" if res == True else "No")

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

using namespace std;

int main()
{
    int N, C_X, C_Y;
    cin >> N;
    vector<long long> X(N), Y(N), H(N);

    for (int i = 0; i < N; i++)
    {
        cin >> X.at(i) >> Y.at(i) >> H.at(i);
    }

    long long value;
    bool flag;
    for (int c_x = 0; c_x < 101; c_x++)
    {
        for (int c_y = 0; c_y < 101; c_y++)
        {
            for(int i=0;i<N;i++){
                if(H[i] != 0){
                    value = H[i] + abs(X[i]-c_x) + abs(Y[i]-c_y);
                    break;
                }
            }
            flag = true;
            for(int i=0;i<N;i++){
                if(H[i] != 0){
                    if(value != H[i] + abs(X[i]-c_x) + abs(Y[i]-c_y)){
                        flag=false;
                        break;
                    }
                }
                else{
                    if(value > abs(X[i]-c_x) + abs(Y[i]-c_y)){
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                C_X = c_x;
                C_Y = c_y;
                break;
            }
        }
        if(flag) break;
    }

    cout << C_X << " " << C_Y << " " << value << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, k, ans, i, j;
	cin >> n >> k;
	vector<long long> ct(k, 0);
	for (i = 1; i <= n; i++) ct[i % k]++;

	ans = ct[0] * ct[0] * ct[0];
	if (k % 2 == 0)  ans += ct[k / 2] * ct[k / 2] * ct[k / 2];

	cout << ans << "\n";


	return 0;
}


Measured memory_bytes: 1792
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

template <std::int_fast64_t Modulus> class modint {
  using u64 = std::int_fast64_t;
public:
  u64 a;
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
typedef modint<MOD> m;
#pragma endregion

int main() {
  char a, b;
  cin >> a >> b;
  if(a < b){
    string _a = "";
    rep(i, b-'0'){
      _a += a;
    }
    cout << _a;
  }else{
    string _b = "";
    rep(i, a-'0'){
      _b += b;
    }
    cout << _b;
  }
}


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

const ll mod = 1e9+7;

ll n;
ll a[401];
ll dp[401][401];
ll solve(ll i,ll j){
    if(i>=j) return 0;
    if(dp[i][j]!=-1){
        return dp[i][j];
    }

    auto sum=[&](ll c,ll d){
        ll s=0;
        for(ll k=c;k<=d;k++){
            s+=a[k];
        }
        return s;
    };   
    ll ans=1e18+5;

    for(ll k=i;k<j;k++){
        ans=min(ans,solve(i,k)+solve(k+1,j)+sum(i,j));
    }
    return dp[i][j]=ans;
}

int main() {
    memset(dp,-1,sizeof(dp));
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }

    ll ans=solve(0,n-1);
    cout<<ans<<endl;
}


Measured memory_bytes: 1536
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] A = new int[3];
        for(int i=0;i<3;i++){
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);
        int ans = Math.abs(A[1]-A[0])+Math.abs(A[2]-A[1]);
        System.out.println(ans);
    }
}


Measured memory_bytes: 22228
import copy

n, m = map(int,input().split())
edge = []
graph = [[] for i in range(n+1)]
for i in range(m):
    edge.append(list(map(int,input().split())))
    graph[edge[-1][0]].append(edge[-1][1])
s, g = map(int,input().split())

INF = 10**18
ans = [[INF, INF, INF] for i in range(n+1)]
q = [s]
d = 0
while q:
    nq = []
    d += 1
    p = d % 3
    for cf in q:
        for ct in graph[cf]:
            if ans[ct][p] == INF:
                ans[ct][p] = d
                nq.append(ct)
    q = copy.deepcopy(nq)
if ans[g][0] == INF:
    print(-1)
else:
    print(ans[g][0]//3)

Measured memory_bytes: 57312
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999

int pow(int x, int n, int now) {
	if (n == 0)return now;
	return (x, n - 1, now*x);
}

int n, ans = 0;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) 
		if (to_string(i).size() % 2)ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int ans=0;	
		int n=sc.nextInt();
		Integer P[]=new Integer[n];
		for (int i=0;i<n;i++){
		P[i]=sc.nextInt();
		}
		for (int i=1;i<n-1;i++){
			if((P[i-1]<P[i]&&P[i]<P[i+1])||(P[i+1]<P[i]&&P[i]<P[i-1])){
				ans=ans+1;
			}
		}
		
	System.out.println(ans);
	}
}

Measured memory_bytes: 21716
Module _20190423

    Sub Main()

        Dim iCount As Integer = Console.ReadLine()

        Dim sWord(iCount - 1) As String

        sWord(0) = Console.ReadLine()

        Dim sLastChar As String = sWord(0).ToCharArray(sWord(0).Length - 1, 1)

        Dim iNGFlg As Integer = 0
        For i As Integer = 1 To iCount - 1

            sWord(i) = Console.ReadLine()

            If sLastChar = sWord(i).ToCharArray(0, 1) Then

                For j As Integer = 0 To i - 1

                    If sWord(j) = sWord(i) Then

                        iNGFlg = 1

                        Exit For

                    End If

                Next

            Else

                iNGFlg = 1

            End If

            If iNGFlg = 1 Then

                Exit For

            Else

                sLastChar = sWord(i).ToCharArray(sWord(i).Length - 1, 1)

            End If

        Next

        If iNGFlg = 1 Then

            Console.WriteLine("No")

        Else

            Console.WriteLine("Yes")

        End If

    End Sub

End Module

Measured memory_bytes: 19792
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const M = parseInt(arg[0].split(" ")[1]);

    const H = arg[1].split(" ").map(n=>parseInt(n));
    const AB = arg.slice(2, M + 2).map(n=>n.split(" ").map(l=>parseInt(l)));
    
    let list = [...Array(N)].fill(true);
    
    for(let i=0; i<M; i++) {
        // list[AB[i][0]-1].push(AB[i][1]-1);
        // console.log(list)
    
        let A = AB[i][0]-1;
        let B = AB[i][1]-1;
        
        // console.log("-----");
        // console.log("H[A]" + H[A]);
        // console.log("H[B]" + H[B]);
        
        if(H[A] <= H[B]) {
            // console.log(A + "はいい展望台ではない")
            list[A] = false;
        }
        
        if(H[B] <= H[A]) {
            // console.log(B + "はいい展望台ではない")
            list[B] = false;
        }
    }
    
    console.log(list.filter(n=>n===true).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 70360