akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

        int[] count;
        count = new int[128];
        String alpha = "abcdefghijklmnopqrstuvwxyz";
        String sen="";
        String pass;

        while(sc.hasNext()){  
            pass = sc.nextLine();        
            sen += pass;
        }
        sen = sen.toLowerCase();
        sen = sen.replace(" ", "");

        for(int i=0; i<sen.length(); i++){
            count[sen.charAt(i)]++;
        }

        for(int i =97; i<=122;i++){
            System.out.println(alpha.charAt(i-97) +" : "+ count[i]);
        }


        sc.close();

    }
}


Measured memory_bytes: 26232
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


signed main(void) {
    int n;
    cin >> n;
    vi v(n);
    int ans = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        ans -= b;
        v[i] = a+b;
    }
    sort(all(v));
    rep(i,n)if(i%2==0)ans += v[n-1-i];
    cout << ans << endl;
}


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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

bool check_is_strong_palindrome_char(
        const string& S, int n) {
    int S_size = S.size();
    int half_size = (S_size / 2);
    return (S[n] == S[half_size - n - 1]) &&
            (S[n] == S[(S_size / 2) + n + 1]) &&
            (S[n] == S[S_size - n - 1]);
}

int main() {
    // get values from input
    string S;
    READ(S);

    // main procedure
    int S_size = S.size();
    int section_size = ((S_size / 2) + 1) / 2;

    bool is_strong_palindrome = true;
    REP(i, section_size) {
        if (!check_is_strong_palindrome_char(S, i)) {
            is_strong_palindrome = false;
            break;
        }
    }

    // output
    WRITE_N(is_strong_palindrome ? "Yes" : "No");

    return 0;
}


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

int main(){
    int m, f, r;
    while(true){
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1){
            break;
        }
        if(m==-1||f==-1){
            cout<<"F"<<endl;
        }
        else if(m+f>=80){
            cout<<"A"<<endl;
        }
        else if(m+f>=65){
            cout<<"B"<<endl;
        }
        else if(m+f>=50){
            cout<<"C"<<endl;
        }
        else if(m+f>=30){
            if(r>=50){
                cout<<"C"<<endl;
            }
            else{
                cout<<"D"<<endl;
            }
        }
        else{
            cout<<"F"<<endl;
        }
    }
}


Measured memory_bytes: 3100
x, y = map(int, input().split())
if x*4 < y:
    print("No")
elif x*2 == y:
    print("Yes")
elif x*4 == y:
    print("Yes")
else:
    x *= 2
    while x < y:
        x += 2
        if x == y:
            print("Yes")
            exit()
    print("No")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

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

    vector<ll> F(N), B(N);
    F[0] = A[0];
    B[N-1] = A[N-1];

    for (int i = 1; i < N; i++) {
        F[i] = __gcd(A[i], F[i-1]);
    }
    for (int j = N-2; j >= 0; j--) {
        B[j] = __gcd(A[j], B[j+1]);
    }

    ll ans;
    ans = max(F[N-2], B[1]);
    for (int i = 1; i < N-1; i++) {
        ans = max(ans, __gcd(F[N-i-2], B[N-i]));
    }

    printf("%lld\n", ans);


}


Measured memory_bytes: 5636
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Sat Jan 19 14:14:34 2019
//
package main

import (
	"fmt"
)

type route struct {
	to, weight int
}

type graph [][]route

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	g := make(graph, N)

	for i := 0; i < M; i++ {
		var a, b, c int
		fmt.Scan(&a, &b, &c)
		a--
		b--
		g[a] = append(g[a], route{to: b, weight: -c})
	}

	dists := make([]int, N)
	for i := range dists {
		dists[i] = 1 << 60
	}
	dists[0] = 0

	for rep := 0; rep < N-1; rep++ {
		for i := range g {
			if dists[i] == 1<<60 {
				continue
			}

			for _, r := range g[i] {
				t, w := r.to, r.weight
				d := dists[i] + w
				if d < dists[t] {
					dists[t] = d
				}
			}
		}
	}

	ans := -dists[N-1]

	negatives := make([]bool, N)
	for rep := 0; rep < N; rep++ {
		for i := range g {
			if dists[i] == 1<<60 {
				continue
			}
			for _, r := range g[i] {
				t, w := r.to, r.weight
				d := dists[i] + w
				if d < dists[t] {
					dists[t] = d
					negatives[t] = true
				}

				if negatives[i] == true {
					negatives[t] = true
				}
			}
		}
	}

	if negatives[N-1] {
		fmt.Println("inf")
	} else {
		fmt.Println(ans)
	}
}


Measured memory_bytes: 768
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
INF = float("inf")


def solve(N: int, a: "List[int]"):
    print(sum([v-1 for v in a]))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
#define vcin(a)                          \
    for (int i = 0; i < (a).size(); i++) \
        cin >> (a)[i];

long double N;

bool check(long double n, long double h)
{
    if (4 * h * n - N * (n + h) == 0.0)
        return false;
    long double T = N * h * n / (4 * h * n - N * (n + h));
    return T > 0 and floor(T) == ceil(T) and T < 3500;
}

int main()
{
    cin >> N;
    for (long double i = 1.0; i < 3500; i++)
    {
        for (long double j = 1.0; j < 3500; j++)
        {

            if (check(i, j))
            {
                cout << setprecision(20) << i << " " << j << " " << N * i * j / (4 * i * j - N * (i + j));
                // cout << (double)(N * i * j) / (double)(4.0 * i * j - N * (i + j));
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

from collections import defaultdict
def main():
    N = int(input())
    A = list(map(int, input().split()))
    counter = defaultdict(int)
    for a in A:
        counter[a] += 1

    total = 0
    for key, ct in counter.items():
        if ct > 1:
            total += cmb(ct, 2)
    
    for a in A:
        ans = total
        ct = counter[a]
        if ct > 1:
            before = cmb(ct, 2)
            after  = before * (ct-2) // ct
            ans -= (before-after)
        print(ans)

    

main()

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

using namespace std;

int n;
int a,b;
long long arr[55];
long long nck[55][55];

int main()
{
	cin >> n >> a >> b;
	assert(a<=b);
	for(int i=0;i<n;i++) cin >> arr[i];
	sort(arr,arr+n);
	long double ans=0;
	for(int i=0;i<a;i++)
		ans+=arr[n-i-1];
	cout << fixed << setprecision(10) << ans/a << endl;
	for(int i=0;i<=n;i++)
	{
		nck[i][0]=1;
		for(int j=1;j<=i;j++) nck[i][j]=nck[i-1][j-1]+nck[i-1][j];
	}
	int comn=0,comnt=0;
	for(int i=n-a;i<n;i++)
	{
		comn+=arr[i]==arr[n-a];
	}
	for(int i=0;i<n;i++)
		comnt+=arr[i]==arr[n-a];
	if(arr[n-a]==arr[n-1])
	{
		long long ans=0;
		for(int i=a;i<=min(b,comnt);i++)
			ans+=nck[comnt][i];
		cout << ans << endl;
		return 0;
	}
	//cout << comn << " " << comnt << endl;
	cout << nck[comnt][comn] << endl;
}

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

int main() {
int X, Y, A, B, C;
  cin>>X>>Y>>A>>B>>C;
  vector<int> R(A);
  vector<int> G(B);
  vector<int> T(C);
  for(int i=0; i<A; i++) cin>>R.at(i);
  for(int i=0; i<B; i++) cin>>G.at(i);
  for(int i=0; i<C; i++) cin>>T.at(i);
  sort(R.begin(),R.end());
  reverse(R.begin(),R.end());
  sort(G.begin(),G.end());
  reverse(G.begin(),G.end());
  
  while(R.size()>X) R.pop_back();
  while(G.size()>Y) G.pop_back();
  int64_t total=0;
  for(int i=0; i<Y; i++) R.push_back(G.at(i));
  for(int i=0; i<C; i++) R.push_back(T.at(i));
  sort(R.begin(),R.end());
  reverse(R.begin(),R.end());
  for(int i=0; i<X+Y; i++) total+=R.at(i);
  
  
  cout<< total; 
}


Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
map<char, map<int, int> > pref;
map<char, map<int, int> > suff;
map<int, map<int, map<int, int> > > used;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	string s;
	cin >> n >> s;
	pref[s[0]][0] = 1;
	for(int i = 1;i < n;i++){
		pref['R'][i] = pref['R'][i - 1];
		pref['B'][i] = pref['B'][i - 1];
		pref['G'][i] = pref['G'][i - 1];
		pref[s[i]][i]++;
	}
	suff[s[n - 1]][n - 1] = 1;
	for(int i = n - 2;i >= 1;i--){
		suff['R'][i] = suff['R'][i + 1];
		suff['G'][i] = suff['G'][i + 1];
		suff['B'][i] = suff['B'][i + 1];
		suff[s[i]][i]++;
	}
	long long ans = 0;
	for(int i = 1;i <= n - 2;i++){
		if(s[i] == 'R'){
			long long cnt1 = pref['G'][i - 1] * suff['B'][i + 1];
			long long cnt2 = pref['B'][i - 1] * suff['G'][i + 1];
			ans += cnt1 + cnt2;
		}else if(s[i] == 'G'){
			long long cnt1 = pref['B'][i - 1] * suff['R'][i + 1];
			long long cnt2 = pref['R'][i - 1] * suff['B'][i + 1];
			ans += cnt1 + cnt2;
		}else{
			long long cnt1 = pref['R'][i - 1] * suff['G'][i + 1];
			long long cnt2 = pref['G'][i - 1] * suff['R'][i + 1];
			ans += cnt1 + cnt2;
		}
	}
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++){
			if(2 * i - j < n)
			if(s[i] != s[2 * i - j] && s[i] != s[j] && s[2 * i - j] != s[j])ans--;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4748
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#define rep(i, n) for (int i=0; i<n; ++i)
#define FOR(i, a, b) for (int i=a; i<b; ++i)
#define pb(x) push_back(x)
#define ll long long
#define ul unsigned long long
#define dbg(x) cout  << #x << " : " << (x) << endl
#define out(x) cout << (x)
#define outl(x) cout << (x) << endl
#define int(n); int n; cin >> n;
#define long(n); long long n; cin >> n;
#define dbl(f); double f; cin >> f;
#define s(s); string s; cin >> s;
#define into(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
using namespace std;

const int inf =1500000000;

int f[20][20];
int res=11;
int gx,gy;
int w,h; 
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

void dfs(int x,int y,int cnt) {
  if(cnt<=10) {
    rep(i, 4) {
      int nx=x+dx[i],ny=y+dy[i];
      if (nx>=w||nx<0||ny>=h||ny<0||f[nx][ny]==1) continue;
      while(true) {
          if (nx>=w||nx<0||ny>=h||ny<0) break; 
          if (nx==gx&&ny==gy){res=min(res,cnt);break;}
          if (f[nx][ny]==1) {
            f[nx][ny]=0;
            dfs(nx-dx[i],ny-dy[i],cnt+1);
            f[nx][ny]=1;
            break;
          }
          nx+=dx[i];ny+=dy[i];
       }
    }
  } 
}

int main () {
  while (true) {
    cin>>w>>h;
    if (w==0&&h==0) break;
    int x0,y0;
    rep(i, h) {
      rep (j, w) {
        cin>>f[j][i];
        if (f[j][i]==2) {
          x0=j;y0=i;
          f[j][i]=0;
        } else if  (f[j][i]==3) {
          f[j][i]=0;
          gx=j;gy=i; 
        } 
      }
    }
    dfs(x0,y0,1);
    outl(res==11?-1:res);
    res=11;
  }
  return 0;
}

Measured memory_bytes: 1164
n = int(input())
A = list(map(int, input().split()))


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


L = [A[0]]
for a in A[1:]:
    L.append(gcd(L[-1], a))

R = [A[-1]]
for a in reversed(A[:-1]):
    R.append(gcd(R[-1], a))
R.reverse()

ans = max(L[-2], R[1])
# i番目を使わない
for i in range(1, n-1):
    x = gcd(L[i-1], R[i+1])
    if ans < x:
        ans = x
print(ans)

Measured memory_bytes: 14428
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (a,b,x) = get!(f64, f64, f64);

    if a*a*b > 2.0*x {
        let a2 = 2.0*x/(a*b);
        println!("{}", (b).atan2(a2).to_degrees());
    } else {
        let b2 = 2.0*(a*a*b-x)/(a*a);
        println!("{}",b2.atan2(a).to_degrees());
    }
}


Measured memory_bytes: 8572
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        int max = 0;
        int stac = 0;
        int first = sc.nextInt();
        int next = 0;
        stac = first;
        for(int i=0;i<n-1;i++){
            next = sc.nextInt();
            if((next - first)>max){
                max = next - first;                
            }
            first = next;
        }
        if((k + stac - next)>max){
            max = k + stac - next;
        }
        sc.close();
        System.out.println(k - max);
    }
}

Measured memory_bytes: 64840
/* ****Ragnar7 -SHINIGAMI- _Lawliet_**** */
/* First, solve the problem.Then write the code. */
#include<bits/stdc++.h>
#define ll          long long
#define ld 			long double
#define hell        1000000007
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen ("input.txt","r",stdin);
	// freopen ("output.txt","w",stdout);
	#endif
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		vector<ll> h(n+1,0);
		for(ll i=1;i<=n;i++)
			cin>>h[i];
		vector<ll> dp(n+1,0);
		h[0] = h[1];
		for(ll i=2;i<=n;i++)
			dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
		cout<<dp[n];
		
	}

	
	time
	return 0;
}

Measured memory_bytes: 4804
n = int(input())
a = [int(input()) for _ in range(n)]
a_sorted = sorted(a)
a_sorted_pos = {}
for i in range(n):
    a_sorted_pos[a_sorted[i]] = i
ans = 0
for i in range(0, n, 2):
    if (i + a_sorted_pos[a[i]]) % 2 == 1:
        ans += 1
print(ans)



Measured memory_bytes: 95772
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans=''
N=II()
N-=1
for l in range(1,15):
  if N>=26**l:
    N-=26**l
    continue
  for i in range(l):
    d=N%26
    ans+=chr(d+ord('a'))
    N//=26
  ans=ans[::-1]
  break
print(ans)


Measured memory_bytes: 61992
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  double ans = 0;

  vector<int> v(n);
  REP(i, n) {
    cin >> v[i];
  }

  SORT(v);

  ans = v[0];
  REP(i, n-1) {
    ans = (ans + v[i+1]) / 2;
  }

  cout << ans << endl;
}


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

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}
use std::collections::HashMap;

fn main() {
    let S: u64 = read();
    let mut memo: HashMap<u64, u64> = HashMap::new();
    let MOD = 10_u64.pow(9) + 7;
    println!("{}", rec_memo(S, MOD, &mut memo));
}
fn rec_memo(n: u64, MOD: u64, memo: &mut HashMap<u64, u64>) -> u64 {
    match n {
        0 => 0,
        1 => 0,
        2 => 0,
        3 => 1,
        4 => 1,
        5 => 1,
        6 => 2,
        _ => match memo.get(&n) {
            None => {
                let mut new_num = 1; // 1はそれ自身
                for i in 3..=n - 3 {
                    new_num += rec_memo(i, MOD, memo);
                    new_num %= MOD;
                }
                memo.insert(n, new_num);
                new_num
            }
            Some(&a) => a,
        },
    }
}


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

int main() {
	ll N,d=0,t;
	string s;
	cin >> N;

	t = N;
	while(t-pow(26,++d) > 0)
		t -= pow(26,d);
	--t;

	while(t > 0) {
		ll r;
		r = t%26;
		t /= 26;
		s.push_back(char(r+'a'));
	}

	while(s.size() < d)
		s.push_back('a');
	reverse(s.begin(), s.end());
	cout << s << endl;
}

Measured memory_bytes: 4100
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n;
ll a[200010];
vector<ll> S;
int d1[200010],d2[200010];

void solve(){
    cin >> n;
    S.resize(n+1);
    rep(i,n){
        cin >> a[i];
        S[i+1]=S[i]+a[i];
    }
    int j=0;
    rep(i,n+1){
        while(abs(2ll*S[j]-S[i])>abs(2ll*S[j+1]-S[i])){
            j++;
        }
        d1[i]=j;
        //cout << j << endl;
    }
    j=n;
    per(i,n+1){
        while(abs(S[n]+S[i]-2ll*S[j])>abs(S[n]+S[i]-2ll*S[j-1])){
            j--;
        }
        d2[i]=j;
        //cout << j << endl;
    }
    // rep(i,n+1){
    //     cout << d1[i] << " " << d2[i] << endl;
    // }
    ll ans=INF;
    Rep(k,2,n-1){
        int j1=d1[k],j2=d2[k];
        ll A=S[j1];
        ll B=S[k]-S[j1];
        ll C=S[j2]-S[k];
        ll D=S[n]-S[j2];
        //cout << A << " " << B << " " << C << " " << D << endl;
        ans=min(ans,max(max(A,B),max(C,D))-min(min(A,B),min(C,D)));
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 7928
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;

int main(){
	int n;
	scanf("%d",&n);
	printf("%d\n",(n-1)/2);
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];

  ll ca = 0, cb = 0;
  rep(i, n) {
    if (a[i] > b[i]) {
      cb += a[i] - b[i];
    } else {
      ca += (b[i] - a[i] + 1) / 2;
      cb += (b[i] - a[i]) % 2;
    }
  }

  cout << (ca >= cb ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3792
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void) {
	int n,k;
	cin >> n >> k;
	int ans = 0;
	vector<int>a;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		a.push_back(h);
	}
	for (int i = 0; i < n; i++) {
		if (a[i] >= k) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 892
def main():
    x,k,d = map(int, input().split())
    if x<0: x=-x

    a = x // d
    if a>=k:
        print(x-k*d)
    else:
        k -= a
        if k%2 == 0:
            print(x-a*d)
        else:
            v = x-(a+1)*d
            if v<0: v=-v
            print(v)
main()

Measured memory_bytes: 9176
fun main(args: Array<String>) {
    
    var N = readLine()!!.toInt()
    var time = readLine()!!.split(" ").map{x->x.toInt()}
    var M = readLine()!!.toInt()
    for(i in 1..M){
        var time_ = time.toMutableList()
        var (p,x) = readLine()!!.split(" ").map(String::toInt)
        time_[p-1] = x
        println(time_.sum())
    }
}


Measured memory_bytes: 37864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
    int N,sum=0;
    cin >> N;
    vector<int> data(N);
    rep(i,N){
        cin >> data.at(i);
    }
    for(int j=0; j<N; j++){
        for(int i=0; i<N; i++){
            sum+=(data.at(i)*data.at(j));
        }
    }

    for(int i=0; i<N; i++){
        sum-=(data.at(i)*data.at(i));
    }

    cout << sum/2 << endl;
}
    

Measured memory_bytes: 256
import sys


def main():
    tmp = input().split(" ")
    n = int(tmp[0])
    m = int(tmp[1])
    tmp = ""
    if n > m:
        for i in range(n):
            tmp += str(m)
    else:
        for i in range(m):
            tmp += str(n)
    print(tmp)


if __name__ == '__main__':
    input = sys.stdin.readline
    main()


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

#ifdef HELTHAZAR
#define dout if (true) cout
#else
#define dout if (false) cout
#endif

#define rep(i, from, to) for (ll i = from; i < ll(to); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<vector<ll> > vvi;

const int MAXN = 301;

int used[MAXN][MAXN][MAXN];
int dp[MAXN][MAXN][MAXN];
string s;

int calcdp(int i, int j, int n, int k) {
	if (i > j)
		return 0;
	if (i == j)
		return 1;
	if (used[i][j][k])
		return dp[i][j][k];
	int maxdp = max(calcdp(i + 1, j, n, k), calcdp(i, j - 1, n, k));
	if (s[i] == s[j])
		maxdp = max(maxdp, calcdp(i + 1, j - 1, n, k) + 2);
	else if (k > 0)
		maxdp = max(maxdp, calcdp(i + 1, j - 1, n, k - 1) + 2);
	used[i][j][k] = 1;
	dp[i][j][k] = maxdp;
	return maxdp;
}

void solve() {
	cin >> s;
	int k;
	cin >> k;
	int n = sz(s);
	cout << calcdp(0, n - 1, n, k);
}

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

	solve();
}


Measured memory_bytes: 213248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back

bool cmp(pair<ll, ll> p1, pair<ll, ll> p2)
{
    if(p1.second<p2.second)
        return 1;
    if(p1.second == p2.second)
    {
        if(p1.first<p2.first)
            return 1;
        return 0;
    }
    return 0;
}

int main()
{
    ll n;
    cin>>n;
    vector<pair<ll, ll>> p;

    for(int i=0;i<n;i++)
    {
        int a, b;
        cin>>a>>b;

        p.pb({a, b});
    }

    sort(p.begin(), p.end(), cmp);

    //for(auto i : p)
      //  cout<<i.first<<" "<<i.second<<endl;

    ll sum = 0, cnt = 0;
    for(auto i : p)
    {
        int a = i.first;
        int b = i.second;

        sum += a;
        
        if(sum>b)
        {
            break;
        }
        cnt++;
    }
    if(cnt==n)
        return cout<<"Yes\n", 0;
    return cout<<"No\n", 0;
}


Measured memory_bytes: 6528
#include<stdio.h>
int main(void){
int n,m;
  long y=1000000007;
  scanf("%d%d",&n,&m);
  int d[m];
  for(int i=0;i<m;i++){
	scanf("%d",&d[i]);
  }
  for(int i=0;i<m-1;i++){
	if(d[i+1]-d[i]==1){
      printf("0");
      return 0;
    }
  }
  
long x[n],s=0;
  x[0]=1;
  x[1]=2;
  if(d[0]==1||d[0]==2){
    s++;
	x[0]=0;
    x[1]=1;
  }
 
  for(int i=2;i<n;i++){
	x[i]=0;
  }
  for(int i=2;i<n;i++){
    //printf("%d段目 ",i+1);
    if(i+1==d[s]){s++;
      //printf("skip\n");
      continue;
    }
    x[i]=(x[i-2]+x[i-1])%y;
    //printf("%ld\n",x[i]);
  }
  printf("%ld",x[n-1]);
return 0;
}
           

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

int n, arr[200], x;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;

    for (int i = 1; i <= n; ++i) {
        cin >> x;
        if (x > i) {
            cout << -1;
            return 0;
        }
        for (int j = i; j > x; --j) {
            swap(arr[j], arr[j - 1]);
        }
        arr[x] = x;
    }

    for (int i = 1; i <= n; ++i) {
        cout << arr[i] << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
// D - Summer Vacation
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);

	int n, m;
	cin >> n >> m;
	vector<vector<int> > a(m);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		if (x <= m) a[x - 1].push_back(y);
	}

	priority_queue<long long> q;
	long long ans = 0;

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < a[i].size(); j++) q.push(a[i][j]);
		if (!q.empty()) {
			ans += q.top();
			q.pop();
		}
	}

	cout << ans << endl;

	return 0;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n; scan(n);
      std::vector<Int> ts(n+2), vs(n+2);
      ts[0] = 0, vs[0] = 0;
      ts[n+1] = 0, vs[n+1] = 0;
      for(Int i = 1; i <= n; ++i) scan(ts[i]);
      for(Int i = 1; i <= n; ++i) scan(vs[i]);
      std::vector<Int> as, bs;
      std::vector<Int> ls, rs;
      Int st = 0;
      for(Int i = 0; i < n + 2; ++i) {
         //
         as.push_back(-1);
         bs.push_back(vs[i]+st);
         ls.push_back(-1e10);
         rs.push_back(st);
         //
         as.push_back(0);
         bs.push_back(vs[i]);
         ls.push_back(st);
         rs.push_back(st+ts[i]);
         //
         as.push_back(1);
         bs.push_back(vs[i]-(st+ts[i]));
         ls.push_back(st+ts[i]);
         rs.push_back(1e10);
         st += ts[i];
      }
      double res = 0.0;
      for(Int i = 0; i <= 2 * st; ++i) {
         double t = (double)i / 2;
         double z = 1e10;
         for(Int k = 0; k < (Int)as.size(); ++k) {
            if( ls[k] <= t and t <= rs[k] ) {
               z = std::min(z, as[k] * t + bs[k]);
            }
         }
         res += z;
      }
      printf("%.20lf\n", res / 2);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 256
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        int sum = 0;
        for(int i=0; i < Math.abs(a-b); i++){
            sum += i;
        }
        
        System.out.println(sum-Math.min(a, b));
    }
}

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

using namespace std;

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

    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        a[i] = t;
        b[i] = t;
        c[i] = t;
    }

    //前の順列
    if (prev_permutation(a.begin(), a.end())) {
        for (int i = 0; i < n; ++i) {
            cout << (i ? " " : "") << a[i];
        }
        cout << endl;
    }

    //与えられた順列
    for (int i = 0; i < n; ++i) {
        cout << (i ? " " : "") << b[i];
    }
    cout << endl;

    //次の順列
    if (next_permutation(c.begin(), c.end())) {
        for (int i = 0; i < n; ++i) {
            cout << (i ? " " : "") << c[i];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include <stdio.h>

#define Max 10000000

int main()
{
    int n, mi[101], x[101][101];
    int i, j, k, o, c;

    scanf("%d", &n);
    
    for (i =1; i <= n;i++){
        scanf("%d%d", &mi[i - 1], &mi[i]);
    }
    
    for (i = 1; i <= n; i++){x[i][i] = 0;}
        
    for (o= 2;o<= n; o++)
    {
        for (i = 1; i <= n -o + 1; i++)
        {
            j = i + o - 1;
            x[i][j] = Max;
	    
            for (k = i; k < j; k++)
            {
                c = x[i][k] + x[k + 1][j] + mi[i - 1] * mi[k] * mi[j];
                x[i][j] = (x[i][j] > c) ? c: x[i][j];
            }
        }
    }

    printf("%d\n", x[1][n]);

    return 0;
}



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

using vi = vector<int>;
using vll = vector<long long>;

constexpr long long mod = 1000000007;

#define rep(i, n) for (int i = 0; i < n; i++)

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

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

    long long cnt = 0;
    if (k > 0) {
        for (int i = k + 1; i <= n; i++) {
            int t = n - (n % i);

            cnt += t / i * (i - k) + max(0, n % i - k + 1);
        }
    } else {
        for (int i = 1; i <= n; i++) {
            cnt += n;
        }
    }

    cout << cnt << endl;
}

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

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){

    int a, b;
    cin >> a >> b;
    cout << (a + b) / 2 << endl;

}



Measured memory_bytes: 3100
class UnionFind:
    """1-index"""

    def __init__(self, n):
        self.parent = [-1] * (n + 1)  # parentは親の番号を格納。親だった時は-サイズを格納。

    # 親の番号を返す
    def root(self, A):
        if self.parent[A] < 0:
            return A
        else:
            return self.root(self.parent[A])

    # サイズを返す
    def size(self, A):
        return - self.parent[self.root(A)]

    # AとBをくっつける(直接ではなくroot(A)とroot(B)を繋げる)
    def unite(self, A, B):
        A = self.root(A)
        B = self.root(B)

        if A == B:  # 既に同じ塊内にいる
            return False

        if self.size(A) < self.size(B):
            A, B = B, A

        self.parent[A] += self.parent[B]  # サイズを更新
        self.parent[B] = A

        return True

    # AとBが同じグループに属しているかを調べる.
    def same_check(self, A, B):
        return self.root(A) == self.root(B)


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

uf = UnionFind(N)

for _ in range(M):
    x, y = map(int, input().split())
    uf.unite(x, y)

ans = 0
for i, v in enumerate(p):
    if uf.same_check(i + 1, v):
        ans += 1
print(ans)


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int H;cin >> H;
	int W;cin >> W;
	int K;cin >> K;

	vector<string> C(H);
	for(int i = 0; i < H; i++){
		cin >> C[i];
	}
	int ans = 0;
	for(int hbit = 0;hbit < pow(2,H);hbit++){
		for(int wbit = 0;wbit < pow(2,W);wbit++){
			int cnt = 0;
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(!((hbit>>i)&1) && !((wbit>>j)&1) && C[i][j] == '#'){
						cnt++;
					}
				}
			}
			if(cnt == K){
				ans++;
			}
		}
	}
	cout << ans << endl;
}


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

int main()
   {
     ll n,i,j;
     string x;
     cin >> x;
     n=x.size();
     if(x[0]==x[2] && x[0]==x[1])
        cout << "No";
     else
        cout << "Yes";
   }


Measured memory_bytes: 768
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

void solve() {
    int n;
    scanf("%d", &n);
    int cnt = 0;
    rep(i, n + 1) {
        if(i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000)) cnt++;
    }
    std::cout << cnt - 1 << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()
    val s = sc.next()
    println(problem034a(n, a, b, c, d, s))
}

fun problem034a(n: Int, a: Int, b: Int, c: Int, d: Int, s: String): String {
    val canSunuke = (!"#{2,}?".toRegex().containsMatchIn(s.take(c).drop(a)))
    val canFunuke = (!"#{2,}?".toRegex().containsMatchIn(s.take(d).drop(b)))
    val canReplace = if (c > d) {
        val sub = s.take(d + 1).drop(b - 2)
        ("x{3,}?".toRegex().containsMatchIn(sub.replace(".", "x")))
    } else {
        true
    }
    return if (canFunuke && canSunuke && canReplace) "Yes" else "No"
}

Measured memory_bytes: 42932
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut ans = 0;

    let mut prev = 0;

    for a in aa {
        if prev > a {
            ans += prev - a;
        }
        prev = std::cmp::max(prev, a);
    }

    println!("{}", ans);
}


Measured memory_bytes: 5632
import sys
a, b, result, tap = 0, 0, 0, 0
a, b = map(int, input().split())

if b == 1:
  print(0)
  exit()

while True:
  result += a
  if result >= b:
    tap += 1
    break
  else:
    result -= 1
    tap += 1
print(str(tap))


Measured memory_bytes: 2940
N, a, b = map(int, input().split())
modz = 10**9 + 7

def repeatSquaring(N, P, M):
    if P <= 0:
        return 1
    if (P &0x01) == 0:
        ans = repeatSquaring(N, (P>>1), M)
        return ans*ans % M

    return N*repeatSquaring(N, P-1, M) % M

def seki(aa, bb):
    res = 1
    for k in range(aa, bb+1):
        res *= k
        if res >= modz:
            res %= modz
    return res

def CC(aa, nn):
    ss = repeatSquaring(seki(1, aa), modz - 2, modz)
    return seki(nn-aa + 1, nn)*ss % modz

total = repeatSquaring(2, N, modz) - 1
total -= CC(a, N)
if total < 0: total += modz

total -= CC(b, N)
if total < 0: total += modz

print(int(total))

Measured memory_bytes: 8948
#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[100];
long long rekur(int now){
    if(now == 0)return 2;
    if(now == 1)return 1;

    long long &ret = dp[now];
    if(ret!=0)return ret;
    ret = rekur(now-1)+rekur(now-2);
    return ret;
}

int main(){
    scanf("%d", &n);
    printf("%lld\n",rekur(n));
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

int main(){
  srand((unsigned int)time(NULL)); 
  int D,M=365*500;
  int c[30];
  int s[370][30];
  int t[370];
  int last[30];
  int ans_max=0,ans=0;
  int old_t,old_d;
  
  scanf("%d",&D);
  for(int i=1;i<=26;i++)
    scanf("%d",c+i);
  for(int i=1;i<=D;i++)
   for(int j=1;j<=26;j++)
     scanf("%d",&s[i][j]);
  
  for(int i=1;i<=D;i++)
    t[i]=rand()%26+1;
  
  ans_max=0;
  for(int k=1;k<=26;k++)
    last[k]=0;
  for(int d=1;d<=D;d++){
    ans_max+=s[d][t[d]];
    last[t[d]]=d;
    for(int j=1;j<=26;j++){
      ans_max-=c[j]*(d-last[j]);
    }
  }
  
  for(int i=1;i<=M;i++){
    ans=0;
    old_d=i%D+1;
    old_t=t[old_d];
    t[old_d]=rand()%26+1;
    for(int k=1;k<=26;k++)
      last[k]=0;
    for(int d=1;d<=D;d++){
      ans+=s[d][t[d]];
      last[t[d]]=d;
      for(int j=1;j<=26;j++){
        ans-=c[j]*(d-last[j]);
      }
    }
    if(ans<ans_max){
      t[old_d]=old_t;
    }else{
      ans_max=ans;
    }
  }
  
  for(int i=1;i<=D;i++)
    printf("%d\n",t[i]);
  return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

const int mod = 1e9 + 7;

signed main() {
  int ans = 0, max = 0;
  REP(i, 3) {
    int tmp = read();
    ans += tmp;
    chmax(max, tmp);
  }
  int k = read(), chVal = max;
  REP(i, k) { chVal *= 2; }
  print(ans - max + chVal);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
const int M = 1e3 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n,m;
int a[N];

int main(){
    ios;
    int l,r,d;
    cin>>l>>r>>d;
    int ans=0;
    rep(i,l,r) if(i%d==0) ++ans;
    cout<<ans;
    return 0;
}
/*

*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 1e5+7;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
// #define trace6(a, n,i;b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// Constants //
 
/*** Template Ends ***/
ld euclid(ld x,ld y,ld i,ld j)
{
  return sqrt(abs(x*x-i*i)+abs(y*y-j*j));
}
void solve()
{
 ll n,k;
 cin>>n>>k;
 ll count=0;
 do
 {
  n/=k;
  count++;
 }while(n);
 cout<<count;
}
int main()
{ 
  // ios;
  // fxreopen("inputt.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
  return 0;
}

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

int main(){
	int64_t n, a, b;
	cin >> n >> a >> b;
	int64_t x[n];
	for(int i = 0; i < n; i++) cin >> x[i];
	int64_t ans = 0;
	for(int i = 1; i < n; i++) ans += min(b,  a * (x[i] - x[i - 1]));
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
int main()
{
    long long a,b,c;
    while(~scanf("%lld%lld",&a,&b))
    {
        long long x=a,y=b;
        c=a%b;
        while(c)
        {
            a=b;
            b=c;
            c=a%b;
        }
        printf("%lld %lld\n",b,x*y/b);
    }
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

double triangle(double x1,double y1,double x2,double y2,double x3,double y3);

int main(void) {
    double xo,yo,x1,y1,x2,y2,square=0;
    scanf("%lf,%lf\n",&xo,&yo);
    scanf("%lf,%lf\n",&x1,&y1);
    while (scanf("%lf,%lf\n",&x2,&y2)!=EOF) {
        square+=triangle(xo,yo,x1,y1,x2,y2);
        x1=x2;
        y1=y2;
    }
    printf("%.6lf\n",square);
    return 0;
}

double triangle(double x1,double y1,double x2,double y2,double x3,double y3) {
    x2 = (x2-x1)*(y3-y1);
    x3 = (y2-y1)*(x3-x1);
    if (x2>x3) {
        return (x2-x3)/2.0;
    } else {
        return (x3-x2)/2.0;
    }
}

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int p, q, r;
    cin >> p >> q >> r;

    cout << min(p + q, min(q + r, r + p)) << endl;
}

Measured memory_bytes: 256