akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	X := nextInt64()
	// X := int64(1000000000000000000)
	stock := int64(100)
	for i := 1; ; i++ {
		stock = int64(float64(stock) * 1.01)
		if stock >= X {
			fmt.Println(i)
			break
		}
	}

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1756
import java.util.*;

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

        int s = X - (K - 1);
        int e = X + (K - 1);

        for (int i = s;i <= e;i++){
            System.out.println(i);
        }
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>                                                                                                       
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
 
int main() {
  int w,a,b; cin>>w>>a>>b;
  if ((a<=b&&b<=a+w)||(b<=a&&a<=b+w)) cout<<0<<endl;
  else cout << abs(a-b) - w << endl;
}

Measured memory_bytes: 256
program sample
    implicit none
  
    integer(8) :: i,j,m,n,x,b,s
    
    integer(8):: a(1000000)
  
    read(*,*) s
    
    
    do i=1,1000000
        a(i)=0
    end do
    m=1
    do 
        if(a(s)==1)then
            exit
        else
            a(s)=a(s)+1
            m=m+1
            if (mod(s,2)==0)then
                s=s/2
            else
                s=s*3+1
            end if
        end if
                 
    end do
   
        write(*,*)m
   
    
    stop
end program sample
  



Measured memory_bytes: 10636
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}


const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t 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(int64_t 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) {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;}

struct combination {
    vector<mint> frac, ifrac;
    combination(int n):frac(n+1), ifrac(n+1) {
        assert(n < mod);
        frac[0] = 1;
        for (int i = 1; i <= n; ++i) frac[i] = frac[i-1]*i;
        ifrac[n] = frac[n].inv();
        for (int i = n; i >= 1; --i) ifrac[i-1] = ifrac[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return frac[n]*ifrac[k]*ifrac[n-k];
    }
} c(2000002);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    mint ans = c(r2+c2+2, r2+1) + c(r1+c1, c1) - c(r1+c2+1, r1) - c(r2+c1+1, c1);
    cout << ans << endl;
}

Measured memory_bytes: 34556
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int pBingo[3][3];
  int pBingoMat[3][3];

  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      scanf("%d", &pBingo[i][j]);
      pBingoMat[i][j] = 0;
    }
  }

  // printf("Input N");
  int N;
  scanf("%d", &N);
  int val = 0;
  for (int n = 0; n < N; n++)
  {
    scanf("%d", &val);

    for (int i = 0; i < 3; i++)
    {
      for (int j = 0; j < 3; j++)
      {
        pBingoMat[i][j] |= ((pBingo[i][j] == val) ? 1 : 0);
      } 
    }
  }

  for (int i = 0; i < 3; i++)
  {
    int sum = 0;
    for (int j = 0; j < 3; j++)
    {
      sum += pBingoMat[i][j];
    }
    if (3 == sum)
    {
      printf("Yes");
      return 0;
    }
  }

  for (int i = 0; i < 3; i++)
  {
    int sum = 0;
    for (int j = 0; j < 3; j++)
    {
      sum += pBingoMat[j][i];
    }
    if (3 == sum)
    {
      printf("Yes");
      return 0;
    }
  }

  {
    int sum = 0;
    for (int j = 0; j < 3; j++)
    {
      sum += pBingoMat[j][j];
    }
    if (3 == sum)
    {
      printf("Yes");
      return 0;
    }
  }

  {
    int sum = 0;
    for (int j = 0; j < 3; j++)
    {
      sum += pBingoMat[j][2-j];
    }
    if (3 == sum)
    {
      printf("Yes");
      return 0;
    }
  }

  printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
          
using namespace std;
          
#define ll long long
#define vi vector<int> 
#define pb push_back
#define sz(s) (int)s.size() 
#define all(v) v.begin(), v.end()
#define show(a) cerr << #a <<" -> "<< a <<"\n"
 
ll mn = 1000000, mx = -1000000000; 
ll cnt, cnt2, sum, x, y;
const int N = 1e5 + 5;
int n;
			             
int main (){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    x = n % 10;
    if (x == 2 || x == 4 || x == 5 || x == 7 || x == 9 || n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
    	cout << "hon";
	}
	else if (x == 0 || x == 1 || x == 6 || x == 8 || n == 0 || n == 1 || n == 6 || n == 8) {
		cout << "pon";
	}
	else if (x == 3 || n == 3) {
		cout << "bon";
	}
    return 0; 
}

Measured memory_bytes: 3652
def resolve():
	s = input()
	w = ['dream', 'dreamer', 'erase', 'eraser']
	h = dict()
	for i in range(len(w)):
		h[w[i][::-1]] = True
	s = s[::-1]
	c = ''
	for i in s:
		c += i
		if h.get(c):
			c = ''
	if not len(c):
		print('YES')
	else:
		print('NO')
resolve()

Measured memory_bytes: 3188
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}

int odd,even;

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

  int n, p;
  cin >> n >> p;
  vector<int> a(n);
  REP(i,n) {
    cin >> a[i];
    if(a[i]%2) odd++;
    else even++;
  }
  if(odd == 0) cout << (p == 0 ? (ll)pow(2,n) : 0) << endl;
  else cout << fixed << setprecision(20) << (ll)pow(2,n-1) << endl;
  
  return 0;
}


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

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    vi a(n, 0);
    vi point(n, k);
    //vector<bool> is_win(n, true);
    rep(i, q){
        int tmp;
        cin >> tmp;
        a[tmp-1]++; //勝ち回数
    }

    rep(i, n){
        point[i] -= (q - a[i]);
    }

    rep(i, n){
        if(point[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 4036
#include <stdio.h>
int main()
{
	int a[10];
	int i,j,k;
	for (i=0;i<10;i++)
			scanf("%d",&a[i]);
		for (i=0;i<9;i++)
		{
			for(j=i+1;j<10;j++)
			{
				if(a[j]>a[i])
				{
					k=a[i];
					a[i]=a[j];
					a[j]=k;
				}
			}
			if(i==2)
				printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
		}
	return 0;
}

Measured memory_bytes: 1028
M = 1000000007


def main(N=None, K=None):
    if not N or not K:
        N, K = map(int, input().split())
    ans = 0
    gcds = {}
    for X in range(K, 0, -1):
        gcds[X] = int(pow(K//X, N, M))
        n = 1
        while True:
            n += 1
            if n*X > K:
                break
            gcds[X] -= gcds[n*X]
        ans += gcds[X]*X
    ans %= M
    print(ans)
    return ans


if __name__ == "__main__":
    # assert main(3, 2) == 9
    # assert main(3, 200) == 10813692
    # assert main(100000, 100000) == 742202979
    main()


Measured memory_bytes: 20576
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	ll n,a;
	cin>>n;
	map<int,int>mp;
	for(int i=0;i<n;i++){
		cin>>a;
		mp[a]++;
	}
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>a;
		if(mp[a]==0){
			cout << "NO"<<endl;
			return 0;
		}
		else{
			mp[a]--;
		}
	}
	cout << "YES"<<endl;
	return 0;
}




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

int main() {
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  
  int ans = 0;
  rep(i, N) if(i == a[a[i]-1]-1) ans++;
  cout<<ans/2<<endl;
}


Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {

    ll n; cin >> n;
    
    vector<vector<ll>> ans(n, vector<ll>(n, 0));
    map<ll, ll> bitindex;
    REP(i, 32) bitindex[1LL << i] = i+1;

    REP(i, n) REP(j, n) if(i < j) {
        // REP(k, 32) {
        //     if (i % (1LL << k) != j % (1LL << k)) {
        //         ans[i][j] = k;
        //         break;
        //     }
        // }
        ll diff = i ^ j;
        ll onlylsb = diff & ~(diff - 1);
        ans[i][j] = bitindex[onlylsb];
    }
    RANGE(i, 0, n-2) RANGE(j, i+1, n-1) {
        cout << ans[i][j] << " \n"[j==n-1];
    }
    
}

Measured memory_bytes: 2432
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

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

// 区間[a, b)の中で最初に pred(x) = true となるような x を返す
template <class Pred>
int64_t bin_search(int64_t a, int64_t b, Pred pred) {
    if (a + 1 == b) return b;
    int64_t m = a + (b - a) / 2;
    if (pred(m))
        return bin_search(a, m, pred);
    else
        return bin_search(m, b, pred);
}

inline int64_t div_ceil(int64_t a, int64_t b) noexcept {
    return (a + b - 1) / b;
}

int main() {
    int N; cin >> N;
    int64_t K; cin >> K;
    vector<int64_t> A(N);
    REP(i, N) cin >> A[i];

    int64_t S = 0;
    REP(i, N) S += A[i];

    int64_t ans = bin_search(0, S+1, [&](int64_t L) {
        // 最大の丸太の長さが L 以下になるように切ることができるか
        int64_t k = 0;
        REP(i, N) k += div_ceil(A[i], L) - 1;
        return k <= K;
    });
    cout << ans << '\n';
}


Measured memory_bytes: 4736
#include <iostream>
#include <limits.h>
#include <string>
using namespace std;

int main(void){
    char s[200010];
    int amin = 300000, zmax = 0;
    cin >> s;
    for (int i = 0; s[i] != '\0'; i++) {
        if (s[i] == 'A') {
            if (i < amin) amin = i;
        }
        if (s[i] == 'Z') {
            if (i > zmax) zmax = i;
        }
    }
    cout << zmax - amin + 1 << endl;
    return 0;
}



Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<iomanip>
#include<fstream>
#include<ctime>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

map<int, int> mapa;
int n, a, f, i, j, res, tab[200005];

int main() {
scanf("%d", &n);
res = 0;
for (i=0;i<n;i++) scanf("%d", &tab[i]);
mapa.clear();
sort(tab, tab + n);
for (j=n-1;j>=0;j--) {
	a = tab[j];
	f = 0;
	for (i=1;i<=(1<<30);i*=2) if (i > a && mapa[i - a] > 0) {
		mapa[i - a]--;
		f = 1;
		break;
	} else if (i == (1<<30)) break;
	res += f;
	if (!f) mapa[a]++;
}	
printf("%d\n", res);	
return 0;
}



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

typedef long long ll;

ll N,M,K;
ll A,B,C;
ll T;
vector<ll> S;


ll dp[3003][3003];
ll sum[3333];
ll score[3003][3003];
ll nexk[3003];

void calc(int id){
  nexk[id] = K;
  ll time = sum[id];

  if( time > T )
    return;

  ll nc = 1LL;
  ll max_c = S[id+1]-S[id];
 // cout << id << " : " << S[id+1] << " -  " << S[id] << " = " << max_c << endl;
 // cout << "time " << time << endl;

  for(int k=0;k<=K;k++){
    ll rtime = T - time;
    ll pc = max(0LL,rtime/A);
 //   cout << k << " :" << retime << " & " << pc << endl;
    nc += pc;
    score[id][k] = min( max_c, nc );

    time += (pc+1) * C;
    if( T >= time )
      nc++;
  }
  for(int k=K;k>=0;k--)
    if( score[id][k] == max_c )
      nexk[id] = k;
}

void update(ll &a,ll b){
  a = max( a, b );
}

ll solve(){
  sum[0] = 0;
  for(int i=1;i<M;i++)
    sum[i] = sum[i-1] + (S[i]-S[i-1])*B;

  for(int i=0;i<M-1;i++){
    calc(i);
   // cout << i << ": " << nexk[i] << endl;
    for(int k=0;k<=K;k++){
    // cout << " -> " << k << " " << " "<<  score[i][k] << endl;

    }
  }

  for(int i=0;i<M-1;i++){
    for(int j=0;j<=K;j++){
      ll pk = min(K-j,nexk[i]);
     // cout <<i << ", " << j << " = " << dp[i][j] << endl;
      int ns = j, nt = K;
      for(int nk=max((ll)j,j+pk-100);nk<=min(K,j+pk+100);nk++)
        update( dp[i+1][nk], dp[i][j] + score[i][nk-j]);
      /*
      if( pk == 0 )
        update( dp[i+1][j], dp[i][j] + score[i][0] );
      else {
        if (j + pk > K)
          update(dp[i+1][K], dp[i][j] + score[i][ K - j ]);
        else {
          update(dp[i+1][j + pk], dp[i][j] + score[i][pk]);
          update(dp[i+1][j + pk - 1], dp[i][j] + score[i][pk - 1]);
        }
      }
       */
    }
  }
  ll res = 0;
  for(int i=0;i<=K;i++) {
//    cout << M-1 << ", "<< i << " = " << dp[M-1][i] << endl;
    update( res, dp[M-1][i] );
  }
  return res;
}

int main(){
  cin >> N >> M >> K;
  cin >> A >> B >> C;
  cin >> T;
  S.resize(M);
  K-=M;
  for(ll &a : S) cin >> a;
  cout<< solve()+(sum[M-1]>T?0:1)-1 << endl;
}

Measured memory_bytes: 30872
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> Q;
 
const int inf = (int)1e9; 
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

 
 
int main(void){
	int n,x,t;
	cin>>n>>x>>t;
	int num = 0;
	if(n%x==0)num = n/x;
	else num = n/x+1;
	cout<<t*num<<endl;
	return 0;
}

Measured memory_bytes: 3592
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String S = sc.next();
		String T = sc.next();

		int s[] = new int[26];
		int t[] = new int[26];
		Arrays.fill(s, -1);
		Arrays.fill(t, -1);

		String ans = "Yes";
		for (int i = 0; i < S.length(); i++) {
			int a = S.charAt(i) - 'a';
			int b = T.charAt(i) - 'a';
			if (s[a] != -1 || t[b] != -1) {
				if (s[a] != b || t[b] != a) {
					ans = "No";
					break;
				}
			}
			s[a] = b;
			t[b] = a;
		}
		System.out.println(ans);

	}

	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 25684
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    sort(v.begin(), v.end());

    //double ans = 0;
    double tmp = (v[0]+v[1])/2.0;
    if(n >= 3){
        for(int i = 2; i < n; ++i){
            //cout << v[i] << endl;
            tmp = (tmp+v[i])/2;

        }
    }

    cout << tmp << endl;
    return 0;
}


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

int main(){
  char a, b;
  cin >> a >> b;  
  if ( a == 'H' && b == 'H' || a == 'D' && b == 'D') cout << 'H' << endl;
  if ( a == 'H' && b == 'D' || a == 'D' && b == 'H') cout << 'D' << endl;
  
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<int> d(n);
	for(auto &x : d){
		cin>>x;
	}
	sort(d.begin(), d.end());
	int k = n/2;
	cout<<(d[k] - d[k - 1])<<endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const double pi = acos(-1);
namespace {
  template <typename T> inline void read(T &x) {
    x = 0; T f = 1;char s = getchar();
    for(; !isdigit(s); s = getchar()) if(s == '-') f = -1;
    for(;  isdigit(s); s = getchar()) x = (x << 3) + (x << 1) + (s ^ 48);
    x *= f;
  }
}
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define _for(n,m,i) for (register int i = (n); i < (m); ++i)
#define _rep(n,m,i) for (register int i = (n); i <= (m); ++i)
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r
#define lowbit(x) x & (-x)
#define pii pair<int,int>
#define fi first
#define se second
int main() {
  int n; cin >> n;
  int flag = 0;
  for(int i = 0; i <= n; ++i) {
    int res = (int)(1.08 * i);
    if(res == n) {
      printf("%d\n", i); 
      flag = 1;break;
    }
  }
  if(!flag) puts(":(");
  return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1180
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int GCD(int x, int y)
{
    if (y == 0)
        return x;
    return GCD(y, x % y);
}
int main(void)
{
    ll p, q;
    cin >> p >> q;

    int d = GCD(p, q);
    p /= d;
    q /= d;

    int ans = 1;
    for (int i = 2; i <= sqrt(q); ++i)
    {
        if (q % i == 0)
        {
            ans *= i;
            while (1)
            {
                if (q % i != 0)
                    break;
                q /= i;
            }
        }
    }
    ans *= q;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

int main() {
    int N, x;
    cin>>N>>x;
    
    int nums[N+5];
    rep(i,N){
        int x;
        cin>>x;
        nums[i]=x;
    }
    
    ll cnt=0;
    if(nums[0]>x){
        cnt += nums[0]-x;
        nums[0] = x;
    }
    
    rep(i,N-1){
        if(nums[i]+nums[i+1]>x){
            cnt += nums[i]+nums[i+1]-x;
            nums[i+1] -= nums[i]+nums[i+1]-x;
        }
    }
    cout1(cnt);
}

Measured memory_bytes: 640
X,N = map(int,input().split())

if N == 0:
	print(X)
	exit()

P = [int(i) for i in input().split()]
mn = 1000
for i in reversed(range(102)):
	if i in P:
		continue
	if mn >= abs(X-i):
		ans = i
		mn = min(mn,abs(X-i))

print(ans)


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

string word;
vector<int> As;

void for1(int i, int limit, int value)
{
  if(!(i<limit)){return;}
  if(i && word[i-1] == 'A' && word[i] == 'C'){value++;}
  As.push_back(value);
  for1(i+1, limit, value);
}

int main()
{
  int size, times, a, b;
  cin >> size >> times >> word;
  for1(0, size, 0);
  while(cin >> a >> b)
  {
    cout << (As[b-1] - As[a-1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 6136
dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1),        ( 1, 1),( 1, 2),
( 0,-2),                        ( 0, 2),
(-1,-2),(-1,-1),        (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]

H, W = map(int, input().split())
sh, sw = map(lambda x:int(x)-1, input().split())
eh, ew = map(lambda x:int(x)-1, input().split())
S = [input() for _ in range(H)]

dst = [[-1]*W for _ in range(H)]
dst[sh][sw] = 0

from collections import deque
dq = deque([(sh, sw)])
while dq:
    h, w = dq.popleft()

    for i in range(4):
        nh = h + dhw[i][0]; nw = w + dhw[i][1]
        if nh < 0 or H <= nh : continue
        if nw < 0 or W <= nw : continue
        if S[nh][nw] == '#': continue
        if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:
            dst[nh][nw] = dst[h][w]
            dq.appendleft((nh, nw))

    for i in range(4, 24):
        nh = h + dhw[i][0]; nw = w + dhw[i][1]
        if nh < 0 or H <= nh : continue
        if nw < 0 or W <= nw : continue
        if S[nh][nw] == '#': continue
        if dst[nh][nw] == -1:
            dst[nh][nw] = dst[h][w] + 1
        elif dst[h][w] + 1 < dst[nh][nw]:
            dst[nh][nw] = min(dst[nh][nw], dst[h][w] + 1)
        else: continue
        dq.append((nh, nw))

print(dst[eh][ew])


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



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    string s,t;
    cin >> n >> s >> t;
    string ans;
    rep(i,0,n){
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define dbV(arr) cout << #arr << "=[ "; \
for(auto i:arr) cout << i << " "; cout << "]\n";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define repF(i,a,n) for(int i = (a); i <= (n); ++i)
#define repB(i,a,n) for(int i = (a); i >= (n); --i)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define umii unordered_map<int,int>
#define umll unordered_map<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define seti set<int>
#define setl set<ll>
#define pb push_back
#define F first
#define S second
#define MOD 1000000007
#define all(z) z.begin(),z.end()
using namespace std;
using ll = long long;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m; cin >> n >> m;
	char mat[n][m];
	rep(i, n * m) cin >> mat[0][i];
	ll dp[n + 1][m + 1]; dp[0][0] = (mat[0][0] == '.') ? 1 : 0;
	repF(i, 1, n - 1) if (mat[i][0] == '.') dp[i][0] = dp[i - 1][0];
	else dp[i][0] = 0;
	repF(i, 1, m - 1) if (mat[0][i] == '.') dp[0][i] = dp[0][i - 1];
	else dp[0][i] = 0;
	repF(i, 1, n - 1) {
		repF(j, 1, m - 1) {
			if (mat[i][j] == '.')
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			else
				dp[i][j] = 0;
		}
	}
	cout << dp[n - 1][m - 1] << endl;
	return 0;
}

Measured memory_bytes: 12368
def check(n,m,star,d,f):
    ns=[i for i in range(n)]
    for i in range(d):
        for j in range(n-1):
            if f[i][j]:
                c=ns[j+1]
                ns[j+1]=ns[j]
                ns[j]=c
    return ns[star-1]==m-1



while True:
    n=int(input())
    if(n==0):break
    m=int(input())
    star=int(input())
    d=int(input())
    f=[[False for i in range(n-1)]for j in range(d)]
    for i in range(d):
        st=input()
        for j in range(n-1):
            f[i][j]=st[j]=='1'
    if check(n,m,star,d,f):
        print(0)
    else:
        ans=False
        for i in range(d):
            for j in range(n-1):
                if ans:break
                ok=not f[i][j]
                if(j>0 and f[i][j-1]) or (j<n-2 and f[i][j+1]):ok=False
                if ok:
                    f[i][j]=True
                    if check(n,m,star,d,f):
                        print(i+1,j+1)
                        ans=True
                    f[i][j]=False
        if not ans:
            print(1)

Measured memory_bytes: 7756
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(b>0 && b<=31)
    if(a>0 && a<=12){
        if(a<=b)
        cout << a;
    else
        cout << a-1;
    }
    return 0;
}


Measured memory_bytes: 504
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(X+1,Y+1):
    for j in range(n):
        if i <= x[j]:
            break
    else:
        for k in range(m):
            if y[k] < i:
                break
        else:
            print('No War')
            break
else:
    print('War')

Measured memory_bytes: 3064
/*
 * 	Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid to fall...
*/
#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

void solve()
{
  string s;
  cin >> s;
  if(s.length()%2==1)
  {
    cout << "No";
    return;
  }
  f(i,s.length()-1)
  {
    string z=s.substr(i,2);
    if(z!="hi")
      {
        cout << "No";
        return;
      }
    else
      i++;
  }
  cout << "Yes";
  return;
}

signed main()
{
  FAST;
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <climits>

using namespace std;

const int N = 3e5 + 5000;
long long n, m, T, a[N];
int main()
{
	ios::sync_with_stdio(false);
	int n, m;
	long long ans;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) cin >> a[i];
	ans = n - a[m] + a[1];
	for (int i = 2; i <= m; i++) ans = max(ans, a[i] - a[i - 1]);
	cout << n - ans;
	return 0;
}

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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    int K;
    cin >> K;
    if (K % 2 == 0 || K % 5 == 0)
        cout << -1;
    else
    {
        int tmp = 7, ans = 1;
        while (true)
        {
            if (tmp % K == 0)
            {
                cout << ans;
                break;
            }
            else
            {
                ans++;
                tmp = (tmp * 10 + 7) % K;
            }
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(c) sort((c).begin(),(c).end())
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define reprs(i, m, n) for(int i = n; i >= m; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  int N;
  vector<int> A;
  int y=0;
  int yi=0;
  int y2=0;

  cin>>N;

  rep(i,N){
  int x;
  cin >> x;
  A.push_back(x);
  if(y<=A[i]){
    y2=y;
    y=A[i];
    yi=i;
  }
  else if(y2<A[i]){
    y2=A[i];
  }
}
  rep(i,N){
    if(i==yi){
      std::cout << y2 << '\n';
    }
    else{
      std::cout << y << '\n';
    }

  }
  return 0;
}


Measured memory_bytes: 2548
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ll m = 0;
	vector<ll> a(n);
	rep(i,n){
		cin >> a[i];
		chmax(m, a[i]);
	}
	ll k = -1, dif = 1e9;
	rep(i,n){
		if(m == a[i]) continue;
		if(dif > abs(m/2 - a[i])){
			k = a[i];
			dif = abs(m/2 - a[i]);
		}
	}
	cout << m << " " << k << endl;
	return 0;
}

Measured memory_bytes: 3984
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll N, K; cin >> N >> K;
    vll v(N);
    vll cum(N);
    ll sum = 0;
    rep(i, 0, N){
        cin >> v[i];
        sum += v[i];
        cum[i] = sum;
    }
    ll ans = 0;
    rep(i, 0, K+1){
        ll r = K - i;
        rep(j, 0, r+1){
            if(i + j > N){
                break;
            }
            vll g(0);
            ll ms = 0;
            rep(k, 0, i){
                g.emplace_back(v[k]);
                ms += v[k];
            }
            rrep(k, N-1, N-1-j){
                g.emplace_back(v[k]);
                ms += v[k];
            }
            ll l = K - (i + j);
            //prtl(ms);
            sort(g.begin(),g.end());
            ll t = sz(g);
            rep(i, 0, l){
                if(i >= t){
                    break;
                }
                else if(g[i]<0){
                    ms -= g[i];
                }else{
                    break;
                }
            }
            ans = max(ans, ms);
        }
    }
    prt(ans);
}

Measured memory_bytes: 256
#include<iostream>
     
using namespace std;
     
int main()
{
    int i, n;
    i = 1;
 
    do{
    cin >> n;
    if(n != 0){
        cout << "Case " << i << ": " << n << endl;
        i++;
    }
 
    }while(n != 0);
     
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define All(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}



int main() {
    double N;
    cin >> N;
    //sort(ALL(A));
    cout  << setprecision(7) << (N-((int)N/2))/N << endl;
}

Measured memory_bytes: 256
import collections
N=int(input())
table=collections.defaultdict(int)
a=list(map(int,input().split()))
for i,x in enumerate(a):
  table[i+1]=x
ans=0
for x in table:
  b=table[x]
  if table[b]==x:
    ans+=1
    table[x]=0
print(ans)

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


int main(){
  int N, M;
  cin >> N >> M;
  vector<char> S(N, ' ');

  for(int ii=0; ii<M; ii++){
    int s;
    char c;
    cin >> s >> c;
    if(S[s-1]==c) continue;
    if(S[s-1]!=' '){
      cout << -1 << endl;
      return 0;
    }
    S[s-1] = c;
  }
  if(S[0]=='0'){
    if(N==1){
      cout << "0" << endl;
    }else{
      cout << -1 << endl;
    }
    return 0;
  }
  if(S[0]==' '){
    if(N==1){
      S[0]='0';
    }else{
      S[0]='1';
    }
  }
  for(auto& c : S){
    if(c==' '){
      c='0';
    }
  }
  for(auto& c : S){
    cout << c;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String args[]) {
		for(;;) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if(W == 0 && H == 0) break;
			sc.skip("\n");
			String field[] = new String[H];
			for(int i = 0; i < H; i++) {
				field[i] = sc.nextLine();
			}
			// debug

			// System.out.println("before");
			// System.out.println(field[0]);
			// System.out.println("after");

			// end
			String cs = ">^<v.";
			int dx[] = {1, 0, -1, 0};
			int dy[] = {0, -1, 0, 1};

			boolean reach[][] = new boolean[H][W];
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					reach[i][j] = false;
				}
			}
			reach[0][0] = false;
			boolean loop = false;

			int x = 0, y = 0;
			for(;;) {
				char c = field[y].charAt(x);
				int idx = cs.indexOf(c);
				if(idx == 4) {
					break;
				}

				int nx = x + dx[idx];
				int ny = y + dy[idx];
				x = nx;
				y = ny;
				if(reach[y][x] == true) {
					loop = true;
					break;
				}
				reach[y][x] = true;
			}
			if(loop == true) System.out.println("LOOP");
			else System.out.printf("%d %d%n", x, y);
		}
	}
}

Measured memory_bytes: 12000
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

def LII_split():
    return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

import math

A, B, N = MII_split()

def f(x):
    return math.floor(A * x / B) - A * math.floor(x / B)

# max = 0
# for x in range(min(B + 1, N + 1)):
#     if x > N:
#         break
#     fx = f(x)
#     # print(fx)
#     if fx > max:
#         max = fx
print(f(min(B-1, N)))

Measured memory_bytes: 9104
#include <stdio.h>

int sort(char *str){
	int i,j,ans;
	char tmp;

	for(i = 0;i < 7;i++){
		for(j = i+1;j < 8;j++){
			if(str[i] < str[j]){
				tmp = str[i];
				str[i] = str[j];
				str[j] = tmp;
			}
		}
	}

	ans = 0;
	for(i = 0;i < 8;i++){
		ans *= 10;
		ans += (str[i]-'0');
	}

	return ans;
}

int sort2(char *str){
	int i,j,ans;
	char tmp;

	for(i = 0;i < 7;i++){
		for(j = i+1;j < 8;j++){
			if(str[i] > str[j]){
				tmp = str[i];
				str[i] = str[j];
				str[j] = tmp;
			}
		}
	}

	ans = 0;
	for(i = 0;i < 8;i++){
		ans *= 10;
		ans += (str[i]-'0');
	}

	return ans;
}

int main(){
	int i,n;
	char str[9];

	scanf("%d",&n);

	for(i = 0;i < n;i++){
		scanf("%s",str);
		printf("%d\n",sort(str)-sort2(str));
	}

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
#include <list>
// #include <cstdin>
using namespace std;

bool calc(int m, vector<int> *S, int i){
  bool ret = false;
  if (m == 0) {
    return true;
  }
  if (i>=S->size() || m < 0) {
    return false;
  }
  ret = calc(m,S,i+1) || calc(m-S->at(i),S,i+1);
  return ret;
}

int main(int argc, char *argv[])
{
  vector<int> vec;
  int n= 0;
  int nn = 0;
  int q = 0;
  int qn = 0;
  cin >> n;
  bool ret = false;
  for (int i = 0; i < n; i++) {
    cin >> nn;
    vec.push_back(nn);
  }
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >>qn;
    ret = calc(qn,&vec,0);
    if (ret) {
      // printf("yes\n")
      cout << "yes" << "\n";
    }else {
      // printf("no\n")
      cout <<"no"  << "\n";

    }
  }
  return 0;
}



Measured memory_bytes: 3160
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,d,ans;
int x,k;
signed main(){
	cin>>x>>k>>d;
	x=abs(x);
	if(x/d>=k)cout<<x-d*k<<endl;
	else {
		if((k-x/d)%2==0)cout<<abs(x-(x/d)*d)<<endl;
		else cout<<abs(x-(x/d+1)*d)<<endl;
	}
}

Measured memory_bytes: 3636