akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
int ans=1e9,n,m,x;
vector<bool> f(13,0);
vector<int> c(13,0);
vector<vector<int>> a(13,vector<int>(13,0));

void dfs(int i,bool ff){
    f.at(i)=ff;
    if(i==n-1){
        vector<int> us(13,0);REP(j,m) us.at(j)=0;
        int cost=0;
        bool flag=true;

        REP(j,n) if(f.at(j)){
            cost+=c.at(j);
            REP(k,m) us.at(k)+=a.at(j).at(k);    
        }

        REP(j,m) if(us.at(j)<x) flag=false;
        if(flag) ans=min(ans,cost);
    }else{
        dfs(i+1,true);
        dfs(i+1,false);
    }
}

int main(){
  cin>>n>>m>>x;
  REP(i,n){
      cin>>c.at(i);
      REP(j,m) cin>>a.at(i).at(j);
  }

  dfs(0,true);
  dfs(0,false);

  cout<<(ans==1e9?-1:ans);
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

long long log2(long long H){
    long long ret=0;
    while(H>0){
        ret++;
        H/=2;
    }
    return ret-1;
}

long long pow2(long long N){
    long long ret=1;
    for(int i=0; i<N; i++){
        ret*=(long long) 2;
    }
    return ret;
}

int main(){
    long long H;
    cin >> H;

    cout << pow2(log2(H)+1)-1 << endl;

}

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

int n;
long long a[200005];
const long long MOD = (long long) (1e9) + 7;

void solve() {
    long long subsum = 0;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        subsum = (subsum + a[i]) % MOD;
    }

    long long ans = 0;
    for (int i=0; i<n; i++) {
        subsum = (subsum - a[i] + MOD) % MOD;
        ans = (ans + (a[i]) * subsum % MOD) % MOD;
    }
    cout << ans << '\n';
}

int main() {
    // int t; cin >> t;
    // while(t--)
        solve();
}

Measured memory_bytes: 5156
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

int main(){
  int n, ans=0;
  string a, b, c;
  cin >> n;
  cin >> a >> b >> c;
  for(int i=0;i<n;i++){
    if(a[i]==b[i]&&a[i]==c[i])continue;
    else if(a[i]==b[i])ans++;
    else if(b[i]==c[i])ans++;
    else if(a[i]==c[i])ans++;
    else ans+=2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 2e5 + 5;
int n, a[N];
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	fw (i, 0, n) cin >> a[i];
	sort(a, a + n);
	multiset<int> s;
	fw (i, 0, n) s.insert(a[i]);
	int ans = 0;
	bw (i, n, 0) {
		int val;
		if (s.find(a[i]) == s.end()) continue;
		fw (j, 1, 31) if (a[i] < (1 << j) && a[i] * 2 >= (1 << j)) {
			val = 1 << j;
			break;
		}
		s.erase(s.find(a[i]));
		if (s.find(val - a[i]) != s.end()) {
			s.erase(s.find(val - a[i]));
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;

	cin>>n>>k;
	int sum = 1;
	while(n--)
	{
		int dob = sum*2;
		int inc = sum + k;
		if(dob<inc)
		{
			sum = sum*2;
		}
		else
		{
			sum = sum + k;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<pii> data;
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    data.push_back(pii(a, b));
  }
  sort(data.begin(), data.end());
  ll res = 0;
  for (int i = 0; i < data.size(); i++) {
    if (data[i].second <= m) {
      res += (ll)data[i].first * data[i].second;
      m -= data[i].second;
    } else {
      res += (ll)data[i].first * m;
      break;
    }
  }
  printf("%lld\n", res);
}


Measured memory_bytes: 1400
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, a, b = map(int, input().split())

# C,Pを求める前処理
m = 2*10**5+10
mod = 10**9 + 7


fact = [0]*(m+5)
fact_inv = [0]*(m+5)
inv = [0]*(m+5)

fact[0] = fact[1] = 1
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1

for i in range(2,m+5):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod


def cmb_large(n,k,mod):
    ans = 1
    for i in range(n, n-k, -1):
        ans = ans * i
        ans = ans % mod
    return ans * fact_inv[k] % mod

print((pow(2,N,mod)-1-cmb_large(N,a,mod)-cmb_large(N,b,mod)) % mod)

Measured memory_bytes: 82424
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;


int main() {
    long n, l;
    cin >> n >> l;
    vector<bool> isKnot (n-1, false);
    vector<long> tieOrder (n-1);
    vector<long long> lenMemo (n);
    long remTies = n-1;
    bool possible = true;
    for (long i = 0; i < n; i++) {
        cin >> lenMemo[i];
    }
    
    // can be approached from behind: can a rope be fully tied from fully untied state?
    while (remTies > 0) {
        long remTiesBefore = remTies;
        for (long i = 0; i < n - 1; i++) {
            if (!isKnot[i]) {
                long newFragment = lenMemo[i] + lenMemo[i+1];
                if (newFragment >= l) {
                    isKnot[i] = true;
                    remTies--;
                    tieOrder[remTies] = i;
                    lenMemo[i] = newFragment;
                    lenMemo[i+1] = newFragment;
                } 
            }
        }
        for (long i = n-2; i >= 0; i--) {
            if (!isKnot[i]) {
                long newFragment = lenMemo[i] + lenMemo[i+1];
                if (newFragment >= l) {
                    isKnot[i] = true;
                    remTies--;
                    tieOrder[remTies] = i;
                    lenMemo[i] = newFragment;
                    lenMemo[i+1] = newFragment;
                } 
            }
        }
        if (remTiesBefore == remTies) {
            possible = false;
            break;
        } 
    }
    
    if (possible) {
        cout << "Possible" << endl;
        ostringstream ss;
        for (long i = 0; i < n - 1; i++) {
            ss << tieOrder[i]+1 << endl;
        }
        cout << ss.str();
    } else {
        cout << "Impossible";
    }
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> w(n + 1, 0);
  rep(i, n) {
    char ss = s[i];
    if (ss == 'W') {
      w.at(i + 1) = w.at(i) + 1;
    } else {
      w.at(i + 1) = w.at(i);
    }
  }
  int res = INT_MAX;
  rep(i, n) {
    int x = w.at(i) + ((n - i - 1) - (w.at(n) - w.at(i + 1)));
    res = min(res, x);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1796
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    ll x;
    ll hoge = 100;
    ll cnt = 0;
    cin>>x;
    while(1){
        hoge = hoge + hoge / 100;
        cnt++;
        if(hoge>=x){
            cout<<cnt<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
//int atoi(const char *str)

int ruijo(int i,int j){
  int mat=1;
  for(int k=0;k<j;k++){
    mat*=i;}
  return mat;
}

int c(int l,int k){
  int mat=1;
  int tmp=l;
  for(int i=0;i<k;i++){
    mat*=tmp;
    tmp--;}
  for(int i=0;i<k;i++){
    mat/=i+1;}
  return mat;
}

int myatoi(char n){
  if(n=='0') return 0;
  if(n=='1') return 1;
  if(n=='2') return 2;
  if(n=='3') return 3;
  if(n=='4') return 4;
  if(n=='5') return 5;
  if(n=='6') return 6;
  if(n=='7') return 7;
  if(n=='8') return 8;
  if(n=='9') return 9;
  return 0;
}

long int sum(char n[],int k){
  if(k<=0) return 1;
  if(n[0]=='\0') return 0;
  int len=strlen(n);
  long int res=0;
  if(myatoi(n[0])==0){
    res+=sum(n+1,k);
    return res;}
  if(len>k) res+=c(len-1,k)*ruijo(9,k);
  res+=(myatoi(n[0])-1)*c(len-1,k-1)*ruijo(9,k-1);
  res+=sum(n+1,k-1);
  return res;
}

int main(){
  char n[102];
  int k;
  scanf("%s",n);
  scanf("%d",&k);


  long int res=sum(n,k);

  printf("%ld\n",res);
  
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321987654321
#define PI 3.14159265358979323846264
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

Pll p[200000];
int main() {
	int n;
	scanf("%d", &n);
	ll S = 0, temp = INF;
	fup(i, 0, n - 1, 1)
	{
		scanf("%lld%lld", &p[i].X, &p[i].Y);
		S += p[i].Y;
		if (p[i].X > p[i].Y)temp = min(temp, p[i].Y);
	}
	printf("%lld", max(0LL,S - temp));
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

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

    if(N == 1) {
        cout << M << endl;
        return 0;
    }
    int L = (int)sqrt((double)M);
    int ans = 1;
    for(int i=1; i <= L; ++i) {
        if(M % i == 0) {
            if(M / i <= M / N) ans = max(ans, M / i);
            if(i <= M / N) ans = max(ans, i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <ll, ll> PLL;
typedef pair <int,string> PIS;
typedef vector <int> vec;
typedef priority_queue<int> PQ;
#define endl '\n'
#define pi 3.141592653589793
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fori(z,n)  for(int i=z;i<n;i++)
#define fork(z,n)  for(int k=z;k<n;k++)
#define forii(z,n) for(int i=z;i<=n;i++)
#define forkk(z,n) for(int k=z;k<=n;k++)
int maxElement(int arr[],int n)
{
    int maxi=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]>maxi)
            maxi=arr[i];
    }
    return maxi;
}
int minElement(int arr[],int n)
{
    int mini=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]<mini)
            mini=arr[i];
    }
    return mini;
}
string trim(const string& str)
{
    size_t first = str.find_first_not_of(' ');
    if (string::npos == first)
    {
        return str;
    }
    int last = str.find_last_not_of(' ');
    return str.substr(first, (last - first + 1));
}
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,w;cin>>n>>w;
    vector<PLL> v(n+1);
    ll value=0;
    fori(1,n+1)
    {
        ll p,q;cin>>p>>q;
        v[i]={p,q};
        value+=q;
    }
    // dp[i][j] represents minimum weights which is required from first j objects to get a value of i.
    ll dp[value+1][n+1];
    forii(1,value) dp[i][0]=1e18;
    forii(1,n) dp[0][i]=0;
    dp[0][0]=0; // to get a value 0 we need 0 items.
    ll ans=0;
    for(ll i=1;i<=value;i++)
    {
        for(int k=1;k<=n;k++)
        {
            if(i-v[k].ss>=0)
                dp[i][k]=min(dp[i-v[k].ss][k-1]+v[k].ff,dp[i][k-1]);
            else
                dp[i][k]=dp[i][k-1];
            if(dp[i][k]<=w)
                ans=max(ans,i);
        }
    }
    /* forii(0,value) */
    /* { */
    /*     forkk(0,n) */
    /*         cout<<dp[i][k]<<" "; */
    /*     cout<<endl; */
    /* } */
    cout<<ans<<endl;
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int x; cin >> x;
	cout << x+x*x+x*x*x << '\n';
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n;
    cin >> n;
    switch(n%10){
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << '\n';
            break;
        case 3:
            cout << "bon" << '\n';
            break;
        default:
            cout << "hon" << '\n';
            break;
    }

    
    return 0;
}


Measured memory_bytes: 3608
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
const ll mod = 1e9+7;

signed main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    int d,t,s;
    cin >> d >>t>> s;
    if(s*t>=d)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<iomanip>
#include<string.h>
using namespace std;
// log10(x)+1  number of digits 
void bubblesort(int arr[], int n);
int arr2[200001];
int main()
{
	int arr[200001];
	int n;
	cin >> n;
	for (int i = 0; i < n-1; i++)
	{
		cin >> arr[i];
		arr2[arr[i]]++;
	}
	for (int i = 1; i <= n; i++)
	{
		cout << arr2[i] << "\n";
	}
}
void bubblesort(int arr[], int n)
{
	int i = 0, j = 0;
	for (; i < n - 1; i++)
	{
		for (; j < n - 1 - i; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				swap(*&arr[j], *&arr[j + 1]);
			}
		}
	}
}

Measured memory_bytes: 5120
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		
	 		StringTokenizer st = new StringTokenizer(bf.readLine());
	 		int a = Integer.parseInt(st.nextToken());
	 		int b = Integer.parseInt(st.nextToken());
	 		int c = Integer.parseInt(st.nextToken());
	 		int d = Integer.parseInt(st.nextToken());
	 		int e = Integer.parseInt(st.nextToken());
	 		
 		if (a == 0){
 			out.println(1);
 		}
 		else if (b == 0){
 			out.println(2);
 		}
 		else if (c == 0){
 			out.println(3);
 		}
 		else if (d == 0){
 			out.println(4);
 		}
 		else if (e == 0){
 			out.println(5);
 		}
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k, s; cin >> n >> k >> s;
    rep(i,n) {
        if(i<k) cout << s << endl;
        else {
            if(s==INF) cout << s-1 << endl;
            else cout << s+1 << endl;
        }
    }

    return 0;
}

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

char num[20];
long long ans=0;
int len;

void rec(int lv,long long val,long long ls)
{
	if(lv==len)
	{
		//printf("%d\n",val+ls);
		ans+=val+ls;
		return ;
	}
	ls*=10;
	rec(lv+1,val+num[lv]-'0'+ls,0);
	rec(lv+1,val,ls+num[lv]-'0');
}

main()
{
	
	scanf("%s",num);
	len=strlen(num);
	rec(0,0,0);
	printf("%lld",ans/2);
}

Measured memory_bytes: 256
N = gets.to_i
V = gets.split(" ").map(&:to_i)
C = gets.split(" ").map(&:to_i)
diff = []
ans = 0
for i in 0...N
  diff << V[i] - C[i]
end
diff.sort!.reverse!
for j in 0...N
  if diff[j] > 0 then ans += diff[j] else break end
end
puts ans

Measured memory_bytes: 1788
using System;

namespace ABC127_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int c = 0;
            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);
            c = b / 2; 
                if(a <= 5)
                {
                    Console.WriteLine("0");
                }
                else if(a >= 13)
                {
                    Console.WriteLine(b);
                }
                else
                {
                    Console.WriteLine(c);
                }
            
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
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(){
    string s; cin >> s;
    int res = (int)s.size();
    for(char c : s){
        int tmp=0;
        for(int i=0; i<s.size();){
            int j=i;
            while(j < s.size() && !((s[j]==c) ^ (s[i]==c))) j++;
            if(s[i] != c) chmax(tmp, j-i);
            i = j;
        }
        chmin(res, tmp);
    }
    cout << res << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    if(n/100 == n%10) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define min(x,y) ((x<y)?(x):(y))
int main(){
	int n,m,a,b,x,i,j,u[15],v[15],d[15][15],s[15];
	while(scanf("%d",&m)!=EOF){
		if(m==0)break;n=0;
		for(i=0;i<11;i++)for(j=0;j<11;j++)d[i][j]=10000000;
		for(i=0;i<m;i++){
			scanf("%d%d%d",&a,&b,&x);
			d[a][b]=d[b][a]=x;
			if(a>n)n=a;
			if(b>n)n=b;
		}
		a=10000000;
		for(i=0;i<=n;i++){
			s[i]=0;
			for(j=0;j<=n;j++)v[j]=10000000,u[j]=0;
			v[i]=0;
			while(1){
				x=-1;
				for(j=0;j<=n;j++){
					if(u[j]==0 && (x==-1 || v[x]>v[j]))x=j;
				}
				if(x==-1)break;
				u[x]=1;
				s[i]+=v[x];
				for(j=0;j<=n;j++){
					v[j]=min(v[j],v[x]+d[x][j]);
				}
			}
			if(a>s[i])a=s[i],b=i;
		}
		printf("%d %d\n",b,a);
	}
	return 0;
}

Measured memory_bytes: 0
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)

int32_t N,A,B;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N>>A>>B;
	if (A == 1 && B==2) {
		out << "Borys" << endl; return 0;
	}
	if ((B - A) & 1) {
		out << "Borys" << endl; return 0;
	}
	else {
		out << "Alice" << endl; return 0;
	}

	return 0;
}
#endif

#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all(C) std::begin(C), std::end(C)

int32_t N;
int64_t a[100000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	for (size_t i = 0; i < N; i++)
	{
		in >> a[i];
	}
	if (a[N - 1] != 2) {
		out << -1 << endl; return 0;
	}

	int64_t min = 2;
	for (int i = N - 2; i >= 0; i--)
	{
		if (min <= a[i]) {
			min = a[i];
		}
		else {
			min = ((min + a[i] - 1) / a[i])*a[i];
		}
		if (a[i + 1] * 2 <= min) {
			out << -1 << endl; return 0;
		}
	}
	out << min << ' ';

	int64_t max = 3;
	for (int i = N - 2; i >= 0; i--)
	{
		if (max < a[i]) {
			assert(false);
		}
		else {
			max = (max / a[i])*a[i] + a[i]-1;
		}

	}
	out << max << endl;

	return 0;
}
#endif


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use procon::*;
use std::cmp::{max, min};
use std::collections::*;
use std::ops::*;
use std::*;

pub fn main() {
    let mut words = read_words::<i32>();
    words.sort();
    let (A, B, C) = (words[0], words[1], words[2]);

    let d = B - A;
    let n = (C - B) + (if d % 2 == 0 { d / 2 } else { d / 2 + 2 });
    println!("{}", n);
    return;
}

pub mod procon {
    use std;
    use std::collections::*;
    use std::io;
    use std::mem;
    use std::str::FromStr;

    pub fn read_line() -> String {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.trim_right().to_owned()
    }

    pub fn read_words<T>() -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.split_whitespace()
            .map(|word| T::from_str(word).unwrap())
            .collect()
    }

    pub fn read_vec(len: usize) -> Vec<String> {
        let mut vec = Vec::new();
        while vec.len() < len {
            let line = read_line();
            for word in line.split_whitespace() {
                vec.push(word.to_owned());
            }
        }
        assert!(vec.len() == len);
        vec
    }
}


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

int main() {
  long k;
  vector<long> ans(50);
  cin >> k;
  for(long i=0;i<50;i++) {
    ans[i]=49+k/50;
    if(i<k%50) ans[i]+=51-k%50;
    else ans[i]-=k%50;
  }
  cout << 50 << endl;
  for(long i=0;i<50;i++) cout << ans[i] << " ";
  cout << endl;
}

Measured memory_bytes: 3572
#include<cstdio>
int a, b;
int main() {
	scanf("%d%d", &a, &b);
	if (0 >= a && 0 <= b) {
		printf("Zero");
	}
	else if (0 < a) {
		printf("Positive");
	}
	else {
		if((b-a)%2==1) printf("Positive");
		else printf("Negative");
	}
	return 0;
}

Measured memory_bytes: 128
import sys
import math

if __name__ == "__main__":
	n = int(input())
	lst = []
	for _ in range(n):
		lst.append(int(input()))
	q = lst[0]
	for x in range(1, n):
		q = (q*lst[x])//math.gcd(lst[x], q)
	print(q)

Measured memory_bytes: 9044
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] ch = new char[h+2][w+2];
		for (int i = 0; i < h+2; i++) {
			if (i == 0 || i == h+1) {
				for (int j = 0; j < w+2; j++) {
					ch[i][j] = '$';
				}
			}
			else {
				String a = sc.next();
				for (int j = 0; j < w+2; j++) {
					if (j == 0 || j == w+1) {
						ch[i][j] = '$';
					} else {
						ch[i][j] = a.charAt(j-1);
					}
				}
			}
		}
		
		for (int i = 1; i < h+1; i++) {
			for (int j = 1; j < w+1; j++) {
				if (ch[i][j] == '$' || ch[i][j] == '.') continue;
				else {
					if (ch[i-1][j] == '#' || ch[i][j-1] == '#' || ch[i][j+1] == '#' || ch[i+1][j] == '#') continue;
					else {
						System.out.println("No"); return;
					}
				}
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 21972
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
j = sum([ i % 10 for i in s ])
if j == 0:
    ans = 0
else:
    if sum(s) % 10 != 0:
        ans = sum(s)
    else:
        for i in range(n):
            tmp = sum(s)-s[i]
            if tmp % 10 != 0:
                ans = tmp
                break
print(ans)

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

int main()
{
  //n...参加者数 k...ポイント所持数 q...正解数
  int n, k, q;
  cin >> n >> k >> q;
  //a 正答者 p 参加者
  int a[q], p[n];
  //標準入力から正答した人の番号を受け取る
  rep(i, q) cin >> a[i];
  //参加者の数分所持ポイントで初期化&正答回数分全員からポイントを減らす
  rep(i, n) p[i] = k - q;
 //減らしたポイントを元に戻す
  rep(i, q) p[a[i] - 1] += 1;
  rep(i, n) 
  {
    if(p[i] > 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}


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

void show_sequence(int N, float* A){
	for(int i=0;i<N;i++){
		if(i==N-1){
			cout << A[i] << endl;
		}else{
			cout << A[i] << " ";
		}
	}
}

void insertion_sort(int N, float* A){
	
	for(int i=0;i<N;i++){
		float tmp = A[i];
		int j = i-1;
		while(j>=0 && A[j] > tmp){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = tmp;
		show_sequence(N, A);
	}
}

int main(){
	int N;
	cin >> N;
	
	float A[N];
	for(int i=0;i<N;i++)
		cin >> A[i];

	insertion_sort(N, A);
}


Measured memory_bytes: 3284
#include <iostream>

void PrintLine( int length ){
    using namespace std;

    for( int i = 0; i < length; ++i ){
        cout << '#';
    }
    cout << endl;
}

int main(){
    using namespace std;

    while( true ){
        int H = 0;
        int W = 0;
        cin >> H >> W;

        if( H == 0 && W == 0 ){ break; }

        for( int i = 0; i < H; ++i ){ PrintLine( W ); }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define MXX 2000000000
using namespace std;

int arr[3][100005];
int dp[3][100005];

int solve(int n){
  for(int i = 0; i<3; ++i)dp[i][n] = arr[i][n];
  for(int i = (n-1); i>=1; --i){
    for(int j = 0; j<3; ++j){
    	for(int k = 0; k<3; ++k){
          if(j==k)continue;
          dp[j][i] = max(dp[j][i],dp[k][i+1]+arr[j][i]);
        }
    }
  }
  return max(dp[0][1],max(dp[1][1],dp[2][1]));
}

int main(){
  int n,k;
  scanf("%d",&n);
  for(int i = 1; i<=n; ++i){
    for(int j = 0; j<3; ++j)scanf("%d",&arr[j][i]);
  }
  printf("%d\n",solve(n));
  return 0;
}

Measured memory_bytes: 2560
line = require('fs').readFileSync('/dev/stdin', 'ascii').split('\n');
line[0] = line[0].split(' ').map(Number);
n = line[0][0];
m = line[0][1];
b = line.slice(n+1, n+m+1).map(Number);

for (i = 0; i < n; i++) {
	sum = 0;
	for (j = 0; j < m; j++) {
		ai = line[i+1].split(' ').map(Number);
		sum += ai[j] * b[j];
	}
	console.log(sum);
}

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

#define int long long int
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>

using namespace std;

int inf = 1e18;
const int N = 1e6+5;
int mod = 1e9+7-998244353+998244353;
/*void dfs(int u,int par,int maxx)
{


    for(int v:adj[u])
    {
        if(v==par)
            continue;
        dfs(v,u,maxx);
    }
}


int ncr(int n , int r ){
	r = min(r,n-r);
	int res = 1 ;
	for(int i = 1 ; i <= r ; i++ ){
		( res *= n-i+1 )%= mod;
		res /= i ;
	}
	return res ;
}
*/

int32_t main()
{
    io
    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        string s;
        cin>>s;
        string t;
        t = s;
        reverse(all(t));
        int n = sz(s);
        int ct= 0 ;
        for(int i=0;i<n/2;++i)
        {
            if(s[i]!=t[i])
                ct++;
        }
        cout<<ct;


    }



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[10], p;
  for(int i = 0; i < 10; ++i) a[i] = 0;
  for(int i = 0; i < 3; ++i){
    cin >> p;
    a[p]++;
  }
  int flag = 0;
  for(int i = 0; i < 10; ++i) if(a[i] == 2) flag = 1;
  if(flag) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define INF 1000000001
#define INFL 1000000000000000001
#define M 1000000007
string s;
ll n,ans=1,cnt[505];
int main(void){
	cin>>s;
	n=s.size();
	ans+=n*(n-1LL)/2LL;
	for(int i=0;i<n;i++)cnt[s[i]]++;
	for(int i='a';i<='z';i++)ans-=cnt[i]*(cnt[i]-1LL)/2LL;
	printf("%lld\n",ans);
}


Measured memory_bytes: 640
N,M=map(int,input().split())
A=list(map(int,input().split()))
sm=0
ans=0
l={0:1}
for i in range(len(A)):
  sm=(sm+A[i])%M
  ans+=l.get(sm,0)
  l[sm]=l.get(sm,0)+1
print(ans)

Measured memory_bytes: 14224
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static List<Long> divisor(long n) {
        List<Long> list = new ArrayList<>();
        for (long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                list.add(i);
                long j = n / i;
                if (j != i) {
                    list.add(j);
                }
            }
        }
        Collections.sort(list);
        return list;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long m = sc.nextLong();
        List<Long> div = divisor(m);
        long ans = 1;
        for (int i = 0; i < div.size(); i++) {
            long d = div.get(i);
            if (d * n <= m) {
                ans = Math.max(ans, d);
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 21972
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int main(){
    set<int> s;
    int n,m;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> m;
        s.insert(m);
    }
    if(s.size()==n)cout <<"YES"<<endl;
  else cout << "NO"<<endl;
  return 0;
  

}

Measured memory_bytes: 9600
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	A := nextInt()
	B := nextInt()
	m := 0
	if (A + B) < N {
		m = 0
	} else {
		m = (A + B) - N
	}
	fmt.Println(min(A, B), m)
}

var dy = []int{1, 0, -1, 0, 0}
var dx = []int{0, 1, 0, -1, 0}
var intmax = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = newScanner()
	log.SetFlags(log.Lshortfile)
}

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    ll N, A, B;
  	cin >> N >> A >> B;
  	if(N == 1 && A != B){
        cout << 0 << endl;
        return 0;
    }
  	if(A > B){
    	cout << 0 << endl;
        return 0;
  	}
  	if(A == B){
      	cout << 1 << endl;
        return 0;
    }
  	cout << (B-A)*(N-2)+1 << endl;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

int factorial(int i){
    if(i == 1) return 1; 
    else return i*factorial(i-1);
}

int main()
{
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    REP(i, N) cin >> x[i] >> y[i];

    vector<int> route(N);
    REP(i, N) route[i] = i;

    double ans = 0;
    do{
        REP(i, N-1){
            ans += sqrt(pow(x[route[i+1]]-x[route[i]], 2) + pow(y[route[i+1]]-y[route[i]], 2));
        }
    }while(next_permutation(route.begin(), route.end()));

    cout << fixed << setprecision(8) << ans/factorial(N) << endl;
    
    return 0;
}

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

int f(int i){
  if(i%10!=0)
    return i%10;
  else
    return 10;
}

int main(){
  int a,b,c,d,e,m,s=0,t,u;
  cin >> a >> b >> c >> d >> e;
  vector<int> r(5);
  r[0]=a;
  r[1]=b;
  r[2]=c;
  r[3]=d;
  r[4]=e;
  m=f(r[0]);
  for(int i=1;i<5;i++)
    m=min(m,f(r[i]));
  if(m==10){
    for(int i=0;i<5;i++)
      s+=r[i];
  }else{
   for(int i=0;i<5;i++){
     if(r[i]%10==m){
       t=r[i];
       u=i;
       break;
     }
   }
    for(int j=0;j<5;j++){
      if(j==u)
        continue;
      else if(r[j]%10!=0)
        s=s+r[j]+10-r[j]%10;
      else
        s+=r[j];
    }
    s+=t;
  }
  cout << s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

double sx, sy, gx, gy;
int n;
vector<double>G[1111];
pair<pair<double, double>, double>cir[1111];
double far[1111];
void dijkstra() {
	fill(far, far + n + 2, (double)inf);
	far[0] = 0.;
	priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>>que;
	que.push({ 0.,0 });
	while (que.size()) {
		pair<double, int>p = que.top(); que.pop();
		int v = p.second;
		if (far[v] < p.first)continue;
		rep(i, n + 2) {
			if (far[i] > far[v] + G[v][i]) {
				far[i] = far[v] + G[v][i];
				que.push({ far[i],i });
			}
		}
	}
	printf("%.12lf\n", far[n + 1]);
}
signed main() {
	cin >> sx >> sy >> gx >> gy >> n;
	REP(i, n + 1) {
		cin >> cir[i].first.first >> cir[i].first.second >> cir[i].second;
	}
	cir[0].first = { sx,sy }; cir[n + 1].first = { gx,gy };
	rep(i, n + 2) {
		rep(j, n + 2) {
			double x1 = cir[i].first.first, y1 = cir[i].first.second;
			double x2 = cir[j].first.first, y2 = cir[j].first.second;
			double memo = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
			memo -= cir[i].second; memo -= cir[j].second;
			G[i].push_back(max(0., memo));
		}
	}
	dijkstra();
}

Measured memory_bytes: 13692
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 998244353
#define int long long
#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define inf 1e14
#define N 500001
#define K 4
#define ALPHA 1.0
#define BETA 1.0



int32_t main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    int d;
    cin >> d;
    vector<int> c(26);
    double average = 0.0;

    for(int i = 0;i < 26;i++)
        cin >> c[i];
    vector<vector<int>> v(d,vector<int>(26,0));
    for(int i = 0;i < d;i++)
    {
        for(int j = 0;j < 26;j++)
        {
            cin >> v[i][j];
            average += v[i][j];
        }
    }
    average /= (d * 26);
    vector<int> last(26,-1);
    for(int i = 0;i < d;i++)
    {
        int mxgain = -inf;
        int ind = -1;
        for(int j = 0;j < 26;j++)
        {
            int gain = v[i][j] + (i - last[j]) * c[j];
            // cerr << j << " " << gain << endl;
            if(gain > mxgain)
            {
                mxgain = gain;
                ind = j;
            }
        }
        last[ind] = i;
        cout << ind + 1 << endl;
    }


    


    

    
    return 0;    
} 



Measured memory_bytes: 3740
using System;
using System.Linq;

public class Program
{

    public static void Main(string[] args)
    {
        var S = Console.ReadLine();

        if (S.Contains('a') && S.Contains('b') && S.Contains('c'))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }

}


Measured memory_bytes: 13268
n,m,q = map(int,input().split())
abcd = [list(map(int,input().split()))for i in range(q)]
from itertools import combinations_with_replacement
A = list(combinations_with_replacement(range(1,m+1),n))
#print(A)
ans = 0
for i in range(len(A)):
    point = 0
    for j in range(q):
        if A[i][abcd[j][1]-1] - A[i][abcd[j][0]-1] == abcd[j][2]:
            point += abcd[j][3]
    ans = max(ans, point)
print(ans)

Measured memory_bytes: 84916
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    vpii v;
    while (n--) {
      int p, d1, d2;
      cin >> p >> d1 >> d2;
      v.emplace_back(d1 + d2, p);
    }
    pii p = *max_element(all(v));
    cout << p.se << ' ' << p.fi << endl;
  }
}

Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int main() {
    int n, q;
    cin >> n;
    unordered_map<int, int>a;
    rep(i, n){
        int tmp;
        cin >> tmp;
        a[tmp]++;
    }
    ll sum = 0;
    for(auto m: a){
        sum += m.first * m.second;
    }
    cin >> q;
    rep(i, q){
        int b, c;
        cin >> b >> c;
        if (a.find(b) != a.end()){
            sum += (c - b) * a[b];
            a[c] += a[b];
            a.erase(b);     
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 6476