akhauriyash/Code-Regression huggingface dataset:
IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC046-A.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 STR PIC X(11).
       77 A PIC 9(3).
       77 B PIC 9(3).
       77 C PIC 9(3).

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
               ACCEPT STR FROM SYSIN.
               UNSTRING STR DELIMITED " "
               INTO A B C.
               IF A = B AND B = C THEN
                   DISPLAY 1
               ELSE IF A = B AND B NOT= C THEN
                   DISPLAY 2
               ELSE IF B = C AND C NOT= A THEN
                   DISPLAY 2
               ELSE IF C = A AND A NOT= B THEN
                   DISPLAY 2
               ELSE
                   DISPLAY 3
               END-IF.
               STOP RUN.
       END PROGRAM ABC046-A.


Measured memory_bytes: 384
N, P=map(int, input().split())
A=list(map(int, input().split()))
odd=[]
even=[]
for a in A:
  if a%2==0:
    even.append(a)
  else:
    odd.append(a)
amod=len(odd)
amev=len(even)
evonly=2**amev

from math import factorial
if P==0:
  evod=0
  i=0
  while amod>=i:
    evod+=factorial(amod)//(factorial(i)*factorial(amod-i))
    i+=2
  print(evonly*evod)
else:
  evod=0
  i=1
  while amod>=i:
    evod+=factorial(amod)//(factorial(i)*factorial(amod-i))
    i+=2
  print(evonly*evod)

Measured memory_bytes: 3064
// https://atcoder.jp/contests/dp/tasks/
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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() {
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;

    vector<double> p(n);
    vector<double> sum(n);

    rep(i, n) { cin >> p[i]; }

    int left = 0;
    int right;
    for (right = left; right < left + k; right++) {
        sum[left] += p[right] + 1.0;
    }
    // printf("l: %d, r: %d, sum: %lf\n", left, right, sum[left]);
    left++;

    for (; right < n; left++) {
        sum[left] = sum[left - 1] + p[right] + 1.0 - (p[left - 1] + 1.0);
        // printf("l: %d, r: %d, sum: %lf\n", left, right, sum[left]);
        right++;
    }

    sort(sum.begin(), sum.end());
    // rep(i, n) { cout << sum[i] << endl; }
    printf("%0.7lf\n", sum[n - 1] / 2);

    return 0;
}



Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll n,k;
    cin >> n >>k;
    if(k>(n-1)*(n-2)/2){
        cout << -1 <<endl;
        return 0;
    }
    cout << n-1+(n-1)*(n-2)/2-k <<endl;
    rep(i,n-1){
        cout << 1 << " " << i+2 <<endl;
    }
    ll cnt=(n-1)*(n-2)/2-k;
    if(cnt==0)return 0;
    rep(i,n-1){
        repl(j,i+1,n-1){
            cout << i+2 <<" " <<j+2 <<endl;
            cnt--;
            if(cnt==0)return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

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

    set<string> S;

    for(int i = 0; i < N; i++){
        string s;
        cin >> s;

        S.insert(s);
    }

    cout << S.size() << endl;

    return 0;
}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> L){
    sort(L.begin(), L.end());
    long long sum = 0;
    REP(i, N - 1) sum += L[i];
    if (sum > L[N - 1]) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(L));
    return 0;
}


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

int main() {
  int r,c;
  cin >> r >> c;
  
   vector<vector<int> > data(r+1, vector<int>(c+1,0));

  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> data.at(i).at(j);
    }
  }
  
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      data.at(i).at(c) += data.at(i).at(j);
    }
  }
  for (int j = 0; j < c; j++) {
    for (int i = 0; i < r; i++) {
      data.at(r).at(j) += data.at(i).at(j);
    }
  }
  
  for (int j = 0; j < c; j++) {
    data.at(r).at(c) += data.at(r).at(j);
  }
  
  for (int i = 0; i < r + 1; i++) {
    for (int j = 0; j < c + 1; j++) {
      cout << data.at(i).at(j);
      if (j == c){
        cout << endl;
      }
      else  {
        cout << ' ';
      }
    }
  }
}
  


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vl v(n);
	vl r(n),l(n);
	rep(i,n)cin>>v[i];
	ll gc=0;
	rep(i,n){
		l[i]=gc;
		gc=gcd(gc,v[i]);
	}
	gc=0;
	rrep(i,n){
		r[i]=gc;
		gc=gcd(gc,v[i]);
	}
	ll ans=0;
	rep(i,n){
		chmax(ans,gcd(l[i],r[i]));
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[100005];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    a[0]=0;
    a[n+1]=0;
    unsigned long long res=0;
    for(int i=1;i<=n+1;i++){
        res+=abs(a[i]-a[i-1]);
    }
    for(int i=1;i<=n;i++){
        cout<<res-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<endl;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define INF            1e9
#define REP(i,n)       for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)      for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n)  for(lint i=(ini),i##_len=(n);i<i##_len;++i)
#define REPR(i,n)      for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)     for(lint i=(n);i>0;--i)
#define REPRI(i,ini,n) for(lint i=(ini)-1,i##_len=(n);i>=i##_len;--i)
#define REPC(i,obj)    for(auto i:obj)
#define R_UP(a,b)      (((a)+(b)-1)/(b))
#define ALL(obj)       (obj).begin(),(obj).end()
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
signed main()
{
	string str = in<string>();
	vector<int>pond;
	int pond_sum = 0, pond_temp = 0, pond_end = -1;
	REP(i, str.size())
	{
		if (i == pond_end)
		{
			pond.push_back(pond_temp);
			pond_sum += pond_temp;
			pond_temp = 0;
			pond_end = -1;
		}
		else if (str[i] == '\\')
		{
			int cnt = 0;
			REPI(j, i + 1, str.size())
			{
				if (str[j] == '/')
				{
					if (cnt-- == 0)
					{
						if (pond_end == -1)pond_end = j;
						pond_temp += j - i;
						break;
					}
				}
				else if (str[j] == '\\') cnt++;
			}
		}
	}
	cout << pond_sum << endl;
	cout << pond.size();
	REPC(i, pond) cout << ' ' << i;
	cout << endl;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n,c,k;
  cin >> n >> c >> k;
  vector<int> t(n);
  for(int i=0;i<n;i++){
    cin >> t[i];
  }
  sort(t.begin(),t.end());
  if(c==1) {
    cout << n << endl;
    return 0;
  }
  int now=t[0],count=1;
  int ans=1;
  for(int i=1;i<n;i++){
    if(t[i]>now+k||count==c){
      ans++;
      now=t[i];
      count=1;
    }else{
      count++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
k,n = map(int,input().split())
A = list(map(int,input().split()))
B = []
for i in range(1,n+1):
    if i == n:
        B.append(A[0]+k-A[n-1])
    else:
        B.append(A[i]-A[i-1])
print(k-max(B))

Measured memory_bytes: 26444
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
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; }



int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  cout << s[0] << s[1] << s[2] << endl;
  return 0;
}

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

int main(){
    ll n;
    cin >> n;
    ll n2,ans,ans2;
    n2=ll(pow(n,0.5));

    rep(i,n2+2){
        if(n%(n2+1-i)==0){
            ans=n2+1-i;
            break;
        }
    }

    //cout << n2 << ans << endl;

    ans2=n/ans;

    ans=max(ans,ans2);

    int k;
    k=1;
    while(ans>=10){
        ++k;
        ans/=10;
    }

    cout << k << endl;

    
    

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	map<int, int> m;
	rep(i, n){
		int in;
		cin >> in;
		m[in]++;;
	}
	int ans = 0;
	rrepit(ritr, m){
		int p1 = ritr->first;
		int p1_sec = ritr->second;
		int p2 = pow(2, (int)log2(p1) + 1) - p1;
		if(p1 == p2){
			int add = p1_sec / 2;
			ans += add;
			m[p1] -= add;
		}else if(m.count(p2) == 1){
			int p2_sec = m[p2];
			int add = min(p1_sec, p2_sec);
			ans += add;
			m[p1] -= add;
			m[p2] -= add;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    string s; cin >> s;
    int l = 0, r = s.size() - 1, ans = 0;
    while(r - l > 0) {
        if(s[l] == s[r]) l++, r--;
        else {
            if(s[l] == 'x') l++;
            else if(s[r] == 'x') r--;
            else {
                cout << -1 << endl; return 0;
            }
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n, m, p;
    while(cin >> n >> m >> p, n) {
        vector<int> v(n+1);
        int sum=0;
        for(int i=0; i<n; ++i) {
            int x;
            cin >> x;
            v[i+1] = x;
            sum += x;
        }
        if(v[m] == 0) {
            cout << 0 << endl;
        } else {
            cout << sum*(100-p)/v[m] << endl;
        }   
    }
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;

#define MAX 200003
#define MOD 1000000007

int main(){
  int N,K;
  cin>>N>>K;
  if(K>(N-1)*(N-2)/2){
    cout<<-1<<endl;
  }else{
    cout<<N-1+(N-1)*(N-2)/2-K<<endl;
    for(int i=2;i<=N;i++){
      cout<<"1 "<<i<<endl;
    }
    int count=0;
    bool flag=false;
    for(int i=2;i<=N;i++){
      for(int j=i+1;j<=N;j++){
        if(count==(N-1)*(N-2)/2-K){
          flag=true;
          break;
        }
        cout<<i<<" "<<j<<endl;
        count++;
      }
      if(flag){
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 105

char S[SIZE],T[SIZE];

int main(){

	int N;
	scanf("%d",&N);

	scanf("%s %s",S,T);

	for(int i = 0; i < N; i++){

		printf("%c%c",S[i],T[i]);
	}

	printf("\n");

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)

	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		n, _ := strconv.Atoi(s[0])
		x, _ := strconv.Atoi(s[1])

		if n == 0 && x == 0 {
			return
		}
		cnt := 0
		for i := 1; i < n-1; i++ {
			for j := i + 1; j < n; j++ {
				for k := j + 1; k < n+1; k++ {
					if i+j+k == x {
						cnt++
					}
				}
			}
		}
		fmt.Println(cnt)
	}
}



Measured memory_bytes: 1100
#include <stdio.h>

main(){
  int data[1000], i, min2, j, k, n, min, ans[1000000], ans2[1000000];

  for(i=0;i<1000;i++){
    data[i]=(i+1)*(i+2)*(i+3)/6;
  }

  ans[0]=0;
  ans2[0]=0;
  for(i=1;i<1000000;i++){
    min=1000000;
    min2=1000000;
    for(j=0;data[j]<=i;j++){
      if(min>ans[i-data[j]]+1) min=ans[i-data[j]]+1;
      if(data[j]%2!=0){
	if(min2>ans2[i-data[j]]+1) min2=ans2[i-data[j]]+1;
      }
    }
    ans[i]=min;
    ans2[i]=min2;
  }
  while(1){
    scanf("%d", &n);
    if(n==0) break;
    printf("%d %d\n", ans[n], ans2[n]);
  }
  return 0;
}

Measured memory_bytes: 8028
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <cstring>
#include <iomanip>
#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1000000000
typedef long long  ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a /g* b ;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
int  GetDigit(T num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(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];
        }
};


int main()
{
    int N,K;
    cin >> N>>K;
    int a[N];
    REP(i,0,N){
        cin >> a[i];
    }
    bool dp[K + 1];
    REP(i, 0, K + 1)
    dp[i] = false;

    for(int i = 1; i <= K; i++){
		for(int j = 0; j < N; j++){
			if(i >= a[j]){
				dp[i] |= !dp[i-a[j]];
			}
		}
	}
    cout << (dp[K] ? "First" : "Second") << endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

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

    while (n != "0") {
        int result = 0;

        for (int i = 0; i < n.size(); i++)
            result += n[i] - '0';

        cout << result << endl;

        cin >> n;
    }

    return 0;
}



Measured memory_bytes: 3176
import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	n = int(input())
	h = list(map(int, input().split()))
	rec = [None] * n
	rec[0], rec[1] = 0, abs(h[1] - h[0])
	for i in range(2, n):
		rec[i] = min(abs(h[i] - h[i - 1]) + rec[i - 1], abs(h[i] - h[i - 2]) + rec[i - 2])
	ans = rec[-1]
	print(ans)

if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


Measured memory_bytes: 14484
#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>;

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

const long long INF = 1LL << 60;

int main(void){
	int n,x;cin >> n >> x;
	int ans = 0,t=10000000;
	rep(i,n){
		int a;
		cin >> a;
		x -= a;
		ans++;
		t = min(t,a);
	}
	while(x>=0){
		ans++;
		x -= t;
	}
	ans--;
	cout << ans << endl;	
	return 0;
}



Measured memory_bytes: 256
#include <set>
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define PII pair<int,int>
#define fi first
#define se second
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,b,a) for (int i=(b);i>=(a);--i)
typedef long long LL;
inline int read(){
    int x=0,f=1; char ch=getchar();
    while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
    while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
    return x*f;
}

const int MAXN=300005;
int n,m,a[305][305],d[305],b[305],c[305],v[305];
int cmp(int i,int j){ return b[i]>b[j]; }
int main(){
	n=read(); m=read();
	FOR(i,1,n)
		FOR(j,1,m) a[i][j]=read();
	memset(b,0,sizeof(b));
	FOR(i,1,n) b[a[i][d[i]=1]]++;
	FOR(j,1,m) c[j]=j;
	sort(c+1,c+1+m,cmp);
	//FOR(j,1,m) printf("%d %d\n",c[j],b[c[j]]);
	//printf("\n");
	memset(v,0,sizeof(v));
	int ans=b[c[1]];
	FOR(k,1,m-1) {
		v[c[1]]=1;
		FOR(i,1,n)
		if (a[i][d[i]]==c[1]){
			b[c[1]]--;
			while (v[a[i][d[i]]]) d[i]++;
			b[a[i][d[i]]]++;
		}
		sort(c+1,c+1+m,cmp);
		ans=min(ans,b[c[1]]);
		//FOR(j,1,m) printf("%d %d\n",c[j],b[c[j]]);
		//printf("\n");
	}
	cout<<ans<<endl;
	
    return 0;
}

/*
4 5
5 1 3 4 2
2 5 1 3 4
2 3 1 4 5
2 5 4 3 1

*/


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0055
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "";
            while (!((str = Console.ReadLine()) == null))
            {
                double[] input = new double[10];
                input[0] = double.Parse(str);
                input[1] = input[0] * 2;
                double sum = 0;
                for (int i = 2; i < 9; i += 2)
                {
                    input[i] = input[i - 1] /3;
                    input[i + 1] = input[i] *2;
                }
                for (int i = 0; i < 10; i++)
                {
                    sum += input[i];
                }
                Console.WriteLine("{0:f9}",sum);
            }
        }
    }
}



Measured memory_bytes: 15908
#include <stdio.h>

int min(int a, int b)
{
    return (a < b)? a: b;
}



int solve(int N, int K, int x[])
{
    int sum = 0;
    
    for (int i = 0; i < N; i++) {
        sum += 2 * min(x[i] - 0, K - x[i]);
    }
    return sum;
}



int main(void)
{
    int N, K, x[100];
    
    scanf("%d", &N);
    scanf("%d", &K);
    for (int i = 0; i < N; i++) {
        scanf("%d", &x[i]);
    }
    
    printf("%d\n", solve(N, K, x));
}


Measured memory_bytes: 128
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

abcde = [ni() for _ in range(5)]
k = ni()
if abcde[-1] - abcde[0] > k:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = [list(map(int,input().split())) for _ in range(Q)]
count = [0]*((10**5)+100)
for i in range(len(A)):
  count[A[i]] += 1
sumA = sum(A)
for q in range(Q):
  count[BC[q][1]] += count[BC[q][0]]
  sumA += (BC[q][1] - BC[q][0])*count[BC[q][0]]
  print(sumA)
  count[BC[q][0]] = 0        

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

using namespace std;

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

const ll maxn =8e5+5;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

int n , m ;

int main(){
    migmig
    cin >> n >> m;
    cout << ((n == m)? "Yes" : "No");


    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 256
using System;

namespace ACpra3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            int D = B / A;
            if(A > B)
            {
                Console.WriteLine(0);
            }else if(A * C <= B && A < B)
            {
                Console.WriteLine(C);
            }
            else 
            {
                Console.WriteLine(D);
            }
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
const int N=1e6+10;
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a>b?b:a;}
int main(){
    int n,l=1,r,a[N];
    scanf("%d",&n);
    r=n;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        a[i]/=10;
    }
    for(int i=1;i<=n;i++)if(l>=i)l=max(l,a[i]+i);
    else {
        printf("no\n");
        return 0;
    }
    for(int i=n;i>=1;i--)if(r<=i)r=min(r,i-a[i]);
    else {
        printf("no\n");
        return 0;
    }
    printf("yes\n");
}


Measured memory_bytes: 3772
// 提出時に消す


import java.util.Scanner;

// 提出時にMainに変更する
public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        StringBuilder ans = new StringBuilder();

        while (n != 0) {
            n--;
            ans.append((char) ('a' + n % 26));
            n /= 26;
        }

        ans = ans.reverse();

        System.out.println(ans);

        sc.close();
    }
}

Measured memory_bytes: 35632
let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i -> doit (sub s 0 i) (sub s (i + 1) (length s - i - 1) :: acc) in
  doit str []

let parent i = int_of_float ((float_of_int (i - 1)) /. 2.)

let left i = 2*i + 1

let right i = 2*i + 2

let to_pow_of_2 n =
  let rec doit i =
    if i >= n then i
    else doit (i * 2) in
  doit 1

let solve n q =
  let n = to_pow_of_2 n in
  let s = Array.make (2*n-1) 2147483647 in
  let update i x =
    let j = n + i - 1 in
    s.(j) <- x;
    let rec doit j =
      if j > 0 then begin
        let j = parent j in
        s.(j) <- min s.(left j) s.(right j);
        doit j
      end in
    doit j in
  let rec find a b k l r =
    if r <= a || b <= l then 2147483647
    else if a <= l && r <= b then s.(k)
    else min (find a b (left k) l ((l + r) / 2)) (find a b (right k) ((l + r) / 2) r) in
  let find a b = find a b 0 0 n in
  let rec doit i =
    if i < q then begin
      begin match List.map int_of_string (split (read_line ()) ' ') with
      | 0 :: x :: y :: _ -> update x y
      | 1 :: x :: y :: _ -> Printf.printf "%d\n" (find x (y + 1))
      | _ -> ()
      end;
      doit (i + 1)
    end in
  doit 0

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [n; q] -> solve n q
  | _ -> ()

Measured memory_bytes: 6472
#include<bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238462643383279;
int main()
{
	int a,b,h,m;
	scanf("%d %d %d %d",&a,&b,&h,&m);
	long double total_minute = h*60+m;
    long double degree = total_minute/2 - m*6.0;
	double rad = (double) degree * PI / 180.0;
	double x = (double) a*a + (double) b * b;
	double y = (double) 2 * a * b * cos(rad);
	printf("%.20lf",sqrt(x-y));
}

Measured memory_bytes: 4180
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <functional>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <set>
#include <queue>
#include <map>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int c=0;
	for(int i=1;i<=n;i++){
		if(a[a[i]]==i){
			c++;
			a[i]=0;
		}
	}
	cout<<c<<endl;
    return 0;
}

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

int main() {
    long long N;
    cin >> N;
    vector<long long> A(N + 1);
    vector<long long> B(N);
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];
        long long zero = 0;
    long long A_sum = accumulate(A.begin(), A.end(), zero);
    rep(i, N) {
        long long tmp = max(zero, B[i] - A[i]);
        A[i] = max(zero, A[i] - B[i]);
        A[i + 1] = max(zero, A[i + 1] - tmp);
    }
    long long A_sum2 = accumulate(A.begin(), A.end(), zero);
    cout << A_sum - A_sum2 << endl;
    return 0;
}

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

using namespace std;

int main(){
  int N,M;
  string s[100],t[100];
  cin >> N;
  for (int i=0;i<N;i++){
    cin >> s[i];
  }
  cin >> M;
  for(int i=0;i<M;i++){
    cin >> t[i];
  }

  int sum;
  int max=0;
  for(int i=0;i<N;i++){
    sum=0;
    for(int j=0;j<N;j++){
      if(s[i]==s[j]){
        sum++;
      }
    }
    for(int j=0;j<M;j++){
      if(s[i]==t[j]){
        sum--;
      }
    }
    if(sum > max){
      max=sum;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long   ll;
typedef pair<ll,ll> pll;
typedef long double ld; 
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define F            first
#define S            second
#define ios          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define hell   1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0) {if (y & 1) res = (res*x) % p;y = y>>1;
  x = (x*x) % p;} return res;} 

const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
ll euclid(ll x,ll y,ll a,ll b){
  return (a-x)*(a-x)+(b-y)*(b-y);
}
void solve()
{
  ll n,k;
  cin>>n>>k;
  ll i;
  std::vector<ll> v(n);
  rep(i,0,n)
  cin>>v[i];
  sort(all(v));
  ll ans=0;
  for(i=0;i<k;i++)
    ans+=v[i];
  cout<<ans;
}
int main()
{ 
  ios; 
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t=1,i=1;
  // sieve();
  // cin>>t;
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)

int n, m;
int POW[16];

int calc(int A, int B, int C) {
	int res = 0;
	for_(i,0,n) {
		int k = n - i - 1;
		if (A >> i & 1) res += 2 * POW[k];
		if (B >> i & 1) res += POW[k], swap(A, C);
	}
	return res;
}

void solve() {
	int cup[3] = { 0 };
	
	for_(i,0,3) {
		int d; cin >> d;
		for_(j,0,d) {
			int p; cin >> p; --p;
			cup[i] |= 1 << p;
		}
	}
	
	int ans = min(calc(cup[0], cup[1], cup[2]), calc(cup[2], cup[1], cup[0]));
	cout << ( (ans > m) ? -1 : ans) << endl;
}

int main() {
	POW[0] = 1;
	for_(i,1,16) POW[i] = POW[i - 1] * 3;
	while (cin >> n >> m, n) {
		solve();
	}
	return 0;
}

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

a = list(map(int, input().split()))
b = input().split()
c = input().split()

sat = 0

ant = -10
for j in a:
    if ant+1 == j:
        sat += int(c[ant-1])
    
    sat += int(b[j-1])
    ant = j

print(sat)

    


Measured memory_bytes: 3060
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)


int main()
{
    long long K, A, B;
    cin >> K >> A >> B;
    long max = 1;
    while(K > 0) {
        if (K >= 2 && B - A > 2 && max >= A) {
            K -= 2;
            max += B - A;
        } else {
            K--;
            max++;
        }
    }
    cout << max << endl;
    return 0;
}



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

int main(){
    int n, m;
    int i, j;
    int count[100][100] = {{}};
    int gyo[100] = {};
    cin>>n>>m; 
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            cin >> count[i][j];
        }
    }
    for(j=0; j<m; j++){
        cin >> gyo[j];
    }
    for(i=0; i<n; i++){
        int x=0;
        for(j=0; j<m; j++) x +=count[i][j]*gyo[j];
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;

int n;

void init()
{
cin>>n;
}

void work()
{
for (int i=n;;i++)
{
    int j=i;

    int a=j/100;
    j-=a*100;
    int b=j/10;
    j-=b*10;
    int c=j;
    if (a==b && b==c)
    {
        cout<<i<<endl;
        return;
    }
    
} 
}


int main()
{
    init();
    work();
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  char num[1001];
  int i,sum;
  while(1)
  {
    sum=0;
    scanf("%s",num);
    if(num[0]=='0') break;
    for(i=0;num[i]!='\0';i++)
    {
      sum+=num[i]-'0';
    }
    printf("%d\n",sum);
  }

  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define maxn 500005
#define maxa 2000005
#define MOD    100000000  //1000000007 //998244353
#define INF 1000000000000000000
#define ll long long

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << " "; cout << endl;}


void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

ll n, a[maxn], ans[maxn], dp[maxn], lim = 0;
vector<ll> v[maxn];

void dfs(ll u, ll p)
{
    ll x = a[u], f = 0, pre;
    ll pos = lower_bound(dp, dp+lim, x) - dp;
    if(pos == lim){
        dp[lim++] = x; f = 1;
    }
    else{
        pre = dp[pos];
        dp[pos] = min(pre, x);
    } //print(dp, 15)
    ans[u] = lim;
    for(auto xx : v[u]){
        if(p!=xx){
            dfs(xx, u);
        }
    }
    if(f) {
        lim--; dp[lim] = 0;
    }
    else dp[pos] = pre;
}

void solve(){

    cin >> n;
    rep(i, n) cin >> a[i+1];

    rep(i, n-1)
    {
        ll x ,y; cin >> x >> y; edge(v, x, y);
    }

    dfs(1, 0);
    for(ll i = 1; i <= n; i++) cout << ans[i] << "\n";
}

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


Measured memory_bytes: 39052
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		if((A == 1 && B == 2) || (A == 2 && B == 1)){
			System.out.println(3);
		}else if((A == 1 && B == 3) || (A == 3 && B == 1)){
			System.out.println(2);
		}else if((A == 3 && B == 2) || (A == 2 && B == 3)){
			System.out.println(1);
		}
	}
}

Measured memory_bytes: 23252
#include "bits/stdc++.h"

using ll = long long;

using namespace std;
#define int ll

//0 -> a-1
#define rep(i, a) for (int i = 0; (i) < (int)(a); (i)++)
//a -> b-1
#define reps(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
//a-1 -> 0
#define rrep(i, a) for (int i = (int)a - 1; (i) >= 0; (i)--)
//a-1 -> b
#define rreps(i, a, b) for (int i = (int)(a)-1; (i) >= (int)(b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
//next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
(v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v) \
	sort(all(v)); \
	(v).erase(unique(all(v)), v.end())
#define CIN(type, x) \
	type x;          \
	cin >> x
#define YES(f) if ((f)) {cout << "YES" << endl;} else {cout << "NO" << endl;}
#define Yes(f) if ((f)) {cout << "Yes" << endl;} else {cout << "No" << endl;}
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
//b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
//c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(12)
#define RS resize
#define CINV(v, N)             \
	do                         \
	{                          \
		v.RS(N);               \
		rep(i, N) cin >> v[i]; \
	} while (0);

#define RCINV(v, N)             \
	do                          \
	{                           \
		v.RS(N);                \
		rrep(i, N) cin >> v[i]; \
	} while (0);
#define MOD 1000000007

template <class T>
inline T GET()
{
	T x;
	cin >> x;
	return x;
}

void init();
void solve();

signed main()
{
	init();
	solve();
}

void init()
{
	vector<int> x(5);
	rep(i, 5) cin >> x[i];
	int sum = 0;
	int ma = 0;
	rep(i, 5) {
		sum += x[i];
		if (x[i] % 10) {
			sum += 10 - x[i] % 10;
			ma = max(ma, 10 - x[i] % 10);
		}
	}
	cout << sum - ma << endl;
}

void solve()
{
}


Measured memory_bytes: 256
#include <stdio.h>

int a, b, c;
int ans = 0;

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

	return 0;
}

Measured memory_bytes: 128
#include<cstdio>

bool check_p(int A[], int n, int k, long p) {
  unsigned int count = 1, sum = 0, i;

  for (i = 0; i < n; i++) {
    if (p < A[i]) return false;
    else if (sum + A[i] <= p) sum += A[i];
    else {
      count++; sum = A[i];
    }
  }

  return count <= k;
}

unsigned long get_p(int A[], int n, int k) {
  unsigned long min = 1;
  unsigned long max = 100000 * n;
  unsigned long p, tmp_p;

  while (min < max) {
    tmp_p = (min + max) / 2;
    if (check_p(A, n, k, tmp_p)) {
      max = tmp_p;
      p = tmp_p;
    } else {
      min = tmp_p + 1;
    }
  }

  return p;
}

int main() {
  int n, k, i;
  scanf("%d %d", &n, &k);

  int w[n];
  for (i = 0; i < n; i++) scanf("%d", &w[i]);

  long p = get_p(w, n, k);
  printf("%d\n", p);

  return 0;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N;
  ll a[100001];
  ll b[100000];
  cin>>N;
  for (int i(0);i<=N;i++) cin>>a[i];
  for (int i(0);i<N;i++) cin>>b[i];
  ll ans(0);
  ll restp(0);
  for (int i(0);i<N;i++){
    if (restp>a[i]){
      ans+=a[i];
      a[i]=0;
    }else{
      ans+=restp;
      a[i]-=restp;
    }
    if (a[i]<b[i]){
      ans+=a[i];
      restp=b[i]-a[i];
    }else{
      ans+=b[i];
      restp=0;
    }
    cerr << restp <<" " << ans<< endl;
  }
  if (restp>a[N]){
    ans+=a[N];
  }else{
    ans+=restp;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        char[] S = sc.next().toCharArray();

        StringBuilder sb = new StringBuilder();
        if (S.length<=K) {
            sb.append(S);
        } else {
            for (int i = 0; i <K; i++) {
                sb.append(S[i]);
            }
            sb.append("...");
        }


        System.out.println(sb.toString());
        return;
    }

}

Measured memory_bytes: 35736
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
    }
    return a;
}


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

    ll maxv = k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (a[i] == k){
            cout << "POSSIBLE" << endl;
            return 0;
        }
        if (a[i] > k) maxv = a[i];
    }

    if (maxv == k){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    ll d = a[0];
    for (int i = 0; i < n - 1; ++i) {
        d = gcd(d, a[i + 1]);
    }
    for (int i = 0; i < n; ++i) {
        if ((a[i] - k) % d == 0) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

list<int> V[1000];

int main() {
 UL N,Q;scanf("%u%u",&N,&Q);
 rep(q,Q){
  UL c; scanf("%u",&c);
  if(c==0){
   UL t; int x; scanf("%u%d",&t,&x);
   V[t].push_back(x);
  } else if(c==1){
   UL t; scanf("%u",&t);
   for(auto i=V[t].begin(); i!=V[t].end(); i++){
    if(i!=V[t].begin()) printf(" ");
    printf("%d",*i);
   } printf("\n");
  } else if(c==2){
   UL s,t; scanf("%u%u",&s,&t);
   V[t].splice(V[t].end(),V[s]);
  }
 }
 return 0;
}




Measured memory_bytes: 18756
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }

    bitset<2000*2000+1> dp;
    dp.set(0);
    rep(i, n){
        dp = dp | (dp << a[i]);
    }

    for(int i = (sum + 1) / 2; i <= sum; i++){
        if(dp.test(i)){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 2296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){ 
	ll n;
	scanf("%lld",&n);
	if(n==1) cout<<0<<endl;
	else if(n==2) cout<<1<<endl;
	else {
		cout<<(n-1)*n/2<<endl;
	}
	return 0;
}

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

int main() {

    int N;

    cin >> N;

    //int l0 = 2;
    //int l1 = 1;

    vector<long> L;
    L.push_back(2);
    L.push_back(1);


    int ans = 0;

    for (int i = 0; i <= N; i++){
      L.push_back(L.at(L.size() -1) + L.at(L.size() -2));
    }

    cout << L.at(N) << endl;

    return 0;

}

Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N;
vector<int> d;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  d.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (d[i] * d[j]);
    }
  }

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

Measured memory_bytes: 384
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    a = [a[i]-(i+1) for i in range(n)]
    a = sorted(a)
    b = a[n//2]

    print(sum([abs(i -b) for i in a]))

solve()


Measured memory_bytes: 25872