akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;



int main()
{
	int i = 0;
	char a[20];

	scanf("%s", a);

	while (1) {
		i++;
		if (a[i] == '\0') break;
	}
	i--;
	while (i != -1) {
		printf("%c", a[i]);
		i--;
	}
	printf("\n");
	

		return (0);
	
}

Measured memory_bytes: 1096
import math
x=int(input())
if x<=2:
  print(x)
else:
  if x%2==0:
    x=x+1
  while True:
    for j in range(2,int(math.sqrt(x))+1):
      if x%j==0:
        break
    else:
      print(x)
      break
    x=x+2

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

using namespace std;

int main(void){
    int K,X;
    scanf("%d%d",&K,&X);
    if (K*500>=X) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 256
using System;

namespace _0009
{
    class Program
    {
        static void Main(string[] args)
        {

            bool[] prime = new bool[1000000];
            for (int i = 1; i < 1000000; i++)
            {
                if (IsPrime(i))
                {
                    prime[i] = true;
                }
            }

            while (true)
            {
                var input = Console.ReadLine();

                if (string.IsNullOrEmpty(input)) { break; }

                var number = int.Parse(input);
                int answer = 0;

                for (int i = 1; i <= number; i++)
                {
                    if (prime[i] == true)
                    {
                        answer++;
                    }
                }

                Console.Write(answer.ToString() + "\n");
            }
        }
        public static bool IsPrime(int number)
        {
           if (number <= 1)
            {
                return false;
            }
            else if(number <= 3)
            {
                return true;
            }
            else if ((number % 2) == 0)
            {
                return false;
            }
            else
            {
                    for (int i = 3; i <= (int)Math.Sqrt(number); i += 2)
                    {
                        if (number % i == 0)
                        {
                            return false;
                        }
                    }
            }
            return true;
        }
    }
}

Measured memory_bytes: 6596
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

typedef std::vector<std::vector<int>> graph;
ll ans[200000] = {};
ll pt[200000] = {};
bool checked[200000] = {};

void dfs(int s, const graph &g)
{
  checked[s] = true;
  ans[s] += pt[s];
  for (auto v : g[s])
  {
    if (checked[v])
      continue;
    ans[v] += ans[s];
    dfs(v, g);
  }
}

int main()
{
  int n, q;
  cin >> n >> q;
  graph g(n);
  REP(i, n - 1)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  REP(i, q)
  {
    int p;
    ll x;
    cin >> p >> x;
    p--;
    pt[p] += x;
  }

  dfs(0, g);

  REP(i, n)
  {
    cout << ans[i];
    if (i != n - 1)
    {
      cout << " ";
    }
  }
  cout << endl;
}


Measured memory_bytes: 25856
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n,ans = 0; cin >>n;
    int arr[2*n];
    fo(i,2*n){
        cin >> arr[i];
    }
    sort(arr,arr+2*n);
    for(int i =0; i < 2*n; i +=2){
        ans +=arr[i];
    }
    cout <<ans;
}




Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

map<int,int> m;
int main(){
    int n,ai;
    cin>>n;
    rep(i,n){
        cin>>ai;
        ++m[ai];
    }
    int ans=0;
    for(map<int,int>::iterator it=m.begin();it!=m.end();++it){
        if(it->second<it->first) ans+=it->second;
        else ans+=it->second-it->first;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4736
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

template<typename T>
struct MIN {
    const T inf = numeric_limits<T>::max();
    int N;
    vector<T> node;

    MIN(vector<T> &v) {
        int sz = v.size();
        N = 1; while (N < sz) N *= 2;
        node.assign(2*N,inf);

        for (int i = 0; i < sz; i++) node[i+N] = v[i];
        for (int i = N-1; i > 0; i--) node[i] = min(node[i<<1|0],node[i<<1|1]);
    }

    void update(int x, T val) {
        x += N;

        node[x] = val;
        while (x > 1) {
            x >>= 1;
            node[x] = min(node[x<<1|0],node[x<<1|1]);
        }
    }

    T getmin(int l, int r) {
        T res = inf;
        l += N; r += N;
        while (l < r) {
            if (l & 1) res = min(res,node[l++]);
            l >>= 1;
            if (r & 1) res = min(res,node[--r]);
            r >>= 1; 
        }

        return res;
    }    
};

template<typename T>
struct MAX {
    int N;
    vector<T> node;

    MAX(vector<T> &v) {
        int sz = v.size();
        N = 1; while (N < sz) N *= 2;
        node.assign(2*N,0);

        for (int i = 0; i < sz; i++) node[i+N] = v[i];
        for (int i = N-1; i > 0; i--) node[i] = max(node[i<<1|0],node[i<<1|1]);
    }

    void update(int x, T val) {
        x += N;

        node[x] = val;
        while (x > 1) {
            x >>= 1;
            node[x] = max(node[x<<1|0],node[x<<1|1]);
        }
    }

    T getmin(int l, int r) {
        T res = 0;
        l += N; r += N;
        while (l < r) {
            if (l & 1) res = max(res,node[l++]);
            l >>= 1;
            if (r & 1) res = max(res,node[--r]);
            r >>= 1; 
        }

        return res;
    }    
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    vector<int> P(N);
    rep(i,N) cin >> P[i];

    MIN<int> mp(P);
    MAX<int> MP(P);

    int cnt = 1;
    set<int> dic;
    for (int i = 0; i < N-K; i++) {
        if (mp.getmin(i,K+1+i) == P[i] && MP.getmin(i,K+1+i) == P[i+K]) {
            dic.emplace(i+1);
            continue;
        }
        cnt++;
    }
    int l = 1;
    int ch = 0;
    for (int i = 1; i < N; i++) {
        if (P[i] < P[i-1]) {
            l = 1;
        } else l++;
        if (l >= K) {
            if (ch > 0) dic.emplace(i+1-K);
            ch++;
        }
    }

    cout << N-K+1-dic.size() << endl;
}

Measured memory_bytes: 14464
n=int(input())
p_list=list(map(int,input().split()))
count=0
for i in range(n):
    if i==n-1:
        if p_list[i]==i+1:
            count+=1
    else:
        if p_list[i]==i+1:
            p_list[i]=p_list[i+1]
            p_list[i+1]=i+1
            count+=1
print(count)
    


Measured memory_bytes: 53036
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, ans int
	fmt.Scan(&n)
	p := make([]int, n)
	for i := range p {
		fmt.Scan(&p[i])
	}
	sort.Ints(p)
	for _, v := range p {
		ans += v
	}
	ans -= p[len(p)-1] / 2
	fmt.Println(ans)
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    //N=100;
    vl X(N);
    vl cnt(102,0);
    rep(i,N){
        cin >> X[i];
        //X[i]=(i<2?99:100);
        cnt[X[i]]++;
    }
    ll i=1;
    while(cnt[i]==0){
        i++;
    }
    if(i==1){
        if(N==2){
            cout << (cnt[1]==2?"Possible":"Impossible") << endl;
        }
        else if(cnt[1]==1&&cnt[2]==N-1){
            cout << "Possible" << endl;
        }
        else{
            cout << "Impossible" << endl;
        }
        return 0;
    }
    else{
        if(cnt[i]>2){
            cout << "Impossible" << endl;
        }
        else{
            ll now=cnt[i];
            ll j=i;
            i++;
            while(cnt[i]>=2){
                now+=cnt[i];
                i++;
            }
            if(!((cnt[j]==1&&i%2==1)||(cnt[j]>=2&&i%2==0))){
                cout << "Impossible" << endl;
                return 0;
            }
            else if(!(2*j+1==i||2*j==i)){
                cout << "Impossible" << endl;
            }
            else if(now==N){
                cout << "Possible" << endl;
            }
            else{
                cout << "Impossible" << endl;
            }
        }
        return 0;
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  long long k;
  cin >> s >> k;
  char ans='1';
  for(int i=0;i<s.size();i++){
    if(s[i]!='1'){
      if(i+1<=k){
        ans=s[i];
        break;
      }
    }
  }
  cout << ans << endl;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    ll S;
    cin >> S;
    if(S == ll(1e18)) {
        cout << "0 0 0 1000000000 1000000000 0" << endl;
        return;
    }
    ll p = S/(ll)INF;
    ll q = S%(ll)INF;
    cout << 0 << " " << 0 << " " << ll(INF);
    cout << " " << ll(INF-q) << " " << 1 << " " << ll(p+1) << endl;
}

int main() {
    solve();
    return 0;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N,T,L,B;
int type[111];
double dp[111][111];

void solve(){
    rep(i,T+1)rep(j,N+1)dp[i][j]=0;
    dp[0][0]=1;
    rep(i,N+1)type[i]=0;
    rep(i,L){
        int l;
        cin>>l;
        type[l]=1;
    }
    rep(i,B){
        int b;
        cin>>b;
        type[b]=2;
    }

    rep(i,T){
        rep(j,N){
            reps(k,1,6+1){
                int to=j+k;
                if(to>N)to=N-(to-N);
                if(type[to]==0)dp[i+1][to]+=dp[i][j]/6;
                else if(type[to]==1)dp[i+2][to]+=dp[i][j]/6;
                else dp[i+1][0]+=dp[i][j]/6;
            }
        }
    }
    double ans=0;
    rep(i,T+1)ans+=dp[i][N];
    printf("%.20f\n",ans);
}

signed main(){
    while(cin>>N>>T>>L>>B,N||T||L||B)solve();
    return 0;
}

Measured memory_bytes: 3232
#include <stdio.h>
#include <string.h>

int N;
int zikan[16][17];

/* [not cleared] */
int memo[65536];

int tansaku(int rest) {
	int result=0x7fffffff,i,j;
	if(rest==0)return 0;
	if(memo[rest]>0)return memo[rest]-1;
	for(i=0;i<N;i++) {
		if(rest & (1<<i)) {
			int nowresult=zikan[i][0];
			for(j=0;j<N;j++) {
				if(!(rest & (1<<j)) && zikan[i][j+1]<nowresult) {
					nowresult=zikan[i][j+1];
				}
			}
			nowresult+=tansaku(rest & ~(1<<i));
			if(nowresult<result)result=nowresult;
		}
	}
	memo[rest]=result+1;
	return result;
}

int main(void) {
	while(scanf("%d",&N)==1 && N>0) {
		int i,j;
		for(i=0;i<N;i++) {
			for(j=0;j<=N;j++)scanf("%d",&zikan[i][j]);
		}
		memset(memo,0,sizeof(memo));
		printf("%d\n",tansaku((1<<N)-1));
	}
	return 0;
}

Measured memory_bytes: 864
#include<stdio.h>
char f[6][6],s[6],i,j,a,y,x,p,b;int main(){for(;i<9;++i,b=!b){scanf("%s",s);for(j=4+b;j--;)a=s[j]-48,f[i/2][j]|=a<<1+b,f[i/2+b][j+!b]|=a<<3-b*3;}do{while(!((f[y][x]>>(p=(p+1)%4))&1));x+=p?2-p:0;y+=3-p?p-1:0;putchar("DLUR"[p=(p+2)%4]);}while(y|x|**f*p>9);return!puts("");}

Measured memory_bytes: 0
d=list(map(int,input().split()))
for i in range(int(input())):
	o=list(map(int,input().split()))

	for i in range(4):
		 d[0],d[1],d[4],d[5]=d[1],d[5],d[0],d[4]
		 if d[0]==o[0]:
		 	break
	if d[0]!=o[0]:
		for i in range(4):
			d[0],d[3],d[5],d[2]=d[3],d[5],d[2],d[0]
			if d[0]==o[0]:
				break
	for i in range(4):
		d[1],d[3],d[4],d[2]=d[3],d[4],d[2],d[1]
		if d[1]==o[1]:
			break
	print(d[2])
	


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

int main()
{
    int n, total;
    cin >> n;
    int a[n] = {};
    int diff[n] = {};
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    total = 0;
    for(int i=0; i<n; i++){
        if(i == 0){
            total += abs(a[i]);
            diff[i] = abs(a[i+1]) - (abs(a[i+1]-a[i]) + abs(a[i]));
        }else if(i == n-1){
            total += (abs(a[i] - a[i-1]) + abs(a[i]));
            diff[i] = abs(a[i-1]) - (abs(a[i]-a[i-1]) + abs(a[i]));
        }else{
            total += abs(a[i] - a[i-1]);
            diff[i] =  abs(a[i+1] - a[i-1]) - (abs(a[i+1]-a[i]) + abs(a[i] - a[i-1]));
        }
    }
    for(int i=0; i<n; i++){
        cout << total+diff[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}
int main()
{
    string A, B;
    cin >> A >> B;

    if (A.size() > B.size())
    {
        cout << "GREATER" << endl;
    }
    else if (A.size() < B.size())
    {
        cout << "LESS" << endl;
    }
    else
    {
        if (A.compare(B) > 0)
        {
            cout << "GREATER" << endl;
        }
        else if(A.compare(B) < 0)
        {
            cout << "LESS" << endl;
        }else{
            cout << "EQUAL" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  lint n;
  cin>>n;
  lint count=0;
  for(lint i=1;i<=n;i++){
    if(i%15==0){

    }
    else if(i%3==0){

    }
    else if(i%5==0){

    }
    else{
      count+=i;
    }
  }
  cout<<count;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
int lcm(int a, int b){
  return a / gcd(a,b) * b;
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int n;
struct P{
  double x,y;
};
vector<P> v;

double dist(P a, P b){
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  
  return sqrt(dx*dx + dy*dy);
}

double f(double x, double y){
  double ret = 0;
  rep(i,n){
    chmax(ret, dist((P){x,y},v[i]));
  }
  return ret;
}

double g(double x){
  double l = 0, r = 1000;
  rep(i,80){
    double c1 = (l*2 + r)/3;
    double c2 = (l + r*2)/3;
    if(f(x,c1) > f(x,c2)) l = c1;
    else r = c2;
  }
  
  return f(x,l);
}
int main(){
  cin >> n;
  v = vector<P>(n);
  rep(i,n){
    cin >> v[i].x >> v[i].y;
  }
  
  double l = 0, r = 1000;
  rep(i,80){
    double c1 = (l*2 + r)/3;
    double c2 = (l + r*2)/3;
    if(g(c1) > g(c2)) l = c1;
    else r = c2;
  }
  
  double ans = g(l);
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int i,a,b,k[6]={},s=0;
  for (i=0;i<3;i++){
    cin >> a >> b;
    k[a]++;
    k[b]++;
  }
  for (i=1;i<=4;i++){
    if (k[i]==1) s++;
    else if (k[i]!=2) break;
  }
  if (i!=5 || s!=2) cout << "NO" << endl;
  else cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,num=0;
	char a[51][51]={0};
	cin>>h>>w;
	for(int x=1;x<=h;x++)
	{
		for(int y=1;y<=w;y++)
		{
			cin>>a[x][y];
		}
	}
	for(int x=1;x<=h;x++)
	{
		for(int y=1;y<=w;y++)
		{
			num=0;
			if(a[x][y]=='.')
			{
				if(a[x-1][y]=='#')++num;
				if(a[x][y-1]=='#')++num;
				if(a[x-1][y-1]=='#')++num;
				if(a[x+1][y]=='#')++num;
				if(a[x][y+1]=='#')++num;
				if(a[x+1][y+1]=='#')++num;
		        if(a[x-1][y+1]=='#')++num;
		        if(a[x+1][y-1]=='#')++num;
		        cout<<num;
		 	}
			else
			{
				cout<<a[x][y];
			} 
		}
		cout<<endl;
	}
}

Measured memory_bytes: 256
N = int(input())
An = map(int, input().split())

total = 0
minim = 1000000000
num_negs = 0

for a in An:
    if a < 0:
        num_negs += 1
        a *= -1
        pass
    total += a
    minim = minim if minim < a else a
    pass

if num_negs % 2:
    print(total - 2*minim)
else:
    print(total)
    pass


Measured memory_bytes: 11212
from collections import Counter
n=int(input())
s=[input() for i in range(n)]

dic1=Counter(s[0])

for i in range(1,n):
    dic2=Counter(s[i])
    
    for i,v in dic1.items():
        dic1[i]=min(v,dic2[i])
ans=[]
for i,v in dic1.items():
    ans+=[i]*v
ans.sort()
print(''.join(ans))
    
    

Measured memory_bytes: 3316
#include <iostream>
using namespace std;
typedef long long ll;
ll n, a[100010], b[100010], fir, sec, com1[100010], com2[100010];
const ll mod = 1000000007;

ll pow(ll x, ll y){
    if (y == 0) return 1;
    if (y % 2){
        return x * pow(x, y - 1) % mod;
    } else {
        ll u = pow(x, y / 2);
        return u * u % mod;
    }
}

int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 1; i <= n + 1; i++){
        cin >> a[i];
        if (b[a[i]] != 0){
            fir = b[a[i]], sec = i;
            break;
        } else {
            b[a[i]] = i;
        }
    }
    com1[0] = 1, com2[0] = 1;
    for (ll i = 0; i <= n; i++){
        com1[i + 1] = com1[i] * (n + 1 - i) % mod * pow(i + 1, mod - 2) % mod;
    }
    ll m = n - sec + fir;
    for (ll i = 0; i < m; i++){
        com2[i + 1] = com2[i] * (m - i) % mod * pow(i + 1, mod - 2) % mod;
    }
    for (ll i = 1; i <= n + 1; i++){
        cout << (mod + com1[i] - com2[i - 1]) % mod << endl;
    }
}


Measured memory_bytes: 3712
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    solve();
	}
    }

    static void solve(){
	double a = kbd.nextDouble();
	double b = kbd.nextDouble();
	int n = kbd.nextInt();
	
	String s = Double.toString(a/b);
	//System.out.println(a/b);

	int ans=0;
	int d=0, i;
	while(!s.substring(d, d+1).equals(".")) d++;
	d+=1;
	for(i=d; i<s.length()&&i<n+d; i++){
	    ans += Integer.parseInt(s.substring(i, i+1));
	}

	System.out.println(ans);
    }
}

Measured memory_bytes: 20748
#include<stdio.h>
#define N 101
int m[N][N],p[N];

void mat(int n) 
{
  int i,l,j,k,q;
  for(i=1; i<=n; i++) m[i][i]=0;
  for(l=2; l<=n; l++)
    for(i=1; i<=n-l+1; i++){
      j=i+l-1;
      m[i][j]=1E+9;
      for(k=i; k<=j-1;k++){
    q = m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
    m[i][j] =  m[i][j]>q ? q:m[i][j];
      }
    }
}
 
int main()
{
  int n,i,r,c;
  int min;
 
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%d%d",&r,&c);
    if(i==0) p[i]=r;
    p[i+1]=c;
  }
  mat(n);
  printf("%d\n",m[1][n]);
  return 0;
}

Measured memory_bytes: 632
// Created by new_sm
//
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
s.find_by_order(x) xth element in set
x.order_of_key(x) number of elements <x*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
int a,b,c;
cin>>a>>b>>c;
int k;
cin>>k;
while((b<=a)&&k)
{
	b*=2;
	k--;
}
while((c<=b)&&k)
{
	c*=2;
	k--;
}
if(a<b&&b<c)
cout<<"Yes";
else
cout<<"No";
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}




Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

int a, b, c;

int main() {
    read(a); read(b); read(c);
    if(a + b + c >= 22) printf("bust\n");
    else printf("win\n");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
#include<string>
#include<cmath>
#include<tuple>
#define INF 1111111
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> tup;
typedef long long ll;

int dy[4]={-1, 0, 1, 0};
int dx[4]={0, -1, 0, 1};
queue<tup> q; 

int sides[10][10];
int a,b;
int n,m;
int ans;

void dfs(int start, int passed[10]){
  int nowpas[10];
  for(int i=0;i<=10;i++)
    nowpas[i] = passed[i];
  for(int i=1;i<=n;i++)
  nowpas[start] = 1; 
  bool flag = true;
  for(int j=1;j<=n;j++){
    if(nowpas[j] == 0)
       flag = false;
  }
  if(flag){
     ans++;
     
  }
  for(int i=1;i<=n;i++){
    if(sides[start][i] == 1 && nowpas[i] == 0){
      dfs(i,nowpas);
    }
  }
}


int main(){
  
  cin >> n >> m;
  int passed[10] = {};
  
  
  for(int i=0;i<=n;i++)
    for(int j=0;j<=n;j++)
      sides[i][j] = 0;
  for(int i=0; i<m; i++){
    cin >> a >> b;
    sides[a][b] = 1;
    sides[b][a] = 1;
  }
  ans = 0;
  int start = 1;
  passed[start] = 1;
  dfs(start, passed);
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    ll X, Y;
    cin >> X >> Y;

    ll cnt = 0;
    while (X <= Y) {
        X *= 2;
        cnt++;
    }

    put(cnt);

    return 0;
}

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

string a,b;

int main()
{
  cin >> a >> b;
  int x = stoi(a+b);
  bool check = false;
  for(int i = 1; i <= 1000; i++)
  {
    if(x == i*i) check = true;
  }
      
  if(check) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
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; }




int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll A, B, C; cin >> A >> B >> C;
    cout << max(C - (A-B),0ll) << endstr;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""微分
"""

import math

def cost(A, x):
    return sum((x-a)**2 for a in A)

def main():
    N = int(input())
    A = list(map(int, input().split()))

    x = sum(A) / N;
    ans = min(cost(A, math.ceil(x)), cost(A, math.floor(x)))

    print(ans)

if __name__ == "__main__": main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define abs(x) ((x)>0?(x):-(x))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define ll long long
//#define file
using namespace std;

bool a[5001],b[5001];
int d1[5001],d2[5001],D[10001],n,N,i,j,k,l,s1,s2,ans,sum,tot;
char ch;

int main()
{
	#ifdef file
	freopen("AGC030E.in","r",stdin);
	#endif
	
	scanf("%d",&n);N=n/2;
	fo(i,1,n) {ch=getchar();while (ch!='0' && ch!='1') ch=getchar(); a[i]=ch=='1';}
	fo(i,1,n) {ch=getchar();while (ch!='0' && ch!='1') ch=getchar(); b[i]=ch=='1';}
	fo(i,1,n-1)
	{
		if (a[i]==a[i+1]) d1[++s1]=i;
		if (b[i]==b[i+1]) d2[++s2]=i;
	}
	if (!s1 && !s2) {if (a[1]==b[1]) printf("0\n"); else printf("%d\n",n);return 0;}
	
	ans=2133333333;
	fo(i,-N,N)
	if ((a[1]^(i&1))==b[1] && abs(s2-(s1+i))<=N)
	{
		j=s2-(s1+i);
		
		tot=sum=0;
		fo(k,1,-i) sum+=d1[k];
		fo(k,1,i) D[++tot]=0;
		fo(k,1+max(-i,0),s1-max(-j,0)) D[++tot]=d1[k];
		fo(k,1,-j) sum+=n-d1[s1-k+1];
		fo(k,1,j) D[++tot]=n;
		
		if (tot>s2) continue;
		
		fo(k,1,tot) sum+=abs(D[k]-d2[k]);
		ans=min(ans,sum);
	}
	
	printf("%d\n",ans);
	
	fclose(stdin);
	fclose(stdout);
	
	return 0;
}

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

s,k,n = 0,1,N
while k<=n:
	m = N//k
	s += (k-1)*k*(n-m)*(n+m+1)//2
	s += k*m*(m+1)
	k,n = k+1,m
if m<k-1:
	s -= (k-1)*m*(m+1) 
print(s//2)


Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define fbo find_by_order //returns iterator
#define fok order_of_key //return index
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=998244353;
//string s=bitset<32>(n).to_string();
typedef tree<lli,null_type,less<lli>,rb_tree_tag, // change both to lli if set is req insted of multiset
tree_order_statistics_node_update> indexed_set;
lli power(lli x, lli y, lli p)   
{  
    lli res = 1;     // Initialize result  ! 
    x = x % p; // Update x if it is more than or  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 

int main()
{
	lli a,b,ma,mb,mc;
	cin>>a>>b>>ma>>mb>>mc;
	lli ara[ma],arb[mb],arc[mc];
	loop(i,0,ma)cin>>ara[i];sort(ara,ara+ma);reverse(ara,ara+ma);
	loop(i,0,mb)cin>>arb[i];sort(arb,arb+mb);reverse(arb,arb+mb);
	loop(i,0,mc)cin>>arc[i];//sort(arc,arc+mc);reverse(ara,ara+ma);
	vl temp;
	for(lli i=0;i<a;i++)temp.pb(ara[i]);
	for(lli i=0;i<b;i++)temp.pb(arb[i]);
	for(lli i=0;i<mc;i++)temp.pb(arc[i]);
	sort(temp.begin(),temp.end());
	reverse(temp.begin(),temp.end());
	lli ani=0;
	for(lli i=0;i<a+b;i++)ani+=temp[i];
	cout<<ani;
    return 0;
}

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

#define MOD 1000000007
#define ll long long int
#define vi vector<int>
#define vii vector< vector<int> >
#define PI 3.1415926535897932384626433832795
#define INF 9223372036854775807LL


int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c;
	cin >> a >> b >> c;
	if(a == b) {
		cout << c;
	} else if(a == c) {
		cout << b;
	} else {
		cout << a;
	}
	return 0;
}



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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
double PI=3.14159265;
int main(void){
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	printf("%.10lf",(double)n*(double)2*PI);
    return 0;
}

Measured memory_bytes: 3724
N = int(input())
A = [0]*N
testi = []
assume = 2**N-1
ans = 0

for i in range(N):
    A[i] = int(input())
    if A[i] == 0:
        testi.append(-1)
    else:
        testi.append([list(map(int, input().split())) for _ in range(A[i])])

while(assume):
    flag = True
    for i in range(N):
        if assume & (2**i) != 0 and testi[i] != -1:
            for j in testi[i]:
                if j[1] != ((assume & (2**(j[0]-1))) >> (j[0]-1)):
                    flag = False
                    break
        
        if not flag:
            break
    
    if flag:
        tmp = bin(assume).count('1')
        if tmp > ans:
            ans = tmp
    assume -= 1
    

print(ans) 

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
    int A,B,m,n,p;
    scanf("%d%d",&A,&B);

    m=A+B;
    n=A-B;
    p=A*B;

    if(m>=n && m>=p)
    {
        printf("%d\n",m);
    }
    else if(n>=m && n>=p)
    {
        printf("%d\n",n);
    }
    else if(p>=m && p>=n)
    {
        printf("%d\n",p);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

int main() {
	ll r, d, x;
	cin >> r >> d >> x;
	rep(i, 10) {
		x = r * x - d;
		cout << x << endl;
	}
	return 0;
}



Measured memory_bytes: 3524
#include<iostream>
#include<cmath>
#include<string>
#include<list>
#include<vector>
#include<algorithm>
#include<numeric>
#include<queue>
#include<utility>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
	/*
	cin>>x;
	cout<<x<<endl;
	*/
	int a,b,c,i,j,k,l,n,m,ans=0;
	vector<tuple<string,int,int>> x;
	string s;

	cin>>a;

	for(i=0;i<a;i++){
		cin>>s>>b;
		x.push_back(make_tuple(s,100-b,i+1));
	}

	sort(x.begin(),x.end());

	for(i=0;i<a;i++){
		cout<<get<2>(x[i])<<endl;
	}

}

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

signed main(){
	int H;
	scanf("%lld", &H);
	H |= (H >> (1 << 0));
	H |= (H >> (1 << 1));
	H |= (H >> (1 << 2));
	H |= (H >> (1 << 3));
	H |= (H >> (1 << 4));
	H |= (H >> (1 << 5));
	printf("%lld\n", H);
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}

#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=2e5+500;

vector<pii> out[maxn];
vector<pii> dp[maxn];

ll fr[maxn];


vector<ll> vec;
ll y;

void hesab(ll b,ll x){
	if(x==0)return;
	if(x<=y){
		dp[b].pb(mp(x,1));
		return;
	}	
	ll v=lower_bound(vec.begin(),vec.end(),x)-vec.begin();
	ll s=vec[v-1];
	dp[b].pb(mp(v-1+y+1,x/s));
	hesab(b,x%s);
}
vector<ll> soodi(vector<ll> a){
	vector<ll> b;
	for(auto e:a){
		while(b.size() && b.back()>=e){
			b.pop_back();
		}
		b.pb(e);
	}
	return b;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	ll q,n;
	cin>>n>>q;
	vec.pb(n);
	for(ll i=0;i<q;i++){
		ll v;
		cin>>v;
		vec.pb(v);
	}
	vec=soodi(vec);
	y=vec[0];
	dp[0+y+1].pb(mp(vec[0],1));
	for(ll i=1;i<(ll)vec.size();i++){
		hesab(i+y+1,vec[i]);
	}
	for(ll i=2;i<=y;i++){
		dp[i].pb(mp(i-1,1));
	}
	for(ll i=0;i<maxn;i++){
		for(auto e:dp[i]){
			out[e.F].pb(mp(i,e.S));
		}
	}
	
	fr[vec.size()-1+y+1]=1;
	for(ll i=vec.size()+y-1;i>=1;i--){
		for(auto e:out[i]){
			fr[i]+=fr[e.F]*e.S;
		}
	}
	for(ll i=1;i<=y;i++){
		cout<<fr[i]<<'\n';
	}	
	for(ll i=y+1;i<=n;i++){
		cout<<"0\n";
	}


}




















Measured memory_bytes: 45012
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
const ll MOD = 1e9;

int main(){
  ll n;
  cin>>n;
  ll mi=1e18;
  ll k;
  for(int i=0;i<n;i++){
	ll a,b;
	cin>>a>>b;
	if(b<mi){
	  mi=b;
	  k=a;
	}
  }
  cout<<k+mi<<endl;
  return 0;
}


Measured memory_bytes: 256
var n:string;
    a,b,c,d:longint;
begin
  readln(n);
  a:=ord(n[1])-48;
  b:=ord(n[2])-48;
  c:=ord(n[3])-48;
  d:=ord(n[4])-48;
  if a-b-c-d=7
  then begin
         writeln(a,'-',b,'-',c,'-',d,'=',7);
         exit;
       end;
  if a+b-c-d=7
  then begin
         writeln(a,'+',b,'-',c,'-',d,'=',7);
         exit;
       end;
  if a-b+c-d=7
  then begin
         writeln(a,'-',b,'+',c,'-',d,'=',7);
         exit;
       end;
  if a-b-c+d=7
  then begin
         writeln(a,'-',b,'-',c,'+',d,'=',7);
         exit;
       end;
  if a+b+c-d=7
  then begin
         writeln(a,'+',b,'+',c,'-',d,'=',7);
         exit;
       end;
  if a+b-c+d=7
  then begin
         writeln(a,'+',b,'-',c,'+',d,'=',7);
         exit;
       end;
  if a-b+c+d=7
  then begin
         writeln(a,'-',b,'+',c,'+',d,'=',7);
         exit;
       end;
  if a+b+c+d=7
  then begin
         writeln(a,'+',b,'+',c,'+',d,'=',7);
         exit;
       end;
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

const ll INF = 1e16;
int main()
{
    int n;
    cin >> n;
    vvp g(n);
    rep(i, n - 1)
    {
        int f, t, d;
        cin >> f >> t >> d;
        f--;
        t--;
        g[f].emplace_back(P(t, d));
        g[t].emplace_back(P(f, d));
    }

    int qry, k;
    cin >> qry >> k;
    k--;
    vll d(n, INF);
    queue<int> q;
    q.push(k);
    d[k] = 0;

    while (q.size())
    {
        int v = q.front();
        q.pop();
        ll now = d[v];
        for (P p : g[v])
        {
            int nv = p.first;
            ll dist = p.second;
            if (now + dist < d[nv])
            {
                q.push(nv);
                d[nv] = now + dist;
            }
        }
    }

    rep(i, qry)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        cout << d[x] + d[y] << "\n";
    }
    cout << endl;

    return 0;
}


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

int main() {
    string O;
    string E;
    cin >> O;
    cin >> E;
    for (int i = 0; i < E.length(); ++i){
        cout << O[i] << E[i];
    }
    if (O.length() > E.length()) cout << O.back();
    cout << endl;
    return 0;
}

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

int main(){
  int h,n;cin >> h >> n;
  int a;
  int s=0;
  for (int i=0;i<n;i++){
    cin >> a;
    s += a;
  }
  if (s >= h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    ll a;
    string b;
    istringstream ss1;
    int p;
    cin >> a >> b;
    b.erase(b.find("."), 1);
    ss1 = istringstream(b);
    ss1 >> p;
    cout << a * p / 100 << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3600
/*
Stay innocent, be naive. 
But still dream big. 
Dream big to the point that it is beyond your ability and endeavour to achieve it. 
So dream big and don�t lose your innocence.
*/
import java.util.*;
import java.io.*;

   public class Main
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int max = 0;
         int max2 = 0;
         int maxcnt = 0;
         int[] arr = new int[N];
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(infile.readLine());
         for(int i=0; i < N; i++)
            max = Math.max(max, arr[i]);
         for(int a: arr)
            if(max == a)
               maxcnt++;
         for(int i=0; i < N; i++)
            if(arr[i] < max)
               max2 = Math.max(max2, arr[i]);
         for(int i=0; i < N; i++)
         {
            if(maxcnt > 1)
               System.out.println(max);
            else
            {
               if(arr[i] == max)
                  System.out.println(max2);
               else
                  System.out.println(max);   
            }
         }
      }
      public static void sort(int[] arr)
      {
         //stable heap sort
         PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
         for(int a: arr)
            pq.add(a);
         for(int i=0; i < arr.length; i++)
            arr[i] = pq.poll();
      }
   }

Measured memory_bytes: 68588
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let k: i64 = read(&mut sin);
    let n: usize = read(&mut sin);
    let mut zs: Vec<i64> = (0..n).map(|_| read(&mut sin)).collect();

    zs.sort();
    let d = std::cmp::max(
        (0..(n - 1)).map(|i| zs[i + 1] - zs[i]).max().unwrap(),
        zs[0] + (k - zs[n - 1]));
    println!("{}", k - d);
}

Measured memory_bytes: 6396
#include<cstdio>
#include<iostream>
#include<string>
#include <algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
using ll = long long;

int main(){
	int A, B, C, K;
		cin >>A >> B >> C >> K;
		cout << A + B + C + max({ A, B, C }) * ((1 << K) - 1) << endl;
		return 0;
	
}


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

int main() {
    char n[3];
    cin >> n;
    if (n[0] == '7' || n[1] == '7' || n[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;

return 0;
}


Measured memory_bytes: 3616