akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const ll mod = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    int sub = stoi(s.substr(0, 4));
    int month = stoi(s.substr(5, 2));
    if (sub >= 2020)
    {
        cout << "TBD" << endl;
    }
    else if (sub <= 2018)
    {
        cout << "Heisei" << endl;
    }
    else
    {
        if (month >= 5)
            cout << "TBD" << endl;
        else
            cout << "Heisei" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
a,b=map(int, input().split())
if a==1:
    print(1)
elif a==2 and b<=1:
    print(1)
elif a==2 and b>=2:
    print(2)
elif a==3 and b<=2:
    print(2)
elif a==3 and b>=3:
    print(3)
elif a==4 and b<=3:
    print(3)
elif a==4 and b>=4:
    print(4)
elif a==5 and b<=4:
    print(4)
elif a==5 and b>=5:
    print(5)
elif a==6 and b<=5:
    print(5)
elif a==6 and b>=6:
    print(6)
elif a==7 and b<=6:
    print(6)
elif a==7 and b>=7:
    print(7)
elif a==8 and b<=7:
    print(7)
elif a==8 and b>=8:
    print(8)
elif a==9 and b<=8:
    print(8)
elif a==9 and b>=9:
    print(9)
elif a==10 and b<=9:
    print(9)
elif a==10 and b>=10:
    print(10)
elif a==11 and b<=10:
    print(10)
elif a==11 and b>=11:
    print(11)
elif a==12 and b<=11:
    print(11)
else:
    print(12)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int,int> > adj[MAX];

void dijkstra(){
  priority_queue<pair<int,int> >PQ;
  int u,minv,i,v,j;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }

  d[0]=0;
  PQ.push(make_pair(0,0));
  color[0]=GRRAY;

  while(!PQ.empty()){
    pair<int,int> f =PQ.top(); PQ.pop();
    u=f.second;
    color[u]=BLACK;

    if(d[u]<f.first * (-1)) continue;

    for(j=0;j<adj[u].size();j++){
      v=adj[u][j].first;
      if(color[v]==BLACK) continue;
      if(d[v]>d[u]+adj[u][j].second){
	d[v]=d[u]+adj[u][j].second;
	PQ.push(make_pair(d[v]*(-1),v));
	color[v]=GRRAY;
      }
    }
  }
  
  for(i=0;i<n;i++){
      cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
 }
}


int main(){
  int i,j;

  cin >> n;

 int k,c,u,v;
 for(i=0;i<n;i++){
   cin >> u >> k;
   for(j=0;j<k;j++){
     cin >> v >> c;
     adj[u].push_back(make_pair(v,c));
   }  
     }
 dijkstra();
 
 return 0;
}



Measured memory_bytes: 7980
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,N) for(int i=0;i<N;i++)
#define MOD 1000000007

using namespace std;

int main(void){
    int N;
    double ans;
    cin>>N;
    VI A(N);
    rep(i,N){
        cin>>A[i];
        ans+=((double)1/A[i]);
    }
    printf("%lf",1/ans);
}



Measured memory_bytes: 256
S = list({i for i in input()})

if len(S)==1 or len(S)==3:
    print("No")
    exit()

elif len(S)==4:
    print("Yes")
    exit()

else:
    if ('E' in S and 'W' in S) or ('N' in S and 'S' in S):
        print("Yes")
        exit()
    else:
        print("No")
        exit()


Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
    int a, b, c;
    scanf("%d %d %d\n",&a,&b,&c);
    
    if(a <= b && b <= c){
    printf("%d %d %d\n" ,a, b, c);}
    
    else if(a <= c && c <= b){
    printf("%d %d %d\n" ,a, c, b);}

    else if(b <= a && a <= c){
    printf("%d %d %d\n" ,b, a, c);}

    else if(b <= c && c <= a){
    printf("%d %d %d\n" ,b, c, a);}

    else if(c <= a && a <= b){
    printf("%d %d %d\n" ,c, a, b);}

    else{
    printf("%d %d %d\n" ,c, b, a);}
    

    return 0;
}


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

int cmp(char a,char b)
{
	return a>b;
}

int main()
{
	string s,t;
	cin>>s;
	cin>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),cmp);
	if (s<t)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
int main(){
	int a,b,d,r;
	std::cin >> a >> b;
	d = a / b;
	r = a % b;
	double f;
	f = 1.00000 * a / b;
	std::cout << d <<" "<< r <<" ";
	printf("%.5lf", f);
return 0;
}

Measured memory_bytes: 3228
#pragma warning(disable:4996)
#include "bits/stdc++.h"
using namespace std;

using ll = long long;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define pb push_back
#define mp make_pair
#define fill(x,y) memset(x,y,sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

int qp(int a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) {
	return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

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; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> p)
{
	ll x = get<0>(p), y = get<1>(p);
	return tuple<ll, ll>(x + y, x - y);
}

int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

	int N; cin >> N;
	vector<int> as(N), nums(N);
	REP(i, N) {
		int a; cin >> a;
		as[i] = a;
		nums[i] = a;
	}
	sort(all(as));
	vector<int> c2(as.begin() + (as.size() - 2) / 2, as.begin() + (as.size() - 2) / 2 + 2);
	if (N == 2) {

	}
	set<int> l(as.begin(), as.begin() + (as.size() - 2) / 2);
	set<int> r(as.rbegin(), as.rbegin() + (as.size() - 2) / 2);
	REP(i, N) {
		int a = nums[i], ans;
		if (c2[0] == a) ans = c2[1];
		else if (c2[1] == a) ans = c2[0];
		else {
			if (c2[0] > a) {
				ans = c2[1];
			}
			else {
				ans = c2[0];
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 12928
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
#define Fill(x, v, y) fill(x, x + v, y);
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;
const long long INFTY = (1LL<<32);
const double PI = 3.1415926535;
const int MOD = 1000000007; // 計算してからmodで割る ans = (ans * a) % mod
#define int long long
template <typename T = long long > T in () { T x; cin >> x; return(x);}
// int a = in() のように使うlong long以外の型の時はstirng s = in<string>()のように型を指定する

// ここから 
// 最小全域木 -> Kruskal -> O(|E|log|E|)

//Union FInd
class UnionFind{
    public:
        // rank -> 木の高さ, p -> 親へのポインタ(自分自身が親なら自分)
        vector<int> rank, p;

        UnionFind() {}
        UnionFind(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            REP(i, size) makeSet(i); // 互いに素な集合の作成
        }

        // 互いに素な集合の作成
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        // x, yが同じグループに属するかどうか
        bool same(int x, int y){
            return findSet(x) == findSet(y);
        }

        // x, yを合併
        void unite(int x, int y){
            link(findSet(x), findSet(y));
        }

        // 低い木を高い木に合併
        void link(int x, int y){
            if(rank[x] > rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x] == rank[y]){
                    rank[y]++;
                }
            }
        }

        // 代表の要素（根）の特定（これが同じ要素は同じ集合に属する）
        int findSet(int x){
            if(x != p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

class Edge{
    public:
    int source, target, cost;
    Edge(int source = 0, int target = 0, int cost = 0):
    source(source), target(target), cost(cost) {}
    bool operator < (const Edge &e) const { // "<"で比較されたときに返す処理
        return cost < e.cost;
    }
};

int Kruskal(int V, vector<Edge> edges){
    int totalCost = 0;
    whole(sort, edges); // 辺の整列(軽い辺の順に並べる)
    UnionFind dset = UnionFind(V); // V+1でもいい

    // REP(i, V) dset.makeSet(i); // 初期化 辺の集合を空にする

    int source, target;
    REP(i, edges.size()){
        Edge e = edges[i];

        if(!dset.same(e.source, e.target)){
            // MST.push_back(e); Minimum Spanning Tree(最小全域木)
            totalCost += e.cost; // 重みが小さい順に取り出されるので初めに木と木を繋げるやつが最適
            dset.unite(e.source, e.target);
        }
    }
    return totalCost;
}

signed main(void){

    int V, E; cin >> V >> E;
    vector<Edge> edges;
    REP(i, E){
        int source, target, cost;
        cin >> source >> target >> cost;
        edges.push_back(Edge(source, target, cost));
    }

    cout << Kruskal(V, edges) << endl;

    return 0;

}


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

bool solve(int (*c)[3])
{
	for (int i = 0; i < 2; i++) {
		if (!((c[i][0]-c[i+1][0] == c[i][1]-c[i+1][1]) &&
				(c[i][1]-c[i+1][1] == c[i][2]-c[i+1][2])))
			return false;
	}
	for (int j = 0; j < 2; j++) {
		if (!((c[0][j]-c[0][j+1] == c[1][j]-c[1][j+1]) &&
				(c[1][j]-c[1][j+1] == c[2][j]-c[2][j+1])))
			return false;
	}

	return true;
}

int main(void)
{
	int c[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}

	if (solve(c))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 256
n = int(input())
l = sorted(list(map(int, input().split())))
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if len(set([l[i], l[j], l[k]])) != 3:
                continue
            if l[k] < l[i] + l[j]:
                cnt += 1
print(cnt)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main(){
	int m,d;
	cin>>m>>d;
	int ans=0;
	for(int i=1;i<=m;i++){
		for(int j=10;j<=d;j++){
			int t1=j%10,t2=j/10;
			if(t1>=2&&t2>=2){
			if(t1*t2==i){
				ans++;
			}
			}
		}
	}
	cout<<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>;
const int INF = 1000000001;

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;}

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

  n %= k;
  n = min(n, abs(n - k));
  cout << n << endl;
  return 0;
}


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

using namespace std;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)
typedef long long ll;
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;




int main() {
	ll n, w;
	cin >> n >> w;
	VLL a, b, c, d;
	ll e, f;
	cin >> e >> f;
	a.push_back(f);
	REP(i, n - 1) {
		ll w, v;
		cin >> w >> v;
		if (w == e)a.push_back(v);
		else if (w == e+1)b.push_back(v);
		else if (w == e+2)c.push_back(v);
		else d.push_back(v);
	}
	sort(ALL(a)), sort(ALL(b)), sort(ALL(c)), sort(ALL(d));
	reverse(ALL(a)), reverse(ALL(b)), reverse(ALL(c)), reverse(ALL(d));
	FOR(i, 1, a.size())a[i] = a[i] + a[i - 1];
	FOR(i, 1, b.size())b[i] = b[i] + b[i - 1];
	FOR(i, 1, c.size())c[i] = c[i] + c[i - 1];
	FOR(i, 1, d.size())d[i] = d[i] + d[i - 1];

	ll res = 0;
	REP(i, a.size() + 1)REP(j, b.size()+1)REP(k, c.size()+1)REP(l, d.size()+1) {
		if ((i + j + k + l)*e + j + 2 * k + 3 * l<=w) {
			ll aa,bb,cc,dd;
			if (i == 0)aa = 0;
			else aa = a[i - 1];
			if (j == 0)bb = 0;
			else bb = b[j - 1];
			if (k == 0)cc = 0;
			else cc = c[k - 1];
			if (l == 0)dd = 0;
			else dd = d[l - 1];
			res = max(res, aa + bb + cc + dd);
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<stdio.h>


int main() {
	int a;
	int b;

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

	if (a > 9 || b > 9) {
		printf("-1");
	}
	else {
		printf("%d", a * b);
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    long long n,k,i,x=0,a[200005],left,right,mid;  
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        x=max(x,a[i]);
    }   
    left=0;
    right=x;
    while(left+1<right)
    {
        mid=(left+right)/2;
        x=0;
        for(i=1;i<=n;i++)
        {
            if(a[i]>mid)
            {
                 x+=(a[i]/mid);    
            }
        }
        if(x>k)
        {
            left=mid;
        }
        else 
        {
            right=mid;
        }
    }
    cout<<right<<endl;
    return 0;
}

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

int main() {
	string s, t, u;
	int sn, tn;
	cin >> s >> t;
	cin >> sn >> tn;
	cin >> u;

	if (u == s) sn--;
	else if (u == t) tn--;
	cout << sn << ' ' << tn;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1e9+7;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define fs first
#define sc second


const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T>
T ngcd(vector<T> a){
    T res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
 
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
T nlcm(vector<T> numbers) {
    T res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}

// 約数列挙
template<typename T>
vector<T> calc_divisor(T n) {
   vector<T> res;
   for (T i = 1LL; i*i <= n; ++i) {
       if (n % i == 0) {
           res.push_back(i);
           T j = n / i;
           if (j != i) res.push_back(j);
       }
   }
   sort(res.begin(), res.end());
   return res;
}

// 素数判定
template<typename T>
bool isPrime(T x){
    T i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    long double a,b,c;
    cin >> a >> b >> c;
    long double tmp = sqrt(a * b);
    long double ans = a + b + 2 * tmp;
    if(ans < (long double)c) print("Yes");
    else print("No");
   
    
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	string s;
	cin >> s;
	int a = s.at(0);
	for (int i = 1; i < 4; i++) {
		if (s.at(i) == a) {
			cout << "Bad" << endl;
			return 0;
		}
		a = s.at(i);
	}
	cout << "Good" << endl;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
Drink = [[] for i in range(n)]
for i in range(n):
    Drink[i] = list(map(int, input().split()))
# 値段安い店順にソート
Drink.sort(key=lambda x: x[0])
ans = 0 # 値段
count = 0 # 総数
ind = 0 # 回る店
while count < m:
    p,num = Drink[ind] # 価格と数
    if count+num < m:
        count+=num
        ans+=p*num
        ind+=1
        continue
    else:
        ans+=p*(m-count)
        count=m
print(ans)

Measured memory_bytes: 62496
#include<stdio.h>
int n,a[1000001],b[1000001],c[1010100];i,ans;
char s[1010101];
int main(void){
    scanf("%d",&n);
    scanf("%s",s);
    //aは左から右へ黒を数える
    for(i = 1;i <= n;i++){
        if(s[i-1] == '#'){
            a[i] += a[i-1]+1;
        }else{
            a[i] = a[i-1];
        }
    //printf("%d",a[i])
    }
    //bは右から白を数える
    for(i = n-1;i>=0;i--){
        if(s[i] == '.'){
            b[i] += b[i+1]+1;
        }else{
            b[i] = b[i+1];
        }
    }
  /* for(i=n-1;i>=0;i--){
      printf("%d",b[i]);
    }*/
    for(i = 0;i <= n+1;i++){
        c[i] = a[i]+b[i];
    }
    ans = c[0];
    for(i=0;i<=n;i++){
    if(c[i]<ans){
        ans = c[i];
    }
    }
printf("%d",ans);
}

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

int main() {
  int n,x,t;
  cin >> n >> x >> t;
  int y;
  if (n%x==0) y=n/x;
  else y=n/x+1;
  cout << y*t << endl;
}

Measured memory_bytes: 3632
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, k = sc.nextInt()
  val a = Array.fill(n)(sc.nextInt()).filter(_ < k)
  val m = a.length

  def compose(x1: Int, x2: Int): Int = {
    x1 * k + x2
  }

  if (m == 0) {
    println(0)
  } else {
    val dpf = Array.fill(m * k)(false)
    dpf(0) = true
    for {
      i <- 1 until m
      j <- 0 until k
    } {
      if (a(i-1) <= j) {
        dpf(compose(i, j)) = dpf(compose(i-1, j)) || dpf(compose(i-1, j - a(i-1)))
      } else {
        dpf(compose(i, j)) = dpf(compose(i-1, j))
      }
    }

    val dpb = Array.fill(m * k)(false)
    dpb(0) = true
    for {
      i <- 1 until m
      j <- 0 until k
    } {
      if (a(m-i) <= j) {
        dpb(compose(i, j)) = dpb(compose(i-1, j)) || dpb(compose(i-1, j - a(m-i)))
      } else {
        dpb(compose(i, j)) = dpb(compose(i-1, j))
      }
    }

    var ans = 0
    for (i <- 0 until m) {
      val x = a(i)
      var count = 0
      for (jb <- k-x until k if dpb(compose(m-i-1, jb))) {
        count += 1
      }
      var found = false
      if (dpf(compose(i, 0)) && count > 0) {
        found = true
      }

      var jf = 1
      while (!found && jf < k) {
        if (dpb(compose(m-i-1, k-jf))) {
          count -= 1
        }
        if (k-x-jf >= 0 && dpb(compose(m-i-1, k-x-jf))) {
          count += 1
        }
        if (dpf(compose(i, jf)) && count > 0) {
          found = true
        }
        jf += 1
      }

      if (!found) {
        ans += 1
      }
    }

    println(ans)
  }
}


Measured memory_bytes: 115796
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio() ios_base::sync_with_stdio(false)
#define rmod(x, y) ((((x)%(y))+(y))%(y))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
template<typename T, typename R = null_type, typename C = less<T>>
tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update> ordered_set(){
    return tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update>();
}

const int maxn = 1e5+5;
bool vis[maxn][2];
int n;
ll a[maxn], mul[2], dp[maxn][2];



ll solve(int i, bool fl){
	if (i==n) return a[i] * mul[fl];
	if (vis[i][fl]) return dp[i][fl];
	vis[i][fl] = 1;
	ll &ret = dp[i][fl];
	//preserve current flip
	ret = max(mul[fl]*a[i] + solve(i+1, 0), mul[!fl]*a[i] + solve(i+1, 1));
	return ret;
}

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


Measured memory_bytes: 7424
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll X, Y, Z; cin >> X >> Y >> Z;

	cout << (X - Z) / (Y + Z) << endl;

	return 0;
}

Measured memory_bytes: 256
def solve():
    N = int(input())
    S = input()

    base = 37
    def rolling_hash(s, mod):
        l = len(s)
        h = [0]*(l + 1)
        v = 0
        for i in range(l):
            h[i+1] = v = (v * base + ord(s[i])) % mod
        pw = [1]*(l + 1)
        v = 1
        for i in range(l):
            pw[i+1] = v = v * base % mod
        return h, pw

    mod1 = 10**9 + 9; mod2 = 10**9 + 7
    h1, pw1 = rolling_hash(S, mod1)
    h2, pw2 = rolling_hash(S, mod2)

    def chk(l, h, pw, mod):
        p = pw[l]
        for i in range(min(l, N-2*l+1)):
            D[i] = (h[l+i] - h[i]*p) % mod
        s = set()
        for i in range(l, N-l+1):
            s.add(D[i-l])
            D[i] = v = (h[l+i] - h[i]*p) % mod
            if v in s:
                return 1
        return 0

    H = [set() for i in range(N//2+2)]
    D = [0]*N
    E = [0]*N
    k = N//2
    for l in range(1, N//2+1):
        if not chk(l, h1, pw1, mod1):
            k = l-1
            break
    ans = 0
    for l in range(k, 0, -1):
        if chk(l, h2, pw2, mod2):
            ans = l
            break
    print(ans)
solve()

Measured memory_bytes: 46684
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  string s;
  cin >> s;
  if(s == "zyxwvutsrqponmlkjihgfedcba") {
    P(-1);
    return 0;
  }
  if(s.size() < 26) {
    int mask = 0;
    rep(i,0,s.size()) {
      mask |= 1 << (s[i] - 'a');
    }
    rep(i,0,26) if(!((mask >> i) & 1)) {
      s += i + 'a';
      break;
    }
  } else {
    string tmp = s;
    next_permutation(all(s));
    rep(i,0,s.size()) if(s[i] < tmp[i]) {
      s = s.substr(0, i);
      break;
    }
  }
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 256
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    temperature = int(input())
    return ['No', 'Yes'][temperature >= 30]


def main():
    print(solve())


if __name__ == "__main__":
    main()


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

#define INF 1e9
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(x, v) for (auto& x: (v))
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl

void solve();
void in(){} template<class T, class... U> void in(T &t, U &...u){ cin >> t; in(u...); }
int main() { cin.tie(0); ios::sync_with_stdio(0); solve(); }

void solve() {
  int N;
  cin >> N;
  map<string, int> mp;
  int mx = 0;
  rep(i, N) {
    string s;
    cin >> s;
    mx = max(mx, ++mp[s]);
  }

  each(x, mp) {
    if (x.second != mx) continue;
    print(x.first);
  }
}


Measured memory_bytes: 23808
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
//#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
//#define EXIST(s, e) ((s).find(e)!=(s).end())
//#define SORT(c) sort(begin(c),end(c))
//#define pb emplace_back
//#define MP make_pair
//#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N, C;
    cin >> N >> C;

    vector<vector<int> > D(C, vector<int>(C));//違和感
    vector<vector<int> > c(N, vector<int>(N));//grid

    rep(i,0,C){
        rep(j,0,C){
            cin >> D[i][j];
        }
    }

    rep(i,0,N){
        rep(j,0,N){
            cin >> c[i][j];
        }
    }
    vector<vector<int>> gr(3, vector<int>(C + 1));

    rep(i, 0, N) {
        rep(j, 0, N) {
            gr[(i + j) % 3][c[i][j]]++;
        }
    }


    int ans = INF;
    rep(c1, 0, C) {
        rep(c2, 0, C) {
            rep(c3, 0, C) {
                if (c1 == c2 || c2 == c3 || c1 == c3) continue;
                int tmp = 0;
                rep(i, 0, C) {
                    tmp += gr[0][i + 1] * D[i][c1];
                }
                rep(i, 0, C) {
                    tmp += gr[1][i + 1] * D[i][c2];
                }
                rep(i, 0, C) {
                    tmp += gr[2][i + 1] * D[i][c3];
                }
                ans = min(ans,tmp);
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
bool compare(pair<ll,ll> p1,pair<ll,ll> p2){
return p1.se>p2.se;
}
bool ispal(string s){
string s1=s;
reverse (all(s1));
return s1==s;
}
void solve(){
string s,s1,s2;
cin>>s;
ll n=s.length();
s1=s.substr(0,(n-1)/2);
s2=s.substr(((n+3)/2)-1,n);
//cout<<s1 sp s2<<endl;
if(ispal(s1) && ispal(s2) && ispal(s)) yes;
else no;

}
int main()
{   fast;
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    vector<ll> A(3);
    A[0] = a;
    A[1] = b;
    A[2] = c;
    sort(A.begin(),A.end());
    if (a%2==0 || b%2==0 || c%2==0) {
        cout << 0 << endl;
    }
    else {
        cout << A[0]*A[1]*((A[2]/2+1)-(A[2]/2)) << endl;
    }
}

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


int main(){
	vector<char> data;
	char str;
	for(int i=0;i<4;i++) {
		cin >> str;
		data.push_back(str); 
	}
	sort(data.begin(), data.end()); 
	if (data[0]==data[1] && data[2]==data[3] && data[1]!=data[2]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
bool check(ull a){
    if(a%3==0 || a%5==0){
        return false;
    }
    return true;
}
int main(){
    ull a,ans=0;
    cin>>a;
    for(ull i=1;i<=a;i++){
        if(check(i)){
            ans += i;
        }
        continue;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int turn = 0;
  while(1){
    
    turn++;
    c -= b;
    if(c <= 0) break;
    
    turn++;
    a -= d;
    if(a <= 0) break;
    
  }
  
  switch(turn % 2){
    case 0 : cout << "No" << endl; break;
    case 1 : cout << "Yes" << endl; break;
  }
    
}

Measured memory_bytes: 3588
#!/usr/bin/env python
from itertools import accumulate as ac
N = int(input())
A = list(ac(map(int, input().split())))
l, r, t = 0, 2, A[-1]
c = t

for m in A[1:-2]:
    while t+m > A[r]+A[r+1]:
        r += 1
    while m > A[l]+A[l+1]:
        l += 1
    x = sorted([A[l],m-A[l],A[r]-m,t-A[r]])
    c = min(c,x[-1]-x[0])
print(c)


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int c = 0;
  for (int i = 1; i < n; ++i) {
    int a = n/i;
    if (n%i == 0) --a;
    c += a;
  }
  cout << c << endl;
}

Measured memory_bytes: 3648
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
const ll MAXN=300200;
ll i,j;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
string s;
cin>>s;
ll r=0,ans=0;
F(i,0,s.length())
{
   if(s[i]=='R')
   {
       r++;
   }
   else
   {
       ans=max(ans,r);
       r=0;
   }
}
 ans=max(ans,r);
 cout<<ans;
return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<vector<int>> xss(n, vector<int>(n-1));
    for (auto& xs : xss) {
        for (int& x : xs) {
            cin >> x;
            --x;
        }
    }
    auto edge_num = [&](int i, int j) {
        return min(i,j) * n + max(i,j);
    };
    vector<vector<int>> outgoing(n*n);
    vector<int> num_ingoing(n*n, 0);
    vector<int> top_sort;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n-2; ++j) {
            int u = edge_num(i, xss[i][j]);
            int v = edge_num(i, xss[i][j+1]);
            outgoing[u].push_back(v);
            ++num_ingoing[v];
        }
    }
    for (int i = 0; i < n*n; ++i) {
        if (num_ingoing[i] == 0) {
            top_sort.push_back(i);
        }
    }
    for (int i = 0; i < (int)top_sort.size(); ++i) {
        for (int j : outgoing[top_sort[i]]) {
            --num_ingoing[j];
            if (num_ingoing[j] == 0) {
                top_sort.push_back(j);
            }
        }
    }
    if ((int)top_sort.size() != n*n) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> lengths(n*n, 0);
    for (int i = n*n-1; i >= 0; --i) {
        int hi = 1;
        for (int j : outgoing[top_sort[i]]) {
            hi = max(hi, lengths[j]+1);
        }
        lengths[top_sort[i]] = hi;
    }
    cout << *max_element(lengths.begin(), lengths.end()) << endl;
    return 0;
}


Measured memory_bytes: 55148
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>v;
	int all = 0;
	for (size_t i = 0; i < n; i++)
	{
		int h;
		cin >> h;
		v.emplace_back(h);
		all ^= h;
	}
	for (size_t i = 0; i < n; i++)
	{
		if (i != 0)cout << " " ;
		cout << (all ^ v[i]);
	}
	cout << endl;
}

Measured memory_bytes: 4252
#include <stdio.h>

#define DATA_SET 10000

int main()
{
    int input[DATA_SET][2];
    char op[DATA_SET];
    int output[DATA_SET];

    for(int i = 0; i < DATA_SET; i++) { 
        scanf("%d %s %d", &input[i][0], &op[i], &input[i][1]);

        if (op[i] == '?') {
            break;
        }
        else {
            /* NOP */
        }
    }

    for(int i = 0; i < DATA_SET; i++) { 
        if (op[i] == '?') {
            break;
        }
        else if (op[i] == '+') {
            output[i] = input[i][0] + input[i][1];            
        }
        else if (op[i] == '-') {
            output[i] = input[i][0] - input[i][1];            
        }
        else if (op[i] == '*') {
            output[i] = input[i][0] * input[i][1];            
        }
        else if (op[i] == '/') {
            output[i] = input[i][0] / input[i][1];            
        }
        else {
            /* NOP */
        }
        
        printf("%d\n", output[i]);

    }  

}


Measured memory_bytes: 2064
#include<iostream>
#include<map>
#include<algorithm>
#include<queue>
#include<math.h>
using namespace std;
int main(){
	int n; cin>>n;
	long long int ar[n+5];
	for(int i=0;i<n;i++) cin>>ar[i];
	
	long long sum = abs(ar[0]-0);
	for(int i=1;i<n;i++){
		sum += abs(ar[i]-ar[i-1]);
	}
	//cout<<sum<<"\n";
	for(int i=0;i<n;i++){
		if(i==0){
			cout<<sum-abs(ar[0]-0)-abs(ar[1]-ar[0])+abs(ar[1]-0)+abs(ar[n-1]);
		}
		else if(i==n-1){
			cout<<sum-abs(ar[i]-ar[i-1])+abs(ar[i-1]);
		}
		else 
			cout<<sum-abs(ar[i]-ar[i-1])-abs(ar[i+1]-ar[i])+abs(ar[i+1]-ar[i-1])+abs(ar[n-1]);

		cout<<"\n";
	}
	return 0;	
}

Measured memory_bytes: 2048
#include <stdio.h>
int k(int);
int main(void)
{
    int N,a[100] = {0},i,j,Alice = 0,Bob = 0,max;
    scanf("%d",&N);
    for(i = 1;i <= N;i++){
        scanf("%d",&a[i-1]);
    }
    for(i = 1;i <= N;i++){
        max = 0;
        for(j = 1;j <= N;j++){
            if(max <= a[j-1]){
                max = a[j-1];
            }
        }
        for(j = 1;j <= N;j++){
            if(max == a[j-1]){
                a[j-1] = 0;
                break;
            }
        }
        if(i % 2 == 1) Alice += max;
        else Bob += max;
    }
    printf("%d",Alice - Bob);
	return 0;
}

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

int main(){
	int n; cin >> n;
	int a[100]; for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		for (int j = i; j > 0; j--) {
			if (a[j - 1] > a[j]) swap(a[j - 1], a[j]);
			else break;
		}
		cout << a[0];
		for (int k = 1; k < n; k++) cout << " " << a[k];
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  vector<int> a(5,0);
  vector<int> b(5,0);
  int ans=0,m=10;
  rep(i,5){
    cin>>a[i];
    if(a[i]%10==0) b[i]=10;
    else b[i]=a[i]%10;
    m = min(m,b[i]);
  }
  rep(i,5){
    if(a[i]%10!=0) a[i]= (a[i]/10)*10+10;
    ans += a[i];
  }
  cout <<ans-(10-m) <<endl;
}



Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

f n [] = n
f n (('J',x):('O',y):('I',z):s)
  | x>=y && y<=z = f (max n y) s
  | otherwise = f n s
f n (t:s) = f n s

main = getLine >>= print . f 0 . map (fnTuple (head,length)) . group

Measured memory_bytes: 75664
#include "bits/stdc++.h"
using namespace std;
const int N = 3e5 + 5;
char str[N];
int n;
int main(){
	scanf("%s" , str + 1);
	n = strlen(str + 1);
	int l = 1;
	int r = n;
	int ans = 0;
	while(l < r){
		if(str[l] == str[r]){
			++l;
			--r;
			continue;
		}
		if(str[l] == 'x'){
			++l;
			++ans;
			continue;
		}
		if(str[r] == 'x'){
			--r;
			++ans;
			continue;
		}
		printf("-1\n");
		return 0;
	}
	printf("%d\n" , ans);
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n),b(n); for(auto&&i:a)cin>>i; for(auto&&i:b)cin>>i;
	for(auto i=a.begin()+1;i!=a.end();++i)*i+=*(i-1);
	for(auto i=b.rbegin()+1;i!=b.rend();++i)*i+=*(i-1);
	int ans=0;
	for(int i=0;i<n;++i)ans=max(ans,a.at(i)+b.at(i));
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
a.sort()
a_left, a_right = a[0], a.pop()
minus, plus = [], []
for i in range(1, n - 1):
    if a[i] < 0:
        minus.append(a[i])
    else:
        plus.append(a[i])

ans_list = []
for i in range(len(minus)):
    ans_list.append([a_right ,minus[i]])
    a_right -= minus[i]
for i in range(len(plus)):
    ans_list.append([a_left ,plus[i]])
    a_left -= plus[i]
ans_list.append([a_right, a_left])

print(a_right - a_left)
[print(*ans_list[i]) for i in range(n-1)]

Measured memory_bytes: 24032
#include<stdio.h>
int main(){
  int n,m,i,j,s,p,o,max,k;
  while(scanf("%d %d",&n,&m),n||m){
    short d[40][1<<16]={1};
    int h[40]={0};
    int t[40]={0};
    for(i=0;i<n+m;i++){
      for(j=0;j<16;j++){
	scanf("%d",&s);
	if(i<n)h[i  ]=h[i  ]*2+s;
	else   t[i-n]=t[i-n]*2+s;
      }
    }
    for(i=max=0;i<n;i++){
      for(j=0;j<1<<16;j++){
	if(d[i][j]==0)continue;
	for(k=0;k<m;k++){
	  s=(j|h[i])&(~t[k]);
	  o=(j|h[i])&t[k];
	  for(p=0;o;o/=2)p+=o%2;
	  if(d[i+1][s]<d[i][j]+p)d[i+1][s]=d[i][j]+p;
	  if(max<d[i+1][s])max=d[i+1][s];
	}
      }
    }
    printf("%d\n",max-1);
  }
  return 0;
}

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

using namespace std;

int N, M;
char S[301][301];
int cost[301][301];
int dp[301][301];

int solve(int a, int b)
{
    for(int i=0; i<=N; i++)
    {
        for(int j=0; j<=N; j++)
        {
            if(i==0 || j==0)
            {
                cost[i][j]=0;
                dp[i][j]=0;
            }
            else
            {
                cost[i][j]=cost[i-1][j-1]+(S[i-1][a]==S[j-1][b]);
                dp[i][j]=min(dp[i-1][j], dp[i][j-1])+cost[i][j];
            }
        }
    }
    return dp[N][N];
}

int main()
{
    scanf("%d%d", &N, &M);
    for(int i=0; i<N; i++)
        scanf("%s", S[i]);
    long long ans=0;
    for(int i=1; i<M; i++)
        ans+=solve(i-1, i);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1152
from heapq import heappush, heappop
def main():
    H, W = map( int, input().split())
    C = [ list( map( int, input().split())) for _ in range(10)]
    A = [ list( map( int, input().split())) for _ in range(H)]
    h = [(0,1)]
    V = [-1]*10
    while h:
        # print(h)
        m, n = heappop(h)
        if V[n] > -1:
            continue
        V[n] = m
        for i in range(10):
            if V[i] == -1:
                heappush(h, (m+C[i][n],i))
    # print(V)
    ans = 0
    for a in A:
        for b in a:
            if b > -1:
                ans += V[b]
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 9300
#include <bits/stdc++.h>
#define ll long long int
#define N 1000
#define M 1000000007
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define mp make_pair
#define bs binary_search
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
  * @author :: Rishabh
  *
  */
int main()
{
	ibs;
	cti;
	ll n;
	cin>>n;
	ll a[n][3];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i][0];
		cin>>a[i][1];
		cin>>a[i][2];
	}
	ll dp[n][3];
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1]+a[i][0],dp[i-1][2]+a[i][0]);
		dp[i][1]=max(dp[i-1][0]+a[i][1],dp[i-1][2]+a[i][1]);
		dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][0]+a[i][2]);
	}
	ll ans=0;
	ans=max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 4992
#include <cstdio>
#include <utility>
#include <cctype>
#include <algorithm>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
struct range{
	int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

int main() {
	for (;;) {
		int r {}, o {};
		do {
			int n;
			scanf("%d", &n);
			if (n > 1)
				r += min(10, n);
			else if (n == 1)
				o++;
			else
				return 0;
		} while (gcu() != '\n');
		if (o > 0)
			r += (r += o - 1) + 11 <= 21 ? 11 : 1;
		outl(r > 21 ? 0 : r);
	}
}


Measured memory_bytes: 2620