akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,s=0,maxx=0,a;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a);
		s+=a;
		maxx=max(maxx,a);
	}
	s-=maxx;
	if(maxx<s)
		printf("Yes");
	else
		printf("No");
	return 0;
}

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

int calcGcd(int n, int m) {
  if (n < m) {
    int tmp = n;
    n = m;
    m = tmp;
  }

  int r = n%m;
  while (r!=0) {
    n=m;
    m=r;
    r=n%m;
  }
  return m;
}

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

  vector<int> a;
  for (int i=0; i<n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  int gcd=a[0];
  int maxNum=a[0];

  for (int i=0; i<n; i++) {
    gcd = calcGcd(gcd, a[i]);
    maxNum = max(maxNum, a[i]);
  }

  if (k%gcd==0 && k<=maxNum) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}


Measured memory_bytes: 892
import numpy as np

h,w = map(int, input().split())
s = list(input() for _ in range(h))

c = np.zeros((h, w))
c = c.tolist()

def minesweep(s,x, y, h, w):
    cnt = 0
    if(s[x][y] == "#"):
        return "#"
    else:
        for i in range(max(0, x-1), min(x+2, h)):
            for j in range(max(0, y-1), min(w, y+2)):
                if(s[i][j] == "#"):
                    cnt += 1
        return cnt
                
for i in range(h):
    for j in range(w):
        c[i][j] = minesweep(s, i, j, h, w)

for i in c:
    print(*i, sep='')

Measured memory_bytes: 12848
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

long long result, a,b,c,d;

typedef pair<long long, long long> pl;
vector<pl> re;
vector<pl> bl;
pl buf;



int main() {
	result = 0;

	cin >> a>>b>>c>>d;
	if (a > b) {
		result += b;
	}
	else {
		result += a;
	}

	if (c > d) {
		result += d;
	}
	else {
		result += c;
	}

	cout << result << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s;
    cin>>s;
    int K;
    cin>>K;
    int n = s.size();
    int dp[105][4][2]={};
    dp[0][0][0]=1;
    for(int i=0;i<n;++i){
        int D=s[i]-'0';
        for(int j=0;j<4;++j){
            for(int k=0;k<2;++k){
                for(int d=0;d<10;++d){
                    int ni=i+1,nj=j,nk=k;
                    if(d!=0)nj++;
                    if(nj>K)continue;
                    if(k==0){
                        if(d>D)continue;
                        if(d<D)nk=1;
                    }
                    dp[ni][nj][nk]+=dp[i][j][k];    
                }

            }
        }
    }
    int ans=dp[n][K][0]+dp[n][K][1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<i64>();
    println!("{}", n * (n - 1) / 2);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2116
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N = int(input())
    L = list(map(int, input().split()))

    ans = 0
    l = 0
    r = 0
    tmp_sum = 0
    while l < N:
        while r < N and tmp_sum ^ L[r] == tmp_sum+L[r]:
            tmp_sum += L[r]
            r += 1
        ans += r-l
        if(l == r):
            r += 1
        else:
            tmp_sum -= L[l]
            l += 1
    print(ans)


solve()


Measured memory_bytes: 23508
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int h = ty - sy;
    int w = tx - sx;

    string ans = string(w, 'R') + string(h+1, 'U') + string(w+1, 'L') + string(h+1, 'D') + 'R' +
                 string(h, 'U') + string(w+1, 'R') + string(h+1, 'D') + string(w+1, 'L') + 'U';
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;

int main() {
    int n;
    cin>>n;
    vector<int>a(n+1),b(n+1),c(n+1);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        cin>>b[i];
    for(int i=1;i<n;i++)
        cin>>c[i];
        int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=b[a[i]];
        if(a[i]==a[i-1]+1) ans+=c[a[i-1]];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int INF=(1<<30);

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep_i(i, n){
    cin >> h[i];
  }
  vector<int> dp(n);
  dp[0] = 0;
  for (int i = 1; i < n; i++){
    dp[i] = INF;
  }
  for (int i = 0; i < n; i++){
    for (int a = 1; a <= k; a++){
      // if(i + a >= n)break;
      if(i+a < n){
        dp[i+a] = min(dp[i+a],dp[i] + abs(h[i] - h[i+a]));
      }
      // if(dp[i+a] >= dp[i] + abs(h[i] - h[i+a])){
      //     dp[i+a] = dp[i] + abs(h[i] - h[i+a]);
      // }
    }
    // debug_vi(dp);
    // cout << endl;
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
  int N, M;
  cin >> N >> M;
  int p = 1;
  rep(i, M) {
    p *= 2;
  }
  int ans = (1900 * M + 100 * (N - M)) * p;

  cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
ll lazy1[4 * N];
int dif[4 * N];
ll lazy2[4 * N];

void prop1(int node, int l, int r)
{
    if(lazy1[node] == 0)
        return;
    if(l == r)
    {
        return;
    }
    else
    {
        lazy1[node * 2 + 1] += lazy1[node];
        dif[node * 2 + 1] += dif[node];
        int mid = (l + r) / 2;
        lazy1[node * 2] += (r - mid) * dif[node] + lazy1[node];
        dif[node * 2] += dif[node];
        dif[node] = 0;
        lazy1[node] = 0;
    }
}

void update1(int node, int l, int r, int st, int en, int val)
{
    prop1(node, l, r);
    if(st > r || en < l)
        return;
    if(st <= l && r <= en)
    {
        lazy1[node] += (en - r) + val;
        dif[node] += 1;
        return;
    }
    int mid = (l + r) / 2;
    update1(node * 2, l, mid, st, en, val);
    update1(node * 2 + 1, mid + 1, r, st, en, val);
}

void prop2(int node, int l, int r)
{
    if(lazy2[node] == 0)
        return;
    if(l == r)
    {
        return;
    }
    else
    {
        lazy2[node * 2] += lazy2[node];
        lazy2[node * 2 + 1] += lazy2[node];
        lazy2[node] = 0;
        return;
    }
}

void update2(int node, int l, int r, int st, int en, int val)
{
    prop2(node, l, r);
    if(st > r || en < l)
        return;
    if(st <= l && r <= en)
    {
        lazy2[node] += val;
        return;
    }
    int mid = (l + r) / 2;
    update2(node * 2, l, mid, st, en, val);
    update2(node * 2 + 1, mid + 1, r, st, en, val);
}

ll query(int node, int l, int r, int idx)
{
    if(idx > r || idx < l)
        return 1e18;
    prop1(node, l, r);
    prop2(node, l, r);
    if(l == r)
        return lazy1[node] + lazy2[node];
    int mid = (l + r) / 2;
    return min(query(node * 2, l, mid, idx), query(node * 2 + 1, mid + 1, r, idx));
}

int arr[N];

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    for(int i = 1; i < n; i++)
    {
        int first = arr[i - 1];
        int second = arr[i];
        if(second > first)
        {
            update1(1, 1, m, first + 1, second, 1);
            update2(1, 1, m, 1, first, second - first);
            if(second < m)
                update2(1, 1, m, second + 1, m, second - first);
        }
        else
        {
            update1(1, 1, m, 1, second, 1);
            if(first < m)
                update1(1, 1, m, first + 1, m, second + 1);
            update2(1, 1, m, second + 1, first, m - first + second);
        }
    }
    ll ans = 1e18;
    for(int i = 1; i <= m; i++)
    {
        ll cur = query(1, 1, m, i);
        ans = min(ans, cur);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int X,N;
    cin >> X >> N;
    if(N==0){
        cout << X << endl;
        return 0;
    }
    vector<int> P(N);
    rep(i,N) cin >> P[i];
    sort(P.begin(),P.end());
    for(int i=0;i<=110;i++){
        bool f = true;
        if(binary_search(P.begin(),P.end(),X-i)){
            ;
        }else{
            cout << X-i << endl;
            return 0;
        }
        if(binary_search(P.begin(),P.end(),X+i)){
            ;
        }else{
            cout << X+i << endl;
            return 0;
        }
    }
    return 0;
}

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

int main(){
	bool is[30];
	fill(is, is + 30, false);
	for(int i = 0; i < 28; i++){
		int a;
		cin >> a;
		a--;
		is[a] = true;
	}
	for(int i = 0; i < 30; i++){
		if(!is[i]) cout << i + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 100000
using namespace std;
typedef long long ll;

int main(){
	string str;
	cin >> str;
	int s, t;
	for (s = 0; s < str.size(); s++) {
		if (str[s] == 'A')break;
	}
	for (t = str.size(); t >= 0; t--) {
		if (str[t] == 'Z')break;
	}
	cout << t - s + 1 << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR (i, 0, n)
#define pb push_back
#define print(x) cout << (x) << "\n"
#define print2(x, y) cout << (x) << " " << (y) << "\n"
#define dump(x) cerr << #x << " = " << (x) << "\n"

int dh[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dw[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int h, w;
bool in(int x, int y)
{
    return 0 <= x and x < h and 0 <= y and y < w;
}

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

    cin >> h >> w;
    vector<string> field;
    rep (i, h) {
        string s;
        cin >> s;
        field.pb(s);
    }
    vector<string> answer = field;

    rep (i, h) {
        rep (j, w) {
            if (field[i][j] == '#')
                continue;
            int cnt = 0, x, y;

            rep (k, 8) {
                x = i + dh[k], y = j + dw[k];
                if (in(x, y) and field[x][y] == '#')
                    cnt++;
            }
            answer[i][j] = char('0' + cnt);
        }
    }

    rep (i, h) {
        print(answer[i]);
    }
}

Measured memory_bytes: 256
n,m = map(int,(input().split()))
a = []
b=[]
c=[]
for i in range(n):
    k = [int(i) for i in input().split()]
    a.append(k)
for i in range(m):
    x = int(input())
    b.append(x)


for j in range(len(a)):
    c.append(0)
    for k in range(len(a[j])):
        c[j] += a[j][k]*b[k]


for j in c:
    print (j)

Measured memory_bytes: 7996
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    Scanner sc = new Scanner(System.in);

    public static final void main(String[] args) {
        Main m = new Main();
        m.init();
        m.solve();
    }

    // ========================================================================= //
    int n, m;
    ArrayList<Integer>[] g;
    int[] edges;
    public void init() {
        n = sc.nextInt();
        m = sc.nextInt();
        g = new ArrayList[n];
        edges = new int[m];
        for (int i = 0; i < n; i++) g[i] = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            g[a].add(b);
            g[b].add(a);
            edges[i] = (a << 16) + b;
        }
    }

    public void solve() {
        int ans = 0;
        for (int i = 0; i < m; i++) {
            int a = edges[i] >> 16;
            int b = edges[i] & 0xffff;
            HashSet<Integer> A = new HashSet<>();
            HashSet<Integer> B = new HashSet<>();

            Stack<Integer> stk = new Stack<>();
            stk.add(a);
            A.add(a);
            while (!stk.isEmpty()) {
                int c = stk.pop();
                for (int nxt : g[c]) {
                    if (nxt != b && !A.contains(nxt)) {
                        stk.add(nxt);
                        A.add(nxt);
                    }
                }
            }

            stk.clear();
            stk.add(b);
            B.add(b);
            while(!stk.isEmpty()) {
                int c = stk.pop();
                for (int nxt : g[c]) {
                    if (nxt != a && !B.contains(nxt)) {
                        stk.add(nxt);
                        B.add(nxt);
                    }
                }
            }

            boolean check = true;
            for (int sa : A) {
                if (B.contains(sa)) {
                    check = false;
                    break;
                }
            }
            if (check) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    char c;
    cin>>c;

    if (c == 'A')
        cout<<'T'<<endl;
    else  if (c == 'T')
        cout<<'A'<<endl;
    else  if (c == 'C')
        cout<<'G'<<endl;
    else  if (c == 'G')
        cout<<'C'<<endl;

    return 0;
}


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

#define ll long long
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007

void solve()
{
	ll n;
	cin>>n;
	set<string> se;
	for(ll i=0;i<n;i++)
	{
		string s;
		cin>>s;
		se.insert(s);
	}
	cout<<se.size();
}

int main() 
{
	FAST
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++) solve();
	return 0;
}

Measured memory_bytes: 19292
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL V, E, r; cin >> V >> E >> r;
		vector<vector<pair<UL, UL>>> G(V);
		rep(i, E) {
			UL a, b, d; cin >> a >> b >> d;
			G[a].push_back({ b, d });
		}
		priority_queue<pair<UL, UL>, vector<pair<UL, UL>>, greater<pair<UL, UL>>> Q;
		Q.push({ 0, r });
		vector<UL> ans(V, (UL) -1);
		while (Q.size()) {
			pair<UL, UL> p = Q.top(); Q.pop();
			if (ans[p.second] != (UL)-1) continue;
			ans[p.second] = p.first;
			for (auto e : G[p.second]) {
				Q.push({ p.first + e.second, e.first });
			}
		}
		rep(i, V) {
			if (ans[i] == (UL)-1) cout << "INF" << endl;
			else cout << ans[i] << endl;
		}
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 13976
#include<stdio.h>

int main(void)
{
   int n, s, m=0, k;


   scanf("%d", &n);

   k=n;

   while(1){

        s=k%10;
        m=m+s;

        if(k<10) break;
        else if(k>=10) k=k/10;
        }
   
    
   if(n%m==0) printf("Yes\n");
   else if(n%m!=0) printf("No\n");

   return 0;
}

Measured memory_bytes: 128
# include "cstdio"
# include "iostream"

using namespace std;

inline int n_lowbit(int x){    //取出含有质因子2的个数 
    int count=0;
    while(x){
        if(x&1){
            return count; 
        }
        count++; 
        x>>=1; 
    }
    return count; 
} 

int
    ans, //记录答案 
    N, 
    a; 

int main(){
    scanf("%d",&N);
    while(N--){
        scanf("%d",&a);
        ans+=n_lowbit(a); //更新答案 
    }
    printf("%d",ans); 
    return 0; 
} 

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <random>
#include <deque>

#define INF_LL 1e18
#define INF 1e9

typedef long long ll;

using namespace std;

int main()
{
  ll x;
  double y;
  cin >> x >> y;
  y = y * 100 + 0.5;
  ll ans = x * (ll)(y);
  cout << ans / 100 << endl;
  return 0;
}


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

A=[]
for i in range(n):
    A.append(int(input()))

A.sort(reverse=True)

s=0
if n%2==0:#P1-2P2+...+2Pn-1-Pn
    s=2*sum(A[0:(n//2-1)])+A[n//2-1]-A[n//2]-2*sum(A[n//2+1:n])
else:#P1-2P2+...-2Pn-1+Pn
    s1=2*sum(A[0:n//2-1])+A[n//2-1]+A[n//2]-2*sum(A[n//2+1:n])
    s2=2*sum(A[0:n//2])-A[n//2]-A[n//2+1]-2*sum(A[n//2+2:n])
    s=max(s1,s2)

print(s)

Measured memory_bytes: 7512
import java.util.*;
class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            int n = stdIn.nextInt();
            if(n == 0) break;
            int[] s = new int[n];
            int sum = 0;
            for(int i = 0; i < n; i++) {
                s[i] = stdIn.nextInt();
                sum += s[i];
            }
            double m = sum/(double)n;
            double a = 0.0;
            for(int i = 0; i < n; i++) {
                a += (s[i] - m)*(s[i] - m);
            }
            a= a/(double)n;
             
            System.out.println(Math.sqrt(a));
             
        }
    }
}



Measured memory_bytes: 31520
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Integer] -> Integer
solve (a:b:c:d:_) = nTotal - nc - nd + ncd
  where
    nTotal = b - a + 1
    nc = b `div` c - (a - 1) `div` c
    nd = b `div` d - (a - 1) `div` d
    ncd = b `div` (lcm c d) - (a - 1) `div` (lcm c d)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;

const int MAX_H = 110, MAX_W = 10;

int main(){
    int H, W, K; cin >> H >> W >> K;
    mint ans = 0;

    mint dp[MAX_H][MAX_W] = {0};
    mint memo[MAX_W][2], count[MAX_W];
    memo[1][0] = 1;
    memo[1][1] = 0;
    count[0] = 1;
    count[1] = 1;
    for(int i = 2; i < MAX_W; i++){
        memo[i][0] = memo[i-1][0] + memo[i-1][1];
        memo[i][1] = memo[i-1][0];
        count[i] = memo[i][0] + memo[i][1];
    }

    dp[0][0] = 1;
    for(int i = 1; i <= H; i++){
        for(int j = 0; j < W; j++){
            dp[i][j] = dp[i-1][j] * count[W - 1 - j] * count[j];
            if(j - 1 >= 0)dp[i][j] += (dp[i-1][j-1]) * count[j-1] * count[W - 1 - j];
            if(j + 1 <  W)dp[i][j] += (dp[i-1][j+1]) * count[j] * count[W - j - 2];
        }
    }
    cout << dp[H][K - 1] << endl;
}

Measured memory_bytes: 256
#include <cstdio>

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

using namespace std;

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

signed main() {
  const int modulus = 1'000'000'007;
  int m = rint();
  int n = rint();
  int r = 1;
  while (n > 0) {
    if (n & 1)
      r = r * m % modulus;
    m = m * m % modulus;
    n >>= 1;
  }
  wint(r);
  return 0;
}



Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    bool ok=false;
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=m;j++){
            if(i*(m-j)+j*(n-i)==k) ok=true;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int a[500005];

int main()
{
	string s;
	cin >> s;
	int n = s.size() + 1;
	
	for (int i = 0; i + 1 < n; i++) {
		if (s[i] == '<') a[i + 1] = max(a[i + 1], a[i] + 1);
	}
	
	for (int i = n - 1; i > 0; i--) {
		if (s[i - 1] == '>') a[i - 1] = max(a[i - 1], a[i] + 1);
	}
	
	ll r = 0;
	for (int i = 0; i < n; i++) r += a[i];
	cout << r << endl;
}


Measured memory_bytes: 2820
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

  while(true){
    int h, w;
    cin >> h >> w;

    if(h==0&&w==0)
      break;

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
	cout << "#";
      }
      cout << endl;
    }
    cout << endl;
  }
}

Measured memory_bytes: 1152
fn main() {
    proconio::input! {
        n: usize,
        q: usize,
        tuv: [(usize,usize,usize);q],
    }
    let mut uf=vec![-1;n];
    for (t,u,v) in tuv {
        if t==0 {
            union(&mut uf, u, v);
        }
        else {
            println!("{}",if find(&mut uf, u)==find(&mut uf, v) {1} else {0});
        }
    }
}
fn find(uf: &mut Vec<i32>, i: usize) -> usize {
    if uf[i]<0 {
        i
    }
    else {
        uf[i]=find(uf, uf[i]as usize)as i32;
        uf[i]as usize
    }
}
fn union(uf: &mut Vec<i32>, i: usize, j: usize) {
    let mut i=find(uf, i);
    let mut j=find(uf, j);
    if i==j {
        return;
    }
    if uf[i]>uf[j] {
        std::mem::swap(&mut i, &mut j);
    }
    uf[i]+=uf[j];
    uf[j]=i as i32;
}

Measured memory_bytes: 9564
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int t=0;t<n;++t ){
        cin >>a[t];
    }
    int ans=0;
    while (true){
        int odd=0;
        for(int i=0;i<n;++i){
            if(a[i]%2==1){
                odd =1;
            }
        }
        if(odd==1){
            break;
        }
        for (int i=0;i<n;++i){
            a[i]/=2;
        }
        ++ans;
    }
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vec;
typedef vector<vec> mat;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
int N,M;
mat mazes[1000];

void rotate(mat &t){
  for(int i=0;i<N;i++)
    for(int j=0;j<N/2;j++)
      swap(t[i][j],t[i][N-1-j]);
  for(int i=0;i<N;i++)
    for(int j=0;j<i;j++)
      swap(t[i][j],t[j][i]);
}

void dfs(vec &t,mat &m,mat &d,int y,int x,int root){
  d[y][x]=root;
  for(int i=0;i<4;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    if(ny<0||nx<0||ny>=N||nx>=N)continue;
    if(d[ny][nx]!=-1||m[ny][nx]==1)continue;
    dfs(t,m,d,ny,nx,root);
  }
  
  if(x>0)return;
  if(t[y]==-1)return;
  for(int i=0;i<N;i++){
    if(t[i]!=t[y])continue;
    if(d[i][0]!=-1)continue;
    if(m[i][0]==1)continue;
    dfs(t,m,d,i,0,root);
  }
}

vec reflesh(vec t){
  vec res=t;
  
  map< int ,int > mp;
  for(int i=0;i<N;i++){
    if(res[i]==-1)continue;
    if( mp.count(res[i]) ){
      res[i]=mp[res[i]];
    }else if(res[i]==0){
      
    }else{
      mp[ res[i] ]=0;
      int f=mp.size();
      mp[ res[i] ]=f;
      res[i]=f;
    }
  }
  return res;
}

vec merge(vec t,mat m){
  mat d( N, vec(N,-1) );
  for(int si=0;si<N;si++){
    if(d[si][0]!=-1)continue;
    if(m[si][0]==1)continue;
    if(t[si]==-1)continue;
    if(t[si]!=0)continue;
    dfs(t,m,d,si,0,t[si]);
  }
  
  for(int si=0;si<N;si++){
    if(d[si][N-1]!=-1)continue;
    if(m[si][N-1]==1)continue;
    dfs(t,m,d,si,N-1,N+si);
  }

  vec res(N,-1);
  for(int i=0;i<N;i++){
    res[i]=d[i][N-1];
  }
  res=reflesh(res);
  return res;
}

bool solve(){
  set< vec > dp;
  dp.insert( vec(N,0) );
  for(int i=0;i<M;i++){
    set< vec > nex;

    mat edge=mazes[i];
    for(int i=0;i<4;i++){
      rotate(edge);
      for(vec v:dp){
        nex.insert( merge( v , edge ) );
      }
    }
    
    dp.clear();
    for( vec v : nex ){
      dp.insert(v);
    }
  }

  for(const vec&v:dp)
    for(int i=0;i<(int)v.size();i++)
      if(v[i]==0)return true;
  return false;
}


void input(int id){
  mazes[id].clear();
  mat A( N, vec(N,0) );
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      char ch;
      cin>>ch;
      A[i][j]=(ch=='#'?1:0);
    }
  }
  mazes[id]=A;
}

int main(){
  while(1){
    cin>>N>>M;
    if(N==0&&M==0)break;
    for(int i=0;i<M;i++){
      input(i);
    }
    cout<< (solve()?"Yes":"No") <<endl;
  }
  return 0;
}



Measured memory_bytes: 4340
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 2e5 + 7;

int a[N], b[N], cnta[N], cntb[N], c[N];

vi G[N];

signed main()
{
	IO_OP;
	
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i], cnta[a[i]]++, G[a[i]].PB(i);
	for(int i = 0; i < n; i++) cin >> b[i], cntb[b[i]]++;
	set<pi> s, ss;
	for(int i = 1; i <= n; i++) {
		if(cnta[i]+cntb[i] > n) {
			cout << "No" << endl;
			return 0;
		}
		if(cntb[i])s.insert({cnta[i]+cntb[i], i});
		if(cnta[i]) ss.insert({cnta[i]+cntb[i], i});
	}
	while(ss.size()) {
		pi p = *ss.rbegin(); ss.erase(p);
		s.erase(p);
		pi pp = *s.rbegin(); s.erase(pp);
		ss.erase(pp);
		int pos = G[p.S].back();
		G[p.S].pop_back();
		c[pos] = pp.S;
		cnta[p.S]--, cntb[pp.S]--;

		if(cntb[p.S])s.insert({cnta[p.S]+cntb[p.S], p.S});
		if(cnta[p.S]) ss.insert({cnta[p.S]+cntb[p.S], p.S});

		if(cntb[pp.S])s.insert({cnta[pp.S]+cntb[pp.S], pp.S});
		if(cnta[pp.S]) ss.insert({cnta[pp.S]+cntb[pp.S], pp.S});
	}
	for(int i = 0; i < n; i++) assert(a[i] != c[i]);
	cout << "Yes" << endl;
	for(int i = 0; i < n; i++) cout << c[i] << " ";
	cout << endl;

}



Measured memory_bytes: 37244
N = int(input())
S = input()
ans = S.count('R')*S.count('G')*S.count('B')

for i in range(N):
    for j in range(i+1, N):
        if S[i]!=S[j]:
            k = 2*j-i
            if k < N and S[i]!=S[k] and S[j]!=S[k]:
                ans -= 1
print(ans)

Measured memory_bytes: 68096
#include <bits/stdc++.h>
#define f(a, n) for (int a=0; a<n; a++)
#define F(a, n) for (int a=1; a<=n; a++)
using namespace std;

struct modint{
	long long const static mod=1e9+7;
	long long a=0;
	modint(){} // If you want to declare modints without initialising a value
	modint(long long x){
		*this = x;
	}
	void operator=(long long x){
		a=x%mod;
		if (a<0) a+=mod;
	}
	bool operator==(modint y){
		return a==y.a;
	}
	bool operator!=(modint y){
		return a!=y.a;
	}
	modint operator+(modint y){
		return modint(a+y.a);
	}
	modint operator-(modint y){
		return modint(a-y.a+mod);
	}
	modint operator*(modint y){
		return modint(a*y.a);
	}
	modint pow (modint x, int y){ //If you want bad practice, you can overload ^ too (and bug due to order of operation :) )
		if (!y) return modint(1);
		if (y%2) return x * pow(x*x, y/2);
		return pow(x*x, y/2);	
	}
	modint operator/(modint y){
		return *this*pow(y, mod-2);
	}
	modint operator^(long long x){ //Warning about order of operations
		if (x==0) return 1;
		return (x%2 ? *this : modint(1)) * (((*this) * (*this)) ^ (x/2));
	}
};

int m, n;
modint fact (int n){
	if (n==0) return modint(1);
	else return fact(n-1) * modint(n);
}
int main(){
	cin>>m>>n;
	if (m<n) swap(m, n);
	if (m==n) cout<<(modint(2) * fact(m) * fact(m)).a<<endl;
	else if (m-1 == n) cout<<(fact(m) * fact(n)).a<<endl;
	else cout<<0<<endl;
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int a[100000007];
int main()
{
	long long int n,k,num=0;
	scanf("%lld%lld",&n,&k);
	do{
		a[num++]=n%k;
		n/=k;
	}while(n!=0);
	printf("%lld",num);
	
 } 

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

n,k=MI()
aa=LI()
for i in range(k,n):
    if aa[i]>aa[i-k]:print("Yes")
    else:print("No")


Measured memory_bytes: 31536
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split(' ');
    var a = Number(inputs[0]);
    var b = Number(inputs[1]);
    if (a < b) {
        console.log('a < b');
    } else if (a > b) {
        console.log('a > b');
    } else {
        console.log('a == b');
    }
});
process.stdin.resume();
process.stdin.setEncoding('utf8');
           process.stdin.setEncoding('utf8');

Measured memory_bytes: 15516
def solve():
    n = int(input())
    hs = list(map(int, input().split()))
    for i in reversed(range(n)):
        if i == 0:
            return "Yes"
        elif hs[i - 1] - hs[i] > 1:
            return "No"
        elif hs[i - 1] - hs[i] == 1:
            hs[i - 1] -= 1
        else:
            continue
    return "Yes"


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define maxn 100010
typedef long long LL;
const LL mod = 998244353;
LL x[maxn], y[maxn], P[maxn];
int main()
{
    LL n;
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i)
        scanf("%lld%lld", &x[i], &y[i]);
    P[0] = 1;
    for (int i = 1; i <= n; ++i)
        (P[i] = P[i-1] << 1) %= mod;
    LL ans = P[n] - 1 - n - n*(n-1)/2;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i+1; j < n; ++j)
        {
            int cnt = 0;
            for (int k = j+1; k < n; ++k)
            {
                if ((x[j]-x[i]) * (y[k]-y[j]) == (x[k]-x[j]) * (y[j]-y[i]))
                    ++cnt;
            }
            ((ans -= P[cnt]-1) += mod) %= mod;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
using namespace std;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    string s;
    cin >> s;

    int sum = s.size() - 2;

    cout << s[0] << sum << s.back() << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int n;
set<string> st;
void dfs(vector<char> now,int ne){
    if(now.size()==n){
        string ret="";
        rep(i,0,now.size()){
            string ee{now[i]};
            ret+=ee;
        }
        st.insert(ret);
        return;
    }
    rep(i,0,ne+1){
        vector<char> nee=now;
        nee.push_back('a'+i);
        if(i==ne)dfs(nee,ne+1);
        else dfs(nee,ne);
    }
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    vector<char> ans;
    dfs(ans,0);
    srep(itr,st)cout<<*itr<<endl;
}





Measured memory_bytes: 14208
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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



int main(){
  int n;
  int a[3];
  rep(i,3) cin >> a[i];
  sort(a,a+3);
  cout << a[2] * 10 + a[0] + a[1] << endl;
}



Measured memory_bytes: 256
S = input()
N = len(S)
l, r = 0, N-1
flg = 1
while l < r:
    while l < r and S[l] == 'x':
        l += 1
    while r > l and S[r] == 'x':
        r -= 1
    if S[l] != S[r]:
        flg = 0
        break
    l += 1
    r -= 1
if flg == 0:
    print(-1)
    exit()
l, r = 0, N-1
ans = 0
while l < r:
    if S[l] != S[r]:
        if S[l] == 'x':
            l += 1
        else:
            r -= 1
        ans += 1
    else:
        l += 1
        r -= 1
print(ans)

Measured memory_bytes: 41840
#include<bits/stdc++.h>
 
#define INF 1000000007
#define LINF 1000000000000000007
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;


int a,b,c,d;

int main(){
	cin >> a >> b >> c >> d;
	
	cout << max(a*b,c*d) << endl;
	
	return 0;
}

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

using namespace std;

int main(){
  int x,y,s;
  
  while(cin>>x>>y>>s,x,y,s){
    int m1=1;
    int m2=s-1;
    int ms1,ms2;
    int max=0;
    int total=0;

    while((s/2+1)!=m1){
      if((m1*100)%(100+x)==0)
	ms1=m1*100/(100+x);
      else
	ms1=m1*100/(100+x)+1;
      
      if((m2*100)%(100+x)==0)
	ms2=m2*100/(100+x);
      else
	ms2=m2*100/(100+x)+1;

      if((ms1*(100+x)/100 + ms2*(100+x)/100)!=s){
	m1++;
	m2--;
	continue;
      }
      
      total=ms1*(100+y)/100 + ms2*(100+y)/100;
      
      if(max<total)
	max=total;
      m1++;
      m2--;
    }
    cout<<max<<endl;
  }
}

    

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define sint int32_t
#define int long long int
#define all(v) v.begin() , v.end()
#define vii vector<int>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

    int x;
    cin>>x;
    cout<<(1^x)<<endl;


}

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

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;

    vector<int> v(n), c(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    for(int i = 0; i < n; i++) cin >> c[i];

    int x = 0, y = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] > c[i]) x += v[i], y += c[i];
    }

    cout << x - y << endl;
}

/**
*/


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

class Main{
	public static void main(String args[]) throws FileNotFoundException{
		FScanner sc=new FScanner();
		//Scanner sc=new Scanner(System.in);
		
		int n=sc.readInt();
		int i=sc.readInt();
		
		System.out.println(n-(i-1));

	}
	
	static void solver(){
		
	}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
	
	static class FScanner{
		Scanner sc;
		FScanner() throws FileNotFoundException{
			sc=new Scanner(System.in);
		}
		boolean hasNextLine(){
			boolean has=true;
			if(!sc.hasNextLine()){
				has=false;
			}
			return has;
		}
		int readInt(){
			int i=sc.nextInt();
			return i;
		}
		long readLong(){
			long i=Long.parseLong(sc.nextLine());
			return i;
		}
		int[] readIntL(){
			String[] buf=sc.nextLine().split(" ");
			int[] num=new int[buf.length];
			for(int i=0; i<buf.length; i++){
				num[i]=Integer.parseInt(buf[i]);
			}
			return num;
		}
		
		String readString(){
			return sc.nextLine();
		}
		String[] readStringL(){
			String[] s=sc.nextLine().split("");
			return s;
		}
	}
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H,W ;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0){
            break;
        }
        for(int i=0;i<H;i++){
          for(int j=0;j<W;j++){
            if(i==0 || j==0 || i==H-1 || j==W-1){
                cout << "#";
            } else {
                cout << ".";
            }
          }
          cout << endl;
        }
      cout << endl;
     }
}


Measured memory_bytes: 3084
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int a[3];
	rep(i, 3) {
		cin >> a[i];
	}
	sort(a, a + 3);
	cout << a[2] - a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[515][100005], v[262150];
int w[262150];
long long query(int x, int y){
    if(x < 512){
        return dp[x][y];
    }
    long long ans = query(x/2, y);
    if(y >= w[x]){
        ans = max(ans, query(x/2, y - w[x]) + v[x]);
    }
    return ans;
}
int main(){
    for(int i = 0; i < 512; i++){
        for(int j = 0; j <= 100000; j++){
            dp[i][j] = 0;
        }
    }
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> v[i] >> w[i];
    }
    for(int i = 1; i < 512; i++){
        int f = i/2;
        for(int j = 1; j <= 100000; j++){
            dp[i][j] = dp[f][j];
            if(j >= w[i]){
                dp[i][j] = max(dp[i][j], dp[f][j - w[i]] + v[i]);
            }
        }
    }
    int q;
    cin >> q;
    for(int i = 1; i <= q; i++){
        int x, y;
        cin >> x >> y;
        cout << query(x, y) << '\n';
    }
    return 0;
}

Measured memory_bytes: 406648