akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

#define INF 1LL<<60



  int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    REP(i, S.size()){
      S.at(i) += N;
      if(S.at(i) > 'Z') S.at(i) -= 'Z' - 'A' + 1;
    }
     print(S);
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    rep(j,2){
    rep(i,n){
        cin >> a[j][i];
    }
    }
    int ans = 0;
    rep(i,n){
        int tmp = 0;
        int cur = 0;
        rep(j,n){
            tmp += a[cur][j];
            if(j==i){
                cur++;
                tmp += a[cur][j];
            }
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7

n,k = map(int,readline().split())
LR = [list(map(int,readline().split())) for i in range(k)]



dp = [0]*(2*n+10)

imos = [0]*(2*n+10)
dp[1] = 1
for i in range(1,n+1):
    imos[i] = (imos[i-1]+imos[i])%mod
    dp[i] = (dp[i]+imos[i])%mod
    for (l,r) in LR:
        imos[i+l] += dp[i]
        imos[i+r+1] -= dp[i]

print(dp[n])




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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	const int card[] = {13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
	int a, b;
	cin >> a >> b;
	if(card[a-1] < card[b-1]){
		cout << "Bob" << endl;
	}
	else if(card[a-1] > card[b-1]){
		cout << "Alice" << endl;
	}
	else{
		cout << "Draw" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	cout<<max3(a+a-1,b+b-1,a+b)<<endl;	
	return 0;
}

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

#define SZ(x) (((int)x.size()))
#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

int a, b, k;

int main()
{
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++)
	{
		if (i % k == 0)
		{
			cout << "OK";
			return 0;
		}
	}
	cout << "NG";
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<climits> //INT_MIN/MAX
using namespace std;

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

#define FOR(i,s,e) for(ll (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(ll (i)=(s);(i)>(e);(i)--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = { 0,0,1,-1,1,1,-1,-1 };
int dy[8] = { 1,-1,0,0,1,-1,1,-1 };

/* -----  xtimex  Problem: ABC 057 C / Link:  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

ll N;

ll ans = INF;

ll sss(ll a) {
    ll cnt = 0;
    while (a > 0) {
        a /= 10;
        cnt++;
    }
    return cnt;
}

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

	cin >> N;
    vector<ll> v;
    FOR(i, 1, sqrt(N) + 1) {
        if (N%i == 0) {
            v.push_back(i);
        }

    }
    FOR(i, 0, v.size()) {
        ll a = v[i];
        ll b = N/a;
        ll aa = sss(a);
        ll bb = sss(b);
        ll temp = max(aa, bb);
        ans = min(temp, ans);
    }

	cout << ans << endl;

	return 0;
}


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

int main(){
  int W,H;
  cin>>W>>H;

  int x,y,r;
  cin>>x>>y>>r;

  if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

 return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
vector <long long> memo(88,-1);


long long ryuka(int n){
  if(memo[n]!=-1){
    return memo[n];
  }
    return memo[n]=ryuka(n-2)+ryuka(n-1);
  }
  
int main(){
  int N;
  cin >>N;
  memo[0]=2;
  memo[1]=1;
  cout<<ryuka(N)<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())
a = ['#' + input() + '#' for _ in range(h)]
b = ['#' * (w + 1)] * 2
r = 0
for i in range(1, h + 1):
  for j in range(1, w + 1):
    if a[i - 1][j] == '.':
      b[1: -1] = map(list, a)
      b[i][j] = 0
      q = deque([(i, j)])
      while(q):
        i, j = q.popleft()
        r = max(r, b[i][j])
        d = 0
        for i1 in range(i - 1, i + 2):
          for j1 in range(j - d, j + 2, 2):                
            if b[i1][j1] == '.':
              b[i1][j1] = b[i][j] + 1
              q.append((i1, j1))
          d ^= 1
print(r)


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N)
    {
        cin >> A[i];
    }

    sort(ALL(A));

    const ll maxA = 1000000;
    ll ans = 0;
    vector<bool> isA(maxA + 1, false);
    REP(i, N)
    {
        if (i - 1 >= 0 && A[i] == A[i - 1])
        {
            isA[A[i]] = true;
            continue;
        }
        if (i + 1 < N && A[i] == A[i + 1])
        {
            isA[A[i]] = true;
            continue;
        }
        bool flag = true;
        vector<ll> divV = divisor(A[i]);
        divV.pop_back();
        REPV(it, divV)
        {
            if (isA[*it])
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            ans++;
        }
        isA[A[i]] = true;
    }

    cout << ans << endl;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define		int 			long long int
#define		pb				push_back
#define		fi(n)			for(int i=0;i<n;i++)
#define		fj(n)			for(int j=0;j<n;j++)
#define		fi1(n)			for(int i=1;i<n;i++)
#define		fj1(n)			for(int j=1;j<n;j++)
#define		rep(z,a,n)		for(z=a;z<n;z++)
#define		rep2(z,a,n)		for(z=a;z<n;z+=2)
#define		clr(x)			memset(x, 0, sizeof(x))
#define		print(x,n)		for(int i=0;i<n;i++) cout<<x[i]<<" ";  cout<<"\n"
#define		nl 				"\n"
#define		vi				vector<int>
#define		pairi			pair<int,int>
#define		vpairi			vector<pair<int,int>>
#define		ff				first
#define		ss				second
#define		inf 			2e18
#define		setp(val,n)		cout<<fixed;cout<<setprecision(n)<<val<<nl;			
#define 	input 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//input.txt"
#define 	output 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//output.txt"
#define 	error 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//error.txt"
int ctoi(char a){ int x=a-48;return x;}
string itos(int a){
	string out_string;
	stringstream ss;
	ss<<a;
	out_string=ss.str();
	return out_string;
}
char itoc(int a){ return itos(a)[0];}
int pow(int e,int x){
	int ans=1;
	while(x>0){
		if(x&1) ans*=e;
		e*=e;
		x>>=1;
	}return ans;
}
string bin(int x){
	bitset<sizeof(1)*CHAR_BIT> bits(x);
	string b=bits.to_string(); return b;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int T=1;
	// cin>>T;
	while(T--){
		int n,budget;
		cin>>n>>budget;
		int val[n];clr(val);
		int wt[n];clr(wt);
		fi(n)
			cin>>wt[i]>>val[i];

		int dp[n+1][budget+1];clr(dp);
		fi(n+1){
			fj(budget+1){
				if(i==0 || j==0)
					dp[i][j]=0;
				else if(j<wt[i-1])
					dp[i][j]=dp[i-1][j];
				else{
					dp[i][j]=max(dp[i-1][j],dp[i-1][j-wt[i-1]]+val[i-1]);
				}
			}
		}
		// fi(n+1){
		// 	fj(budget+1){
		// 		cout<<dp[i][j]<<" ";
		// 	}
		// 	cout<<nl;
		// }

		cout<<dp[n][budget]<<nl;
		
	}
	return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    reps(i,1,3501){
        reps(j,1,3501){
            ll bunbo=4*i*j-N*i-N*j;
            if(bunbo<=0) continue;
            if(N*i*j%bunbo==0){
                cout<< i <<" "<< j <<" "<< N*i*j/bunbo <<"\n"; return;
            }
        }
    }

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;

void swap(int &X, int &Y) {
    int tmp = X;
    X = Y;
    Y = tmp;
} 

void Main() {
    // input
    int X, Y, Z;
    cin >> X >> Y >> Z;


    // translate
    swap(X, Y);
    swap(X, Z);


    // output
    cout << X << " " << Y << " " << Z << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N; cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  double val = v.at(0);
  for (int i = 1; i < N; i++) {
    val = (val + (double)v.at(i)) / 2.0;
  }
  cout << val << endl;

  return 0;
}



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

using namespace std;

ifstream fin("carte.in");
ofstream fout("carte.out");

long long n, dp[100002], v[100002], k;

int main()
{
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  dp[1] = 0;
  for (int i = 2; i <= n; i++)
    dp[i] = (1ll << 60);
  for (int i = 2; i <= n; i++) {
    for (int j = i - 1; j >= max(i - k, 1ll); j--)
      dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
  }
  cout << dp[n];
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cassert>
#include <set>

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.length();
	vector <int> cnt;
	vector <long long> stuff;
	int l = 0, r = 0;
	while (r < n) {
		while (r < n && s[l] == s[r]) {
			++r;
		}
		stuff.push_back(r - l);
		l = r;
	}
	
	// 0 1 2 3 4 5 6
	//  < < < < < <
	//  > > > >
	// 6 3 2 1 0
	// 1 2
	// ><<>
	// 1 0 1 2 0
	long long result = 0;
	int i = 0;
	if (s[0] == '>') {
		result = stuff[0] * (stuff[0] + 1) / 2;
		++i;
	}
	// (6 + 1) / 2 * 6
	const int m = stuff.size();
	for (; i + 1 < m; i += 2) {
		long long a = stuff[i];
		long long b = stuff[i + 1];
		result += b * (b + 1) / 2;
		result += a * (a + 1) / 2;
		result -= min(a, b);
	}
	if (i < m) {
		result += stuff[i] * (stuff[i] + 1) / 2;
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 3068
// IOI 2021
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

bool A[N], B[N];
int L[N], R[N];

bool CMP(pii a, pii b) { return a > b; }
int F(string &a, string &b) {
	int n = sz(a);
	for (int i = 0; i < 3 * n; i++) A[i] = a[i % n] - '0', B[i] = b[i % n] - '0';
	for (int i = 1; i < 3 * n; i++) L[i] = B[i] ? 0 : L[i - 1] + 1;
	for (int i = 3 * n - 2; i >= 0; i--) R[i] = B[i] ? 0 : R[i + 1] + 1;
	int ans = n + n;
	for (int d = 0; d <= n; d++) {
		vector<pii> v;
		for (int i = n; i < n + n; i++) if (A[i] != B[i + d]) v.push_back(make_pair(L[i], R[i]));
		sort(all(v), CMP);
		int mx = d;
		for (pii p : v) ans = min(ans, sz(v) + 2 * (p.first + mx) - d), mx = max(mx, p.second);
		ans = min(ans, sz(v) + 2 * mx - d);
	}
	return ans;
}

int main() {
 
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	string a, b; cin >> a >> b;
	bool ca = 1, cb = 1;
	for (int i = 0; i < sz(a); i++) ca &= (a[i] == '0'), cb &= (b[i] == '0');
	if (cb && ca) die(0);
	if (cb && !ca) die(-1); 
	int ans = F(a, b);
	reverse(all(a)), reverse(all(b));
	ans = min(ans, F(a, b));
	cout << ans << endl;

	return 0;
}


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

int main(){
    int N,T; cin >> N >> T;
    vector <int> A(N);
    rep(i,N) cin >> A[i];
    int ans=0;
    
    rep(i,N-1){
        if (A[i+1]-A[i]<T) ans+=A[i+1]-A[i];
        else ans+=T;
    }
    ans+=T;
    cout << ans;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

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

    rep(i, s.size()) {
        if (s[i] != 'a') {
            int c = 'z'-s[i]+1;
            if (K >= c) {
                s[i] = 'a';
                K -= c;
            }
        }
    }
    if (K > 0)
        s.back() = 'a' + (s.back()-'a' + K)%26;

    cout << s << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>

using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;
#define IFYES(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} 
#define IFYes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} 
#define IFyes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} 
#define DEBUG_OUTPUT_ARRAY(XXX,ONE) for(int i=0;i<(ONE);i++){cout<<"DEBUG: i = "<<i<<" -> "<<XXX[i]<<endl;}
#define DEBUG_OUTPUT_ARRAY2(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<"<<< i = "<<i<<" >>>"<<endl;for(int j=0;j<(TWO);j++){cout<<"DEBUG: j = "<<j<<" -> "<<XXX[i][j]<<endl; } }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<i<<"  ";for(int j=0;j<(TWO);j++){cout<<XXX[i][j]<<" "; } cout<<endl;}

typedef pair<long long int,long long int> pll;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int N,M,sum=0,res=0;

string str;

int main() {
	cout << fixed << setprecision(18);
    
    cin>>N>>M;
    while(N!=0){
        res++;
        N/=M;
    }
    cout<<res;
} 


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	int sum=0, k=0;
	while(sum<n){
		sum+=k;
		k++;
	}
	if(n!=k*(k-1)/2){
		cout << "No" << endl;
		return 0;
	}

	vector<int> v[1000];
	v[1].push_back(1);
	v[2].push_back(1);
	int l=1;
	for(int i=3; i<=k; i++){
		for(int j=1; j<i; j++){
			v[j].push_back(l+j);
			v[i].push_back(l+j);
		}
		l+=i-1;
	}

	cout << "Yes" << endl;
	cout << k << endl;
	for(int i=1; i<=k; i++){
		cout << v[i].size() << " ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j];
			if(j<v[i].size()-1) cout << " ";
		}
		cout << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+10; 

int cnt[N];
int main(){
  fast;
  int n;
  cin>>n;
  fill(cnt,0);
  FOR(i,1,n)
  {
  	int temp;
  	cin>>temp;
  	cnt[temp]++;
  	cnt[temp+1]++;
  	if(temp!=0)
  		cnt[temp-1]++;
  }

  int maxi=0;
  FOR(i,0,100000)
  {
  	maxi=max(maxi,cnt[i]);
  }
  cout<<maxi<<endl;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
 
int main(void)
{   int a,b;
    char o;
    for(int i=1;i>0;i++){
        scanf("%d %c %d",&a,&o,&b);
        if(o=='+')
        {
            printf("%d\n",a+b);
        }
        else if(o=='-')
        {
            printf("%d\n",a-b);
        }
        else if(o=='*')
        {
            printf("%d\n",a*b);
        }
        else if(o=='/')
        {
            printf("%d\n",a/b);
        }
        else if(o=='?') 
        {
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 2044
// ref. https://img.atcoder.jp/arc091/editorial.pdf

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, a, b;
  cin >> n >> a >> b;

  if (a+b-1 <= n && n <= a*b) { // ok
    vector<ll> ans;
    ll cur = 1; // current value
    ll remain = n-a;
    // Here, we print additional numbers (max: b-1 numbers) in each step.
    rep(iter, a) {
      ll now = min(remain, b-1);
      remain -= now;
      for (int i = cur+now; i >= cur; --i) { ans.push_back(i); }
      cur += now + 1;
    }

    rep(i, n) {
      cout << ans[i];
      if (i < n-1) { cout << " "; }
    }
    cout << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 6256
I=input;n,q=map(int,I().split());s=' %s '%I();l,r=0,n+1
for t,_,d in eval('I(),'*q)[::-1]:L=d<'R';R=1-L;l+=(t==s[l+1])*L-(t==s[l])*R;r+=(t==s[r])*L-(t==s[r-1])*R
print(r-l-1)

Measured memory_bytes: 220188
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N, S;
  cin >> N >> S;
  vector<int64_t> A(N);
  rep(i, N) cin >> A[i];

  const int64_t mod = 998244353;
  vector<vector<int64_t>> DP(N + 1, vector<int64_t>(S + 1, 0));
  DP[0][0] = 1;
  rep(i, N) {
    for (int j = S; j >= 0; --j) {
      DP[i + 1][j] += (DP[i][j] * 2L) % mod;
      DP[i + 1][j] %= mod;

      int nj = j + A[i];
      if (nj <= S) {
        DP[i + 1][nj] += (DP[i][j]) % mod;
        DP[i + 1][nj] %= mod;
      }
    }
  }

  cout << DP[N][S] << endl;
  return 0;
}


Measured memory_bytes: 73760
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  s[3]='8';
  pr(s);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b, x;

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

	x = (a + b);

	if (x % 2 == 0)
		printf("%d\n", x / 2);
	else
		printf("%d\n", (x / 2) + 1);

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int a = nextInt();
        int b = nextInt();
        int c = nextInt();
        int[] arr = {a,b,c};
        int k = nextInt();

        int aa = 0;
        int bb = 0;
        int cc = 0;
        for(aa=0;aa<=k;aa++){
            for(bb=0;bb<=k;bb++){
                for(cc=0;cc<=k;cc++){
                    if(aa+bb+cc<=k){
                        arr[0]=nibai(arr[0],aa);
                        arr[1]=nibai(arr[1],bb);
                        arr[2]=nibai(arr[2],cc);
                        if(arr[2]>arr[1] && arr[1]>arr[0]){
                            print("Yes");
                            System.exit(0);
                        }
                        else{
                            arr[0] = a;
                            arr[1] = b;
                            arr[2] = c;
                        }
                    }
                }
            }
        }
        print("No");
    }
    public static int nibai(int num, int con){
        for(int i=0;i<con;i++){
            num*=2;
        }
        return num;
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

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

inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}

int main()
{
	int n,a,m,s;
	n=read();m=s=0;
	for (int i=1;i<=n;i++)
	{
		a=read();m=max(a,m);s+=a;
	}
	if (m<s-m) printf("Yes\n");else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
def main():
  import bisect
  
  n = int(input())
  s = list(input())
  q = int(input())
  
  d = {}
  for i in range(26):
    d[chr(ord('a')+i)] = []
  for i in range(n):
    d[s[i]].append(i)
  #print(d)
  
  for i in range(q):
    t,a,b = input().split()
    if t == '1':
      a = int(a)-1
      if s[a] == b:
        continue
      #idx = bisect.bisect_left(d[s[a]],a)
      #d[s[a]].pop(idx)
      d[s[a]].remove(a)
      bisect.insort_left(d[b],a)
      s[a] = b
    else:
      a = int(a)-1
      b = int(b)-1
      c = 0
      for i in range(26):
        idx = bisect.bisect_left(d[chr(ord('a')+i)],a)
        if idx < len(d[chr(ord('a')+i)]) and d[chr(ord('a')+i)][idx] <= b:
          c += 1
      print(c)
  
main()

Measured memory_bytes: 107008
#include <iostream>
using namespace std;
int main(){
    int a,b,c,sum;
    cin >> a >> b >> c;
    
    sum = 0;
    for(int i = a;i<=b;i++){
        if(c % i == 0){
            sum += 1;
        }
    }
    cout << sum << '\n';
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    int x;
    cin >> x;
    a[x-1]++;
  }
  sort(a.begin(),a.end());
  vector<int> s(n+1,0);
  s[0]=0;
  rep(i,n){
    s[i+1]=s[i]+a[i];
  }
  for(int k=1;k<=n;k++){
  //  cout<<k<<endl;

    ll l=0;
    ll r=n+1;
    while(l+1<r){
      ll c=(l+r)/2;
      ll id=lower_bound(a.begin(),a.end(),c)-a.begin();
      ll sum=s[id]+c*(n-id);
    //  cout<<id<<"id"<<sum<<"sum"<<(c*k)<<"c"<<l<<"l"<<r<<"r"<<endl;
      if(sum<c*k){
        r=c;
      }
      else l=c;
    //  cout<<l<<"l"<<r<<"r"<<endl;

    }
    cout<<l<<endl;

  }
}


Measured memory_bytes: 5492
#include <stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    n=n%10;
    if(n==2 || n==4 || n==5 || n==7 || n==9){
        printf("hon\n");
    }else if(n==3){
        printf("bon\n");
    }else{
        printf("pon\n");
    }
    return 0;
}

Measured memory_bytes: 2088
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main (String[] args){
	    Scanner scan = new Scanner(System.in);
	    int N = Integer.parseInt(scan.next());

	    ArrayList<Integer> SList = new  ArrayList<Integer>();
	    int seiseki = 0;
	    for(int i = 0; i < N; i++){
	    	int S = Integer.parseInt(scan.next());
	    	SList.add(S);
	    	seiseki = seiseki + S;
	    }
	    Collections.sort(SList);
	    
	    if(seiseki % 10 != 0){
	    	System.out.println(seiseki);
	    }else{
	    	for(int s : SList){
	    		if(s  % 10 != 0){
	    			seiseki = seiseki - s;
	    			System.out.println(seiseki);
	    			break;
	    		}
	    	}
	    	if(seiseki % 10 == 0){
	    		System.out.println(0);
	    	}
	    }
	}
}

Measured memory_bytes: 22100
n, m = map(int, input().split())

cnt = [0] * -~n
for i in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1

for u in cnt:
    if u & 1:
        print("NO")
        exit()

print("YES")


Measured memory_bytes: 9596
#!/usr/bin/env python3
from copy import deepcopy
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]

last = {}
for i in range(26):
    last[i] = -1

s = 0
Ret = []
for d in range(D):
    sr = {}
    ll = {}
    for c in range(26):
        last_cp = deepcopy(last)
        s_cp = deepcopy(s)
        last_cp[c] = d
        s_cp += S[d][c]
        for i in range(26):
            s_cp -= C[i] * (d-last_cp[i])
        sr[c] = s_cp
        ll[c] = last_cp
    sr = sorted(sr.items(), key=lambda x:x[1])
    ret = sr[-1][0]
    s = sr[-1][1]
    last = deepcopy(ll[ret])
    Ret.append(ret+1)

for r in Ret:
    print(r)


Measured memory_bytes: 73204
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	long long d;
	cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		if (x*x+y*y <= d*d)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

// 24 4 6 --> 2
// 24 4 6 2 --> 1

const int mxN = 1e6 + 7;
int mult[mxN];

void flag(int n){
	for(int i = n; i < mxN; i += n){
		mult[i] = 1;
	}
}

void solve(){
	int n; cin >> n;
	int a[n];
	forn(i,0,n) cin >> a[i];
	sort(a,a+n);
	
	// duplicates
	forn(i,1,n){
		if(a[i] == a[i-1] && !mult[a[i]]) flag(a[i]);
	}
	int ans = 0;
	forn(i,0,n){
		int elm = a[i];
		if(mult[elm]) continue;
		++ans;
		flag(elm);
	}
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 8332
#include<stdio.h>
int main(){
	int a,b,c,d,p,x,y,r;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	if(c>p){
		y=b;
	}else{
		y=b+(p-c)*d;
	}
	x=a*p;
	if(y<x){
		r=y;
	}else{
		r=x;
	}
	printf("%d\n",r);
	return 0;
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

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

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

class DigitVector {
  int origin;
  vector<int> digits;

  public:
    DigitVector(string s){
      origin = stoi(s);
      for(unsigned int i = 0; i < s.size(); i++) {
        digits.push_back(s[i] - '0');
      }
    }

    ~DigitVector() = default;

    int sum() {
      int total = 0;
      for(auto x:digits) {
        total += x;
      }
      return total;
    }

    int toInt() {
      return origin;
    }
};

int main(){
  string s;

  cin >> s;

  DigitVector * d = new DigitVector(s);

  bool flag = d->toInt() % d->sum() == 0 ? true : false;

  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
}


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

int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
if(i%10==3 || i%3==0 || (i/10)%10==3|| (i/100)%10==3 || (i/1000)%10==3){
cout<<" "<<i;
}
}
cout<<endl;
return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int ans=0;

//Union-Find 素集合データ構造
struct UnionFind {

    vector<int> sz; // sz[i]:iが根のとき、木のサイズ それ以外の値に意味はない
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : sz(N),par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++){
            sz[i] = 1;
            par[i] = i;
        }
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    int size(int x) { // データxが属する木の大きさを得る
        return sz[root(x)];
    }

    void unite(int x, int y) { //xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをryにつける
        sz[ry] += sz[rx];//yの大きさにxの大きさを足す
        //sz[rx]=-1;// 根でないデータの大きさに意味はない
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

};
void Main(){
    int n,m;cin>>n>>m;
    vector<int> p(n);
    For(i,0,n) {
        cin>>p[i];
        p[i]--;
    }
    UnionFind Tree(n);
    For(i,0,m){
        int x,y;cin>>x>>y;
        x--;y--;
        Tree.unite(x,y);
    }
    For(i,0,n) if(Tree.same(i,p[i])) ans++;
    cout<<ans<<endl; 
}
int main(){
    Main();
    return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 300000 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	3e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, p, m, y;
string s, t;
ld w;
ll a, b;


// <------------- Implement Functions Here ----------> //


// <------------- Implement Functions Here ----------> //

bool comp(ll &a, ll &b) {
	ll x = a%10; if(x == 0) x = 10;
	ll y = b%10; if(y == 0) y = 10;
	
	return x > y;
}

// <------------- Start of main() -------------------> //

void MAIN() {	
	ll a,b,c,d,e;
	vll A(5);
	cin >> a >> b >> c >> d >> e;
	
	A[0] = a;
	A[1] = b;
	A[2] = c;
	A[3] = d;
	A[4] = e;

	sort(all(A),comp);
	//DISP(A);

	a = A[0];
	b = A[1];
	c = A[2];
	d = A[3];
	e = A[4];

	ll t = 0;
	t += a;
	t = (t+9)/10 * 10;
	t += b;
	t = (t+9)/10 * 10;
	t += c;
	t = (t+9)/10 * 10;
	t += d;
	t = (t+9)/10 * 10;
	t += e;
	cout<<t;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3612
import java.util.*;

public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), x = sc.nextInt();
		int a[] = new int[n];
		for(int i=0;i<n;i++)a[i] = sc.nextInt();
		long ans = 0;
		for(int i=0;i<n-1;i++) {
			if(a[i]+a[i+1]>x) {
				long t = (long)a[i] + a[i+1] - x;
				ans += t;
				a[i+1] = (int)Math.max((long)a[i+1]-t, 0);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 50468
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();

		sc.close();

		out.print(n + ":");

		List<Integer> ans = new ArrayList<>();

		for (int i = 2; i * i <= n; i++) {
			while (n % i == 0) {
				ans.add(i);
				n /= i;
			}
		}

		// 1以外が残るのは、元のnが素数だった場合
		if (n != 1) {
			ans.add(n);
		}

		for (int x : ans) {
			out.print(" " + x);
		}
		out.println();
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}



Measured memory_bytes: 26332
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    var h = in.readLine().toLong

    var count = 0
    while (h > 0) {
      h >>= 1
      count += 1
    }

    h = 1

    for {
      i <- 1 to count
    } {
      h <<= 1
    }

    System.out.println(h - 1)
  }
}


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

int main(){
  long long n,a,b;
  cin >> n >> a >> b;
  if(n==1&&a!=b)cout << 0 << endl;
  else if(a>b)cout << 0 << endl;
  else cout << (b-a)*(n-2)+1<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int s = 0;
		int n = sc.nextInt();
		int[] a = new int[n], b = new int[n], c = new int[n-1];

		for(int i = 0; i < n; i++) a[i] = sc.nextInt();
		for(int i = 0; i < n; i++) b[i] = sc.nextInt();
		for(int i = 0; i < n - 1; i++) c[i] = sc.nextInt();

		for(int i = 0; i < n; i++) {
			s += b[a[i] - 1];
			if(i != 0 && a[i - 1] + 1 == a[i]) s += c[a[i] - 2];
		}

		System.out.println(s);
	}
}

Measured memory_bytes: 35828
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;
struct Point {
	ll x, y;
	Point(){}
	Point(ll xx, ll yy): x(xx), y(yy){}
};


int main() {
	ll h, w;
	cin >> h >> w;
	vector<vector<bool>> grid;
	grid.resize(h);
	vector<vector<ll>> distance;
	distance.resize(h);
	ll numTrue = 0;
	for (ll i = 0; i < h; i++) {
		grid[i].resize(w);
		distance[i].resize(w);
		string str;
		cin >> str;
		for (ll j = 0; j < w; j++) {
			if (str[j] == '.') {
				grid[i][j] = true;
				numTrue++;
			}
			distance[i][j] = -1;
		}
	}
	queue<Point> Q;
	Q.push(Point(0, 0));
	distance[0][0] = 0;
	while (!Q.empty()) {
		Point now = Q.front();
		Q.pop();
		ll nowDis = distance[now.x][now.y];
		Point tmp[4];
		for (ll i = 0; i < 4; i++) {
			tmp[i] = now;
		}
		tmp[0].x++;
		tmp[1].x--;
		tmp[2].y++;
		tmp[3].y--;
		for (ll i = 0; i < 4; i++) {
			if (0 <= tmp[i].x && tmp[i].x < h && 0 <= tmp[i].y && tmp[i].y < w && distance[tmp[i].x][tmp[i].y] == -1 && grid[tmp[i].x][tmp[i].y] == true) {
				distance[tmp[i].x][tmp[i].y] = nowDis + 1;
				Q.push(tmp[i]);
			}
		}
	}
	if (distance[h - 1][w - 1] == -1) {
		cout << -1 << endl;
	}
	else {
		cout << numTrue - distance[h - 1][w - 1] - 1 << endl;
	}
}


Measured memory_bytes: 3608
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, sqrt
from operator import mul
from functools import reduce
from operator import mul
from pprint import pprint
from copy import deepcopy



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 2


n = I()
s = S()
l = len(s)
L = []
one_cnt = 0
for i in range(l - 1):
    ret = abs(int(s[i]) - int(s[i + 1]))
    L += [ret]
    if ret == 1:
        one_cnt += 1

m = 0
for j in range(l - 1):
    m += int(l - 2 & j == j) * L[j]
    m %= 2

if m % 2:
    print(1)
    exit()
else:
    if one_cnt:
        print(0)
    else:
        L = [k // 2 for k in L]
        ret2 = 0
        for jj in range(l - 1):
            ret2 += int(l - 2 & jj == jj) * L[jj]
            ret2 %= 2
        if ret2:
            print(2)
        else:
            print(0)














Measured memory_bytes: 216444
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int N, i, ali = 0, bob = 0;
  int a[100];
  cin >> N;
  for (i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a, a+N, greater<int>());
  for (i = 0; i < N; i++){
    if (i%2 == 0){
      ali += a[i];
    }else{
      bob += a[i];
    }
  }
  int out;
  out = ali - bob;
  cout << out;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,W,i,j;
	
	cin>>n>>W;
	long long int ans[n+10][W+10];
	long long int v[n+10];
	long long int w[n+10];
	for(i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
	}
	long long int t=0;
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=W;j++)
		{
			if(i==0||j==0)
			{
				ans[i][j]=0;
			}
			else if(w[i]<=j)
			{
				ans[i][j]=max(v[i]+ans[i-1][j-w[i]],ans[i-1][j]);
			}
			else
			{
				ans[i][j]=ans[i-1][j];
			}
		}
	}
	
	cout<<ans[n][W]<<endl;
	
}

Measured memory_bytes: 80640
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	while (1) {
		int n; scanf("%d", &n);
		if (n == 0) break;
		vector<int> x(n, -inf), y(n, -inf);
		x[0] = y[0] = 0;
		vector<vector<pair<int, int>>> g(n);
		for (int i = 1; i <= n - 1; i++) {
			int a, b; scanf("%d %d", &a, &b);
			int c;
			if (b == 0) c = 2;
			if (b == 1) c = 3;
			if (b == 2) c = 0;
			if (b == 3) c = 1;
			g[a].emplace_back(i, b);
			g[i].emplace_back(a, c);
		}
		queue<int> q;
		q.push(0);
		while (!q.empty()) {
			int cur = q.front();
			q.pop();
			for (auto next : g[cur]) {
				if (x[next.first] != -inf) continue;
				if (next.second == 0) {
					x[next.first] = x[cur] - 1;
					y[next.first] = y[cur];
				}
				if (next.second == 1) {
					x[next.first] = x[cur];
					y[next.first] = y[cur] - 1;
				}
				if (next.second == 2) {
					x[next.first] = x[cur] + 1;
					y[next.first] = y[cur];
				}
				if (next.second == 3) {
					x[next.first] = x[cur];
					y[next.first] = y[cur] + 1;
				}
				q.push(next.first);
			}
		}
		sort(x.begin(), x.end());
		sort(y.begin(), y.end());
		printf("%d %d\n", x.back() - x[0] + 1, y.back() - y[0] + 1);
	}
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}



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


long long a[20][20], w[1<<16] = {0};

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }
  for (int S = 0; S < (1<<n); ++S) {
    for (int i = 0; i < n; ++i) if (S&(1<<i)) {
      for (int j = 0; j < i; ++j) if (S&(1<<j)) {
        w[S] += a[i][j];
      }
    }
    w[S] = max(w[S], 0ll);
  }
  for (int S = 0; S < (1<<n); ++S) {
    for (int SS = S^(S&-S); SS; SS = S&(SS - 1)) {
      w[S] = max(w[S], w[SS] + w[SS^S]);
    }
  }
  cout << w[(1<<n) - 1] << '\n';
}


Measured memory_bytes: 768