akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        p.at(i) = i;
    }

    vector<vector<bool>> G(n, vector<bool>(n));
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G.at(a).at(b) = true;
        G.at(b).at(a) = true;
    }

    int cnt = 0;
    do {
        if (p.at(0) != 0) break;
        bool ok = true;
        for (int i = 0; i < n - 1; i++) {
            if (!G.at(p.at(i)).at(p.at(i + 1))) {
                ok = false;
                break;
            }
        }
        if (ok) cnt++;
    } while (next_permutation(p.begin(), p.end()));

    cout << cnt << endl;
}   

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

using namespace std;


int main(){
 int n;
  cin>>n;
  
  int total=0;
  if(n>=105) total++;
   if(n>=135) total++;
    if(n>=165) total++;
    if(n>=189) total++;
  if(n>=195) total++;
  cout<<total<<endl;
}

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

const val INF = 10000000000L
const val VMAX = 100007
fun solve(N: Int, W: Int, w: IntArray, v: IntArray) {
    // dp[i][v] = iまで使って価値vとなる最小の重さ
    // dp[i][v] = Math.min(dp[i-1][v], dp[i-1][v-v[i]] + w[i])
    val dp = Array(N) { LongArray(VMAX) { INF } }
    for (i in 0 until N){ dp[i][0] = 0 }
    dp[0][v[0]] = w[0].toLong()
    for (i in 1 until N) {
        for (j in 0 until VMAX) {
            dp[i][j] = Math.min(
                dp[i - 1][j],
                dp[i - 1].getOrElse(j - v[i]) { INF } + w[i]
            )
        }
    }
    val ans = dp[N - 1].indexOfLast { it <= W } ?: 0
    println(ans)
    return
}

fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val W = sc.next().toInt()
    val w = IntArray(N.toInt())
    val v = IntArray(N.toInt())
    for (i in 0 until N.toInt()) {
        w[i] = sc.next().toInt()
        v[i] = sc.next().toInt()
    }
    solve(N, W, w, v)
}


Measured memory_bytes: 153784
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
        for(int i=0;i<26;i++){
            for(int j=0;j<s.length();j++)
                if(s[j]>='a'&&s[j]<='z')
                    s[j]='a'+(s[j]-'a'+1)%26;
            for(int j=2;j<s.length();j++){
                if(s[j]=='e'&&s[j-1]=='h'&&s[j-2]=='t'){
                    if((j-3<0||s[j-3]<'a'||s[j-3]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                       goto next;
                    
                }
                if(j>2)
                    if((s[j]=='s'&&s[j-1]=='i'&&s[j-2]=='h'&&s[j-3]=='t')||(s[j]=='t'&&s[j-1]=='a'&&s[j-2]=='h'&&s[j-3]=='t'))
                        if((j-4<0||s[j-4]<'a'||s[j-4]>'z')&&((j==s.length()-1)||s[j+1]<'a'||s[j+1]>'z'))
                            goto next;
            }
        }
    next:cout<<s<<endl;
    }
}

Measured memory_bytes: 1176
/*
  #問題：
  


  #分析：
  #オブジェクト：
  A
  B
  K
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

using namespace std;

int main(void){
  int A,B,K;
  cin>>A>>B>>K;
  FORQ(i,A,B){
    if(i>=A && i<=B && (i>B-K || i<A+K)){
      cout<<i<<endl;
    }
  }
  
  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include <cstring>
#include <iomanip>
#include <algorithm>
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

const double PI  = acos(-1.0);
using namespace std;
//typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
//typedef complex<double> point;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//char rv[4]={'D','R','L','U'};
const double EPS = 1e-9;
const int N = 100000 + 9;
int n,cap,mem[109][N],w[N],v[N];

int dp(int i,int sum)
{
    if(sum <= 0) return 0;
    if(i > n) return 1e9 + 9;
    if(mem[i][sum] != -1) return mem[i][sum];


    int c1 = w[i] + dp(i+1, sum - v[i]);
    int c2 = dp(i+1,sum);
    return mem[i][sum] = min(c1, c2);

}

 int main()
{
//freopen("calc.in","r",stdin);
//freopen("calc.out","w",stdout);
//__builtin_popcount()
input
        cin>>n>>cap;
        forr(i,1,n)cin>>w[i]>>v[i];


        int l = 0 ,r = 100000, mid, ans = 0;
        while(l <= r)
        {
            mid = (l + r) / 2;
            memset(mem,-1,sizeof mem);
            int ck = dp(1, mid);

            if(ck <= cap) ans = mid, l = mid + 1;
            else r = mid - 1 ;
        }


        cout<<ans<<endl;





return 0;
}


Measured memory_bytes: 46244
n, m, l = map(int, input().split())

a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    li = input().split()
    for j in range(m):
        a[i][j] = int(li[j])
 
for i in range(m):
    li = input().split()
    for j in range(l):
        b[i][j] = int(li[j])
 
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k]*b[k][j]
        if j < l - 1:
            print(str(c[i][j]), end=" ")
        else:
            print(str(c[i][j]))


Measured memory_bytes: 7016
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int N;
    int[] A;
    void Solve() {
        //input
        N = io.Int;
        A = new int[N];
        for (int i = 0; i < N; ++i)
            A[i] = io.Int;
        //cal
        var map = new Dictionary<int, int>();
        for(int i = 0; i < N; ++i) {
            if (!map.ContainsKey(A[i])) map[A[i]] = 0;
            map[A[i]]++;
        }
        var ans = 0;
        foreach(var num in map.Values) {
            if (num % 2 != 0)
                ans++;
        }
        //ret
        Console.WriteLine(ans);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    SimpleIO(bool isAutoFlush = false) { this.isAutoFlush = isAutoFlush; }
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    public bool isAutoFlush;
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        if(!isAutoFlush)
            Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];

        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 20692
package main

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

type Line struct {
	L int
	R int
}

func main() {
	s := IOInitialize()
	N := Int(s)
	M := Int(s)
	Q := Int(s)
	m := scanNums(s, M, N)
	targets := scanTargets(s, Q)

	cm := map[int]map[int]int{}
	rm := map[int]map[int]int{}
	for i := 0; i <= N; i++ {
		cm[i] = map[int]int{}
		rm[i] = map[int]int{}
		for j := i; j <= N; j++ {
			cm[i][j] = 0
			rm[i][j] = 0
		}
	}

	for i := 1; i <= N; i++ {
		for j := i; j <= N; j++ {
			cm[i][j] = m[i][j] + cm[i][j-1]
		}
	}

	for i := 1; i <= N; i++ {
		for j := N; j >= 1; j-- {
			if j == N {
				//fmt.Println(cm[j][i])
				rm[j][i] += cm[j][i]
			} else {
				//fmt.Println(cm[j][i])
				rm[j][i] += cm[j][i] + rm[j+1][i]
			}
			//rm[j][i] = cm[j-1][i] + cm[j][i]
		}
	}

	for _, target := range targets {
		cnt := rm[target.L][target.R] - rm[0][target.L-1]
		//cnt := 0
		//for i := target.L; i <= target.R; i++ {
		//	cnt += cm[i][target.R]
		//}
		fmt.Println(cnt)
	}
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func String(s *bufio.Scanner) string {
	if !s.Scan() {
		panic("scan error")
	}

	return s.Text()
}

func scanNums(s *bufio.Scanner, len int, n int) (m map[int]map[int]int) {
	m = map[int]map[int]int{}
	for i := 1; i <= n; i++ {
		m[i] = map[int]int{}
		for j := i; j <= n; j++ {
			m[i][j] = 0
		}
	}
	for i := 0; i < len; i++ {
		l := Int(s)
		r := Int(s)
		m[l][r]++
	}
	return
}

func scanTargets(s *bufio.Scanner, len int) (lines []Line) {
	for i := 0; i < len; i++ {
		l := Int(s)
		r := Int(s)
		lines = append(lines, Line{L: l, R: r})
	}
	return
}


Measured memory_bytes: 35200
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;

void main() {
	auto N = readln.chomp.to!int;
	int count;
	foreach(_; 0..N) {
		auto ip = readln.split.to!(int[]);
		count += ip[1] - ip[0] + 1;
	}
	writeln(count);
}

Measured memory_bytes: 380
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector<int> a(5);
	for (int i = 0; i < a.size(); ++i)
		cin >> a[i];

	sort(a.begin(), a.end(), greater<int>());

	cout << a[0];
	for (int i = 1; i < a.size(); ++i)
		cout << " " << a[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
int n;
char a[N];
int main()
{
	scanf("%s",a+1);
	n=strlen(a+1);
	int num=0,ans=n;
	for(int i=1;i<=n;i++)
	{
		if(a[i]=='T')
		{
			if(num>0) num--,ans-=2;
		}
		else num++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
let rev str =
  let len = String.length str in
  let buf = Buffer.create len in
  let rec loop = function
      0 -> Buffer.contents buf
    | i ->
      Buffer.add_char buf str.[i-1];
      loop (i-1)
  in loop len

let () =
  let print str a b = print_endline (String.sub str a (b-a+1)) in
  let replace str a b p =
    let len = String.length str in
    (if a>0 then String.sub str 0 a else "") ^
    p ^
    (if b+1<len then String.sub str (b+1) (len-b-1) else "") in
  let reverse str a b = replace str a b (String.sub str a (b-a+1) |> rev) in
  let rec loop acc = function
      0 -> ()
    | i ->
      let code = Str.split (Str.regexp " ") (read_line ()) in
      let op,a,b = List.nth code 0,
                   List.nth code 1 |> int_of_string,
                   List.nth code 2 |> int_of_string in
      match op with
      | "print" -> print acc a b; loop acc (i-1)
      | "reverse" -> loop (reverse acc a b) (i-1)
      | _ -> let p = List.nth code 3 in
             loop (replace acc a b p) (i-1)
  in 
  let str = read_line () in
  loop str (read_int ())

Measured memory_bytes: 2564
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();
			String op = sc.next();
			int b = sc.nextInt();
			if (op.equals("+"))
				System.out.println(a + b);
			if (op.equals("-"))
				System.out.println(a - b);
			if (op.equals("*"))
				System.out.println(a * b);
			if (op.equals("/"))
				System.out.println(a / b);
			if (op.equals("?"))
				break;
		}
		sc.close();
	}
}


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

const int MAX_N = 83;
int N;
int A[MAX_N];
ll dp[MAX_N];

void solve()
{
	dp[1]=1000;
	for(int i=2;i<=N;++i){
		dp[i] = dp[i-1];
		for(int j=1;j<i;++j){ //buy on jth day
			ll num = dp[j] / A[j];
			dp[i]=max(dp[i],dp[j]-num*A[j]+A[i]*num);
		}
	}
	cout << dp[N] << '\n';
}

int main()
{
	cin >> N;
	for(int i=1;i<=N;++i) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 3672
#include <stdio.h>

int main(void){
    int i = 0;
	int n;
	int count = 0;
	char str[11];
	char bunsyou[1010];
	int s,len,len2;


	scanf("%s", str,10);

	len = strlen(str);
	while (1) {
		scanf("%s", bunsyou,1000);
        len2 = strlen(bunsyou);
		if (strcmp(bunsyou, "END_OF_TEXT") == 0)break;
		
		for (n = 0; bunsyou[n] != '\0'; n++) {
			bunsyou[n] = tolower(bunsyou[n]);
		}
	

		if (len == len2) {
		    if (strncmp(str, bunsyou,len) == 0) {
			count++;
		}
}
	}
	printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int main() {
    int n,m; cin >> n >> m;
    lint x[1000],y[1000],z[1000];
    rep(i,n) cin >> x[i] >> y[i] >> z[i];
    lint ans = 0;
    rep(i,2) {
        rep(j,2) {
            rep(k,2) {
                lint t[1000] = {0};
                rep(u,n) {
                    lint value = 0;
                    if (i*2-1 > 0) value += x[u];
                    else value -= x[u];
                    if (j*2-1 > 0) value += y[u];
                    else value -= y[u];
                    if (k*2-1 > 0) value += z[u];
                    else value -= z[u];
                    
                    t[u] = value;
                }
                sort(t, t+n, greater<lint>());
                lint value = 0;
                rep(i,m) value += t[i];
                ans = max(ans, value);
            }
        }
    }
    cout << ans << endl;
    // WAwakaranai...
}

Measured memory_bytes: 3652
#include <stdio.h>

#define MAX 45
#define NIL -1

int A[MAX];

int fib(int n) {
	if (A[n] == NIL) A[n] = fib(n - 1) + fib(n - 2);
	return A[n];
}

int main() {
	int n, i;

	scanf("%d", &n);
	A[0] = A[1] = 1;

	for (i = 2; i < MAX; i++) A[i] = NIL;

	printf("%d\n", fib(n));

	return 0;
}


Measured memory_bytes: 2076
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    R = ii()
    if R < 1200:
        print('ABC')
    elif R < 2800:
        print('ARC')
    else:
        print('AGC')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10168
#include <stdio.h>
#include <math.h>

int prime_check(int);

int main(){
  int n,i,in,ans=0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d",&in);
    if(prime_check(in)==1) ans++;
  }
  printf("%d\n",ans);
  return 0;
}

//prime:1,not prime:0
int prime_check(int n){
  int i;
  int lim=sqrt(n);
  if(n==2 || n==3) return 1;
  if(n%2==0) return 0;
  for(i=3; i<lim+1; i+=2) if(n%i==0) return 0;
  return 1;
}



Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  string Mat;
  string result;
  // Matは作業用,result は出力用
  for (int i = 0; i < H ; i++){
   string S;
    cin >> S;
    Mat += "," + S;
  }
  //爆弾を見つける　行--->列
  for(int i = 0; i < H ;i++){
   for (int j = 0;j < W;j++){
     //空地か判定
     int place = (W+1)*i +j+1;
     if (Mat.at(place) == '.' ){
       //空地だったら周囲を調べる
       int counter = 0;
         //左
         if (j>0){if (Mat.at(place -1) == '#'){
           counter ++;
         }}
         //右
         if (j+1<W){if (Mat.at(place+1) == '#'){
          counter++; 
         }}
       if (i>0){
        //上があるとき
        int placeup = (W+1)*(i-1) + j +1;
        //真上
        if (Mat.at(placeup) == '#'){
         counter++; 
        }
        //左上
        if (j>0){if (Mat.at(placeup -1) == '#'){
         counter++; 
        }}
        //右上
        if (j<W-1){if (Mat.at(placeup+1) == '#'){
          counter++;
        }}
       }
      //した
      if (i+1 < H){
       int placedown =  (W+1)*(i+1) + j +1;
       //真下
        if (Mat.at(placedown) == '#'){
         counter++; 
        }
        //左下
        if (j > 0){
         if (Mat.at(placedown -1) == '#'){
          counter++;
         }
        }
        //右下
        if (j+1<W){
         if (Mat.at(placedown +1) == '#'){
          counter++; 
         }
        }
      }
       //結果を代入
       result += to_string(counter);
     }
     else {
       result += "#";
     }
     
     if (j == W-1){
      result +="\n";
     }
   }
  }
  cout << result <<endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        x: usize,
    }

    let quotient = x / 11;

    if quotient * 11 == x {
        println!("{}", quotient * 2)
    } else {
        if x - quotient * 11 <= 6 {
            println!("{}", quotient * 2 + 1)
        } else {
            println!("{}", quotient * 2 + 2)
        }
    }
}


Measured memory_bytes: 2176
#include<stdio.h>
int main(void) {
	int f,n,u,i;
	for (i = 0; i < 4; i++) {
		scanf("%d %d", &f, &n);
		switch (f) {
		case 1:
			u = 6000 * n;
			break;
		case 2:
			u = 4000 * n;
			break;
		case 3:
			u = 3000 * n;
			break;
		case 4:
			u = 2000 * n;
			break;
		}
		printf("%d\n", u);
	}
	return 0;
}

Measured memory_bytes: 600
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt

    val d = n / 100
    val r = n % 100

    System.out.println(
      if (((r - 1) / 5 + 1) <= d) {
        1
      } else {
        0
      }
    )
  }
}


Measured memory_bytes: 27328
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
struct PrettyOS {
    ostream& os;
    bool first;
    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

template <class D> struct MinDist {
    V<D> dist;
    V<int> from;
};

template <class D, class E>
MinDist<D> mindist(const VV<E>& g, int s, D inf = numeric_limits<D>::max()) {
    int n = (int)g.size();
    V<D> dist = V<D>(n, inf);
    V<int> from = V<int>(n);
    struct P {
        D key;
        int to;
        bool operator<(P r) const { return key > r.key; }
    };
    priority_queue<P> q;
    q.push(P{0, s});
    dist[s] = D(0);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        if (dist[p.to] < p.key) continue;
        for (E e : g[p.to]) {
            if (p.key + e.dist < dist[e.to]) {
                dist[e.to] = p.key + e.dist;
                from[e.to] = p.to;
                q.push(P{dist[e.to], e.to});
            }
        }
    }
    return MinDist<D>{dist, from};
}

struct E {
    int to; ll dist;
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, m;
    cin >> n >> m;
    VV<E> g(n);
    auto adde = [&](int from, int to, ll di) {
        g[from].push_back({to, di});        
    };
    for (int i = 1; i < n; i++) {
        adde(i, i - 1, 0);
    }
    for (int i = 0; i < m; i++) {
        int l, r; ll c;
        cin >> l >> r >> c; l--; r--;
        adde(l, r, c);
    }
    auto dist = mindist<ll>(g, 0);
    if (dist.dist[n - 1] >= TEN(18)) dist.dist[n - 1] = -1;
    cout << dist.dist[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 11132
import numpy as np
def resolve():
    k = int(input())
    n = 20
    l = [[] for _ in range(n)]
    size = 0
    pre_size = 0

    for i in range(1, 10, 1):
        l[0].append(i)
    
    size += len(l[0])
    for j in range(n-1):
        if size >= k:
            break
        for var in l[j]:
            v = var % 10
            for a in range(v-1, v+2, 1):
                #print(a)
                if a >= 0 and a <= 9:
                    l[j+1].append(var*10 + a)
        size += len(l[j+1])
        pre_size += len(l[j])

    print(l[j][k - pre_size - 1])

if __name__ == "__main__":
    resolve()

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

using namespace std;
map<int, int> ar;
int main()
{
    int n, x, ans = 0;
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        cin>>x;
        ar[x]++;
    }
    for(map<int, int>::iterator it = ar.begin(); it != ar.end(); it++)
    {
        if(it->second < it->first)
            ans+=it->second;
        else if(it->second > it->first)
            ans += it->second - it->first;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 4736
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

double board_turn_table[106][101]; // [board][turn]
int board_top, turn_top;
int mark[101];
int board_size, turn, lost_count, back_count;

int set_data()
{
	int temp;
	scanf("%d %d %d %d", &board_size, &turn, &lost_count, &back_count);
	if (board_size == 0)
		return 0;
	for (int i = 0; i <= board_size; i++)
		for (int j = 0; j <= turn; j++)
			board_turn_table[i][j] = 0;
	for (int i = 0; i < 101; i++)
		mark[i] = 0;
	board_turn_table[0][0] = 1.0;
	for (int i = 0; i < lost_count; i++)
	{
		scanf("%d", &temp);
		mark[temp] = 1;
	}
	for (int i = 0; i < back_count; i++)
	{
		scanf("%d", &temp);
		mark[temp] = 2;
	}
	return 1;
}

int play()
{
	int temp;
	for (int i = 0; i < turn; i++)
	{
		for (int j = 0; j < board_size; j++)
			if (mark[j] != 2)
				for (int k = 1; k <= 6; k++)
				{
					temp = j + k;
					if (temp > board_size)
						temp = board_size * 2 - temp;
					if (mark[temp] == 0)
						board_turn_table[temp][i + 1] += board_turn_table[j][i] / 6.0;
					else if (mark[temp] == 2)
						board_turn_table[0][i + 1] += board_turn_table[j][i] / 6.0;
					else if (mark[temp] == 1)
						board_turn_table[temp][i + 2] += board_turn_table[j][i] / 6.0;
				}
		board_turn_table[board_size][i + 1] += board_turn_table[board_size][i];
	}
}

int main()
{
	while (set_data())
	{
		play();
		printf("%lf\n", board_turn_table[board_size][turn]);
	}
}


Measured memory_bytes: 2052
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    S = input().strip()

    Na = [0] * 10
    NNa = [[0] * 10 for _ in Na]
    NNNa = [[[0] * 10 for _ in Na] for _ in Na]

    for Sc in S:
        Si = int(Sc)

        for i, NNi in enumerate(NNa):
            for j, NNj in enumerate(NNi):
                NNNa[i][j][Si] = NNj

        for j, Nj in enumerate(Na):
            NNa[j][Si] = Nj

        Na[Si] = 1
        

    Count = 0
    for NNi in NNNa:
        for Nj in NNi:
            for Nk in Nj:
                Count += Nk


    print(Count)
        



if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define im 2147483647
#define lm 9223372036854775807
#define ll long long
#define ii pair<int, int>
#define debug(index, num) cerr << "Case #" << index << ": " << num << endl
#define be(x) x.begin(), x.end()
#define rbe(x) x.rbegin(), x.rend()
#define pb push_back
const ll MOD = 1000000007;
int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    vector<int> dp(n+2, im), h(n+1);
    for(int i = 1; i <= n; i++) cin >> h[i];
    dp[1] = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= 2; j++) {
            if(i + j > n) continue;
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
        }
    }
    cout << dp[n];
}

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

class Program
{
    static List<int> MakeACList(string s)
    {
        int len = s.Length;
        var ans = Enumerable.Repeat(0, len).ToList();
        for (int i = 0; i < len-1; i++)
        {
            var ac = 0;
            if(s[i] == 'A' && s[i+1] == 'C')
            {
                ac = 1;
            }
            ans[i + 1] = ans[i] + ac; 
        }
        return ans;
    }

    static int GetAC(List<int> aclist, int l, int r)
    {
        return aclist[r - 1] - aclist[l - 1];
    }

    static void Main(string[] args)
    {
        string nq = Console.ReadLine();
        int n = int.Parse(nq.Split(' ')[0]);
        int q = int.Parse(nq.Split(' ')[1]);
        string s = Console.ReadLine();

        var aclist = MakeACList(s);

        for (int i = 0; i < q; i++)
        {
            string lr = Console.ReadLine();
            int l = int.Parse(lr.Split(' ')[0]);
            int r = int.Parse(lr.Split(' ')[1]);
            int ans = GetAC(aclist, l, r);
            Console.WriteLine(ans);
        }
        Console.WriteLine();
        Console.ReadLine();
    }
}


Measured memory_bytes: 17080
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		try (Stream<String> lines = new BufferedReader(new InputStreamReader(System.in)).lines()) {
			new Main().exec(lines.toArray(String[]::new));
		}
	}

	void exec(String[] args) {
		long h = Long.parseLong(args[0]);
		System.out.println((long)Math.pow(2, IntStream.iterate(0, i -> i + 1).filter(i -> Math.pow(2, i) >= h + 1).findFirst().getAsInt()) - 1);
	}

}


Measured memory_bytes: 26964
#include<bits/stdc++.h>
using namespace std;
#define rc(s) return cout<<s,0
long long x,y;
int main(){
  cin >> x >> y;
  if(__gcd(x,y)==y) rc(-1);
  for(int i=1;i<=10000000;i++){
     if((x*i)%y!=0)  rc(x*i); 
  }
  rc(-1);
}

Measured memory_bytes: 256
l,r = map(int,input().split())
if r - l >= 2019:
  print(0)
else:
  l %= 2019
  r %= 2019
  mini = 2019
  if r >= l:
    for i in range(l,r+1):
      for j in range(i+1,r+1):
        mini = min(mini,i*j%2019)
  else:
    for i in range(l,r+2020):
      for j in range(i+1,r+2020):
        mini = min(mini,i*j%2019)
  print(mini)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vivi vector<vi>
const int INF = 1<<29;
typedef long long ll;

int main(){
    int N;cin >> N;
    int p[N];rep(i, N)cin >> p[i];
    int ans = 0;
    int minv[N + 1];
    minv[0] = INF;
    rep(i, N)minv[i + 1] = min(minv[i], p[i]);
    rep(i, N){
        if(minv[i] >= p[i])ans += 1;
    }
    cout << ans;
}


Measured memory_bytes: 1792
n = int(input())
s = input()
l = [0] * (n + 1)
l_c = 0
r = [0] * (n + 1)
r_c = 0
for i in range(1,n + 1):
  if s[i - 1] == '#':
    l_c += 1
  l[i] = l_c
for i in reversed(range(0, n)):
  if s[i] == '.':
    r_c += 1
  r[i] = r_c
m = float('inf')
for i in range(n + 1):
  m = min(m,l[i]+r[i])
print(m)


Measured memory_bytes: 12812
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

double dp[3000][3000];

void solve()
{
       ll n;
       cin>>n;
       double p[n+1];
       rep(i, 1, n+1) cin>>p[i];
       dp[1][0] = 1-p[1];
       dp[1][1] = p[1];
       for(ll i=2; i<=n; i++)      // i tosses
       {
              for(ll j=0; j<=i; j++)      // j heads
              {
                     dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
              }
       }
       double ans=0;
       for(ll i=0; i<=n; i++)
       {
              if(i>n-i) ans+=dp[n][i];
       }
       cout<<fixed<<setprecision(12);
       cout<<ans;
}


int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 68992
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    ll x,k,d; cin >> x >> k >> d;
    ll ans;
    if (x<0) x = -x;
    ll num = min(k, x/d);
    x -= d*num;
    k -= num;
    if (k==0) {
        cout << x << endl;
        return 0;
    }
    if (k%2==0) ans = x;
    else ans = abs(x-d);
    cout << ans << endl;
}

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

#define MOD 1000000007

using namespace std;

long q_pow(long x, long n){
    if(n == 0) return 1;
    if(n==1) return x;
    else if(n%2 == 0) return q_pow(x*x%MOD, n/2) % MOD;
    else return x * q_pow(x, n-1) % MOD;
}

int main(){
   long N, K;
   cin >> N >> K; 
   long ans = 0;
   long dp[K + 1];
   for(long div = K; div >= 1; div --){
       int n_div = K / div;
       dp[div] = q_pow(n_div, N);
       for(int i=2; i*div <= K; i++){
           dp[div] -= dp[i * div];
           dp[div] = (dp[div] + MOD) % MOD;
       }
   }

    for(int i=1; i<=K; i++){
        ans += i * dp[i];
        ans %= MOD;
    }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll extgcd(ll a, ll b, ll& x, ll&y){
    ll d=a;
    if(b!=0){
        d=extgcd(b, a%b, y, x);
        y-=(a/b)*x;
    }
    else {
        x=1; y=0;
    }
    return d;
}

ll mod_inverse(ll a){
    ll x,y;
    extgcd(a,MOD,x,y);
    return (MOD+x%MOD)%MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin>>N;
    ll A[N];
    rep(i,0,N) cin>>A[i];
    ll s=0;
    rep(i,1,N+1){
        s+=mod_inverse(i);
        s%=MOD;
    }
    ll res=0;
    rep(i,0,N){
        res+=s*A[i]%MOD;
        res%=MOD;
        s=((s-mod_inverse(N-i)+MOD)%MOD+mod_inverse(i+2))%MOD;
    }
    rep(i,1,N+1){
        res*=i;
        res%=MOD;
    }
    cout <<res<<"\n";
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
	int kingaku[] = {6000, 4000, 3000, 2000};
	//????????????
	for (int i = 0; i < 4; i++) {
		int t,n;
		cin >> t >> n;
		cout << kingaku[t-1] * n << endl;
	}
		
	return 0;
}

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

using namespace std;

int main(void) {
  vector<int> v(3);
  int right = 0, acute = 0, obtuse = 0, total = 0;
  
  while (true) {
    for (int i = 0; i < 3; i++) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    if (v[0] + v[1] <= v[2]) break;

    int A = v[0] * v[0], B = v[1] * v[1], C = v[2] * v[2];
    if (A + B == C) right++;
    else if (A + B > C) acute++;
    else obtuse++;
    total++;
  }

  cout << total << " " << right << " " << acute << " " << obtuse << endl;

  return 0;
}


Measured memory_bytes: 3096
N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A,key=lambda x:x[0])
s=0 #本数
t=0 #値段
for i in range(N):
  s+=A[i][1]
  if M>s:
    t+=A[i][0]*A[i][1]
  else:
    over=s-M
    t+=A[i][0]*A[i][1]-A[i][0]*over
    break
print(t)

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

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

	}
}


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

using namespace std;

int main(){
 long n,h;
  cin >> n >> h;
  vector<long> a(n),b(n);
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  
  sort(a.begin(),a.end(),greater<long>());
  sort(b.begin(),b.end(),greater<long>());
  
  long res=0;
  for(int i=0;i<n;i++){
   if(b[i]>=a[0]&&h>0) {
     h-=b[i];
     res++;
   }
  }
  if(h>0) res+=(h-1)/a[0]+1;
  cout << res << endl;

}

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

namespace AtCoder {
    class MainClass {
        public static void Main(string[] args) {

            var n = int.Parse(Console.ReadLine());

            var sArray = Console.ReadLine().Split(' ');
            int[] iArray = sArray.Select(int.Parse).ToArray();

            trace(iArray, n);
            inserionSort(iArray, n);


        }

        static void inserionSort(int[] A, int N) {

            for(var i = 1; i < N; i++) {

                var v = A[i];
                var j = i - 1;
                while (j >= 0 && A[j] > v) {

                    A[j + 1] = A[j];
                    j--;

                }
                A[j + 1] = v;
                trace(A, N);
            }

        }

        static void trace(int[] A, int N) {

             for (var i = 0; i < N; i++) {

                if(i > 0) {

                    Console.Write(" ");

                }

                Console.Write(A[i]);

            }

            Console.WriteLine("");

        }
    }
}



Measured memory_bytes: 16276
X = int(input())
l = []
if X == 1:
    print(1)
else:
    for b in range(2, int(X ** 0.5) + 1):
        for p in range(2, 2 ** 10):
            if b **p <= X:
                l.append(b ** p)
    print(max(l))

Measured memory_bytes: 2940
N=int(input())
A=[0]
a=list(map(int,input().split()))
A+=a
A.append(0)
S=[0]
for i in range(N):
    S.append(S[-1]+abs(A[i+1]-A[i]))
S.append(S[-1]+abs(A[i+1]))
for i in range(N):
    print(S[i]+abs(A[i+2]-A[i])+S[-1]-S[i+2])

Measured memory_bytes: 14176
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.B
{
	class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			Scanner cin = new Scanner();

			int n = cin.nextInt();
			var d = cin.ArrayInt(n);
			long ans = 0;
			for (int i = 0; i < n; i++)
			{
				for (int j = i + 1; j < n; j++)
				{
					ans += d[i] * d[j];
				}
			}
			Console.WriteLine(ans);

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return next();
			i = 0;
			return s[i++];
		}

		public int nextInt()
		{
			return int.Parse(next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextInt() + add;
			}
			return Array;
		}

		public long nextLong()
		{
			return long.Parse(next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextLong() + add;
			}
			return Array;
		}

		public double nextDouble()
		{
			return double.Parse(next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = nextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 13140
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = nextCharArray();
  if(s.length % 2 == 1){
     myout("No");
    return;
  }
  for(var i = 0; i < s.length; i++){
    if(i % 2 == 0){
       if(s[i] != "h"){
          myout("No");
      	return;
       }
    }else{
      if(s[i] != "i"){
          myout("No");
      	return;
       } 
    }
  }
  myout("Yes");
}

Measured memory_bytes: 21064
import sys
import math
from collections import deque
from itertools import product

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = input()
    for op1, op2, op3 in product("+-", repeat=3):
        q = S[0]+op1+S[1]+op2+S[2]+op3+S[3]
        if eval(q) == 7:
            print(q + "=7")
            exit()


if __name__ == "__main__":
    main()

Measured memory_bytes: 3440
#include <stdio.h>
#include <math.h>

typedef struct{
	double x,y;
}POINT;
double norm(POINT p){
	return p.x * p.x + p.y * p.y;
}
void dif(POINT p, POINT q, POINT *r){
	(*r).x = p.x - q.x;
	(*r).y = p.y - q.y;
}

int main(){
	POINT p1, p2;
	POINT r;
	scanf("%lf %lf %lf %lf", &p1.x, &p1.y, &p2.x, &p2.y);
	dif(p1,p2, &r);
	printf("%lf\n", sqrt(norm(r)));
	return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>

using namespace std;

int main() {
    vector<int> a(3);
    for (int i = 0; i < 3; ++i)
    {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    cout << a[0] + a[1] + 10 * a[2] << endl;
    
    return 0;
}

Measured memory_bytes: 256
/*
* @Author: kabbo
* @Date:   2020-06-14 17:50:39
* @Last Modified by:   kabbo
* @Last Modified time: 2020-06-14 18:19:54
*/
#include<bits/stdc++.h>
using namespace std;
#define pii pair<long long,long long>
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod = 1e9 + 7;
using u64 = uint64_t;
using u128 = __uint128_t;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
void solve() {
	int n, m;
	cin >> n >> m;
	/*if (n * 2 == m) {
		cout << "YES" << endl;
		return ;
	}
	if (n * 4 == m) {
		cout << "YES" << endl;
		return;
	}*/
	bool flag = false;
	for (int i(0); i <= n ; ++i) {
		if ((m - (i * 2)) == ((n - i) * 4)) {
			flag = true;
			break;
		}
	}
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	/*int t;
	cin >> t;
	for (int i(1); i <= t; ++i) {
		printf("Case %d: ", i);*/
	solve();
	//}
#ifndef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

Measured memory_bytes: 3808
#include<stdio.h>
#include<string.h>
#define N 1000

void lcs(char x[N+1], char y[N+1], int m, int n){
    int c[N+1][N+1];
    for(int i=0 ; i<=m ; i++) c[i][0]=0;
    for(int j=0 ; j<=n ; j++) c[0][j]=0;

    for(int i=1 ; i<=m ; i++){
        for(int j=1 ; j<=n ; j++){
        if(x[i-1] == y[j-1])    c[i][j] = c[i-1][j-1]+1;
        else                    c[i][j] = c[i-1][j] >= c[i][j-1] ? c[i-1][j] : c[i][j-1];
        }
    }
    printf("%d\n",c[m][n]);
}

int main(){
  int n;
  char c1[N+1],c2[N+1];

  scanf("%d", &n);
  for(int i=0 ; i<n ; i++){
    scanf("%s%s", c1, c2);
    lcs(c1, c2, strlen(c1), strlen(c2));
  }
  return 0;
}



Measured memory_bytes: 5676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int s;
    cin >> s;
    vector<bool> vec(10010, false);
    vec[s] = true;
    int i=1;
    while(true){
        if(s % 2 == 0) s /= 2;
        else  s = 3*s + 1;
        i++;
        if(vec[s]) break;
        else vec[s] = true;
    }
    out(i);
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1000000007;


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

  char c;
  cin >> c;
  int id = c - 'a' + 1;
  char res = 'a' + id;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void)
{		
	while (1) {
		int h, w;
		cin >> h >> w;
		if (h == 0 && w == 0) break;
				
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ((i + j) % 2 == 0) {
					cout << "#";
				} else {
					cout << ".";
				}
			}
			cout << "\n";
		}
		
		cout << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG

 // 深さ優先探索
vector<bool> seen;
int dfs(const Graph &G, ll v) {
    seen[v] = true; // v を訪問済にする
    int score = 0; 

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー

        // 負荷さ優先探索中の処理



        dfs(G, next_v); // 再帰的に探索, 毎回mat渡してええの？
    }
    return score;
} 

/*
//桁数の計算
ll keta(ll num){
  ll ans= 0 ;
  ll rem;

  for (ll i = 4; i >= 0 ; i--){
    rem = pow(10,i);
    ans += (num / rem); 
    num = num % rem;
  }
  return ans;
}
*/


int main() {
  ll N, tmp;
  string ans;
  cin >> N;

  tmp = N % 10; 
  if (tmp == 2 || tmp == 4 || tmp == 5 || tmp == 7 ||tmp == 9) cout << "hon" << endl;
  else if (tmp == 0 || tmp == 1 || tmp == 6 || tmp == 8) cout << "pon" << endl;
  else cout << "bon" << endl;





  //cout << ans <<endl; 

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    ll n; cin >> n;
    ll mn = inf_l;
    rep(i,5) {
        ll x; cin >> x;
        chmin(mn,x);
    }
    cout << 5 + ((n+mn-1)/mn) - 1 << endl;
}

Measured memory_bytes: 256
/*Always success does not build on success,success build on failure*/
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define vec         vector<int>
#define map         map<int,int>
#define scn(t)      scanf("%d",&t)
#define lscn(t)      scanf("%lld",&t)
#define mod         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define endl        "\n"
using namespace std;
const int N=1e5+5;
int main()
{
   string s1,s2;
   cin>>s1>>s2;
   
   int l1=s1.length();
   int l2=s2.length();
   
   int ans[l1+1][l2+1];
   
   memset(ans,0,sizeof(ans));
   
   for(int i=1;i<=l1;i++)
   {
       for(int j=1;j<=l2;j++)
       {
           ans[i][j]=max(ans[i-1][j],ans[i][j-1]);
           
           if(s1[i-1]==s2[j-1])
           ans[i][j]=ans[i-1][j-1]+1;
       }
   }
   
   string ans1;
   int k2=l2;
   int k1=l1;
   while(k2>0&&k1>0)
   {
       if(ans[k1][k2]>max(ans[k1-1][k2],ans[k1][k2-1]))
       {
           ans1=ans1+s1[k1-1];
           k1--;
           k2--;
       }
       else
       {
           if(ans[k1][k2]==ans[k1][k2-1])
           {
               k2--;
           }
           else
           {
               if(ans[k1][k2]==ans[k1-1][k2])
               {
                   k1--;
               }
               else
               {
                   k2--;
               }
           }
       }
   }
   reverse(ans1.begin(),ans1.end());
   
   cout<<ans1<<endl;
}

Measured memory_bytes: 35456