akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N + 1, 0);
	for (int i = 1; i <= N; i++) {
		for (int j = i; j <= N; j += i) {
			A[j]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += i * A[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 81400
n,d,a = map(int,input().split())
monsters = [tuple(map(int,input().split())) for _ in range(n)]
monsters.sort()

# 各モンスターを倒すためにおこなった攻撃回数を記録する
# atk_count[1]が2の場合、x2番目のモンスターに対して2回攻撃をおこなったことを意味する
atk_count = [0]*n
atk_count_sum = 0
l = 0 # 左端
for i in range(n):
    x = monsters[i][0]
    h = monsters[i][1]
    # 尺取り法
    while monsters[l][0] + 2*d < x:
        atk_count_sum -= atk_count[l]
        l += 1
    # 既に受けているダメージ
    al = atk_count_sum * a
    h = h - al
    if h > 0:
        atk_count[i] = -(-h//a)
    atk_count_sum += atk_count[i]
print(sum(atk_count))

Measured memory_bytes: 38004
#include<bits/stdc++.h>
            #define ll long long
            #define f   first
            #define s   second
            #define pb          push_back
            #define mod        1000000007
            #define mod1       1000000009
            #define hell        998244353
            #define inf         1000000000000000000LL
            #define pi          3.14159265358979323
            #define N           5000005
            using namespace std;
            ll n,k,sum,q,res,m,val;
            ll x,y;
            
            void solve()    
            {   

                cin>>n>>k;
                vector<ll> v(n);
                for(int i=0;i<n;i++) cin>>v[i];
                    ll ans=0;
                sort(v.begin(), v.end());
                for(int i=0;i<k;i++) ans+=v[i];
                    cout<<ans;

            }
            int main()
            {   
                ios_base::sync_with_stdio(false);
                cin.tie(0);cout.tie(0);
                ll t=1;
                //cin>>t;
                
                for(int i=1;i<=t;i++)
                    solve();
            
            }            

Measured memory_bytes: 3624
N,K,C=map(int,input().split())
S=input()
i=0
d1=[-1]*N
for k in range(K):
    while S[i]=='x' and i<N:
        i+=1
    if i==N:break
    d1[i]=k
    i+=C+1
i=0
d2=[-1]*N
for k in range(K-1,-1,-1):
    while S[N-1-i]=='x' and i<N:
        i+=1
    if i==N:break
    d2[N-1-i]=k
    i+=C+1
print(*[i+1 for i in range(N) if d1[i]==d2[i]>=0],sep='\n')

Measured memory_bytes: 30136
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

int main()
{
  int x,y;
  scanf("%d%d",&x,&y);
  if ((x-y>=-1)&&(x-y<=1)) printf("Brown\n");
  else printf("Alice\n");
  return 0;
}

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

#define MOD (int)(1e9+7)
#define INF 1e9+1;

struct UnionFind
{
	vector<int> par;
	vector<int> sizes;

	UnionFind(int n) : par(n), sizes(n, 1) {
		for (int i = 0; i < n; i++) par[i] = i;
	}

	int find(int x) {
		if (x == par[x])return x;
		return par[x] = find(par[x]);
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);

		if (x == y) return;

		if (sizes[x] < sizes[y]) swap(x, y);

		par[y] = x;
		sizes[x] += sizes[y];
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	int size(int x) {
		return sizes[find(x)];
	}
};

int main()
{
	int N; cin >> N;
	vector<pair<int, int>>X(N),Y(N);
	vector<pair<int,pair<int,int>>>dist;

	for (int i = 0; i < N; i++) {
		int x, y; cin >> x >> y;
		X[i] = make_pair(x, i);
		Y[i] = make_pair(y, i);
	}
	sort(X.begin(), X.end());
	sort(Y.begin(), Y.end());

	for (int i = 0; i < N; i++) {
		if (i > 0) {
			dist.push_back(make_pair(X[i].first - X[i - 1].first, make_pair(X[i].second, X[i - 1].second)));
			dist.push_back(make_pair(Y[i].first - Y[i - 1].first, make_pair(Y[i].second, Y[i - 1].second)));
		}
		if (i < N - 1) {
			dist.push_back(make_pair(X[i + 1].first - X[i].first, make_pair(X[i].second, X[i + 1].second)));
			dist.push_back(make_pair(Y[i + 1].first - Y[i].first, make_pair(Y[i].second, Y[i + 1].second)));
		}
	}

	sort(dist.begin(), dist.end());

	long long ans = 0;
	UnionFind un(N);
	for (int i = 0; i < dist.size(); i++) {
		if (un.same(dist[i].second.first, dist[i].second.second))continue;

		un.unite(dist[i].second.first, dist[i].second.second);

		ans += dist[i].first;

		if (un.size(0) == N)break;
	}

	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 10096
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;


int main() {
	int k, x; cin >> k >> x;
	for (int i = max(-1000000, x - k + 1); i <= min(1000000, x + k - 1); i++) {
		cout << i << " \n"[i == min(1000000, x + k - 1)];
	}
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int N(205);
int n, m, ans, f[2][N][N][N], sum[N][N]; char s[N][N];
int check(int x1, int y1, int x2, int y2)
{
	int a = (y2 - y1 + 1) * (x2 - x1 + 1);
	int b = sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
	return b == 0 || b == a;
}

int main()
{
	n = read(), m = read();
	for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) sum[i][j] = s[i][j] == '.';
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
	for (int l = 1; l <= n; l++)
		for (int r = l; r <= n; r++)
			for (int j = 1, k; j <= m; j = k)
			{
				for (k = j; k <= m; k++) if (!check(l, j, r, k)) break;
				for (int p = j; p < k; p++) f[0][l][r][p] = k - 1;
				if (k == j) f[0][l][r][j] = j - 1, ++k;
			}
	for (int o = 0; f[o][1][n][1] < m; )
	{
		o ^= 1, ++ans;
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				for (int p = 1; p <= m; p++)
				{
					int l = i, r = j - 1, v = f[o ^ 1][i][j][p];
					if (v < m)
					{
						f[o][i][j][p] = f[o ^ 1][i][j][v + 1];
						while (l <= r)
						{
							int mid = (l + r) >> 1, _l = f[o ^ 1][i][mid][p], _r = f[o ^ 1][mid + 1][j][p];
							f[o][i][j][p] = std::max(f[o][i][j][p], std::min(_l, _r));
							if (_l < _r) r = mid - 1; else l = mid + 1;
						}
					}
					else f[o][i][j][p] = m;
				}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 65408
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, C;
    read(N, C);

    auto imos = make_v(0, C, 100010);

    rep(i, N) {
        int s, t, c;
        read(s, t, c);
        --c;
        imos[c][s] += 1;
        imos[c][t+1] -= 1;
    }

    rep(c, C) {
        reps(i, 1, 100002) imos[c][i] += imos[c][i-1];
    }

    int ans = 0;
    reps(t, 0, 100002) {
        int cnt = 0;
        rep(c, C) {
            cnt += !!imos[c][t];
        }
        chmax(ans, cnt);
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 12416
let () =
  let rec charlist_of_string str n i =
    if i = n then [] else str.[i] :: charlist_of_string str n (i+1) in
  Scanf.scanf "%d\n%s\n" @@ fun n s ->
  let former = charlist_of_string (String.sub s 0 (n/2)) (n/2) 0 in
  let later = charlist_of_string (String.sub s (n/2) (n/2)) (n/2) 0 in
  let ans = List.fold_left2
      (fun ans x y -> if x=y then ans && true else false) true former later in
  Printf.printf "%s\n" (if ans && n mod 2 = 0 then "Yes" else "No")

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

int main() {
    int N; cin >> N;
    vector<long long> A(N), B(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) cin >> B[i];

    long long plus = 0, minus = 0;
    for (int i = 0; i < N; ++i) {
        long long diff = B[i] - A[i];
        if (diff > 0) plus += diff/2;
        if (diff < 0) minus -= diff;
    }
    if (plus >= minus) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int H, W;
    cin >> H >> W;
    
    vec<string> a(H);
    rep(i,H) {
        cin >> a[i];
        a[i] = "#" + a[i] + "#";
    }
    rep(i,W+2) cout << "#";
    cout << endl;
    rep(i,H) cout << a[i] << endl;
    rep(i,W+2) cout << "#";
    cout << endl;
}


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

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

          int N = Integer.parseInt(input[0]);
          int K = Integer.parseInt(input[1]);

          int[] result = new int[N];
          int d = 0;

          for(int i = 0; i < K; i++){
            d = Integer.parseInt(br.readLine());
            String[] tmp = br.readLine().split(" ");
           
            for(int j = 0; j < d; j++){
              result[Integer.parseInt(tmp[j])-1] += 1;
            }
          }

          int min = 0;
          int count = 0;

          for(int i = 0; i < result.length; i++){
            if(min > result[i]){
              min = result[i];
            }
          }


          for(int i = 0; i < result.length; i++){
            if(min == result[i]){
              count++;
            }
          }

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

Measured memory_bytes: 33592
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <algorithm>

using namespace std;

int main(){
    long long N,A,B;

    cin >> N >> A >> B;

    long long i = N/(A+B);

    if(N%(A+B) < A){
        cout << i*A + N%(A+B) << endl;
    }else{
        cout << i*A + A << endl;
    }

    return 0;
}


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

string S;
vector<int> memo, alp(4, 0);

int parse(string &s, int &id, bool flg);
int term(string &s, int &id);

int main() {
  memo.assign(1 << 16, 100);
  memo[0] = memo[(1 << 16) - 1] = 1;
  set<int> st;
  st.insert(0);
  st.insert((1 << 16) - 1);
  for(int a = 0; a < 4; ++a) {
    int tmp = 0;
    for(int i = 0; i < (1 << 4); ++i)
      tmp += (i >> a & 1) << i;
    alp[a] = tmp;
    st.insert(tmp);
    memo[tmp] = 1;
    tmp ^= (1 << 16) - 1;
    st.insert(tmp);
    memo[tmp] = 2;
  }
  for(int P = 0; P < 3; ++P) {
    vector<int> v;
    for(auto x : st)
      for(auto y : st) {
        int tmp;
        // *
        tmp = x & y;
        if(memo[tmp] > memo[x] + memo[y] + 3) {
          memo[tmp] = memo[x] + memo[y] + 3;
          v.push_back(tmp);
        }
        tmp ^= (1 << 16) - 1;
        if(memo[tmp] > memo[x] + memo[y] + 4) {
          memo[tmp] = memo[x] + memo[y] + 4;
          v.push_back(tmp);
        }
        // ^
        tmp = x ^ y;
        if(memo[tmp] > memo[x] + memo[y] + 3) {
          memo[tmp] = memo[x] + memo[y] + 3;
          v.push_back(tmp);
        }
        tmp ^= (1 << 16) - 1;
        if(memo[tmp] > memo[x] + memo[y] + 4) {
          memo[tmp] = memo[x] + memo[y] + 4;
          v.push_back(tmp);
        }
      }
    for(auto x : v) st.insert(x);
  }
  while(1) {
    cin >> S;
    if(S == ".") break;
    int x = 0;
    cout << memo[parse(S, x, 1)] << endl;
  }
  return 0;
}

int parse(string &s, int &id, bool flg) {
  int l = term(s, id), r;
  if(flg) return l;
  bool op = s[id] == '*';
  r = term(s, ++id);
  if(op) return l & r;
  return l ^ r;
}

int term(string &s, int &id) {
  int res = 0;
  if(s[id] == '(') {
    ++id;
    res = parse(s, id, 0);
    assert(s[id] == ')');
    ++id;
  }
  else if(s[id] == '-') {
    ++id;
    res = parse(s, id, 1);
    res ^= (1 << 16) - 1;
  }
  else if(isdigit(s[id])) {
    if(s[id] == '1') res = (1 << 16) - 1;
    ++id;
  }
  else
    res = alp[s[id++] - 'a'];
  return res;
}


Measured memory_bytes: 6464
import sys

import numpy as np

sys.setrecursionlimit(10000)
INF = float('inf')

N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))
A = np.array([list(map(int, input().split())) for _ in range(N)])

print(((A * B).sum(axis=1) + C > 0).sum())


Measured memory_bytes: 12492
S = input()
ans = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == '<':
        ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
    if S[i] == '>':
        ans[i] = max(ans[i], ans[i + 1] + 1)
print(sum(ans))

Measured memory_bytes: 29112
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <tuple>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
bool suitstr(string str,string query)
{
  if(query=="*") return true;
  REP(i,SZ(str)-SZ(query)+1)
    if(query==string(str.begin()+i,str.begin()+i+SZ(query)))
      return true;
  return false;
}
int main(void)
{
  int n,q;
  string book[128][3];
  const int title=0,auther=1,date=2;
  cin >> n;
  REP(i,n) REP(j,3)
    cin >> book[i][j];
  cin >> q;
  REP(i,q){
    if(i) cout << endl;
    string qtitle,qauther,qdate[2];
    cin >> qtitle >> qauther >> qdate[0] >> qdate[1];
    REP(j,n){
      if(suitstr(book[j][title],qtitle)
	 && suitstr(book[j][auther],qauther)
	 && (qdate[0] <= book[j][date] || qdate[0] == "*")
	 && (book[j][date] <= qdate[1] || qdate[1] == "*"))
	cout << book[j][title] << endl;
    }
  }
  return 0;
}

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

int main(){
    int N;
    scanf("%d",&N);
    
    string S[N];
    int len[N];

    for (int i=0; i<N; i++){
        cin >> S[i];
        len[i] = (int)S[i].length();
    }

    int topB=0;
    int bottomA=0;
    int middle=0;
    int both = 0;
    int bothFlag = 0;
    for (int i=0; i<N; i++){
        for (int j=0; j<len[i]; j++){
            if(j==0 && S[i][j]=='B'){
                topB++;
                bothFlag = 1;
            }
            if(S[i][j]=='A' && j<len[i]-1){
                if(S[i][j+1]=='B'){
                middle++;
            }
            }
            if(j==len[i]-1 && S[i][j]=='A'){
                bottomA++;
                if (bothFlag == 1) both++;
            }

        }
        bothFlag = 0;
    }

    //printf("B:%d, A:%d, mid:%d, both:%d\n",topB,bottomA,middle,both);
    if (topB == bottomA && topB == both && topB != 0){
        printf("%d", middle + both - 1);
    }
    else if(topB < bottomA){
        printf("%d", middle + topB);
    }
    else if(topB >= bottomA){
        printf("%d", middle + bottomA);
    }


}

Measured memory_bytes: 896
N = int(input())
D = set()
s = input().rstrip()
D.add(s)
s0 = s[-1]
for _ in range(N-1):
    s = input().rstrip()
    if s in D:
        print("No")
        exit()
    if s[0] != s0:
        print("No")
        exit()
    D.add(s)
    s0 = s[-1]
print("Yes")



Measured memory_bytes: 62200
#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	if ((b<c&&c<a)||(a<c&&c<b))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#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>
#include <random>
#include<sstream>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;

int main()
{
  //"Don't regret anything you do, because in the end it makes you who you are."
  int n;
  cin >> n;
  ll t;
  long double ans = 1;
  for (int i = 0; i < n; i++)
  {
      cin >> t;
      if (ans != -1)
         ans *= t;
      if (ans > 1000000000000000000 || ans < 0)
         ans = -1;
      if (t == 0)
         ans = 0;
  }
  cout << (ll)ans;
  return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val A, B, T = sc.nextInt()

    val num = 1.until(T+1).flatMap { i =>
      if (i % A == 0) {
        Some(B)
      } else None
    }.sum

    println(s"$num")
  }
}

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

int main() {
  int n, a, b; cin >> n >> a >> b;
  int l = min(a, b);
  int r = max(a, b);
  if(((r-1) - l) % 2 == 0){
    cout << "Borys" << endl;
  } else {
    cout << "Alice" << endl;
  }
}

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

int main(){
    double pai=3.141592653589;
    int h,w;
    for(;;){
        scanf("%d %d",&h,&w);
        if(h==0 && w==0) break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if((i+j)%2==0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3140
/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 100010;

ll n;
string S[maxn], T[4] = {"AC", "WA", "TLE", "RE"};

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    // ifstream cin(".in");

    cin >> n;
    fori (i, n) cin >> S[i];
    fori (i, 4) {
        cout << T[i] << " x " << count(S, S + n, T[i]) << '\n';
    }

}


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

#define sc(x) scanf("%d",&x)
#define pf(c) scanf("%d",x);
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	float l;
	cin >> l;
	
	
	float ans = 0;
	
	float len = l/3;
	l -= len;
	
	float b = l /2;
	
	//cout << b << endl;
	
	float h = l - b;
	
	ans = len*b*h;
	
	printf("%0.12f\n",ans);
	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    int ans = 0;
    if (2 * y - H == 0 && 2 * x - W == 0)
    {
        ans++;
    }
    
    cout << setprecision(27) << (long double)W * H /2 << " " << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
//#pragma GCC target ("sse4")
#pragma optimize("fast-math")

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define endl '\n'
#define ull unsigned long long
#define si short int
#define ll long long
#define ld long double
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define piii pair<pair<int, int>, int>
#define all(vec) (vec).begin(), (vec).end()
#define rall(vec) (vec).rbegin(), (vec).rend()
#define piiii pair<pair<int, int>, pair<int, int>>
vector<vector<int>> vert;
vector<int> arr;

int mxn11 =2e5+2;//FIXME
vector<int> t(4 * mxn11 + 1, 0);

int mux(int a, int b) {
    if (a > b) return a;
    return b;
}

int mun(int a, int b) {
    if (a < b) return a;
    return b;
}

int get(int v, int vl, int vr, int l, int r) {
    if (l > r) return 0;
    if (vl == l && vr == r) {
        return t[v];
    }
    int tmp = (vl + vr) >> 1;
    int a = get(v << 1, vl, tmp, l, mun(tmp, r));
    int b = get((v << 1) + 1, tmp + 1, vr, mux(tmp + 1, l), r);
    return max(a,b);
}

void update(int v, int vl, int vr, int l, int x) {
    if (vl == vr) {
        t[v]=x;
        return;
    }
    int tmp = (vl + vr) / 2;
    if(l<=tmp){
        update(2 * v, vl, tmp, l, x);
    }
    else{
        update(2 * v + 1, tmp + 1, vr, l, x);
    }
    t[v] = max(t[2 * v], t[2*v+1]);
}

vector<int> ans;
vector<bool> was;
void dfs(int v, int n){
    was[v]=true;
    int kolvo=get(1, 0, n, 0, arr[v]-1);
    int wasval=get(1, 0, n, arr[v], arr[v]);
    update(1, 0, n, arr[v], kolvo+1);
    int allkek=get(1, 0, n, 0, n);
    ans[v]=allkek;
    for(int son:vert[v]){
        if(was[son]) continue;
        dfs(son, n);
    }
    update(1, 0, n, arr[v], wasval);
}
void solve() {
    int n;
    cin>>n;
    arr.resize(n+1);
    ans.resize(n+1);
    was.resize(n+1);
    vert.assign(n+1, vector<int>(0));
    vector<int> kek;
    for(int i=0;i<n;i++){
        cin>>arr[i+1];
        kek.pb(arr[i+1]);
    }
    sort(all(kek));
    kek.erase(unique(all(kek)), kek.end());
    for(int i=1;i<n+1;i++){
        int ind=lower_bound(all(kek), arr[i])-kek.begin();
        arr[i]=ind+1;
    }
    for(int i=0;i<n-1;i++){
        int u,v;
        cin>>u>>v;
        vert[u].pb(v);
        vert[v].pb(u);
    }

    dfs(1, n);
    for(int i=1;i<n+1;i++) {
        cout<<ans[i]<<endl;
    }
}

void testcases(int n) {
    n = 1 - n;
    if (!n) cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "r", stdin);
    //f=fopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w");
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w", stdout);

    unsigned int beg_time = clock();
    testcases(0);
    // 0 - no t, 1 - with t

    unsigned int end_time = clock();
    //cout << endl << endl << end_time - beg_time;
    return 0;
}

Measured memory_bytes: 33948
import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
pragma(inline, true) T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!int;
pragma(inline, true) void scan(Args...)(ref Args args) {
    string[] ss = readln.split;
    foreach (i, ref arg ; args) arg = ss[i].parse!int;
}


void main() {
    string s = readln.chomp;
    bool can = true;
    if (s=="AAA" || s=="BBB") can = false;
    writeln(can ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <numeric>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
    string S;
    cin >> S;
    int ans = 0;
    
    for(char c : S){
        if( c == '+' )  ans++;
        else    ans--;
    }

    cout << ans << endl;
}

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

using namespace std;

#define endl '\n'
#define cw(x) cout << (x) << endl
#define cww(x,y) cout << (x) << ' ' << y << endl
#define cwa(x) for(auto a:x) cout << a << ' ';cout << endl
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef unordered_set<int> usi;
typedef vector<pi> vpi;

int a[10050],x,y,z,v,n;

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

    while(x++<=105){
        for(y=0;y++<=105;){
            for(z=0;z++<=105;){
                if((v=x*x+y*y+z*z+x*y+y*z+z*x) < 10050){
                    a[v]++;
                }
            }
        }
    }
    for(cin >> n,v=0;v<n;v++) cout << a[v+1] << endl;

    return 0;
}


Measured memory_bytes: 3688
#include <iostream>
using namespace std;
typedef long long int mint_type;
const mint_type MOD = 1000000007;
const mint_type MAX = 500000;
class mint{
    public:
        static mint_type fac[MAX];
        static mint_type finv[MAX];
        static inline mint_type mod(mint_type a, mint_type mod = MOD){ return (a % mod + mod) % mod;}
        static mint_type mpow(mint_type a, mint_type n, mint_type mod = MOD);
        static mint_type extGCD(mint_type a, mint_type b, mint_type& x, mint_type& y);
        static mint_type minv(mint_type a, mint_type mod = MOD);
        static void mcinit(mint_type max = MAX, mint_type mod = MOD);
        static mint_type mchoose(mint_type n, mint_type r, mint_type mod = MOD);
};
mint_type mint::fac[MAX];
mint_type mint::finv[MAX];

mint_type mint::mpow(mint_type a, mint_type n, mint_type mod){
    mint_type result = 1;
    while(n > 0){
        if(n & 1){
            result = result * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    
    return result;
}

mint_type mint::extGCD(mint_type a, mint_type b, mint_type& x, mint_type& y){
    if(a % b == 0){
        x = 0;
        y = 1;
        return b;
    }
    
    mint_type d = extGCD(b, a % b, x, y);
    mint_type tmp = -y * (a / b) + x;//
    x = y;
    y = tmp;
    return d;
}

mint_type mint::minv(mint_type a, mint_type mod){
    mint_type x, y;
    mint::extGCD(a, mod, x, y);
    //while(x < 0) x += mod;
    return mint::mod(x);
}

void mint::mcinit(mint_type max, mint_type mod){
    mint::fac[0] = 1;
    for(mint_type i = 1; i < max; i++){
        mint::fac[i] = mint::fac[i-1] * i % mod;
    }
    mint::finv[max-1] = mint::minv(fac[max-1]);
    for(mint_type i = max-1; i > 0; i--){
        mint::finv[i-1] = mint::mod(mint::finv[i] * i);
    }
}

mint_type mint::mchoose(mint_type n, mint_type r, mint_type mod){
    return mint::mod(mint::fac[n] * mint::mod(mint::finv[r] * mint::finv[n-r]));
}
int main(){
    int n, m;
    cin >> n >> m;
    mint::mcinit();
    int res = 0;
    if(n >= 2) res += mint::mchoose(n, 2);
    if(m >= 2) res += mint::mchoose(m, 2);
    
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var < (end); var++)
#define RFOR(var, begin, end) for (int var = (begin) - 1; var >= (end); var--)
#define REP(var, length) FOR(var, 0, length)
#define RREP(var, length) RFOR(var, length, 0)
#define SORT(vector) sort(vector.begin(), vector.end())

#define DIGIT 63

const ll MOD = 1e9 + 7;

void solve(istream& cin, ostream& cout) {
  int n;
  vector<int> count(DIGIT, 0);
  ll k;
  cin >> n >> k;
  ll mask;
  vector<ll> a(n);

  REP(i, n) {
    ll input;
    cin >> input;
    a[i] = input;
    mask = 1;
    REP(j, DIGIT) {
      if (mask & input) {
        count[j]++;
      }
      mask <<= 1;
    }
  }

  mask = 0;
  REP(i, DIGIT) {
    if (count[i] <= n / 2) {
      mask |= (ll) 1 << i;
    }
  }
  ll ans = 0;
  do {
    ll tmp = 0;
    REP(i, n) {
      tmp += (mask & k) ^ a[i];
    }
    ans = max(ans, tmp);
    REP(i, DIGIT) {
      if (k & (ll) 1 << i) {
        if (i == 0) {
          REP(j, DIGIT) {
            if (k & (ll) 1 << j) {
              k &= ~((ll) 1 << j);
            } else {
              break;
            }
          }
        } else {
          k--;
        }
        break;
      }
    }
  } while (k);

  cout << ans << endl;
}

#ifndef TEST
int main() {
  solve(cin, cout);
}
#endif


Measured memory_bytes: 1024
ans = 0
x = [int(input()) for _ in range(5)]
y = 200
for i, xi in enumerate(x):
    xx = xi % 10
    if xx == 0:
        xx = 10
    if y > xx:
        y = xx
        j = i

for i in range(5):
    if i == j:
        ans += x[i]
    else:
        ans += (x[i] + 10 - 1) // 10 * 10
print(ans)


Measured memory_bytes: 3060
n = gets.to_i
points = []
n.times do
  x, y, h = gets.split.map(&:to_i)
  points << {x: x, y: y, h: h}
end
# p points # for debug
LIMIT = 100
flag = false

(0..LIMIT).each do |cx|
  (0..LIMIT).each do |cy|
    h_candidates = []
    points.each do |point|
      h_candidates << point[:h] + (cx - point[:x]).abs + (cy - point[:y]).abs if point[:h].nonzero?
      break if h_candidates.sort.uniq.count > 1
    end
    # p h_candidates # for debug
    if h_candidates.count == 1
      peak = points.find { |point| point[:h].nonzero? }
      puts "#{peak[:x]} #{peak[:y]} #{peak[:h]}"
      flag = true
    elsif h_candidates.sort.uniq.count == 1
      puts "#{cx} #{cy} #{h_candidates[0]}"
      flag = true
    end
    break if flag
  end
  break if flag
end


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

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

    int m=n;

    int sum=0;
    int digit=0;

    while(m>0){
        sum += m % 10;
        m /= 10;
        
    }

    if(n % sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

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

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll H,W;
    cin>>H>>W;
    vector<string> map(H);
    for(auto&& m:map){
        cin>>m;
    }
    vector<vector<ll>> acc_x(H,vector<ll>(W,0));
    vector<vector<ll>> acc_y(H,vector<ll>(W,0));
    //よこ
    for(int y=0;y<H;++y){
        ll sum=0;
        for(int x=0;x<W;++x){
            if(map[y][x]=='.'){
                ++sum;
            } else {
                sum=0;
            }
            acc_x[y][x]=sum;
        }
        sum=0;
        for(int x=W-1;x>=0;--x){
            if(map[y][x]=='.'){
                ++sum;
            } else {
                sum=0;
            }
            acc_x[y][x]+=sum;
        }
    }
    //たて
    for(int x=0;x<W;++x){
        ll sum=0;
        for(int y=0;y<H;++y){
            if(map[y][x]=='.'){
                ++sum;
            } else {
                sum=0;
            }
            acc_y[y][x]=sum;
        }
        sum=0;
        for(int y=H-1;y>=0;--y){
            if(map[y][x]=='.'){
                ++sum;
            } else {
                sum=0;
            }
            acc_y[y][x]+=sum;
        }
    }
    //全探索
    ll ans=0;
    for(int y=0;y<H;++y){
        for(int x=0;x<W;++x){
            ans=max(acc_x[y][x]+acc_y[y][x],ans);
	    }
    }
    cout<<ans-1-1-1<<endl;
    return 0;
}

Measured memory_bytes: 67072
package main

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

func main() {
	sc := NewScanner(os.Stdin)
	n, m := sc.Int(), sc.Int()

	v := make([]*Vertex, n)
	for i := range v {
		v[i] = &Vertex{}
	}

	for i := 0; i < m; i++ {
		x, y := sc.Int()-1, sc.Int()-1
		v[x].nexts = append(v[x].nexts, v[y])
	}

	var max int
	for _, vtx := range v {
		max = Max(max, vtx.check())
	}

	fmt.Println(max)
}

type Vertex struct {
	checked bool
	nexts   []*Vertex
	length  int
}

func (v *Vertex) check() int {
	if v.checked {
		return v.length
	}
	v.checked = true

	for _, vtx := range v.nexts {
		v.length = Max(v.length, vtx.check()+1)
	}
	return v.length
}

// generated by https://github.com/murosan/gollect

func BytesToInt(b []byte) (n int) {
	var i int
	negative := b[0] == 45
	if negative {
		i++
	}
	for ; i < len(b); i++ {
		n = n*10 + int(b[i]-'0')
	}
	if negative {
		return -n
	}
	return
}

type Scanner struct{ *bufio.Scanner }

func NewScanner(r io.Reader) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &Scanner{Scanner: s}
}

func (s *Scanner) Bytes() []byte { s.Scan(); return s.Scanner.Bytes() }

func (s *Scanner) Int() int { return BytesToInt(s.Bytes()) }

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 14848
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 
#define debugP(vec) for(auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

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

	ll ans = 1;
	rep1(i, n) {
	  (ans *= i) %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
V, E = map(int, raw_input().split())

INF = 10**9
e = [[INF]*V for i in xrange(V)]
deg = [0] * V
su = 0
for i in xrange(E):
    s, t, d = map(int, raw_input().split())
    e[s][t] = e[t][s] = min(e[s][t], d)
    deg[s] += 1
    deg[t] += 1
    su += d
odd = [v for v in xrange(V) if deg[v]%2]
dp = {}
dp[2**len(odd) - 1] = 0
for k in xrange(V):
    for i in xrange(V):
        for j in xrange(V):
            e[i][j] = min(e[i][j], e[i][k] + e[k][j])
def dfs(state):
    if state in dp:
        return dp[state]
    res = INF
    for i, u in enumerate(odd):
        if state & (1 << i):
            continue
        for j, v in enumerate(odd):
            if u==v or state & (1 << j) or e[u][v]==INF: continue
            res = min(res, dfs(state | (1 << i) | (1 << j)) + e[u][v])
    dp[state] = res
    return res
print dfs(0) + su

Measured memory_bytes: 6868
#include<stdio.h>

int main(){
	int a,b,c,d,e,f,g,h;
	scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g,&h);
	a=a+b+c+d;
	e=e+f+g+h;
	if(a>e)
	{
		printf("%d\n",a);
	}
	else if(e>a)
	{
		printf("%d\n",e);
	}
	else {
		printf("%d\n",a);
	}
	
	
	
	
	
	
	return 0;
} 


Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1e9
#define MOD 1e9+7
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a<=c && c<=b ? "Yes" : "No" )<<endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::*;
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, a: [usize; n]);
    let s = a.iter().fold(0usize, |b, &x| b ^ x);
    let ret = a
        .iter()
        .map(|ai| (s ^ ai).to_string())
        .collect::<Vec<_>>()
        .join(" ");
    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: 18712
x,n = map(int,input().split())
p = list(map(int,input().split()))
 
anskouho = []
if p:
    val = []
    for i in range(-200,200):
        if i not in p:
            anskouho.append(i)
    for i in anskouho:
        val.append(abs(x - i))
    if x - min(val) not in p:
        print(x - min(val))
    else:
        print(x + min(val))
else:
    print(x)

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

template<class T> inline bool chmax(T &a, T b) {
    if(a<b) {
        a=b; return 1;
    } 
    return 0;
}

template<class T> inline bool chmin(T &a, T b) {
    if(a>b) {
        a=b; return 1;
    } 
    return 0;
}

const ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    string s;
    cin >> s;
    string ans="No";
    rep(i,s.size()) if(s.at(i)=='7') ans="Yes";
    cout << ans << endl;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2e5)+10;
int n,a[maxn];
ll sum,ans,tmp;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) read(a[i]),sum+=a[i];
	ans=1LL<<55;
	for (int i=0;i<=n;i++) {
		tmp+=a[i];
		ans=min(ans,abs(tmp-sum+tmp));
	}
	printf("%lld\n",ans);
	return 0;
}
/*
  REMEMBER:
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Array size? Integer overflow? Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int gcd(int x, int y) {
  if (x == 0) return y;
  else return gcd (y % x, x);
}

int main() {
  int N,K; cin >> N >> K;
  vector<int> A(N);
  for (int i =0; i < N; i++) cin >> A[i];
  
  bool can = true;
  sort(A.begin(),A.end());

  if (A[N-1] < K) can = false;
  int a = 0;
  for (int i = 0; i < N; i++) a = gcd(a, A[i]);
  if (K % a != 0) can = false;

  if (can) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 640
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        ArrayList<String> s = new ArrayList<String>(),
        t = new ArrayList<String>();
        int N = r.i();
        for(int i = 0; i < N; i++)
            s.add(r.s());
        int M = r.i();
        for(int i = 0; i < M; i++)
            t.add(r.s());
        s.sort(null);
        t.sort(null);
        int max = 0;
        for(int i = 0; i < N; i++){
            String u = s.get(i);
            int sum = 1;
            while(i+1 < N && u.equals(s.get(i+1))){
                i++;
                sum++;
            }
            int j = t.indexOf(u);
            if(j > -1){
                sum--;
                while(j+1 < M && u.equals(t.get(j+1))){
                    j++;
                    sum--;
                }
            }
            if(max < sum)
                max = sum;
        }
        print(max);
    }

    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int Int(String s){
            return Integer.parseInt(s);
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}


Measured memory_bytes: 23252
#define n'   '
L[n],p;F[n],X[n];i;long D[n*4],Z[n*4],A[n],x;long f(a,k,l,r,b){return(Z[k]+=(b=a>l|-r<~i)?0:x)+(D[k]=l<=i&a<r&b?fmax(f(a,2*k,l,b),f(a,2*k+1,b=l+r>>1,r)):D[k]);}main(j){for(gets(L);~scanf("%d%d%ld",L+j,&p,A+j);F[p]=j++)X[j]=F[p];for(;p?:(p=F[++i],f(i,1,0,n),n/i);p=X[p])x=A[p],x=f(L[p],1,0,n);printf("%ld",x);}

Measured memory_bytes: 133248