akhauriyash/Code-Regression huggingface dataset:
s = input()
n = len(s)

ans = 0
if s[1:] == '9' * (n - 1):
  ans = int(s[0]) + 9 * (n - 1)
elif n != 1:
  ans = int(s[0]) + 9 * (n - 1) - 1
else:
  ans = int(s[0])

print(ans)


Measured memory_bytes: 61088
// 間違ってJOI垢で提出していた…
const bool DEBUG = 1;
#include <iostream>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
#include <stdio.h>
#include <sys/time.h>
#include <cassert>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef pair<int, PP> IPP;
typedef vector<int> VI;
typedef vector<P> VP;
 
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
 
#define FOR(i,a,b) for(int i=(a);i<int(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=int(a);--i)
#define RREP(i,n) RFOR(i,0,n)
 
#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define LREP(i,n) LFOR(i,0,n)
#define LRFOR(i,a,b) for(ll i=(b)-1;i>=(a);--i)
#define LRREP(i,b,a) LRFOR(i,0,n)
 
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define REACH(i,c) RREP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
#define BR cout << "\n"
 
#define dump(x) if(DEBUG)cerr<<"[" << __LINE__ << "] "<<#x<<"="<<(x)<<"\n"
#define dump2(x,y) if(DEBUG)cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\
			<<" , "<<#y<<"="<<(y)<<"\n"
#define dump3(x,y,z) if(DEBUG)cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\
			<<" , "<<#y<<"="<<(y)<<"\n"\
			<<" , "<<#z<<"="<<(z)<<"\n"
 
#define SAY(x) if(DEBUG) cerr << "[" << __LINE__ << "] " << (x) << "\n"
 
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;
 
ll ans;
 
int main() {
	omajinai;
	ll w,h;cin>>w>>h;
	VP v;
	REP(i,w){
		int p;
		cin>>p;
		v.PB(P(p, 0));
	}
	REP(i,h){
		int p;
		cin>>p;
		v.PB(P(p, 1));
	}
	SORT(v);
 
	int c[] = {0,0};
	ll ans = 0;
	for(auto e:v){
		int x = e.first, f = e.second;
		ans += (ll)x * ((f ? w+1 : h+1) - c[f]);
		c[!f]++;
	}
	cout << ans;
}


Measured memory_bytes: 2420
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,j,l,ns,zs,r=200;
    char s[128];
    scanf("%s",s);
    l=strlen(s);
    for(i='a';i<='z';i++){
        ns=0;zs=0;
        for(j=0;j<l;j++){
            if(s[j]==i){ns=0;}else{ns++;}
            zs=max(zs,ns);
        }
        r=min(zs,r);
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int i,j,k,l,n,num,rooms[4][3][10];

	for ( i = 0; i < 4; i++){
		for (j = 0; j < 3; j++) {
			for ( k = 0; k < 10; k++){
				rooms[i][j][k] = 0;
			}
		}
	}
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d %d %d", &j, &k, &l, &num);
		--j; --k; --l;
		rooms[j][k][l] += num;
	}
	for (i = 0; i < 4; i++) {
		for (j = 0; j < 3; j++) {
			for (k = 0; k < 10; k++) {
				printf(" %d", rooms[i][j][k]);
				
			}
			printf("\n");
		}
		if (i != 3) {
			printf("####################\n");
		}
		
	}
}

Measured memory_bytes: 2684
# coding: utf-8
# Your code here!
H,W = [int(i) for i in input().split()]
c=[[int(i) for i in input().split()] for _ in range(10)] 
A=[[int(i) for i in input().split()] for _ in range(H)]


dist = c
n=10
#n: 頂点数
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j] = min(dist[i][j], dist[i][k]+ dist[k][j])


ans = 0
for i in range(H):
    for j in range(W):
        if A[i][j] != -1:
            ans += dist[A[i][j]][1]
print(ans)     



Measured memory_bytes: 3316
#include <stdio.h>
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  if (a<=20 && a>=3 && b<=20 && b>=3){
    if (a+b<a*2-1){
      printf("%d",a*2-1);
    }else if(a+b<b*2-1){
      printf("%d",b*2-1);
    }else{
      printf("%d",a+b);
    }
  }
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int d=0;
    for (int i = a; i <= b; i++) {
       if(c%i==0){
         d++;
       }            
    }
    System.out.println(d);
  }
}



Measured memory_bytes: 26404
import java.util.*;

public class Main{

    public static int gcd(int a,int b){
        if(a%b==0) return b;
        return gcd(b,a%b);
    }

    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);
        int k=sc.nextInt();
        long total=0;
        for(int i=1;i<=k;i++){
            for(int j=1;j<=k;j++){
                int g=gcd((int)Math.max(i,j),(int)Math.min(i,j));
                for(int l=1;l<=k;l++){
                    total+=gcd((int)Math.max(g,l),(int)Math.min(g,l));
                }
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 35856
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if A <= B:
    if A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')
else:
    if A - V * T <= B -  W * T:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 9184
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

int main(void) {
  string str;
  cin >> str;

  int ar[26]={};


  for (size_t i = 0; i < str.size(); i++) {
    ar[str[i]-'a']++ ;
  }


  for (size_t i = 0; i < 26; i++) {
    if (ar[i]%2 != 0){
      printf("No");
      exit(0);
    }
  }

  printf("Yes");

}


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

typedef long long ll;

int main() {
	ios::sync_with_stdio(0);

	int a, b, c, x;
	cin >> a >> b >> c >> x;
	x /= 50;
	int ans = 0;
	for (int i = 0; i <= c; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= a; k++) {
                if (i + j*2 + k*10 == x) {ans++;}
            }
        }
	}
	cout << ans;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>/*{{{*/
#include <iomanip>
#include <string>
#include <map>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <exception>
#include <ctime>
#include <climits>
#include <list>
#include <bitset>
#include <cassert>
using namespace std;
#define rep_n(i, a, b) for (int i=(a); i<(b); i++)
#define rep(i, n) rep_n(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define ci1(a) cin>>a 
#define ci2(a, b) cin>>a>>b
#define ci3(a, b, c) cin>>a>>b>>c
#define ci4(a, b, c, d) cin>>a>>b>>c>>d
#define co1(a) cout<<a<<endl;
#define co2(a, b) cout<<a<<" "<<b<<endl;
#define co3(a, b, c) cout<<a<<" "<<b<<" "<<c<<endl;
#define co4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
typedef long long ll;/*}}}*/

int main() {
    int n;
    ci1(n);
    int di[n];
    vector<int> d;
    rep(i, n) {
        ci1(di[i]);
        d.push_back(di[i]);
    }

    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());

    int ans=d.size();
    co1(ans);
}


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

using namespace::std;

const int SIZE = 1e5 + 1;
int DP[SIZE][3];

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

	int N;
	cin >> N;
	
	for(int i = 1;i <= N;i++){
		int a,b,c;
		cin >> a >> b >> c;

		DP[i][0] = max(DP[i - 1][1],DP[i - 1][2]) + a;
		DP[i][1] = max(DP[i - 1][0],DP[i - 1][2]) + b;
		DP[i][2] = max(DP[i - 1][1],DP[i - 1][0]) + c;
	}

	cout << *max_element(DP[N],DP[N] + 3) << '\n';

	return 0;
}


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

int main(){
  int a,b,c,d;
  string s;
  cin >> a >> b >> c >> d;
  if(a+b > c+d){
    s = "Left";
  }else if(a+b < c+d){
    s = "Right";
  }else{
    s = "Balanced";
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

    int Q;
    cin >> Q;
    rep(loop, Q){
        int ans;
        int a, b;
        cin >> a >> b;
        int c = a*b;
        int left = 0, right = MOD;
        int mid;
        while(right-left>1){
            mid = (left+right)/2;
            if(mid*mid>=c) right = mid;
            else left = mid;
        }
        int maxi = left;
        if(maxi == 0){
            cout << 0 << endl;
            continue;
        }
        if((c-1)/maxi > maxi){
            ans = maxi * 2;
            if(a <= maxi) --ans;
            if(b <= maxi) --ans;
        }
        else{
            ans = maxi * 2 -1;
            if(a <= maxi) --ans;
            if(b <= maxi) --ans;
        }
        cout << ans << endl;
    }
}

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

int main(){
	char a[4],b[4];
	cin>>a;cin>>b;
	int ans=0;
	for(int i=0;i<3;i++){
		if(a[i]==b[i]){
			ans++;
		}
	}
	cout<<ans<<endl;

	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long INF = 1e18;
int n;
vector<long long> a(440, 0);
vector<long long> sum(440, 0);
vector< vector<long long> > dp(440, vector<long long>(440, -1));

long long rec(int l, int r) {
    if(dp[l][r] != -1) return dp[l][r];
    if(abs(l-r) <= 1) return 0;
    long long res = INF;
    for(int mid = l+1; mid < r; ++mid) {
        chmin(res, rec(l, mid)+rec(mid, r));
    }
    return dp[l][r] = res + (sum.at(r)-sum.at(l));
}

int main() {
    cin >> n;
    sum.at(0) = 0;
    for(int i = 0; i < n; ++i) {
        cin >> a.at(i);
        sum.at(i+1) = sum.at(i) + a.at(i);
    }
    cout << rec(0, n) << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int a[N];
int main()
{
    FASTINOUT;
    int x,m,l,r;
    cin>>x>>m;
    for (int i=0;i<m;i++){
        cin>>l>>r;
        a[l]++;
        a[r+1]--;
    }
    for (int i=1;i<=x;i++)
        a[i]+=a[i-1];
    int ans=0;
    for (int i=1;i<=x;i++){
        if (a[i]==m)
            ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        n:usize,
        s:chars,
        k:usize
    }
    let char_k = s[k - 1];
    let mut res:String = String::new();
    for c in s {
        if c != char_k {
            res.push('*');
        } else {
            res.push(c);
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 4352
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_row(n)

    max_count = sum(num_list)

    if max_count % 10 != 0:
        print(max_count)
        exit()

    num_list.sort()

    for num in num_list:
        if num % 10 == 0:
            continue
        max_count -= num
        break
    else:
        max_count = 0

    print(max_count)

if __name__ == '__main__':
    main()


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

const int MAXN = 80008;
int main() {
  string num;
  int N;
  const int mod = 11;
  int m[MAXN];
  int d[MAXN][mod];
  int t[MAXN];
  t[0] = 1;
  for(int i = 1; i < MAXN; ++i) {
    t[i] = t[i-1] * 10 % mod;
  }

  while(cin >> num && num != "0") {
    N = num.size();
    reverse(num.begin(), num.end());
    m[0] = 0;
    for(int i = 0; i < N; ++i) {
      m[i+1] = ( m[i] + t[i] * (num[i]-'0') ) % mod;
    }
    fill(d[0], d[MAXN], 0);
    for(int i = 0; i <= N; ++i) {
      d[i][m[i]] = 1;
    }
    for(int j = 0; j < mod; ++j) {
      for(int i = 0; i < N; ++i) {
	d[i+1][j] += d[i][j];
      }
    }
    int res = 0;
    for(int i = 1; i <= N; ++i) {
      if(num[i-1] != '0')
	res += d[i-1][m[i]];
    }
    cout << res << endl;
  }
  return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

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

            while (n-- > 0)
            {
                TimeSpan input = TimeSpan.Parse(Console.ReadLine());

                int h = input.Hours;
                int m = input.Minutes;

                double s = h * 30 + m * 0.5;
                double l = m * 6;

                double d = Math.Abs(s - l);
                if (d > 180) d = 360 - d;

                if (d < 30) sb.AppendLine("alert");
                else if (d >= 90) sb.AppendLine("safe");
                else sb.AppendLine("warning");
            }
            Console.Write(sb);
        }
    }
}

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

const double inf = 1e40;
int n;
int x[50], y[50];

double dist(double a, double b, double c, double d) {
  double p = c - a;
  double q = d - b;
  return sqrt(p * p + q * q);
}

bool in(double sx, double sy, double r) {
  for (int i = 0; i < n; ++i) {
    double d = dist(sx, sy, x[i], y[i]);
    if (d >= r + 1e-8) return false;
  }
  return true;
}

double cat(int i, int j) {
  double sx = (x[i] + x[j]) / 2.0;
  double sy = (y[i] + y[j]) / 2.0;
  double r = dist(x[i], y[i], sx, sy);
  return in(sx, sy, r) ? r : inf;
}

bool online(int i, int j, int k) {
  long a = x[j] - x[i];
  long b = y[j] - y[i];
  long c = x[k] - x[i];
  long d = y[k] - y[i];
  return a * d == b * c;
}

double sub(int i, int j, int k) {
  if (online(i, j, k)) return inf;
  double a = dist(x[k], y[k], x[j], y[j]);
  double b = dist(x[i], y[i], x[k], y[k]);
  double c = dist(x[j], y[j], x[i], y[i]);
  double s = a * a * (b * b + c * c - a * a);
  double t = b * b * (c * c + a * a - b * b);
  double u = c * c * (a * a + b * b - c * c);
  double sx = (s * x[i] + t * x[j] + u * x[k]) / (s + t + u);
  double sy = (s * y[i] + t * y[j] + u * y[k]) / (s + t + u);
  
  double r = dist(x[i], y[i], sx, sy);
  return in(sx, sy, r) ? r : inf;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
  }
  
  double mn = inf;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      mn = min(mn, cat(i, j));
    }
  }
  
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = j + 1; k < n; ++k) {
        mn = min(mn, sub(i, j, k));
      }
    }
  }
  cout << fixed << setprecision(16) << mn << endl;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)

xlist.sort()
diclist = [xlist[i+1] - xlist[i] for i in range(N)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if N > 1:
    a = gcd(diclist[0], diclist[1])
    for i in range(N-2):
        a = gcd(a, diclist[i+2])
    print(a)

else:
    print(diclist[0])


Measured memory_bytes: 63000
n = int(input())
a = list(map(int, input().split()))

prefix = [0]

for i in a:
    prefix.append(prefix[-1] + i)

mini = float('inf')

for i in range(0, n):
    mini = min(abs(prefix[i] - (prefix[-1] - prefix[i])), mini)

print(mini)


Measured memory_bytes: 26224
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

int main()
{
    int N, L, sum=0;
    cin >> N >> L;
    vector<int> a(N);
    for(int i = 0; i < N; i++)
    {
        a.at(i) = L+i;
        sum += a.at(i);
    }
    if(L >= 0) cout << sum-a.at(0) << endl;
    else if(L < 0 && N > L*(-1)) cout << sum <<endl;
    else if(L < 0 && N <= L*(-1)) cout << sum-a.at(N-1) <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4] == s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) { //gcdを返す
	if(a == 0){
		return b;
	} else if (b == 0){
		return a;
	} else {
	  if(a < b) return gcd(b, a);
	  ll r;
	  while ((r=a%b)) {
	    a = b;
	    b = r;
	  }
	  return b;
	}
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
const ll mod = 1000000007;
int main(){
	ll r, D, x2000;
	cin >> r >> D >> x2000;
	vl x(11);
	x[0] = x2000;
	for(ll i = 1; i <= 10; i++){
		x[i] = r*x[i-1] - D;
		cout << x[i] << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=1e10+7;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}

int32_t main()
{
    fast;

    string str;
    cin>>str;

    if(str=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC";
}

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

using namespace std;

int main() {

	int n, w;
	cin >> n >> w;

	long long weights[n];
	long long vals[n];
	for (int i = 0; i < n; i++) {
		cin >> weights[i] >> vals[i];
	}

	// Maximum value from x weight and the first y items
	long long result[w+1][n+1];

	for (int i = 0; i < w+1; i++) {
		result[i][0] = 0;
	}

	for (int j = 1; j < n+1; j++) {

		for (int i = 0; i < w+1; i++) {
			result[i][j] = result[i][j-1];
		}

		for (int i = weights[j-1]; i < w+1; i++) {
			result[i][j] = max(result[i][j], result[i - weights[j-1]][j-1] + vals[j-1]);
		}

	}

	// for (int i = 0; i < w+1; i++) {
	// 	for (int j = 0; j < n+1; j++) {
	// 		cout << result[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	cout << result[w][n] << endl;

}

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

int main(){
  int D, T, S;
  cin >> D >> T >> S;

  cout << (D <= S * T ? "Yes" : "No") << endl;
  
}

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

int main() {
int N;
cin >> N;
  queue<int64_t> lun;
  for(int i = 1; i <=9;i++){
  lun.push(i);
  }
  int64_t sansho = 0;
  for(int i = 0; i < N; i ++){
    sansho = lun.front();
    if(sansho%10 != 0){
    	lun.push(sansho * 10 + sansho%10 -1);          
    }
    lun.push(sansho * 10 + sansho%10);
    if(sansho%10 != 9){
    	lun.push(sansho * 10 + sansho%10 + 1);
    }
  	lun.pop();
  }
    cout << sansho << endl;

}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <iostream>
#include <ctype.h>
#include <ctime>
#include <unordered_set>
#include <ctype.h>

#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pli;
typedef pair<lli,lli> pll;

int n,m,adj[701][701],vis[701];
int cache[2][701];
bool dfs(int cur,int c) {
	vis[cur]=c;
	for(int i=1;i<=n;i++) if(adj[cur][i]) {
		if(vis[i]!=-1) {
			if(vis[i]==vis[cur]) return false;
		}
		else if(!dfs(i,c^1)) return false;
	}
	return true;
}
void get(int cur,int c,int &as,int &bs) {
	vis[cur]=1;
	if(c==0) as++; 
	else bs++;
	for(int i=1;i<=n;i++)if(adj[cur][i] && !vis[i]) get(i,c^1,as,bs);
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) if(i!=j) adj[i][j]=1;
	}
	for(int i=0;i<m;i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		adj[a][b]=0;
		adj[b][a]=0;
	}
	
	memset(vis,-1,sizeof(vis));
	for(int i=1;i<=n;i++) if(vis[i]==-1) {
		if(!dfs(i,0)) {
			puts("-1");
			return 0;
		}
	}
	
	memset(vis,0,sizeof(vis));
	vector<pii> arr;
	for(int i=1;i<=n;i++) if(!vis[i]) {
		int as=0,bs=0;
		get(i,0,as,bs);
		arr.push_back(pii(as,bs));
	}

	int pr=0,cur=1;
	cache[pr][0]=1;
	for(auto &cv:arr) {
		for(int i=0;i<=n;i++) cache[cur][i]=0;
		for(int i=0;i<=n;i++) if(cache[pr][i]) {
			cache[cur][i+cv.fi]=1;
			cache[cur][i+cv.se]=1;
		}
		swap(cur,pr);
	}
	
	int mx=n*n;
	for(int i=0;i<=n;i++) if(cache[pr][i]) {
		int val = i*(i-1)/2 + (n-i)*(n-i-1)/2;
		mx = min(mx,val);
	}	
	printf("%d\n",mx);

	return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	ll e = 0;
	for(int i=0;i<n-1;i++)
	{
		int u,v; cin>>u>>v;
		if(u>v) swap(u,v);
		e+=ll(u)*ll(n+1-v);
	}
	ll v = 0;
	for(int i=1;i<=n;i++)
	{
		v+=(n-i+1)*1LL*i;
	}
	cout<<v-e<<'\n';
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdint>
#include <algorithm>

typedef int64_t lint;
#define LINT_MAX (INT64_MAX / 2)
#define LINT_MIN (INT64_MIN / 2)

using namespace std;

lint max(lint a,lint b) {
    if(a > b)
        return a;
    return b;
}

int main(void) {
    lint n,m;
    cin >> n >> m;
    lint p[1001][3];
    for(lint i = 0;i < n;i++) {
        cin >> p[i][0] >> p[i][1] >> p[i][2];
    }
    lint retval = LINT_MIN;
    for(lint f = 0;f < 8;f++) {
        lint sum[1001];
        lint ff[3] = {1,1,1};
        if(f % 2 == 1)
            ff[0] = -1;
        if((f / 2) % 2 == 1)
            ff[1] = -1;
        if((f / 4) % 2 == 1)
            ff[2] = -1;
        for(int i = 0;i < n;i++)
            sum[i] = (p[i][0] * ff[0]) + (p[i][1] * ff[1]) + (p[i][2] * ff[2]);
        lint ss = 0;
        sort(sum,sum+n);
        for(int i = 0;i < m;i++)
            ss = ss + sum[(n-1)-i];
        
        retval = max(retval,ss);
    }
    cout << retval;
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
const long MOD=1000000007;
long powmod(long x,long p){
  if(p==0)return 1;
  if(p%2)return x*powmod(x,p-1)%MOD;
  long tmp=powmod(x,p/2);return tmp*tmp%MOD;
}
long inv(long x){return powmod(x,MOD-2);}
long COM(long n,long k){
  long r=1;
  for(long i=0;i<k;i++){r=r*(n-i)%MOD;r=r*inv(i+1)%MOD;}
  return r;
}
long f(long r,long c){return COM(r+c,r);}
int main(){
  long r1,c1,r2,c2;cin>>r1>>c1>>r2>>c2;
  long ans=f(r2+1,c2+1)%MOD+(MOD-f(r2+1,c1))%MOD+(MOD-f(r1,c2+1))%MOD+f(r1,c1)%MOD;
  cout<<ans%MOD;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

main()
{
    fastio;
    int a, b, n;
    cin>>a>>b>>n;
    int k=min(b-1, n);
    int ans=((a*k)/b)-(a*(k/b));
    cout<<ans;
}


Measured memory_bytes: 3564
use std::io::{self};

fn main() {
    let mut buffer1 = String::new();
    let mut s: String = match io::stdin().read_line(&mut buffer1) {
        Ok(_) => {
            buffer1.trim().parse::<String>().ok().expect("woops")
        },
        Err(_) => panic!()
    };
    let mut buffer2 = String::new();
    let mut t: String = match io::stdin().read_line(&mut buffer2) {
        Ok(_) => {
            buffer2.trim().parse::<String>().ok().expect("woops")
        },
        Err(_) => panic!()
    };

    let ans = exec_calc(&mut s, &mut t);

    println!("{:?}", ans);
    return;
}

fn exec_calc(s: &mut str, t: &mut str) -> u32 {
    let s_vec = s.split("").collect::<Vec<&str>>();
    let t_vec = t.split("").collect::<Vec<&str>>();
    let mut count : u32 = 0;
    for ind in 0 .. s_vec.len() {
        if s_vec[ind] != t_vec[ind] {
            count += 1
        }
    }

    return count
}

Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  int  sum = 0;
  bool odd = false;
  for (int i = 1, prev = 0;; prev = i, i *= 10) {
    if (i > n) {
      if (odd) sum += n - prev + 1;
      break;
    }
    if (odd) sum += i - prev;
    odd = !odd;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

const double PI = acos(-1.0);

bool inside(int x, int a, int b) {
  return min(a, b) <= x and x <= max(a, b);
}

long long dist(int x1, int y1, int x2, int y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}

int LIS(vector<int> &v) {
  vector<int> lis;

  for (auto &x : v) {
    auto it = upper_bound(lis.begin(), lis.end(), x);
    if (it == lis.end()) {
      lis.push_back(x);
    } else {
      *it = x;
    }
  }

  return lis.size();
}

double calc(int d, int lis, int sz) {
  double ans = 100. * (d - 2 * lis) + 2. * lis * 90. + 5. * lis * PI;

  if (sz == lis) {
    ans += 5 * PI;
  }

  return ans;
}

int main() { IO;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  if (x1 > x2) {
    swap(x1, x2);
    swap(y1, y2);
  }

  int n;
  cin >> n;

  vector<pair<int,int>> v(n);
  for (auto &p : v) {
    cin >> p.first >> p.second;
  }
  sort(v.begin(), v.end());

  vector<int> points;
  for (auto &p : v) {
    if (inside(p.first, x1, x2) and inside(p.second, y1, y2)) {
      points.push_back(p.second);
    }
  }

  if (y1 > y2) {
    reverse(points.begin(), points.end());
  }

  int lis = LIS(points);
  int d = dist(x1, y1, x2, y2);
  int sz = min(abs(x1 - x2), abs(y1 - y2)) + 1;

  double ans = calc(d, lis, sz);
  cout.precision(15);
  cout << fixed << ans << endl;

  return 0;
}


Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(){
   int n;
   cin >> n;
   int MAX = 0;

   rep(i,n){
      int h; cin >> h;
      MAX = max(h,MAX);
      if(h!=MAX){
         if(h!=MAX-1){
            cout << "No" << endl;
            return 0;
         }
      }
   }
   cout << "Yes" << endl;
   return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    public class Program
    {
        //static void SendAll()
        //{

        //    Console.WriteLine("Start!!!");
        //    int count = 0;

        //    // Read in the specified file.
        //    // ... Use async StreamReader method.

        //    for (int i = 0; i < 10; i++)
        //    {
        //        SendFinal("hello", "hi", "duongtrungvinh2711@gmail.com");
        //        count++;
        //        Console.WriteLine("Done {0}", count);
        //    }
        //    Console.WriteLine("End!!!");
        //}
        //static void SendFinal(string title, string content, string receiver)
        //{
        //    string myemail = "tomgiongvn.vn@gmail.com";
        //    string mypassword = "tomgiongvn@123";

        //    MailMessage message = new MailMessage();
        //    message.IsBodyHtml = true;
        //    message.From = new MailAddress(myemail, "PHÒNG TÀI VỤ HUFLIT");
        //    message.To.Add(new MailAddress(receiver));
        //    //message.CC.Add(new MailAddress(myemail));
        //    message.Subject = title + " | HUFLIT";
        //    message.Body = content;

        //    SmtpClient smtp = new SmtpClient();
        //    smtp.Host = "smtp.gmail.com";
        //    smtp.Port = 587;
        //    smtp.UseDefaultCredentials = false;
        //    smtp.EnableSsl = true;
        //    NetworkCredential nc = new NetworkCredential(myemail, mypassword);
        //    smtp.Credentials = nc;
        //    smtp.Send(message);
        //}
        static bool lant(int n)
        {
            for (int i = 2; i < Math.Sqrt(n) + 1; i++)
                if (n % i == 0)
                    return false;
            return true;
        }
        static void Main(string[] args)
        {
            //Task task = new Task(SendAll);
            //task.Start();

            //for (int i = 0; i < 10000; i++)
            //    Console.Write(i);
            //var watch = System.Diagnostics.Stopwatch.StartNew();
            // the code that you want to measure comes here

            int a = int.Parse(Console.ReadLine());
            if (a < 3)
            { 
                Console.WriteLine(2);
            }
            else
            {
                while (!lant(a))
                    a++;
                Console.WriteLine(a);
            }


        }
    }

}


Measured memory_bytes: 11092
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int main() {
  int N;
  cin >> N;
  int L[N];
  rep(i,N) cin >> L[i];
  sort(L,L+N);
  int ans = 0;
  for(int i=0; i<N; i++) {
    for(int j=i+1; j<N-1; j++) {
      int lval = -L[i]+L[j];
      int rval = L[i]+L[j];
      int l = upper_bound(L+j+1,L+N,lval) - (L+j+1);
      int r = lower_bound(L+j+1,L+N,rval) - (L+j+1) - 1;
      if(r < 0 || l == N - j - 1) continue;
      else ans += (r-l+1);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int dx[6] = { -1,-1,0,1,1,0 };
int dy[6] = { 0,-1,-1,0,1,1 };
struct aa {
	int x;
	int y;
	int turn;
};
int main() {
	while (1) {
		int T, N; cin >> T >> N;
		if (!T)break;
		set<pair<int, int>>mp;
		for (int i = 0; i < N; ++i) {
			int x, y; cin >> x >> y;
			mp.emplace(x, y);
		}
		int sx, sy; cin >> sx >> sy;
		queue<aa>que;
		que.push(aa{ sx,sy,0 });
		mp.emplace(sx, sy);
		while (!que.empty()) {
			aa atop(que.front());
			que.pop();
			if (atop.turn == T)break;
			else {
				for (int i = 0; i < 6; ++i) {
					int nx = atop.x + dx[i];
					int ny = atop.y + dy[i];
					if (mp.find(make_pair(nx, ny)) == mp.end()) {
						mp.emplace(nx, ny);
						que.push(aa{ nx,ny,atop.turn + 1 });
					}
				}
			}
		}
		cout << mp.size() - N << endl;
	}
	return 0;
}

Measured memory_bytes: 3180
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val A, B, C = ni()
    val ms = max(max(A, B), C)
    val ans = ms * 10 + A + B + C - ms
    out.println(ans)
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }
}


Measured memory_bytes: 27332
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [H, W] = [int(input_raw[0]), int(input_raw[1])]
    field = []
    for i in range(H):
        input_raw = read_func().strip().split()
        field.append(input_raw[0])

    dp = [[0 for i in range(W)] for j in range(H)]

    for i in range(H):
        if field[i][0] == ".":
            dp[i][0] = 1
        else:
            break
    for i in range(W):
        if field[0][i] == ".":
            dp[0][i] = 1
        else:
            break
    for i in range(1, H):
        for j in range(1, W):
            if field[i][j] == ".":
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007L
            else:
                dp[i][j] = 0
    print dp[H - 1][W - 1]

if __name__ == '__main__':
    main()


Measured memory_bytes: 44504
//#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<functional>
#include<vector>

#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int n;
vector<ll> v;
vector<ll> w;

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    cin >> n;
    forn(i, n)
    {
        int x;
        cin >> x;
        v.pb(x);
    }
    sort(v.begin(), v.end());
    while(v.size()>=2)
    {
        if(v[v.size()-1] == v[v.size()-2])
        {
            w.pb(v[v.size()-1]);
            v.pop_back();
            v.pop_back();
        }
        else v.pop_back();
    }
    if(w.size()<2) cout << 0 << endl;
    else cout << w[0] * w[1] << endl;
}


Measured memory_bytes: 1908
#include <stdio.h>

int main(void){
	int N,K;
	scanf("%d %d",&N,&K);
	int i,h[N+1];
	for(i=1;i<N+1;i++){
		scanf("%d",&h[i]);
	}
	int ans = 0;
	for(i=1;i<N+1;i++){
		if(h[i] >= K) ans++;
	}
	printf("%d\n",ans);
	
	return 0;
}




Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int main(){
	long long H,W;
	scanf("%ld %ld",&H,&W);
	if(H == 1 || W == 1){
		printf("1\n");
		return 0;
	}
	if(H%2 == 0 || W%2 == 0){
		printf("%ld\n",H*W/2);
	}
	else{
		printf("%ld\n",H*W/2+1);
	}

	return 0;
}

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

int main(){
    int n;
    cin >> n;

    int x, y;
    int min_sum = INT_MAX;
    int max_sum = INT_MIN;
    int min_diff = INT_MAX;
    int max_diff = INT_MIN;
    for(int i = 0; i < n; ++i){
        cin >> x >> y;
        min_sum = min(x + y, min_sum);
        max_sum = max(x + y, max_sum);
        min_diff = min(x - y, min_diff);
        max_diff = max(x - y, max_diff);
    }

    cout << max(max_sum - min_sum, max_diff - min_diff);
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

void trace(int A[], int N){
	int i;
	for(i=0;i<N;i++){
		printf("%d",A[i]);
		if (i==N-1){
			printf("\n");
		}
		else{
			printf(" ");
		}
	}
} 

void insertionSort(int A[], int N){
	int i,j,key;
	for (i=1;i<N;i++){
		key = A[i];
		j=i-1;
		while (j >= 0 && A[j] > key){
			A[j+1] = A[j];
            j--;     
		}
        A[j+1] = key; 
		trace(A,N);	
	}
    
    
   
}

int main(){
	int N,i;
	int A[100];
	
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d", &A[i]);
	}
	trace(A,N);
	insertionSort(A,N);
}




Measured memory_bytes: 2088
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	ll H,W;
	string c[110];
	cin>>H>>W;
	reg(i,1,H)cin>>c[i];
	reg(i,1,2*H){
		rep(j,W){
			printf("%c",c[(i+1)/2][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;




int main(){
    int a,b;
    cin>>a>>b;
    if(a>b){
        swap(a,b);
    }
    string s;
    for(int i=0;i<b;i++){
        s+=to_string(a);
    } 
    out(s);   
    return 0;
}


Measured memory_bytes: 256