akhauriyash/Code-Regression huggingface dataset:
// ABC114_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N;
    cin >> N;
    // vector<ll> vec(N);
    // REP(i, N) cin >> vec[i];
    
    // calculation
    if (N == 3 || N == 5 || N == 7) {
        cout << "YES" << "\n";
    } else{
        cout << "NO" << "\n";
    }
    
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int ans = 0;
		int min = 100000;
		int max = 0;
		int[] all = new int[100001];
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = reader.nextInt();
			all[arr[i]]++;
			min = Math.min(min, arr[i]);
			max = Math.max(max, arr[i]);
		}
		for (int i = min; i <= max; i++) {
			int tmp = all[i];
			if (i > 0) {
				tmp += all[i-1];
			}
			if (i < 100000) {
				tmp += all[i+1];
			}
			ans = Math.max(tmp, ans);
		}

		System.out.println(ans);
		reader.close();

	}
}





Measured memory_bytes: 61300
from collections import deque

N,X,Y=map(int,input().split())

Ndmin=[0]*(N-1)
for i in range(1,N):
    tmp=deque([i])
    dmin=deque([0])
    Dmin=[10000]*(N)
    while tmp:
        E=tmp.popleft()
        d=dmin.popleft()
        Dmin[E-1]=min(d,Dmin[E-1])
        if E<N:
            if d+1<Dmin[E]:
                tmp.append(E+1)
                dmin.append(d+1)
        if E>1:
            if d+1<Dmin[E-2]:
                tmp.append(E-1)
                dmin.append(d+1)
        if E==X and d+1<Dmin[Y-1]:
            tmp.append(Y)
            dmin.append(d+1)
        if E==Y and d+1<Dmin[X-1]:
            tmp.append(X)
            dmin.append(d+1)
        
    for ii in range(i,N):
        Ndmin[Dmin[ii]-1]+=1

for i in range(N-1):
    print(Ndmin[i])

Measured memory_bytes: 53980
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)  
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;  
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n , m , k;
    cin >> n >> m >> k;
    map<int,int>r,c;
    map<pair<int,int>,bool>  vis;
    for(int i =0 ;i < k;i++){
      int x ,y;
      cin >> x >>y;
      r[x]++;
      c[y]++;
      vis[{x,y}]=1;
    }
    int ans = 0;
    int rmx =0 , cmx = 0;
    for(auto i : r)rmx=max(rmx,i.se); 
    for(auto i : c)cmx=max(cmx,i.se); 
    vector<int>rr,cc;
    for(auto i : r)if(rmx==i.se)rr.pb(i.fi);
    for(auto i : c)if(cmx==i.se)cc.pb(i.fi);
    bool ok= 1;
    for(auto i : rr){
      for(auto j : cc)
        if(vis[{i,j}]==0){
          ok = 0;
          break;
        }
        if(ok==0)break;
    }
    ans = rmx + cmx -ok;
    cout << ans <<'\n';
  }
  return 0;
}


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

#define ll long long
#define ld long double
#define debug(x) \
	//    (cout << #x << ": " << (x) << endl)
#define eb emplace_back
#define fi first
#define se second

using namespace std;

const int nm = 100002;
const ll inf = 1000000000000000000ll;

int n;
ll a[nm];

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		if (!a[i]) {
			printf("0\n");
			return 0;
		}
	}
	ll res = 1;
	for (int i = 1; i <= n; ++i) {
		if (a[i] > inf / res) {
			printf("-1\n");
			return 0;
		}
		res *= a[i];
	}
	printf("%lld\n", res);
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (a >= k) {
	  cout << k << endl;
	} else if (a + b >= k) {
	  cout << a << endl;
	} else {
	  cout << a - (k - (a + b)) << endl;
	}
    
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
  FAST/**/
   
   string s;
   cin>>s;
   
   ll tot = 0;
   rep(s.length())
   {
       tot = (tot + s[i] - '0')%9;
   }
   
   if(tot == 0)
        cout<<"Yes\n";
   else cout<<"No\n";        
   
   return 0;        
}  

  
          
   

Measured memory_bytes: 3664
#include<iostream>
#define MAX 1000000000
using namespace std;
int main(){
  int n,k,s;
  cin >> n >> k >> s;
  for (int i = 0; i < k; i++){
    cout << s <<" ";
  }
  for (int i = k; i < n; i++){
    if(s>1000000){
      cout << 1 << " ";
    }else{
      cout << MAX  - 1<< " ";
    }
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>

int main(){
	int A,B,C,D,L,x,y,z;
	scanf("%d \n %d \n %d \n %d \n %d",&L,&A,&B,&C,&D);
        if(A%C == 0){
		x=A/C;
	}else{
		x=A/C+1;
	}
	if(B%D == 0){
		y=B/D;
	}else{
		y=B/D+1;
	}
        if(x <= y){
		z = L -y;
	}else{
		z = L -x;
	}
	printf("%d\n",z);
	return 0;
}

Measured memory_bytes: 596
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const ll mod = 12345678910;
const int maxn = (int)1e5 + 5;
using namespace std;

int main(){
	ll a, b, x;
    cin >> a >> b >> x;
    ll ans = b / x - a / x + 1;
    if(a % x) ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{

int a,b;

scanf("%d\n",&a);
scanf("%d\n",&b);

if(a < b){
 
 printf("a < b\n");

}else if(a > b){

 printf("a > b\n");

}else if(a == b){

 printf("a == b\n");

}

return 0;

}

Measured memory_bytes: 1816
#include<stdio.h>
#define MOD 2019
#define ll long long 
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 main(){
    ll L,R;
    scanf("%lld%lld",&L,&R);
    ll count=0;
    if(R-L>=MOD)
        printf("0\n");
    else if(R%MOD==0||L%MOD==0)
        printf("0\n");
    else{
        int p=R%MOD;
        int q=L%MOD;
        int minn=2019;
        for(int i=min(p,q);i<max(p,q);i++)
            for(int j=i+1;j<=max(p,q);j++)
                if((i*j%MOD)<minn)
                    minn=i*j%MOD;
        printf("%d\n",minn);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    
    string s;
    cin>>s;
    string s1=s;
    reverse(s.begin(),s.end());
    if(s1==s){
        puts("Yes");
    }else{
        puts("No");
    }
    
    
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    vector<int> nums(N);

    rep(i, N) {
        cin >> A[i];
        nums[A[i] - 1]++;
    }
    sort(All(nums));
    reverse(All(nums));
    int res = 0;
    for(int i = 0; i < K; i++) {
        res += nums[i];
    }

    cout << N - res << endl;
    return 0;
}

Measured memory_bytes: 1792
H,W = map(int,input().split())
s = [input() for _ in range(H)]
ans = [[-1 for w in range(W)] for h in range(H)]
ans0 = ans[:]
for h in range(H):
    sh = s[h]
    st = -1
    gl = -1
    cnt = 0
    for w in range(W):
        if sh[w] == '.':
            cnt += 1
            if st == -1:
                st,gl = w,w
            gl +=1
            if w == W-1:
                for i in range(st,w+1):
                    ans[h][i] += cnt
        else:
            for i in range(st,gl):
                ans[h][i] += cnt
            cnt = 0
            st,gl = -1,-1
#print(*ans,sep='\n')
#ans1 = ans[:]
#ans = [[0 for w in range(W)] for h in range(H)]
for w in range(W):
    st = -1
    gl = -1
    cnt = 0
    for h in range(H):
        if s[h][w] == '.':
            cnt += 1
            if st == -1:
                st,gl = h,h
            gl +=1
            if h == H-1:
                for i in range(st,h+1):
                    ans[i][w] += cnt
        else:
            for i in range(st,gl):
                ans[i][w] += cnt
            cnt = 0
            st,gl = -1,-1
#print(*ans,sep='\n')
mx = 0
for x in ans:
    mx = max(max(x),mx)
print(mx)

Measured memory_bytes: 101720
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<utility>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,k;
int main(){
	cin>>n>>k;
	if(k==1)
	{
		cout<<0;
		return 0;
	}
	cout<<n-k;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int t=sc.nextInt();
        for (int i=0;i<t;i++){
            int win=1;
            int color[][]=new int[3][9];
            for (int j=0;j<3;j++) Arrays.fill(color[j],10);
            int num[]=new int[9];
            for (int j=0;j<9;j++) num[j]=sc.nextInt();
            int color_num[]=new int[3];
            for (int j=0;j<9;j++){
                char c=sc.next().charAt(0);
                if (c=='R') color[0][color_num[0]++]=num[j];
                if (c=='G') color[1][color_num[1]++]=num[j];
                if (c=='B') color[2][color_num[2]++]=num[j];
            }
            for (int j=0;j<3;j++) Arrays.sort(color[j]);
            if (color_num[0]%3!=0||color_num[1]%3!=0||color_num[2]%3!=0) win=0;
            for (int j=0;j<3&&win!=0;j++){
                for (int k=0;k<color_num[j]/3;k++){
                    if (color[j][k*3]==color[j][k*3+2]){
                        color[j][k*3]=0;
                        color[j][k*3+1]=0;
                        color[j][k*3+2]=0;
                    }
                    if (color[j][k*3]==color[j][k*3+1]-1&&color[j][k*3]==color[j][k*3+2]-2){
                        color[j][k*3]=0;
                        color[j][k*3+1]=0;
                        color[j][k*3+2]=0;
                    }
                }
            }
            for (int j=0;j<3&&win!=0;j++){
                int n=color_num[j];
                int changed=0;
                for (int l=0;l<n/3;l++){
                    int bef=-2;
                    changed=0;
                    for (int k=0;k<color_num[j];k++){
                        if ((k==color_num[j]-2&&changed==0)||(k==color_num[j]-1&&changed<=1)) break;
                        int now=color[j][k];
                        if ((now!=0&&changed==0)||now==bef+1){
                            color[j][k]=0;
                            changed++;
                            bef=now;
                        }
                        if (changed==3){
                            changed=0;
                            bef=-2;
                        }
                    }
                }
                if (changed!=0) win=0;
            }
            for (int j=0;j<3;j++){
                for (int k=0;k<color_num[j];k++){
                    if (color[j][k]!=0) win=0;
                }
            }

            System.out.println(win);
        }
    }
}

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

int h1, m1, h2, m2, k;
int main() {
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	m1 += h1*60;
	m2 += h2*60;
	cout << max(0, m2-m1-k);
	return 0;
}


Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] a = new int[N];
        
        for(int i = 0; i < N; i++){
            a[i] = sc.nextInt();
        }

        int min = Integer.MAX_VALUE;
        for(int i = -100; i <= 100; i++){
            int cost = 0;
            for(int j = 0; j < N; j++){
                cost += Math.abs(a[j] - i) * Math.abs(a[j] - i);
            }
            if(min > cost){
                min = cost;
            }
        }
        System.out.println(min);
    }        
}


Measured memory_bytes: 22740
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e9
typedef long long ll;
typedef pair<ll,ll> P;
 
 
int main(void){
    int n,a,b;
    cin>>n>>a>>b;
    if((b-a-1)%2==0)cout<<"Borys"<<endl;
    else cout<<"Alice"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{   int n;
    scanf("%d",&n);
    int d[n];
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
        }
        long long ans=0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    printf("%lld",ans);

    return 0;
}


Measured memory_bytes: 128
import java.util.*;

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

        int n = sc.nextInt();
        int k = sc.nextInt();
        double[] arr = new double[n];
        double[] accSum = new double[n+1];
        double ans = 0;

        for (int i=0; i<n; i++){
            int tmp = sc.nextInt();
            if (tmp%2==0) {
                arr[i] = tmp/2 + 0.5;
            }else {
                arr[i] = tmp/2 + 1;
            }
        }

        accSum[1] = arr[0];
        for (int i=2; i<n+1; i++){
            accSum[i] = accSum[i-1]+arr[i-1];
        }

        for (int i=0; i<n-k+1; i++){
            double tmp = accSum[i+k] - accSum[i];
            ans = Math.max(ans, tmp);
        }

        System.out.println(ans);


    }
}


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

from  collections import defaultdict
import bisect


# SegTreeの関数
def segfunc(x, y):
    return x | y


# 単位元
# min->inf, max->-inf, add->0, mul->1
ide_ele = set()


# セグメント木
class SegTree:
    """
    init(init_val, segfunc, ide_ele): 配列init_valで初期化、構築
    update(k, x): k番目の値をxに更新
    query(l, r): 区間[l, r)をsegfuncしたものを返す
    """

    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセットする
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        :param k: index(0-index)
        :param x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        :param l: 0-index
        :param r: 0-index
        :return:
        """
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

def main():
    N = I()
    S_ = S()
    S_list = []
    Q = I()
    for s in S_:
        val = set()
        val.add(s)
        S_list.append(val)


    segtree = SegTree(S_list, segfunc, ide_ele)
    for i in range(Q):
        query = LS()
        if query[0] == '1':
            i_q = int(query[1]) - 1
            c_q = query[2]
            segtree.update(i_q, {c_q})
        if query[0] == '2':
            l_q = int(query[1]) - 1
            r_q = int(query[2])
            ans = len(segtree.query(l_q, r_q))
            print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 365432
#include<iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;

    int a[100];
    int max=0;
    for(int i=0;i<n;i++){
      cin >> a[i];
      if(max<a[i]) {
        max = a[i];
      }
    }

    float sum=0.0;
    for(int i=0;i<n;i++){
      sum = sum + (float)max / a[i];
    }
    
    cout << max / sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c){
		cout<<"Yes"<<endl;
	}else if(a==c&&a!=b){
		cout<<"Yes"<<endl;
	}else if(b==c&&b!=a){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define int long long
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

signed main(){
  int A,B,C;
  cin >> A >> B >> C;
  int ans;
  ans = 9*max({A,B,C})+A+B+C;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl


void func() {
  LL N;
  cin >> N;
  N--;
  vector<LL> C(N);
  vector<LL> S(N);
  vector<LL> F(N);

  REP(i, N) {
    cin >> C[i];
    cin >> S[i];
    cin >> F[i];
  }

#if 0
  PRINTLN(C);
  PRINTLN(S);
  PRINTLN(F);
#endif

  for (LL start = 0; start < N+1; start++) {
    LL now = 0;
    for (LL i = start; i < N; i++) {
      now = max(now, S[i]);
      
      LL wait = (now - S[i]) % F[i];
      LL wait_ = 0;
      for (; now % F[i] != 0; now++) {}
      now += C[i];
    }
    cout << now << endl;
  }
}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





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

#define lowbit(x) (x & (-x))
const int MAXN = 100010;
typedef long long ll;

int n, a[MAXN], sum[MAXN];
int tree[MAXN << 1];

void modify(int p, int v)
{
	for(; p < (MAXN << 1); p += lowbit(p))
		tree[p] += v;
}

int query(int p)
{
	int res = 0;
	for(; p; p -= lowbit(p)) res += tree[p];
	return res;
}

bool Check(int mid)
{
	ll res = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(a[i] >= mid) sum[i] = sum[i - 1] + 1;
		else sum[i] = sum[i - 1] - 1;
		if(sum[i] >= 0) ++res;
	}
	for(int i = 1; i <= n; ++i) sum[i] += 100001;
	memset(tree, 0, sizeof(tree));
	for(int i = 1; i <= n; ++i)
	{
		res += query(sum[i]);
		modify(sum[i], 1);
	}
	if(res >= (((ll)n * (n + 1) / 2) + 1ll) / 2ll) return 1;
	return 0;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	int l = 1, r = 1e9, ans = 0;
	while(l <= r)
	{
		int mid = (l + r) >> 1;
		if(Check(mid)) ans = mid, l = mid + 1;
		else r = mid - 1;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) (x.begin(),x.end())
#include<math.h>
#include<vector>
#include<iostream>
#include<istream>
#include<string.h>
using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int counter=0;
    for(int i=0;i<3;i++)
    {
        if(a[i]==b[i])
        {
            counter++;
        }
    }
    printf("%d\n",counter);
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		if((A==B&&C!=A)||(B==C&&C!=A)||(C==A&&B!=C)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}

class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 23124
n = int(input())
length = len(str(n))
cnt = 0
odd_l = []
for i in range( len(str(n))):
    if ((i+1)%2 == 1) & (i != len(str(n))-1):
        cnt += 10**(i+1)-(10**i)
    elif (i+1)%2 == 1:
        for i in range(10**i, n+1):
            cnt += 1
            odd_l.append(i)
print(cnt)

Measured memory_bytes: 6680
import heapq
N, M = map(int, input().split())
AB = [[] for _ in range(10**5+10)]
for _ in range(N):
	ta, tb = map(int, input().split())
	AB[ta].append(-tb)

ans = 0
q = []
for i in range(1,M+1):
	while AB[i]:
		heapq.heappush(q, AB[i].pop())

	if q:
		ans += heapq.heappop(q)

print(-ans)

Measured memory_bytes: 17860
import math
N,M=map(int,input().split())
max=1
for i in range(1,int(math.sqrt(M))+2):
    if M%i==0 and i>=N:
        max=int(M/i)
        break
    if M%i==0 and M/i>=N:
        max=i
print(max)

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=1010;
int n;
int a[MAXN];
int main()
{
	scanf("%d",&n);
	n*=2;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int ans=0;
	for(int i=n-1;i>=1;i-=2)
		ans+=a[i];
	printf("%d",ans);
	return 0;
}

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

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

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int n, m, x;
   cin >> n >> m >> x;
   vector<int> a(m);
   for(int i = 0; i < m; i++){
      cin >> a[i];
   }

   int left = 0, right = 0;
   for(int i = 0; i < m; i++){
      if(a[i] < x){
         left++;
      }
      else{
         right++;
      }
   }

   cout << min(left, right) << endl;

   return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  ll C;
  scanf("%lld",&C);
  cout << max({10*A+B+C, A+10*B+C, A+B+10*C}) << endl;
}

int main()
{
  solve();
  return 0;
}


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

#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define debug(x) cerr << #x << " = " << x << endl;
#define puts_name() cerr << "\n\t\t\t\tAdson_S\n";
#define SET(c, v) memset(c, v, sizeof c)
#define pi 3.14159265358979323846264338
#define all(S) (S).begin(), (S).end()
#define INF 0x3f3f3f3f
#define mod 1000000007
#define pf push_front
#define pb push_back
#define mk make_pair
#define MAX 5010
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
typedef unsigned long long int ull;
int N, a, b, ans;

bool ver(int i, int j) {
	return (i <= N && j <= N);
}

int main(int argc, char ** argv) {
	scanf("%d%d%d", &N, &a, &b);
	rep(i, 0, N)
		rep(j, 0, N)
			if(ver(i+a, j+b)) ans++;
	printf("%d\n", ans);
	puts_name();
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <map>
using namespace std;
using ll = long long int;

const int INF = 1 << 28;
struct Array {
    ll lim;
    map<ll, ll> rec;
};

ll str_eval(string s, map<char, Array>& mp, int l, int r) {
    if(isalpha(s[l])) {
        // assignment
        char array_name = s[l];

        int i = l, sum = 0;
        while(!(sum == 1 && s[i] == ']')) {
            if(s[i] == '[') sum++;
            if(s[i] == ']') sum--;
            i++;
        }

        ll idx = str_eval(s, mp, l+2, i);

        if(i+1 == r || s[i+1] != '=') {
            if(!mp[array_name].rec.count(idx)) return -1;
            return mp[array_name].rec[idx];
        }
        else {
            ll value = str_eval(s, mp, i+2, r);

            if(idx < 0 || value < 0) return -1;
            if(mp[array_name].lim <= idx) return -1;
            return mp[array_name].rec[idx] = value;
        }
    }
    else {
        // number
        ll num = 0;
        for(int i=l; i<r; i++) num = num * 10 + (s[i] - '0');
        return num;
    }
}

int main() {
    while(1) {
        int z = 0, ans = INF;
        map<char, Array> mp;

        while(1) {
            string s; cin >> s;
            if(z == 0 && s == ".") goto program_end;
            if(s == ".") break;

            z++;
            char array_name = s[0];
            if(!mp.count(array_name)) {
                // declaration
                ll range = 0;
                for(size_t i=1; i<s.size(); i++) {
                    if(!isdigit(s[i])) continue;
                    range = range * 10 + (s[i] - '0');
                }
                mp[array_name] = Array{range, map<ll, ll>()};
            }
            else {
                // assignment
                ll res = str_eval(s, mp, 0, s.size());
                if(res < 0) {
                    ans = min(ans, z);
                }
            }
        }

        cout << (ans == INF ? 0 : ans) << endl;
    }

    program_end:;
    return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  long n,a,b;
  cin >> n >> a >> b;

  long sum = n / (a+b) * a;
  sum += min(n % (a+b), a);

  cout << sum << endl;
}

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

using namespace std;
int main(){
    char c;
    vector<int> v(4);
    for(int i=0;i<4;++i){
        cin>> c;
        v[i]=c-'0';
    }
    if(v[0]+v[1]+v[2]+v[3]==7)cout<<v[0]<<"+"<<v[1]<<"+"<<v[2]<<"+"<<v[3]<<"=7"<<endl;
    else if(v[0]-v[1]+v[2]+v[3]==7)cout<<v[0]<<"-"<<v[1]<<"+"<<v[2]<<"+"<<v[3]<<"=7"<<endl;
    else if(v[0]+v[1]-v[2]+v[3]==7)cout<<v[0]<<"+"<<v[1]<<"-"<<v[2]<<"+"<<v[3]<<"=7"<<endl;
    else if(v[0]+v[1]+v[2]-v[3]==7)cout<<v[0]<<"+"<<v[1]<<"+"<<v[2]<<"-"<<v[3]<<"=7"<<endl;
    else if(v[0]-v[1]-v[2]+v[3]==7)cout<<v[0]<<"-"<<v[1]<<"-"<<v[2]<<"+"<<v[3]<<"=7"<<endl;
    else if(v[0]+v[1]-v[2]-v[3]==7)cout<<v[0]<<"+"<<v[1]<<"-"<<v[2]<<"-"<<v[3]<<"=7"<<endl;
    else if(v[0]-v[1]+v[2]-v[3]==7)cout<<v[0]<<"-"<<v[1]<<"+"<<v[2]<<"-"<<v[3]<<"=7"<<endl;
    else if(v[0]-v[1]-v[2]-v[3]==7)cout<<v[0]<<"-"<<v[1]<<"-"<<v[2]<<"-"<<v[3]<<"=7"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
     
#define pb emplace_back
#define fi first
#define se second
     
using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ ll x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

template<typename T>
struct Dijkstra{
  typedef pair<int,T> pit;
  typedef pair<T,int> pti;  
  const T INFT;
  vector<vector<pit> > G;
  vector<T> dist;
  int n;
  Dijkstra( T INFT ) : INFT(INFT) {}
  void init( int arg_n ){
    n = arg_n;
    G = vector<vector<pit> >( n , vector<pit>(0) );
  }
  void add_biedge( int fr , int to , T co ){
    G[fr].pb( to , co );
    G[to].pb( fr , co );
  }
  void add_edge( int fr , int to , T co ){
    G[fr].pb( to , co );
  }
  T dijkstra( int s , int t = -1 ){
    dist = vector<T>( n , INFT );
    dist[s] = 0;
    priority_queue<pti,vector<pti>,greater<pti> > que;
    que.emplace( 0 , s );
    while( !que.empty() ){
      T d = que.top().fi;
      int p = que.top().se;
      que.pop();
      if( d > dist[p] ){
	continue;
      }
      if( p == t ){
	return d;
      }
      YYS( w , G[p] ){
	int to = w.fi;
	T co = w.se;
	if( d + co < dist[to] ){
	  dist[to] = d + co;
	  que.emplace( dist[to] , to );
	}
      }
    }
    return INFT;
  }
};

int n;

Dijkstra<ld> dij( INFLL );

ld x[1010], y[1010], r[1010];

int main(){

  x[0] = in();
  y[0] = in();
  x[1] = in();
  y[1] = in();

  n = in();
  REP( i , n ){
    x[i+2] = in();
    y[i+2] = in();
    r[i+2] = in();
  }

  dij.init( n + 2 );

  REP( i , n+2 ){
    REP( j , i ){
      ld d = sqrt( sq( x[i] - x[j] ) + sq( y[i] - y[j] ) );
      dij.add_biedge( i , j , max( (ld)0 , d - r[i] - r[j] ) );
    }
  }

  printf( "%.18lf\n" , (double)dij.dijkstra( 0 , 1 ) );

  return 0;
}


Measured memory_bytes: 40812
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

lis = []
for _ in range(N):
    title, time = input().split()
    time = int(time)
    lis.append((title, time))

X = input()
ok = False
ans = 0
for i in range(N):
    title, time = lis[i]
    if ok:
        ans += time
    if title==X:
        ok = True
print(ans)
    

Measured memory_bytes: 61968
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m; cin >> n >> m;
  stack<int> st;
  for(int i = n; i > 0; i--) st.push(i);
  FOR(i,0,m) {
    int in; cin >> in;
    st.push(in);
  }
  bool used[n+1]; CLR(used);
  while(!st.empty()) {
    int x = st.top(); st.pop();
    if(!used[x]) {
      cout << x << endl;
      used[x] = true;
    }
  }
  return 0;
}

Measured memory_bytes: 4436
S = input()
answer = 0
for bit in range(2 ** (len(S) - 1)):
    f = S[0]
    for i in range(len(S) - 1):
        if bit & (1 << i):
            f += '+'
        f += S[i + 1]
    answer += sum(map(int, f.split('+')))
print(answer)


Measured memory_bytes: 9072
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef pair<int, int> pi;
#define SQ(a) (a) * (a)
#define mod 1000000007
#define w(x) int x; cin>>x; while(x--)
#define deb(x) cout << #x << " = " << x << '\n'
#define deb2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
 
void solve(){
    double d,t,s;
    cin>>d>>t>>s;
    if(d/s -t < 1e-9){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}
 
int main(int argc, char const *argv[])
{
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    solve();
    return 0;
}

Measured memory_bytes: 3740
/**
 * auther: moririn_cocoa
 */

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second

int main (void) {
  
  int X;
  int Y;
  int Z;
  
  cin >> X;
  cin >> Y;
  cin >> Z;
  
  cout << Z << " " << X << " " << Y << endl;

    return 0;
}




Measured memory_bytes: 3616
n,l=map(int,input().split())
pi=0
a=[]
abs_a=[]
for i in range(1,n+1):
    pi+=l+i-1

for i in range(1,n+1):
    a.append(l+i-1)

for i in range(n):
    abs_a.append(abs(a[i]))    

if max(a)<0:
    p=pi+min(abs_a)
else:
    p=pi-min(abs_a)
    
print(p)

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

int main(){
	long long K;
	int N;
	cin >> K >> N;
	vector<long long> A(N);
	for(auto &i:A)cin >> i;
	long long m=A[0]+K-A[N-1];
	for(int i=0;i<N-1;i++)m=max(m,A[i+1]-A[i]);
	cout << K-m << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
    int t;
    scanf("%d",&t);
    int m,n;
    scanf("%d%d",&n,&m);
    int falg=0;
    int i;
    for(i=1;i*t<=m;i++)
    {
        if(i*t>=n&&i*t<=m)
        {
            falg=1; break;
        }
    }
    if(falg==1)
        printf("OK\n");
    else
        printf("NG\n");
    return 0;
}


Measured memory_bytes: 3760
#include <cmath>
#include <cstdlib>
#include <iostream>
using namespace std;

int main() {
    long long int N, A, B;
    cin >> N >> A >> B;
    long long int space_AB = abs(A - B);
    long long int ans;
    if (space_AB % 2 == 0) {
        ans = space_AB / 2;
    } else {
        if (A < B) {
            long long int space_1A = abs(A - 1);
            long long int space_BN = abs(N - B);
            if (space_1A < space_BN) {
                long long int space_1B = abs(B - 1);
                ans = space_1A + (space_1B-space_1A+1) / 2;
            } else {
                long long int space_AN = abs(N - A);
                ans = space_BN + (space_AN-space_BN+1) / 2;
            }
        } else {
            long long int space_1B = abs(B - 1);
            long long int space_AN = abs(N - A);
            if (space_1B < space_AN) {
                long long int space_1A = abs(A - 1);
                ans = space_1B + (space_1A-space_1B+1) / 2;;
            } else {
                long long int space_BN = abs(N - B);
                ans = space_AN + (space_BN-space_AN+1) / 2;;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.PrintWriter;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int N = sc.nextInt();
		int[] x = new int[N];
		for(int i=0; i<N; i++)
			x[i] = sc.nextInt();
		int L = sc.nextInt();
		int Q = sc.nextInt();
		final int G = 18;
		int[][] m = new int[G][N];
		for(int i=0; i<N; i++) {
			int idx = Arrays.binarySearch(x, x[i]+L);
			if(idx<0)
				idx = -idx-2;
			m[0][i] = idx;
		}
		for(int i=1; i<G; i++) {
			for(int j=0; j<N; j++) {
				m[i][j] = m[i-1][m[i-1][j]];
			}
		}
		
		for(int i=0; i<Q; i++) {
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			if(a>b) {
				int temp = a;
				a = b;
				b = temp;
			}
			int ans = 0;
			for(int j=G-1; j>=0; j--) {
				if(m[j][a]<b) {
					ans |= 1<<j;
					a = m[j][a];
				}
			}
			pw.println(ans+1);
		}
		
		sc.close();
		pw.close();
	}
	
}


Measured memory_bytes: 34800
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;




int main() {

	int n, m;
	cin >> n >> m;
	if (n == m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	vi cnt(30, 0);
	string s;
	cin >> s;
	rep(i, s.size()) cnt[s[i] - 'a']++;
	rep(i, 26)if(!cnt[i]){
		cout << (char)('a' + i) << endl;
		return 0;
	}
	cout << "None" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 512
n,w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

sum_v = sum([wv[i][1] for i in range(n)])

# dp[i][j]: i番目の品物までで価値がj以上であるときの重さの最小値
dp = [[float('inf')]*(sum_v+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    for j in range(sum_v+1):
        # 品物を選ぶ場合
        if (j - wv[i][1] >= 0):
            dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]] + wv[i][0])
        # 品物を選ばない場合
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
ans = 0
for i in range(sum_v+1):
    if dp[n][i] <= w:
        ans = i
print(ans)

Measured memory_bytes: 248640
use std::cmp::{max, min};
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(
        it,
        n: usize,
        vw: [(usize, usize); n],
        q: usize,
        vl: [(u1, usize); q]
    );
    let nu = min(2usize.pow(9) - 1, n);
    let wm = vl.iter().map(|(_, l)| *l).max().unwrap();
    let mut dp = vec![vec![0; wm + 1]; nu];

    for i in 0..nu {
        let (v, w) = vw[i];
        for j in 0..(wm + 1) {
            if i == 0 {
                if j >= w {
                    dp[i][j] = v;
                }
            } else {
                let pi = (i - 1) / 2;
                dp[i][j] = max(if j >= w { dp[pi][j - w] + v } else { 0 }, dp[pi][j]);
            }
        }
    }

    let mut vws = vec![(0usize, 0usize)];
    let mut buf = vec![];
    for &(i, l) in vl.iter() {
        if i < nu {
            println!("{}", dp[i][l]);
        } else {
            let mut u = i;
            while u >= nu {
                let (vu, lu) = vw[u];
                for &(v, l) in vws.iter() {
                    buf.push((v + vu, l + lu));
                }
                vws.append(&mut buf);
                u = (u - 1) / 2;
            }

            let mut ret = dp[u][l];
            for &(v, w) in vws.iter() {
                if l >= w {
                    ret = max(ret, dp[u][l - w] + v)
                }
            }
            vws.clear();
            vws.push((0, 0));
            buf.clear();
            println!("{}", ret);
        }
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 412528