akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<fstream>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);


using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e5+7;
static const int INF = 0x3f3f3f3f;
static const int MOD = 1e9+7;


int main() {
    FASTIO;    
    int D;cin >> D;
    
    cout << "Christmas ";
    FOR(i,0,5-D%10){
        cout << "Eve ";
    }
}

Measured memory_bytes: 256
//# define FLAG
///delet....................................
# include   <bits/stdc++.h>
using namespace std;
# define    pb                      push_back
# define    mp                      make_pair
# define    IOS                     ios::sync_with_stdio(false)
# define    mem(a,b)                memset(a,b,sizeof(a))
# define    FO(i,n,a)               for(int i=n; i>=a; --i)
# define    FOR(i,a,n)              for(int i=a; i<=n; ++i)
# define    MAX(a,b)                (a)>(b)?(a):(b)
# define    MIN(a,b)                (a)<(b)?(a):(b)
# define    LINF                    0xfcfcfcfcfcfcfcf
# define    INF                     0x3f3f3f3f
# define    MOD                     1000000007
# define    eps                     0.00000001
# define    pi                      3.141592653
# define    ee                      2.718281828459
# define    hr                      putchar('\n')
# define    kb                      putchar(' ')
# define    bug                     puts("H");
# pragma    comment(linker,"/STACK:1024000000,1024000000")
typedef     vector<int>             VI;
typedef     long long               LL;
typedef     unsigned long long      ULL;
inline char gtc() {
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
# define    Template                int
inline Template read() {
    int flag=1;
    char ch=gtc();
    if(ch==EOF)return EOF;
    Template sum=0;
    while(!((ch>='0'&&ch<='9')||ch=='-'))ch=gtc();
    if(ch=='-')flag=-1,ch=gtc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-'0',ch=gtc();
    return sum*flag;
}
inline void out(Template x) {
    if(x<0)putchar('-'),x=-x;
    if(x>9)out(x/10);
    putchar(x%10+'0');
}
///coding...................................

int main() {
    IOS;
#ifdef FLAG
    //freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
    int a,b,c,flag=1;
    cin>>a>>b>>c;
    FOR(i,0,a/2) {
        int d=a-2*i;
        int x=b*i;
        if(d==0&&c==x)flag=0;
        else if(c>=x&&c<=b*(a-i)&&(c-x)%d==0)flag=0;
    }
    if(flag)puts("No");
    else puts("Yes");
    return 0;
}










///delete FLAG..............................




Measured memory_bytes: 256
/* include file*/

#include <iostream>

#include <functional>

#include <vector>

#include <algorithm>

using namespace std;



template <class Monoid>

struct Segment {

	using Func = function<Monoid(Monoid, Monoid)>;



	vector<Monoid> node;

	Monoid ide;

	int n = 1;



	Func bin_f;

	Func update_f;



	Segment(const vector<Monoid>& init, Monoid ide_, Func f_, Func u_f)

		: bin_f(f_), ide(ide_), update_f(u_f) {

		int sz = init.size();

		while (n < sz) n *= 2;

		node.assign(n * 2 - 1, ide);

		for (int i = 0; i < sz; i++) node[i + n - 1] = init[i];

		for (int i = n - 2; i >= 0; i--)

			node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);

	}



	void update(int i, Monoid x) {

		i += n - 1;

		node[i] = update_f(node[i], x);

		while (i) {

			i = (i - 1) / 2;

			node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);

		}

	}



	Monoid get_inter(int a, int b, int k = 0, int l = 0, int r = -1) {

		if (r < 0) r = n;

		if (a <= l && r <= b) return node[k];

		if (r <= a || b <= l) return ide;



		Monoid lm = get_inter(a, b, k * 2 + 1, l, (l + r) / 2);

		Monoid rm = get_inter(a, b, k * 2 + 2, (l + r) / 2, r);

		return bin_f(lm, rm);

	}

};

using i64 = long long;

int main() {
	int N, Q;
	cin >> N >> Q;

	Segment<i64> seg(vector<i64>(N, (1LL << 31) - 1), 1LL << 31,
		[](i64 a, i64 b) {return min(a, b); },
		[](i64 a, i64 b) {return b; });

	for (int i = 0; i < Q; i++) {
		i64 c, x, y;
		cin >> c >> x >> y;
		if (c == 0) seg.update(x, y);
		else cout << seg.get_inter(x, y + 1) << endl;
	}
}


Measured memory_bytes: 5676
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	long long n;

	scanf("%lld", &n);

	string sol;

	while (n)
	{
		int val;

		n--;

		val = n % 26;

		sol.insert(sol.begin(), val + 'a');

		n /= 26;
	}

	printf("%s\n", sol.c_str());

	return 0;
}

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

signed main() {
  ios::sync_with_stdio(false);
  string N;
  cin >> N;
  int ans = 0;
  for (char c : N) ans += c - '0';
  cout << max<int>((N.size() - 1) * 9 + N[0] - '1', ans) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;

long long frac(long long n) {
    long long res = 1;
    for (int i=1; i<=n; i++) res *= i;
    return res;
}
int main() {
    long long n;
    long double ans = 0;
    long double sum = 0;
    cin >> n;
    vector<long double> x(n);
    vector<long double> y(n);

    for (int i=0; i<n; i++) cin>>x[i]>>y[i];

    vector<int> c(n);
    iota(c.begin(), c.end(), 0);

    do {
        for (int i=0; i<n-1; i++) {
            sum += sqrt( pow(x[c[i]]-x[c[i+1]],2) + pow(y[c[i]]-y[c[i+1]],2));
        }
    } while(next_permutation(c.begin(), c.end()));

    cout << setprecision(14) << (sum/frac(n)) << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
ll x, y;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> x >> y;
  cout << (abs(x - y) <= 1 ? "Brown" : "Alice");
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl;
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2


int main() {
	ll l, r;
	cin >> l >> r;

	if (r - l >= 2018)puts(0)
	else {
		ll ans = 101010;
		rep(i, l, r+1)rep(j, i + 1, r+1) {
			ans = min(ans,(i*j)%2019);
		}
		puts(ans);
	}
	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int a, b;
  cin >> a >> b;

  int sum = a + b;
  if (sum % 2 == 1)
    sum = sum + 1;
  sum = sum / 2;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
#define MAX 10000
#define NIL -1
struct Node { int parent, left, right; };
Node T[MAX];
int n, D[MAX], H[MAX];
void setDepth(int u, int d) {
	if (u == NIL)return;
	D[u] = d;
	setDepth(T[u].left, d + 1);
	setDepth(T[u].right, d + 1);
}
int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if (T[u].left != NIL)h1 = setHeight(T[u].left) + 1;
	if (T[u].right != NIL)h2 = setHeight(T[u].right) + 1;
	return H[u] = max(h1, h2);
}
int getSibling(int u) {
	if (T[u].parent == NIL)return NIL;
	if (T[T[u].parent].left != u&&T[T[u].parent].left != NIL)return T[T[u].parent].left;
	if (T[T[u].parent].right != u&&T[T[u].parent].right != NIL)return T[T[u].parent].right;
	return NIL;
}
void print(int u) {
	printf("node %d: ", u);
	printf("parent = %d, ", T[u].parent);
	printf("sibling = %d, ", getSibling(u));
	int deg = 0;
	if (T[u].left != NIL)deg++;
	if (T[u].right != NIL)deg++;
	printf("degree = %d, ", deg);
	printf("depth = %d, ", D[u]);
	printf("height = %d, ", H[u]);
	if (T[u].parent == NIL)printf("root\n");
	else if (T[u].left == NIL&&T[u].right == NIL)printf("leaf\n");
	else printf("internal node\n");
}
int main() {
	int v, l, r, root = 0;
	cin >> n;
	for (int i = 0; i < n; i++)T[i].parent = NIL;
	for (int i = 0; i < n; i++) {
		cin >> v >> l >> r;
		T[v].left = l;
		T[v].right = r;
		if (l != NIL)T[l].parent = v;
		if (r != NIL)T[r].parent = v;
	}
	for (int i = 0; i < n; i++)if (T[i].parent == NIL)root = i;
	setDepth(root, 0);
	setHeight(root);
	for (int i = 0; i < n; i++)print(i);
	return 0;
}



Measured memory_bytes: 3116
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if ((a+b)%2 == 0) {
		cout << (a+b) / 2;
	}
	else {
		cout << ((a+b) / 2)+ 1;
	}
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int a[200005];

int main()
{
    int k,n;
    scanf("%d%d",&k,&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int ans=0;
    for(int i=1;i<n;i++)
    {
        ans=max(ans,a[i]-a[i-1]);
    }
    ans=max(ans,a[0]+k-a[n-1]);
    printf("%d\n",k-ans);
    return 0;
}


Measured memory_bytes: 1024
import math
A,B,H,M = map(int,input().split())
H_pos = H/12 + M/720
M_pos = M/60
deg = 360*(H_pos-M_pos)
if deg > 180: deg = 360-deg
rad = math.radians(deg)
co = math.cos(rad)
print("{:.9f}".format(math.sqrt(A**2+B**2-2*A*B*co)))

Measured memory_bytes: 9512
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int A, B;
	cin >> A >> B;
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
		cout << "Possible";
	else
		cout << "Impossible";
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
// atcoder/abc130/E/main2.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

const int N = 2000 + 5;
const lli mod = 1e9 + 7;

vector<int> s;
vector<int> t;

lli memo[N][N];
lli rec(int i, int j)
{
  if (i == s.size()) return 0;
  if (j == t.size()) return 0;

  lli& ret = memo[i][j];
  if (ret != -1) return ret;

  lli sum = 0;

  sum += rec(i + 1, j);
  sum += rec(i, j + 1);
  sum -= rec(i + 1, j + 1);
  sum += mod;
  sum %= mod;

  if (s[i] == t[j]) {
    sum += rec(i + 1, j + 1) + 1;
    sum %= mod;
  }

  return ret = sum;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    s.resize(n);
    t.resize(m);
    cin >> s >> t;

    fill(&memo[0][0], &memo[N - 1][N - 1] + 1, -1);
    cout << rec(0, 0) + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 32128
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val s = sc.next()
    println(
            buildString {
                repeat(s.length) { append("x") }
            }
    )
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

using namespace std;

int ipow(int x,int y){
  if(y==0) return 1;
  if(y&1) return ipow(x*x,y/2)*x;
  return ipow(x*x,y/2);
}

int main(){
  int n,m; cin >> n >> m;
  cout << (1900*m+(n-m)*100)*ipow(2,m) << endl;
  return 0;
}


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

using namespace std;

int main () {

    int n;
    cin >> n;
    vector<int> A(n), B(n), C(n-1);

    for(int i=0; i<n; i++) cin >> A[i], A[i]--;
    for(int i=0; i<n; i++) cin >> B[i];
    for(int i=0; i<n-1; i++) cin >> C[i];
    int ans = 0;
    int gotLast = -1, i = 0;
    for(int i=0; i<n; i++){
        if(i==0 or A[i-1]!=A[i]-1) ans+=B[A[i]];
        else
            ans+=B[A[i]]+C[A[i]-1];
        
        //cout << ans << endl;
    }
    cout << ans << endl;
    


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n,_n,a;
  int i,j,k,l;
  while(scanf("%d",&n) != EOF){
    a = 0;
    for(i=0;i<10;i++){
      for(j=0;j<10;j++){
        for(k=0;k<10;k++){
          _n = n-i-j-k;
          if(0<=_n && _n<=9) a++;
        }
      }
    }
    printf("%d\n",a);
  }
  return 0;
}

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

using namespace std;
#define MOD 1000000007
typedef long long Int;

Int calc(Int *x, Int n){
  Int res = 0;
  for(int i = 0;i < n-1;i++){
    res += (x[i+1] - x[i]) * (i+1) %MOD * (n - i - 1) %MOD;
    res %= MOD;
  }
  return res;
}


Int x[108000], y[108000], n, m;
int main(){
  cin >> n >> m;
  for(int i = 0;i < n;i++) cin >> x[i];
  for(int i = 0;i < m;i++) cin >> y[i];

  cout << calc(x, n) * calc(y, m) % MOD << endl;
  return 0;  
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];
		int[] b = new int[n + 1];
		for (int i = 0; i < n + 1; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		b[n] = 0;
		sc.close();
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) {
				ans += b[i];
				a[i] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i];
				b[i] -= a[i];
				a[i] = 0;
			}
			if (a[i + 1] > b[i]) {
				ans += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			} else {
				ans += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
		}
		System.out.println(ans);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 65040
N = int(input())
H = list(map(int, input().split()))

INF = 10**10
dp = [INF]*N
dp[0] = 0
dp[1] = abs(H[1]-H[0])
for i in range(2, N):
    dp[i] =  min(dp[i-2]+abs(H[i]-H[i-2]), dp[i-1]+abs(H[i]-H[i-1]))

print(dp[N-1])

Measured memory_bytes: 13924
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (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; }
typedef long long ll;
typedef pair<int,int> P;

vector<vector<ll>> dp(100,vector<ll>(2,-1));

int main(){
  int n;
  cin >> n;
  ll k;
  cin >> k;
  ll a[n];
  rep(i,n)cin >> a[i];
  dp[0][0]=0;
  rep(d,50){
    ll mask = 1LL<<(50-d-1);
    int c1=0;
    rep(i,n)if(a[i]&mask)c1++;
    int c0=n-c1;
    ll cost0 = c1*mask;
    ll cost1 = c0*mask;
    if(dp[d][1] != -1){
      chmax(dp[d+1][1],dp[d][1]+max(cost0,cost1));
    }
    if(dp[d][0] !=-1){
      if (k & mask) { // K の d 桁目が 1 だったら、X の d 桁目は 0 にする
                chmax(dp[d+1][1], dp[d][0] + cost0);
      }
    }
    if(dp[d][0] != -1){
      if (k & mask) chmax(dp[d+1][0], dp[d][0] + cost1);
      else chmax(dp[d+1][0], dp[d][0] + cost0);
    }
  }
  cout << max(dp[50][0], dp[50][1]) << endl;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   String nyuB=sc.nextLine();
 
 //    String[] O=sc.nextLine().split("");
   //  String[] E=sc.nextLine().split("");

//int n=Integer.parseInt(nyuA);

//int A=Integer.parseInt(nyuA);
//int B=Integer.parseInt(nyuB);
BigInteger A = new BigInteger(nyuA);
BigInteger B = new BigInteger(nyuB);


if(A.compareTo(B)>0)
System.out.println("GREATER");
else if(A.compareTo(B)<0)
System.out.println("LESS");
else if(A.compareTo(B)==0)
System.out.println("EQUAL");

//long H=Long.parseLong(t[0]);
//long W=Long.parseLong(t[1]);
//long C=Long.parseLong(t[2]);


	}
}

Measured memory_bytes: 21332
from sys import stdin
Q,H,S,D = [int(x) for x in stdin.readline().rstrip().split()]
N = int(stdin.readline().rstrip())

ans = 0
Q4 = Q * 4
H2 = H * 2
D0 = D / 2
QH = Q * 2 + H

if min(Q4,H2,S,D0,QH) == D0:
    ans = ((N // 2) * int(D0 * 2))
    ans += ((N % 2) * min(Q4,H2,S,QH))

else:
    ans = (min(Q4,H2,S,QH) * N)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 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; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,X;
    cin >>A>>B>>X;
    if(X>=A && X<=A+B ){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3608
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
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 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))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){

    int N;
    cin >> N;
    ll A[N];
    REP(i,N) cin >> A[i];

    ll sum = 0;
    REP(i,N) sum += A[i];

    ll l = 0;
    ll r = sum;
    ll rest, m=sum/2;
    int i=0;
    while(r > l){
        rest = m - l;
        l += A[i];
        r -= A[i];
        ++i;
    }

    
    if(sum%2 == 0){
        int ans = min(rest, l-m);
        cout << 2*ans << endl;
    }
    else{
        double ans;
        if(rest >= l-m) ans = l-m - 0.5;
        else ans = rest + 0.5;
        cout << (int)(2*ans) << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,(n)-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n in O(log(n)) time

const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;

/*********** variables ************/
int N, A;
int x[60];
lng po[3010];
lng ne[3010];
/**********************************/

lng acc(int i) {
    return i>0 ? po[i] : ne[-i];
}

void pl(int i, lng x) {
    if(i>0) po[i] += x;
    else ne[-i] += x;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>N>>A;
    REP(i, N) cin >> x[i];

    REP(i, N) x[i] -= A;

    pl(0, 1);
    REP(i, N) {
        int z = 1;
        if(x[i] <= 0) z = -1;
        for(int k=z*3000; k!=0; k-=z) {
            if(acc(k) > 0) {
                pl(k+x[i], acc(k));
            }
        }
        pl(x[i], acc(0));
        for(int k=-z*1; k!=-z*3000; k+=-z) {
            if(acc(k) > 0) {
                pl(k+x[i], acc(k));
            }
        }
    }
    cout << acc(0) - 1;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  int d;
  cin >> d;
  cout << "Christmas";
  for(int i = 24;i >= d;--i){
    cout << " Eve";
  }
  cout << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    llong ans;

    signed call_of_Cthulhu( signed datum ) {

        String s;
        read s;
        int n = pow(2, s.size()-1);
        for ( int i = 0; i < n; i++ ) {
            int t = i;
            llong tmp = s[0]-'0';
            llong buf = 0;
            int j = 0;
            for ( int j = 1; j < s.size(); j++ ) {
                if ( i & (1<<(j-1)) ) {
                    buf += tmp;
                    tmp = 0;
                }
                tmp = tmp*10 + ( s[j] - '0' );
            }
            buf += tmp;
            ans += buf;
        }
        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
using namespace std;


typedef long long ll;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)

const int mod = 1000000007;


int main(){
  int x, y, z;
  cin >> x >> y >> z;
  int ans = 0;
  int length = y + z;
  x -= z;
  ans = x / length;

  cout  << ans << endl;
}


Measured memory_bytes: 256
V=int(input())

G=[[] for i in range(V)]
d=[1001001001 for i in range(V)]

import heapq

def dijkstra(s):
    q=[]
    d[s]=0
    heapq.heappush(q,(0, s))
    
    while(len(q)):
        
        p=heapq.heappop(q)
        v=p[1]
        if d[v]<p[0]:
            continue
        for e in G[v]:
            if d[e[0]]>d[v]+e[1]:
                d[e[0]]=d[v]+e[1]
                
                heapq.heappush(q, (d[e[0]], e[0]))

import sys
for l in sys.stdin:
    l=list(map(int,l.split()))
    u=l[0]
    k=l[1]
    G[u]=zip(*[iter(l[2:])]*2)
    
dijkstra(0)
for i in range(V):
    print(i, d[i])
    

    

Measured memory_bytes: 41556
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	d, r := n/(a+b), n%(a+b)
	if r <= a {
		fmt.Println(d*a + r)
	} else {
		fmt.Println(d*a + a)
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

string s1, s2, s3;

int main()
{
  cin >> s1 >> s2 >> s3;
  //const char c1 = (char)toupper(s1[0]);
  s1[0] = (char)toupper(s1[0]);
  s2[0] = (char)toupper(s2[0]);
  s3[0] = (char)toupper(s3[0]);
  cout << s1[0] << s2[0] << s3[0] << endl;
  return 0;
}


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

void solve(long long N, long long A, long long B)
{
    ll train = N * A;
    printf("%lld\n", train<B?train:B);
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	char s[60];
	int n;
	int i;
	int x;
	int c;

	scanf("%d",&n);
	scanf("%s",s);
	x = 0;
	c = 0;

	for(i=0;i<n;i++){
		switch(x){
		case 0:
			if(s[i] == 'A'){ x = 1;	}
			else{ x = 0; }
			break;

		case 1:
			if(s[i] == 'B'){ x = 2;	}
			else if(s[i] == 'A'){ x = 1;}
			else{ x = 0; }
			break;

		case 2:
			if(s[i] == 'C'){
				x = 0;
				c++;
			}
			else if(s[i] == 'A'){ x = 1;}
			else{ x = 0; }
			break;

		}

	}

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

	return 0;
}

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

int main (){
  
  int N;
  int K;
  
  cin >> N >> K;
  
  if(N % 2 == 1){
    if(N / 2 + 1 < K){
      cout << "NO" << endl;
    }
    else{
      cout << "YES" << endl;
    }
  }
  else{
    if(N / 2 < K){
      cout << "NO" << endl;
    }
    else{
      cout << "YES" << endl;
    }
}

}

Measured memory_bytes: 256
# coding: utf-8
from heapq import heapify, heappop, heappush
N, M = map(int, input().split())
AB = []
heapify(AB)
d = {}
for _ in range(N):
    a, b = list(map(int, input().split()))
    if a > M:
        continue
    if a not in d.keys():
        d[a] = [-b]
    else:
        d[a].append(-b)
day = M - 1
ans = 0
ables = []
while day >= 0:
    now = M - day
    if now in d.keys():
        for v in d[now]:
            heappush(ables, v)
    if len(ables) > 0:
        v = heappop(ables)
        ans += -1 * v
    day -= 1
print(ans)

Measured memory_bytes: 26532
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	cnt := 0
	switch {
	case N >= 3 && M >= 3:
		cnt = (N - 2) * (M - 2)
	case N == 1 && M == 1:
		cnt = 1
	case N == 1 || M == 1:
		cnt = N*M - 2
	case N == 2 || M == 2:
		cnt = 0
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  int n;
  cin>>n;
  int m;
  if(n%2==0){
    m = n*(n-1)/2-n/2;
    cout<<m<<endl;
    REPP(i,n){
      REPP(j,i-1){
        if(j==n+1-i)continue;
        cout<<i<<' '<<j<<endl;
      }
    }
  }else{
    m = n*(n-1)/2-n/2;
    cout<<m<<endl;
    REPP(i,n){
      REPP(j,i-1){
        if(j==n-i && i<n)continue;
        cout<<i<<' '<<j<<endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int k;
  string s;
  cin >> k >> s;

  if(k >= s.length()){
    cout << s << endl;
  }else{
    REP(i,s.length()){
      if(k <= i){
        cout << "...";
        break;
      }else{
        cout << s[i];
      }
    }
    cout << endl;
  }
  return 0;
}



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

using namespace std;

int main() {
  string s;
  
  cin >> s;
  
  int count = 0;
  
  for (int i = 1; i < s.size(); i++) {
    if (s.at(i - 1) == s.at(i)) {
      count++;
    }
  }
  if (count > 0) {  
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" <<endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    ll X;
    cin >> X;
    int cnt = 1, d = X;
    while (d != 0) {
        d += X;
        cnt++;
        if (d >= 360)
            d -= 360;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#include <random>
#define INF 1000000007
using namespace std;

int main(void){
	int n,temp;
	long long ans=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> temp;
		ans+=temp-1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int cnt0 = 0, cnt1 = 0, cnt2 = 0;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    int cnt = 0;
    while(a % 2 == 0) {
      a /= 2;
      cnt++;
    }
    if (cnt == 0) cnt0++;
    if (cnt == 1) cnt1++;
    if (cnt >= 2) cnt2++;
  }
  
  if (cnt1 == 0) {
    if (cnt2 + 1 >= cnt0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    if (cnt2 >= cnt0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

  }
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}

ll const N=(ll)2e5+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
      
      vll a(5);
      ll tt=10;
      for(i=0;i<5;i++){
              cin>>a[i];
              if(a[i]%10)
              tt=min(tt,a[i]%10);
      }
      ll ans=0;
      n=5;
      for(i=0;i<n;i++){
              ans+=a[i];
              ans=(10*ceil1(ans,10));
      }
      if(tt!=10)
      ans-=(10-tt);
      cout<<ans<<endl;
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
 
    void solve(){
        int n;
        cin>>n;
        vector<int>a(n);
        for(int i=0;i<n;i++)
            cin>>a[i];
        sort(a.begin(),a.end());
        int total=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    if(a[i]!=a[j] && a[j]!=a[k]){
                        vector<int>b(3);
                        b[0]=a[i];
                        b[1]=a[j];
                        b[2]=a[k];
                        sort(b.begin(),b.end());
                        if(b[0]+b[1]>b[2]){
                            // cout<<i<<" "<<j<<" "<<k<<"\n";
                            total++;
                        }
                    }
                }
            }
        }
        cout<<total;
        return;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 3660
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 100'009;

int a[N];
int b[N];
int o[N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", a + i, b + i);
  }
  for (int i = 0; i < n; ++i) {
    o[i] = i;
  }
  sort(o, o + n, [](int i, int j) {
    return a[i] < a[j];
  });
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    int q = min(m, b[o[i]]);
    m -= q;
    ans += (long long)a[o[i]] * q;
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 1280
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int A=sc.nextInt(), B=sc.nextInt();
    if(A-B>=2){
      System.out.println(A+A-1);
    }else if(B-A>=2){
      System.out.println(B+B-1);
    } else{
      System.out.println(A+B);
    }
  }
}


Measured memory_bytes: 35568
n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))

can_consist_numbers = dict()
for mask in range(1 << n):
    total = 0
    for i, a in enumerate(A):
        if mask & (1<<i) >= 1:
            total += a
    can_consist_numbers[total] = True

for m in M:
    if m in can_consist_numbers:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 5640
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define OK(x,y) abs(w[x]-w[y])<=1
int n, w[311];
int dp[311][311];

int main(){
  while(cin>>n&&n){
    REP(i,n) cin>>w[i];
    memset(dp, 0, sizeof dp);

    for(int j=1; j<n; j++){
      for(int i=0; i+j<n; i++){
        if(OK(i,i+j) && dp[i+1][i+j-1]==j-1){
          dp[i][i+j]=j+1;
        }

        for(int k=i; k<=i+j; k++){
          dp[i][i+j]=max(dp[i][i+j], dp[i][k]+dp[k+1][i+j]);
        }
      }
    }
    cout << dp[0][n-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 3432
// https://atcoder.jp/contests/dp/tasks/dp_a

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

int main (int argc, char* argv[]) {
	long long n;
	cin >> n;

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

	vector<long long> dp(n);
	for (long long i = 1; i < n; i++) {
		dp[i] = dp[i - 1] + abs(heights[i] - heights[i - 1]);
		if (i - 2 < 0) {
			continue;
		}
		dp[i] = min(dp[i], dp[i - 2] + abs(heights[i] - heights[i - 2]));
	}

	cout << dp.back() << endl;
}


Measured memory_bytes: 1792
from collections import deque

H, W = map(int, input().split())

m = [[0 for _ in range(W)] for _ in range(H)]
root = []
for i in range(H):
    # m.append(list(map(lambda x: 0 if x=="#" else 1, input()))）
    for j, c in enumerate(input()):
        if c == "#":
            m[i][j] = 1
            root.append((i, j))

# print(m)
# print(root)

queue = deque(root)
visited = deque(root)
visited_extend = visited.extend
ans = 0
while len(visited) < H*W:
    # print(visited)
    ans += 1
    new_queue = deque([])
    while queue:
        p = queue.popleft()
        for i, j in ([-1, 0], [1, 0], [0, 1], [0, -1]):
            next_p = (p[0] + i, p[1] + j)
            if (0 <= next_p[0] < H) and (0 <= next_p[1] < W):
                if not m[next_p[0]][next_p[1]]:
                    m[next_p[0]][next_p[1]] = 1
                    new_queue.append(next_p)
    visited_extend(new_queue)
    queue = new_queue
print(ans)


Measured memory_bytes: 122428
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

int main() {
		string S = "MARCH";
		ll c[5] = {0};
		int N;
		cin >> N;

		for (int i = 0; i < N; i++) {
				string t;
				cin >> t;
				for (int j = 0; j < 5; j++) {
						if (t[0] == S[j]) {
								c[j]++;
						}
				}
		}

		ll ans = 0;
		for (int i = 0; i < 5; i++) {
				for (int j = i+1; j < 5; j++) {
						for (int k = j+1; k < 5; k++) {
								ans += c[i] * c[j] * c[k];
						}
				}
		}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 10000000020
using namespace std;

//左から右に単調非減少
//右は左以上
//h[0] <= h[1]

//(h[i-1] < h[i]) h[i]--;
//(h[i-1] = h[i]) continue;
//((h[i-1] - h[i]) > 1) false;

// h[n-1]<=h[n]

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<ll> h(n+2,0);
    h[0] = -1;
    h[n+1] = INF;
    bool flag = true; 
    for(int i = 1; i <= n; i++){
        cin>>h[i];
        if ((h[i-1] - h[i]) > 1){
            flag = false;
            break;
        }else if((h[i-1] - h[i]) == 1){
            h[i]++;
        }else{
            continue;
        }
    }
    if( flag ) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 1024