akhauriyash/Code-Regression huggingface dataset:
from math import ceil

a = [0, 1, 2, 4] # n = 0 ??? 3 ????????§??°??????
while True:
    n = int(input())
    if n == 0:
        break
    for i in range(len(a), n+1):
        a.append(a[-3] + a[-2] + a[-1])
    print( int(ceil(a[n]/3650)) )

Measured memory_bytes: 7736
#include <bitset>
#include <iostream>

int main() {
  std::bitset<64> bs;
  int n, q;
  std::cin >> n;
  std::bitset<64> mask[n];
  for (int i = 0; i < n; ++i) {
    int k;
    std::cin >> k;
    while (k-- > 0) {
      int m;
      std::cin >> m;
      mask[i].set(m);
    }
  }

  std::cin >> q;
  for (int j = 0; j < q; ++j) {
    int c, i;
    std::cin >> c >> i;

    if (c == 0)
      std::cout << bs.test(i) << std::endl;

    if (c == 1)
      bs |= mask[i];

    if (c == 2)
      bs &= ~mask[i];

    if (c == 3)
      bs ^= mask[i];

    if (c <= 3)
      continue;

    std::bitset<64> bsm;
    if (c >= 4)
      bsm = bs & mask[i];

    if (c == 4)
      std::cout << (bsm == mask[i]) << std::endl;

    if (c == 5)
      std::cout << bsm.any() << std::endl;

    if (c == 6)
      std::cout << bsm.none() << std::endl;

    if (c == 7)
      std::cout << bsm.count() << std::endl;

    if (c == 8)
      std::cout << bsm.to_ullong() << std::endl;
  }
}



Measured memory_bytes: 3108
#include<iostream>
using namespace std;
int main(){
	int w,h,a,b;
	while(1){
		cin>>h>>w;
		if(h==0&&w==0){break;}
		for(b=0;b<h;b++){
			for(a=0;a<w;a++){
				if((b%2)==0&&b!=1){
					if((a%2)==0&&a!=1){
						cout<<'#';
					}else if((a%2)!=0||a==1){
						cout<<'.';
					}
				}else if((b%2)!=0||b==1){
					if((a%2)==0&&a!=1){
						cout<<'.';
					}else if((a%2)!=0||a==1){
						cout<<'#';
					}
				}
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,x;
ll a[13][13];
ll c[13];
ll maxx=10000000;
ll findd(ll i,ll p[])
 {
     ll j;
      for( j=0;j<m;j++)
        if(p[j]>=x)
          continue;
         else
            break;
            
   if(j==m)
   {
    //   for( j=0;j<m;j++)
    //   cout<<p[j]<<" ";
    //   cout<<i<<"***"<<endl;
     return 0;
   }
   if(i==n)
     return 10000000;
   
   ll ans=findd(i+1,p);
    for(ll j=0;j<m;j++)
      p[j]=p[j]+a[i][j];
   ans=min(ans,findd(i+1,p)+c[i]);
   for(ll j=0;j<m;j++)
      p[j]=p[j]-a[i][j];

   return ans;
  }
int main()
{
  cin>>n>>m>>x;
 
  ll i,j;
//   for(i=0;i<n;i++)
//     cin>>c[i];
  ll p[m];
  for(i=0;i<m;i++)
    p[i]=0;
  for(i=0;i<n;i++)
  {
      cin>>c[i];
    for(j=0;j<m;j++)
      cin>>a[i][j];
  }
    
      ll ans=findd(0,p);
      if(ans>=10000000)
      ans=-1;
      cout<<ans;
  
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <ctype.h>
#include <cstdio>
using namespace std;

int main() {
  char a[1200];
  int i;
  for (i = 0; i < 1200; i++) {
    a[i] = getchar();
    if (a[i] == '\n') break;
  }
  for (int j = 0; j < i; j++) {
    if (a[j] == '\n') break;
    else if (isupper(a[j])) a[j] = tolower(a[j]);
    else if (islower(a[j])) a[j] = toupper(a[j]);
  }
  for (int j = 0; j < i; j++)  {
    if (a[j] == '\n') break;
    cout << a[j];
  }
  cout << endl;
}


Measured memory_bytes: 3064
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  int xs[100] = {};
  int ys[100] = {};
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> ys[i];
  }
  double sum1 = 0.0, sum2 = 0.0, sum3 = 0.0;
  double d = 0.0, max = 0.0;
  for (int i = 0; i < n; i++) {
    d = abs((xs[i] - ys[i]));
    sum1 += d;
    sum2 += (d * d);
    sum3 += (d * d * d);
    if (max < d) {
      max = d;
    }
  }
  printf("%.5f\n", sum1);
  printf("%.5f\n", sqrt(sum2));
  printf("%.5f\n", pow(sum3, 1.0 / 3.0));
  printf("%.5f\n", max);
  return 0;
}


Measured memory_bytes: 3332
open Batteries
open Char
let arr = String.explode (read_line ())
let brr = String.explode (read_line ())
let crr = String.explode (read_line ())
let ans = escaped (List.nth arr 0) ^ escaped (List.nth brr 1) ^ escaped (List.nth crr 2)
let () = print_endline ans

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

using namespace std;
typedef long long ll;

int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  vector< vector<int> > s(M);
  for (int i = 0; i < M; ++i) {
    int k;
    scanf("%d", &k);
    vector<int> tmp(k);
    for (int j = 0; j < k; ++j) {
      scanf("%d", &tmp[j]);
      tmp[j]--;
    }
    s[i] = tmp;
  }

  vector<int> p(M);
  for (int i = 0; i < M; ++i) scanf("%d", &p[i]);

  int ans = 0;
  for (int i = 0; i < 1 << N; ++i) {
    bool is_valid = true;
    for (int j = 0; j < M; ++j) {
      int cnt = 0;
      for (int k = 0; k < s[j].size(); ++ k) {
	if (i >> s[j][k] & 1) cnt++;
      }
      if (cnt % 2 != p[j]) {
	is_valid = false;
	break;
      }
    }
    if (is_valid) ans++;
  }
  printf("%d\n", ans);
  return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
#define N 100001
#define NIL -1
  
 struct Node
{
  int parent;
  int left;
  int right;
};
struct Node T[N];
int cnt=0;
  
int depth(int nodeid)
{
  if(T[nodeid].parent == NIL)
  {
    return cnt;
  }
  else
  {
 cnt++;
 return depth(T[nodeid].parent);
  }
}
  
void degree(int nodeid)
{
  if(nodeid != NIL)
  {
    if(cnt != 0)
    {
      printf(", ");
    }
    printf("%d",nodeid);
    cnt++;
    degree(T[nodeid].right);
  }
}
  
int main(void)
{
    
  int i,j,n,m,newnode,child,left,right;
    
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    T[i].parent = T[i].left = T[i].right = NIL;
  
  for(i=0;i<n;i++)
  {
    scanf("%d%d",&newnode,&m);
    for(j=0;j<m;j++)
    {
      scanf("%d",&child);
      T[child].parent = newnode;
      if(j != 0) {
    T[left].right = child;
      }
      else {
    T[newnode].left = child;
      }
      left = child;
    }
  }
  for(i=0;i<n;i++) {
    cnt = 0;
    printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,depth(i));
      if(T[i].parent == NIL) {
    printf("root, [");
      }
      else if (T[i].left == NIL) {
    printf("leaf, [");
      }
      else  {
    printf("internal node, [");
      }  
    cnt=0;
    degree(T[i].left);
    printf("]\n");
  }
  return 0;
}

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

void dfs(int now,vector<int> &parent, 
        map<pair<int,int>,int> &edge_color, vector<vector<int>> &G){
    int col=0;
    int now_p = parent.at(now);
    rep(i, (int)G.at(now).size()){
        pair<int,int> p=make_pair(min(now,now_p), max(now,now_p));
        int c;
        if(now==0)  c=-1;
        else  c=edge_color[p];
        int go=G.at(now).at(i);
        if(go != parent.at(now)){
            if(col==c) col++;
            parent.at(go) = now;
            pair<int, int> q=make_pair(min(now,go), max(now,go));
            edge_color[q] = col;
            col++;
            dfs(go, parent, edge_color,G);
        }
    }
}


int main(){
    int n;
    cin >> n;
    vector<vector<int>> G(n);
    vector<pair<int,int>> edge_num(n-1);
    map<pair<int,int>,int> edge_color;
    rep(i, n-1){
        int a,b;
        cin >> a >> b;
        a--; b--;
        pair<int, int> p;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
        p=make_pair(a,b);
        edge_num.at(i) = p;
    }
    vector<int> parent(n,0);
    dfs(0, parent, edge_color, G);
    int ans=0;
    rep(i,n){
        ans = max(ans, (int)G.at(i).size());
    }
    cout << ans << endl;
    rep(i, n-1){
        pair<int, int> p;
        p=edge_num.at(i);
        cout << edge_color.at(p) + 1 << endl;
    }
}


Measured memory_bytes: 20436
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B, C;
    cin >> A >> B >> C;
    for (int sum = A; sum <= A * B; sum += A)
    {
        if (sum % B == C)
        {
            cout << "YES" << endl;
            return;
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int i,K,X;
  

   
    scanf("%d", &K); 
    scanf("%d", &X);
    
    if(K==1){
        printf("%d ",X);
    }
    else{
        for(i=K-1;i>=1;i--){
            printf("%d ",X-i);
        }
        printf("%d ",X);
        for(i=1;i<K;i++){
            printf("%d ",X+i);
        }  
        
    }
  
  return 0;
   
}

Measured memory_bytes: 128
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

  vector<ll> ws(N + 1), vs(N + 1);
  vector<vector<ll> > dp(N + 1, vector<ll>(W + 1, 0));

  for (int i = 1; i <= N; i++) {
    cin >> ws[i] >> vs[i];
  }

  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= W; j++) {
      dp[i][j] = dp[i - 1][j];
      if (ws[i] <= j) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - ws[i]] + vs[i]);
      }
    }
  }

  ll ans = dp[N][W];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <iomanip>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    ll n,m,d;
    cin >> n >> m >> d;
    ll c =  n - d;//条件を満たす組
    ll mul = 1;
    if(d != 0){
        mul = 2;
    }

    float result = (float)(n - d) * (float)(m - 1) * (float)mul / (float)(n * n);
    cout << setprecision(10) << result << endl;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val A = sc.next().toLong()
        val V = sc.next().toLong()
        val B = sc.next().toLong()
        val W = sc.next().toLong()
        val T = sc.next().toLong()
        if (A <= B && A + V * T >= B + W * T) {
            pw.println("YES")
        } else if (A > B && A - V * T <= B - W * T) {
            pw.println("YES")
        } else {
            pw.println("NO")
        }
    }
}


Measured memory_bytes: 36524
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long N=scan.nextLong();
		long a[]=new long[(int) (N+1)];
		a[0]=0;
		a[1]=scan.nextLong();
		for(long i=2;i<N+1;i++){
			long c=scan.nextLong();
			a[(int) i]=a[(int) (i-1)]+c;
		}
		Arrays.sort(a);
		long ans=0;
		long co=0;
		for(long i=1;i<N+1;i++){
			if(a[(int) i]!=a[(int) (i-1)]){
				if(co!=0){
					ans+=(co+1)*co/2;
					co=0;
				}
			}
			else{
				co++;
			}
		}
		ans+=(co+1)*co/2;
		System.out.println(ans);
	}
}

Measured memory_bytes: 89688
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
using namespace std;
ll a[200010];

bool cmp(ll a,ll b)
{
    return a>b;
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
        scanf("%ld",a+i);
    sort(a+1,a+n+1,cmp);
    ll ans=0;
    for(int i=1;i<=n/2;i++)
    {
        ans+=2*a[i];
    }
    ans-=a[1];
    if(n%2==1)
    {
        ans+=a[n/2+1];
    }
    printf("%ld\n",ans);
	return 0;
}


Measured memory_bytes: 5380
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
}


Measured memory_bytes: 22484
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B
{
    public class Program

    {

        const string KEYENCE = "keyence";

        public static void Main(string[] args)
        {
            string s = RSt();
            if(s == KEYENCE)
            {
                Console.WriteLine("YES");
                return;
            }

            for (int i = 0 ; i < s.Length ; i++)
            {
                for (int j = 1 ; j <= s.Length - i ; j++)
                {
                    if(s.Remove(i,j) == KEYENCE)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }
             Console.WriteLine("NO");
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, A[200000], B[200000];
ll cnt;
priority_queue<pair<int, int>>q;
int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> B[i];
		if (A[i] != B[i]) {
			q.push(mkp(B[i], i));
		}
		if (A[i] > B[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	while (true) {
		if (q.size() == 1) {
			int x = q.top().first;
			int y = q.top().second;
			if ((x - A[y]) % (B[(y + N - 1) % N] + B[(y + 1) % N]) == 0) {
				cnt += (x - A[y]) / (B[(y + N - 1) % N] + B[(y + 1) % N]);
				cout << cnt << endl;
				return 0;
			}
			else {
				cout << -1 << endl;
				return 0;
			}
		}
		else {
			int x = q.top().first;
			int y = q.top().second;
			if (A[y] >= max(B[(y + N - 1) % N], B[(y + 1) % N])) {
				if ((x - A[y]) % (B[(y + N - 1) % N] + B[(y + 1) % N]) == 0) {
					cnt += (x - A[y]) / (B[(y + N - 1) % N] + B[(y + 1) % N]);
					q.pop();
					B[y] = A[y];
				}
				else {
					cout << -1 << endl;
					return 0;
				}
			}
			else {
				cnt += (x - max(B[(y + N - 1) % N], B[(y + 1) % N])) / (B[(y + N - 1) % N] + B[(y + 1) % N]) + 1;
				B[y] -= ((x - max(B[(y + N - 1) % N], B[(y + 1) % N])) / (B[(y + N - 1) % N] + B[(y + 1) % N]) + 1)*(B[(y + N - 1) % N] + B[(y + 1) % N]);
				if (B[y] < A[y]) {
					cout << -1 << endl;
					return 0;
				}
				q.pop();
				if (B[y] != A[y]) {
					q.push(mkp(B[y], y));
				}
			}
		}
	}
}


Measured memory_bytes: 3700
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;
 
#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
 
const ll MAX_N = 100000;
 
int main(void){
    ll a, b,c,d;
    string S;
    cin >> S;
    //cin >> a>>b>>c>>d;
    string answer;
 
    if (S[0] == S[1] && S[1] == S[2]) answer = "Yes";
    else if (S[1] == S[2] && S[2] == S[3]) answer = "Yes";
    else answer = "No";
    cout << answer << endl;
 
    return 0;
}

Measured memory_bytes: 256
'use strict';
(function(stdin) {
    var line = stdin.split('\n');
    var param = line[0].split(' ').map(Number);
    var result = (function(a, b, c) {
        return {
            true: 'Yes',
            false: 'No'
        }[(a < b && b < c)];
    }(param[0], param[1], param[2]));
    console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15560
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007

using namespace std;

static const long long MAX = 100001;
static const long long NIL = -1;

struct nex{
    long long p,d;
};

long long n;
vector <nex> G[MAX];
long long color[MAX];
long long pos[MAX];

bool dfs(long long r , long long c){
    stack<long long> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()){
        long long u = S.top();
        S.pop();
        for (long long i=0;i<G[u].size();i++){
            nex v = G[u][i];
//            cout << v.d << endl;
//            cout << v.p << endl;
            if(color[v.p] != NIL){
                if(pos[v.p] != pos[u] + v.d){
                    return false;
                }
            }
            if(color[v.p] == NIL){
                color[v.p] = c;
                pos[v.p] = pos[u] + v.d;
                S.push(v.p);
            }
        }
    }
    return true;
}

bool assignColor(long long n){
    long long id = 1;
    for (long long i=0;i<=n;i++){
        color[i] = NIL;
    }
    for (long long u = 1;u<=n;u++){
        if (color[u] == NIL){
            bool p = dfs(u, id++);
            if(!p){
                return p;
            }
        }
    }
    return true;
}

int main() {
    
    long long n,m;
    cin >> n >> m;
    for (long long i=0;i<m;i++){
        long long l,r,d;
        cin >> l >> r >> d;
        nex p;
        p.p = r;
        p.d = d;
        G[l].push_back(p);
        p.p = l;
        p.d = -d;
        G[r].push_back(p);
    }

    if(assignColor(n)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
//    for (long long i=1;i<=n;i++){
//        cout << i << " " << pos[i] << " " << color[i] << endl;
//    }

}

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

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans;
    // AとBの偶奇が一致するか
    if(a%2 == b%2){
        // Aは全ての試合で敗北し、Bは全ての試合で勝利すればよい
        ans = (b-a)/2;
    }
    else{
        // Aが卓1で処理するかBが卓Nで敗北して調整する

        // A,Bどちらかが1,Nに到達するまでのラウンド数
        ll dist = min(a-1,n-b);
        // どちらかが到達してから調整の一勝（一敗）をした上で2人が同じ卓になるまでのラウンド数が答え
        ans = dist + 1 + (b-a-1)/2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*Author : Yuvraj Singh
 * Patience is Power
 * 
 * */
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007
#define ar array
ll power(ll x,ll y) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return ((temp%mod)*(temp%mod))%mod; 
    else
        return ((x%mod)*(temp%mod)*(temp%mod))%mod; 
}

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


bool cmp(pair<int,int>a,pair<int,int>b){
	return a.second<b.second;
}




void solve(){
	ll n; cin>>n;
	ll res=0;
	ll j=1;
	while((n-1)/j){
		res += (n-1)/j;
		j++;
	}
	cout<<res;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	//int t; cin>>t;
	//while(t--)
		solve();
    return 0;
}

Measured memory_bytes: 3636
# coding: utf-8
# Your code here!
from copy import deepcopy
def selectionSort(A,N):
    lst=deepcopy(A)
    for i in range(N):
        minj=i
        for j in range(i,N):
            if int(lst[j][1])<int(lst[minj][1]):
                minj=j
        lst[i],lst[minj]=lst[minj],lst[i]
    return(lst)

def bubbleSort(A,N):
    lst=deepcopy(A)
    for i in range(N):
        for j in range(N-1,i,-1):
            if int(lst[j][1])<int(lst[j-1][1]):
                lst[j],lst[j-1]=lst[j-1],lst[j]
    return(lst)

a=int(input())
b=input().split(" ")
Selected=selectionSort(b,a)
Bubbled=bubbleSort(b,a)
IsStable="Stable"
for i in range(a):
    if Selected[i] != Bubbled[i]:
        IsStable="Not stable"

print(" ".join(Bubbled),"Stable"," ".join(Selected),IsStable,sep="\n")


Measured memory_bytes: 6352
using System;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[3];
            a[0] = int.Parse(str[0]);
            a[1] = int.Parse(str[1]);
            a[2] = int.Parse(str[2]);
            Array.Sort(a);
            Console.WriteLine("{0} {1} {2}", a[0], a[1], a[2]);
        }
    }
}

Measured memory_bytes: 9368
A, B, C, D, E, F = map(int, input().split())

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range(int((E*w / 100) / C) + 1) for d in range(int((E*w / 100) / D) + 1) if ((c*C + d*D)*100 <= E*w) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(100*A if W[I] == 0 else W[I] + S[I], S[I])

Measured memory_bytes: 5308
n,W=map(int,input().split())
wt,p=[],[]
for _ in range(n):
    a,b=map(int,input().split())
    wt.append(a)
    p.append(b)
dp=[0 for i in range(W+1)]
for x in range(1,n+1):
  
  for y in range(W,0,-1):
    if wt[x-1]<=y:
        
      dp[y]=max(dp[y-wt[x-1]]+p[x-1],dp[y])
    else:

      dp[y]=dp[y]
print(dp[-1])

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const MAX_N = 100;
ll const MAX_K = 100000;
ll const INF = 1LL << 60;
ll const MOD = 1000000007;

struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}

    mint operator-() const { return mint(-x); }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

mint dp[MAX_N + 5][MAX_K + 5];
mint cum[MAX_K + 5];

int main() {
    INIT;

    ll N, K;
    cin >> N >> K;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    rep(i, a[0] + 1) { dp[0][i] = 1; }

    reps(i, 1, N) {
        cum[0] = dp[i - 1][0];
        reps(j, 1, K + 1) cum[j] = cum[j - 1] + dp[i - 1][j];

        rep(j, K + 1) { dp[i][j] = cum[j] - cum[max(0LL, j - a[i]) - 1]; }
    }

    // rep(i, 10) {
    //     rep(j, 15) { cout << dp[i][j] << " "; }
    //     cout << endl;
    // }

    cout << dp[N - 1][K] << endl;

    return 0;
}

Measured memory_bytes: 86420
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI as(n);
  VI bs(n);
  FOR(a,as) {
    cin >> a;
  }
  FOR(b,bs) {
    cin >> b;
  }
  int ans = 0;
  REP(i,0,30) {
    int mod = 2 << i;
    VI b_mod(n);
    transform(bs.begin(), bs.end(), b_mod.begin(), [=](int x){return x % mod;});
    sort(b_mod.begin(), b_mod.end());
    int count = 0;
    FOR(a,as) {
      int ak = a % mod;
      int ub = mod - 1 - ak;
      int lb = ub - mod / 2 + 1;
      count += upper_bound(b_mod.begin(), b_mod.end(), ub) - b_mod.begin();
      if(lb < 0) {
        count += n;
        lb += mod;
      }
      count -= lower_bound(b_mod.begin(), b_mod.end(), lb) - b_mod.begin();
    }
    if(count % 2) {
      ans |= 1 << i;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 2672
<?php

fscanf(STDIN, '%d %d %d', $a, $b, $c);

$aaa = [$a,$b,$c];

$counter = array_count_values($aaa);

if ($counter[5] === 2 && $counter[7] === 1) {
    echo 'YES';
} else {
    echo 'NO';
}

echo PHP_EOL;


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

int main(){
  constexpr char black= '#';
  constexpr char white= '.';

  int N;
  string S;
  cin >> N >> S;

  vector<int> left_b(N+1);
  for(int i=0; i<N; i++){
    int diff= (S.at(i)==black) ? 1
                               : 0;
    left_b.at(i+1)= left_b.at(i)+ diff;
  }

  const int Nblack= left_b.back();
  const int Nwhite= N- Nblack;
  // [0,i)を白, [i,N)を黒に塗ったときの手数を求め、最小値を出力
  int ans= N;
  for(int i=0; i<=N; i++){
    int right_w= N-i - (Nblack- left_b.at(i));
    int Nop= left_b.at(i)+ right_w;
    ans= min(ans, Nop);
  }

  cout << ans << endl;
}

Measured memory_bytes: 4444
#include <cstdio>
int abs(int x) {
	return x > 0 ? x : -x;
}
int main() {
	int n, x, max = -1, min = 10e9+1, arr[1001];
	scanf("%d", &n);
	while (n--) {
		scanf("%d", &x);
		if (max < x) max = x;
		if (min > x) min = x;
	}
	printf("%d", abs(max-min));
}

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

int main() {
  string S;
  cin >> S;
  
  int ans = 0;
  for (int i = 0; i < S.size() / 2; ++i) {
    if (S[i] != S[S.size() - i - 1]) ++ans;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int b[1000];
int c[1000];
int d[1000];
int e[1000];
int main(){
    int a;
    while(scanf("%d",&a),a){
        for(int i=0;i<a;i++)scanf("%d%d%d%d",b+i,c+i,d+i,e+i);
        int p,q,r,s;
        scanf("%d%d%d%d",&p,&q,&r,&s);
        bool ok=false;
        for(int i=0;i<a;i++){
            if(c[i]<=p&&d[i]<=q&&e[i]<=r&&4*c[i]+9*d[i]+4*e[i]<=s){
                ok=true;
                printf("%d\n",b[i]);
            }
        }
        if(!ok)printf("NA\n");
    }
}


Measured memory_bytes: 2632
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>

#define FOR(x,y)	for(int i=x;i<y;i++)
#define FOR2(x,y)	for(int j=x;j<y;j++)

#define LL			unsigned long long int

using namespace std;

int main(void)
{
	int k, n;
	vector<int> v;
	v.clear();

	cin >> n >> k;

	FOR(0, n) 
	{
		int hoge;
		cin >> hoge;
		v.push_back(hoge);
	}

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

	int sum = 0;
	FOR(0, k)
		sum += v[i];

	cout << sum;

	return 0;
}

Measured memory_bytes: 3600
n = int(input())
lista = []
for x in range(n):
    item = input()
    lista.append(item)

lista.sort(reverse = False)
contador = 1

if len(lista) == 1:
    print(contador)
else:
    i = 0
    j = 1
    while i != len(lista)-1:
        if lista[i] != lista[j]:
            contador += 1
        i += 1
        j += 1

    print(contador)


Measured memory_bytes: 23964
#include<stdio.h>
#define MAX 10000
#define NIL -1

typedef struct{
    int p, l, r;
}Node;

Node T[MAX];

void preParse(int);
void inParse(int);
void postParse(int);

int n;

int main() {
    int i, v, l, r, root;

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        T[i].p = NIL;
    }

    for (i = 0; i < n; i++) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if (l != NIL) T[l].p = v;
        if (r != NIL) T[r].p = v;
    }

    for (i = 0; i < n; i++) if (T[i].p == NIL ) root = i;

    printf("Preorder\n");
    preParse(root);
    printf("\n");
    printf("Inorder\n");
    inParse(root);
    printf("\n");
    printf("Postorder\n");
    postParse(root);
    printf("\n");

    return 0;
}

void preParse(int u) {
    if ( u == NIL) return;
    printf(" %d", u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse(int u) {
    if (u == NIL) return;
    inParse(T[u].l);
    printf(" %d", u);
    inParse(T[u].r);
}

void postParse(int u) {
    if ( u == NIL ) return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d", u);
}



Measured memory_bytes: 2056
## ひとまず愚直に書いて、ダメだったら後で賢いやり方を探ろう！
S = str(input())
## 101010...
count_10 = 0 
for i in range(len(S)):
  s = int(S[i])
  if i % 2 == 0:
    if s != 1:
      count_10 += 1
  else:
    if s != 0:
      count_10 += 1

## 010101...
count_01 = 0 
for i in range(len(S)):
  s = int(S[i])
  if i % 2 == 0:
    if s != 0:
      count_01 += 1
  else:
    if s != 1:
      count_01 += 1
    
print(min(count_10,count_01))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


ll ans=0;

int main(){
	ll N;
	cin >> N;
	ll a;
	vector<ll> L(N);
	REP(i,0,N) cin >> L[i];
	sort(L.begin(),L.end());
	REP(i,0,N-2){
		REP(j,i+1,N-1){
			auto itr = lower_bound(L.begin(),L.end(),L[i]+L[j]) - L.begin();
			ans += itr-(j+1);
		}
	}
	
	
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define ALL(x) x.begin(), x.end()

typedef long long int lld;
typedef pair<int, int> pii;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(15);
	cout << fixed;

	int n = 0;
	cin >> n;
	int cnt = 0;

	for (int i = 1; i <= n; i++) {
		if ((int)floor(log10(i)) % 2 == 0)
			cnt++;
	}

	cout << cnt << endl;


	return 0;
}

Measured memory_bytes: 256
from collections import deque

s = input()
q = deque(list(s))

while q:
  if len(q) >= 5:
    subs = q.popleft()+q.popleft()+q.popleft()+q.popleft()+q.popleft()
    if subs != 'erase' and subs != 'dream':
      print('NO')
      exit()
    if subs == 'erase' and len(q) != 0 and q[0] == 'r':
      q.popleft()
    if subs == 'dream' and len(q) == 2 and q[0]+q[1] == 'er':
      q.popleft()
      q.popleft()
    if subs == 'dream' and len(q) >= 3 and q[0]+q[1] == 'er' and q[2] != 'a':
      q.popleft()
      q.popleft()
  else:
   
    print('NO')
    exit()
    
print('YES')



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


int A[100100];

int main(){
	int n,cnt=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> A[i];
	}
	
	for(int i=1;i<=n;i++){
		if(i==A[A[i]])
			cnt++;
		
	}
	
	cout << cnt/2 << endl;
	return 0;
}

Measured memory_bytes: 640
//Abhinav ---IIIT_A
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;

bool Compare(pair<int,int> a, pair<int,int> b)
{
    int l1=a.ss-a.ff+1;
    int l2=b.ss-b.ff+1;
    if(l1!=l2) return l1>l2;
    return a.ff > b.ff;
}
std::priority_queue<pii, std::vector<pii>, std::function<bool(pii, pii)>> pq(Compare);

void solve(){
  int n; cin>>n;
  vector<long double> dp(n+1);
  dp[0]=1;
  f(i,0,n){
    ld th; cin>>th;
    for(int j=i+1;j>=0;--j){
      if(j!=0) dp[j]=dp[j-1]*th + dp[j]*(1-th);
      else dp[j]= dp[j]*(1-th);
    }
  }
  ld ans=0;
  f(i,0,n+1){
    int tails=n-i;
    if(i> tails) ans+=dp[i];
  }
  cout<<fixed<<setprecision(10)<<ans<<"\n";
}

int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
  int t=1; //cin>>t;
  while(t--) solve();
  return 0;
}
// check for overflows dummy !!!


Measured memory_bytes: 3868
import sys
from collections import Counter

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


w = input()
counter = Counter(w)
for c, num in counter.items():
    if num % 2 != 0:
        print('No')
        exit(0)
print('Yes')

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++){
    cout<<"node "<<i+1<<": key = "<<a[i]<<", ";
    if(i) cout<<"parent key = "<<a[(i-1)/2]<<", ";
    if(i*2+1<n) cout<<"left key = "<<a[i*2+1]<<", ";
    if(i*2+2<n) cout<<"right key = "<<a[i*2+2]<<", ";
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007

int main(){
    int a,b;
    cin >> a >> b;
    if(a+b == 15) cout << '+' << endl;
    else if(a*b == 15) cout << '*' << endl;
    else cout << 'x' << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

typedef unsigned long long ULL;
using namespace std;

bool check(int a, int b){
    if( a > b ){
        return true;
    }else{
        return false;
    }
}
int main(){
    int *A;
    int *B;
    int N;
    int i;
    int pos;
    int point,score;
    
    cin >> N;
    A = new int[N];
    B = new int[N];
    for(i=0;i<N;i++){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B,B+N,check);
    for(i=0;i<N;i++){
        if( B[0] == A[i] ){
            cout << B[1] << endl;
        }else{
            cout << B[0] << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3200
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt()

    println(n * n * n)

    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }


// Extensions
fun<T> List<T>.toBuckets(bucketKeys: List<T>): Map<T, Int> {
    val buckets = bucketKeys.associate { t -> Pair(t, 0) }.toMutableMap()
    this.forEach { t ->
        buckets[t] = buckets[t]!! + 1
    }
    return buckets
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)

// Util Functions
fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 31688
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  if(s.at(0)!=s.at(1)&&s.at(1)!=s.at(2)&&s.at(2)!=s.at(0)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


s = input()
K = int(input())
l = len(s)
ans = ['a']*l

ORDa = 97

for i in range(l):
	now = ord(s[i]) - ORDa
	tmp = 26 - now
	
	if K == 0:
		ans[i] = s[i]
	elif tmp == 26:
		ans[i] = s[i]
	elif tmp <= K:
		ans[i] = 'a'
		K -= tmp
	else:
		ans[i] = s[i]

if K > 0:
	K = K % 26
	tmp = ord(ans[-1])
	if tmp + K > ord('z'):
		aa = tmp + K - (ord('z') + 1)
		ans[-1] = chr(aa + ORDa)
	else:
		ans[-1] = chr(tmp + K)
		
print("".join(ans))
# last shori


Measured memory_bytes: 41200
# D - Partition
# Mの約数で、しかもN倍してもMを超えないもののうち、最大のものを探す

N, M = map(int, input().split())

x = min(M//N, int(M**0.5))
ans_list = []

while x > 0:
    if M % x == 0:
        ans_list.append(x)
        if (M//x) * N <= M:
            ans_list.append(M//x)
    x -= 1
    
print(max(ans_list))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
	int n, k, d,tmp;
	std::cin>>n>>k;
	bool seen[n + 1] = {false};
	for(int i =0; i < k; i++) {
		std::cin>>d;
		for(int j = 0; j < d; j++) {
			std::cin>>tmp;
			seen[tmp] = true;
		}
	}
	int count = 0;
	for(int i = 1; i<= n; i ++) {
		if (false == seen[i]) count++;
	}
	std::cout << count << std::endl;
	return 0;
}

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

using namespace std;

typedef long double LD;

const int NMAX = 3000;

int N;
LD dp[NMAX + 5][NMAX + 5];

int main()
{
    
    cin >> N;
    dp[0][0] = LD(1.0);

    for(int i = 1; i <= N; i++)
    {
        LD p;
        cin >> p;

        LD heads = p;
        LD tails = 1.0 - p;

        dp[i][0] = dp[i - 1][0] * tails;

        for(int j = 1; j <= i; j++)
            dp[i][j] = dp[i - 1][j] * tails + dp[i - 1][j - 1] * heads;
    }

    LD ans = 0.0;
    for(int i = N / 2 + 1; i <= N; i++)
        ans += dp[N][i];
    cout << fixed << setprecision(15) << ans << '\n';

    exit(0);
}

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

int main()
{
	int a, b, c, x, sum = 0, cnt = 0;

	cin >> a >> b >> c >> x;

	for (int i = 0; i <= a; i++){
		for (int j = 0; j <= b; j++){
			for (int k = 0; k <= c; k++){
				sum = 500 * i + 100 * j + k * 50;
				if (sum == x)
					cnt++;
			}
		}
	}

	cout << cnt << endl;

}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using bigint = long long;
#define ALL(a)  (a).begin(),(a).end()

int main(){
    int N;
    int alice = 0;
    int bob = 0;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i] ;
    sort(ALL(A));
    reverse(ALL(A));
    rep(j, N){
        if  (j % 2 == 0) {
            alice += A[j];
        } else {
            bob += A[j];
        }
    }
    cout << (alice - bob) << endl;
}

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

int main()
{
  i64 n;
  cin >> n;
  vector<i64> a(n), b(n), c(n - 1);
  for (i64 i = 0; i < n; i++)
    cin >> a[i];
  for (i64 i = 0; i < n; i++)
    cin >> b[i];
  for (i64 i = 0; i < n - 1; i++)
    cin >> c[i];
  i64 ans = 0;
  for (i64 i = 0; i < n; i++)
  {
    ans += b[a[i] - 1];
    if (i + 1 != n && a[i] + 1 == a[i + 1])
      ans += c[a[i] - 1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	string s;
	cin >> s;
	rep(i, s.size()) {
		if (i == 4)cout << " ";
		cout << s[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int ans = 0;
		for (int i = 0; i < 3; i++) {
			if (s.charAt(i) == t.charAt(i))
				ans++;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 21588
using System;
using System.Collections;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n - 1];

        string[] s = Console.ReadLine().Split();
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(s[i].ToString());
        }
        s = Console.ReadLine().Split();
        for (int i = 0; i < n; i++)
        {
            b[i] = int.Parse(s[i].ToString());
        }
        s = Console.ReadLine().Split();
        for (int i = 0; i < n - 1; i++)
        {
            c[i] = int.Parse(s[i].ToString());
        }


        int sum = 0;
        int pre = -2;
        for(int i = 0; i < n; i++)
        {
            sum += b[a[i] - 1];
            if(pre + 1 == a[i] - 1)
            {
                sum += c[pre];
            }
            pre = a[i] - 1;
        }
        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int inf = 1e9 + 10;

int H, W;
string S[2010];

int tate[2005][2005], yoko[2005][2005];

signed main()
{
	cin >> H >> W;

	rep(i, H) cin >> S[i];

	rep(i, H) rep(j, W) {
		if (S[i][j] == '#') {
			tate[i][j] = -1;
			yoko[i][j] = -1;
		}
	}

	rep(i, H) rep(j, W) {
		if (S[i][j] == '.') {
			if  (tate[i][j] == 0) {
				int cur = 0;
				int y;
				for (y = i; y < H; ++y) {
					if (S[y][j] == '#') break;
					cur++;
				}
				for (; y > i; --y) {
					tate[y - 1][j] = cur;
				}
			}
			if (yoko[i][j] == 0) {
				int cur = 0;
				int x;
				for (x = j; x < W; ++x) {
					if (S[i][x] == '#') break;
					cur++;
					yoko[i][x] = cur;
				}
				for (; x > j; --x) {
					yoko[i][x - 1] = cur;
				}
			}
		}
	}

	int mx = 0;

	rep(i, H) rep(j, W) chmax(mx, tate[i][j] + yoko[i][j] - 1);

	cout << mx << endl;
}




Measured memory_bytes: 67072
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main(){
	vll A, B;
	ll N;
	cin >> N;
	for (int i = 0; i < N; i++){
		ll a, b;
		cin >> a >> b;
		A.push_back(a);
		B.push_back(b);
	}
	ll m = INF;
	for (int i = 0; i < N; i++){
		if (A[i] > B[i]){
			m = min(m, B[i]);
		}
	}
	if (m == INF){
		cout << 0 << endl;
	}
	else{
		ll sum = accumulate(B.begin(), B.end(), 0LL);
		cout << sum - m << endl;
	}
	return 0;
}


Measured memory_bytes: 768
# 入力
A, B = map(int, input().split())

# A,B,A+Bのうちどれか1つでも3で割り切れればPossible
if A % 3 == 0:
    print('Possible')
elif B % 3 == 0:
    print('Possible')
elif (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')

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

int main()
{
    int a,b,c;
    int max_,mid,min_;
    cin >> a >> b >> c;

    max_ = max({a,b,c});
    min_ = min({a,b,c});
    mid = a + b + c - max_ - min_;
    
    cout << max_ * 10 + min_ + mid;
}

Measured memory_bytes: 256