akhauriyash/Code-Regression huggingface dataset:
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp
#??????????????????
#??????????????????????°???????????????£?????´???????????´?????¨??\?????????????????????????????????????????´????????????
#??????????????????????????????????°????????????????????????´???????????????????????????????????????????????¨??????

def bubble_sort(origin_list):
    list_length = len(origin_list)
    target_list = [i for i in origin_list]#??°????????????????????????
    flag = True
    change_count = 0
    top_index = 1
    while flag:
        flag = False
        for i in range(top_index, list_length)[::-1]:
            if target_list[i][1] < target_list[i - 1][1]:
                tmp = target_list[i]
                target_list[i] = target_list[i - 1]
                target_list[i - 1] = tmp
                change_count += 1
                flag = True
        top_index += 1       
    return target_list

def selection_sort(origin_list):
    list_length = len(origin_list)
    target_list = [i for i in origin_list]#??°????????????????????????
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j][1] < target_list[min_index][1]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
    return target_list

def check_stable(origin_list, target_list):
    for i, origin_v in enumerate(origin_list):
        for origin_v2 in origin_list[i+1:]:
            if origin_v[1] == origin_v2[1]:
                for j, target_v in enumerate(target_list):
                    for target_v2 in target_list[j+1:]:
                        if origin_v == target_v2 and origin_v2 == target_v:
                            return "Not stable"
    return "Stable"

def stable_sort(target_list):
    print(*bubble_sort(target_list))
    print(check_stable(target_list, bubble_sort(target_list)))
    print(*selection_sort(target_list))
    print(check_stable(target_list, selection_sort(target_list)))
    
def main():
    n_list = int(input())
    target_list = [a for a in input().split()]
    stable_sort(target_list)
    
if __name__ == "__main__":
    main()

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

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

  cout << n*n*n << endl;

  return 0;
}



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

int main(){
    int a,b;
    cin >> a >> b;
    
    int ave;
    float avef;

    ave = (a+b)/2;
    avef = ((float)a+(float)b)/2;

    if( avef > ave ) cout << ave + 1 << endl;
    else cout << ave << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
#include <complex>
using namespace std;

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

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

    int a[12] = { 1 };
    for (int i = 0; i < 10; i++) {
        a[i + 1] = a[i] * 2;
    }
    for (int i = 0; i < 10; i++) {
        if (N < a[i]) {
            cout << a[i-1] << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
package main

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

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

var sc = newScanner()

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanString() string {
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

func main() {
	v, e, r := scanInt(), scanInt(), scanInt()
	edges := make([]edge, e)
	for i := 0; i < e; i++ {
		edges[i] = edge{scanInt(), scanInt(), scanInt()}
	}
	bellmanFord(v, e, r, edges)
}

type edge struct {
	from, to, cost int
}

const inf = 1000000000000
const infMin = 30000000

func bellmanFord(v, e, r int, edges []edge) {
	d := make([]int, v)
	for i := 0; i < v; i++ {
		if i != r {
			d[i] = inf
		}
	}

	negativeCycle := -1
	for updated, counter := 0, 0; updated >= 0; counter++ {
		if counter >= v {
			negativeCycle = updated
			break
		}
		updated = -1
		for _, e := range edges {
			if d[e.to] > d[e.from]+e.cost {
				d[e.to] = d[e.from] + e.cost
				updated = e.from
			}
		}
	}
	if negativeCycle >= 0 && d[negativeCycle] < infMin {
		fmt.Println("NEGATIVE CYCLE")
		return
	}
	for i := 0; i < v; i++ {
		if d[i] > infMin {
			fmt.Println("INF")
		} else {
			fmt.Println(d[i])
		}
	}
}

func debug(a ...interface{}) {
	fmt.Println(a...)
}



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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

int v[N], dp[N], n, k;

int solve(int i){
    if(i == n-1)
        return 0;
    if(dp[i] != -1)
        return dp[i];
    int ans = mod;
    for(int j = 1; j <= k; j++){
        if(i + j < n)
            ans = min(ans, solve(i+j) + abs(v[i]-v[i+j]));
    }
    return dp[i] = ans;
}

int main(){
	fastio;
    memset(dp, -1, sizeof(dp));
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    cout << solve(0) << endl;
	return 0;
}


Measured memory_bytes: 11060
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    ll res=0;
    ll reg=1;
    rep(i,n){
        if(reg>vec[i])continue;
        if(reg==vec[i])reg++;
        ll temp=(vec[i]-1)/reg;
        res+=temp;
        vec[i]-=temp*reg;
        if(reg==1)reg++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  long long count=0;
  long long cnt=0;
  long long mark=-1;
  for(int i=0;i<N;i++){
    if(i!=N-1){
    	if(A.at(i)!=mark){
      		if(cnt%2!=0){
        	count++;
      	}
      	mark=A.at(i);
      	cnt=1;
    	}
    	else{
      	cnt++;
    	}
  	}
    else{
      if(A.at(i)==mark){
        cnt++;
        if(cnt%2==1){
          count++;
        }
      }
      else{
        count=count+1+cnt%2;
      }
    }
  }
  cout<<count<<endl;
}


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

using namespace std;
using ll = long long;


int main()
{
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    map<ll,ll> mp;
    for(int i = 0; i < n; i++)mp[a[i] - i]++;

    ll cnt = 0;
    for(int i = 0; i < n; i++) {
        cnt += mp[-a[i] - i];
    }
    cout << cnt << endl;
}

Measured memory_bytes: 26644
from math import gcd

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

A = list(map(int,input().split()))

d = 1
a = A[0]
while a % 2 == 0:
    d *= 2
    a //= 2

if not all((a//d)%2 != 0 and a%d == 0 for a in A):
    print(0)
    exit()

A = [a//d for a in A]
g = 1
for a in A:
    g = g*a//gcd(g,a)

g *= d//2

x = M//g

print((x+1)//2)

Measured memory_bytes: 90908
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();

		int ans = 1;
		for (int i = 0; i < n; i++) {
			ans = Math.min(2 * ans, ans + k);
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
typedef vector<i64> vi;
typedef vector<vi> vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

void Main()
{
  i64 n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  rep(i,n){
    if(a[i]%2==0){
      if(a[i]%3!=0 && a[i]%5!=0){
        cout << "DENIED\n";
        return;
      }
    }
  }
  cout << "APPROVED\n";
  return;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define rep(i,n) for(int i = 0; i < n; i++)
#define MSG(a) cout << #a << " " << a << endl;
template<class T, class C> pair<T,C> mp(T a, C b){ return make_pair(a, b);}

int main()
{
	int n;
	while(cin >> n && n)
	{
		vector<vector<bool> > s(n, vector<bool>(n));
		rep(i,n+1) fill(s[0].begin(), s[0].end(), false);

		int m;
		cin >> m;

		rep(i,m)
		{
			int a, b;
			cin >> a >> b;
			s[a-1][b-1] = s[b-1][a-1] = true;
		}

		int res = 0;

		for(int i = 1; i < n; i++)
		{
			if(s[0][i])	res++;
			else
			{
				for(int j = 1; j < n; j++)
				{
					if(s[0][j] && s[j][i])
					{
						res++;
						break;
					}
				}
			}
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

int n, m;
int a[100005];
pair <int, int> job[100005];
priority_queue <int> que;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1, x, val; i <= n; ++i) {
		scanf("%d%d", &x, &val);
		job[i].fi = m - x + 1;
		job[i].se = val;
	}

	long long ans = 0;
	sort (job + 1, job + n + 1);
	for (int i = m, j = n; i; --i) {
		for (; j; --j) {
			if (job[j].fi < i) break;
			que.push(job[j].se);
		}
		if (!que.empty()) {
			ans += que.top();
			que.pop();
		}
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
  int INF = 1000000000;
  string s, t;
  cin >> s >> t;
  int lens = s.size();
  int lent = t.size();
  int ans = INF;
  bool ok = true;
  rep(i,lens){
    rep(j,lent){
      if(s[i] == t[j]){
        if(i-j < 0) break;
        if(i+lent-j > lens) continue;
        int hiku = 0;
        rep(k,lent){
          if(s[i - j + k] == t[k]) hiku++;
        }
        ans = min(ans, lent - hiku);
      }
    }
  }
  if(ans == INF) ans = lent;
  cout << ans << endl;
}


Measured memory_bytes: 3612
n = int(input())
a = list(map(int,input().split()))

import collections
count = collections.Counter(a)

import math
def p(n, r):
    return math.factorial(n) // math.factorial(n - r)
def c(n, r):
    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# print(count)
s = 0
cmb = {}
for i in count.keys():
    cmb[i] = (c(count[i], 2),c(count[i] - 1, 2))
    s += cmb[i][0]
# print(s)
# print(cmb)

for i in range(n):
    ans = s - cmb[a[i]][0] + cmb[a[i]][1]
    print(ans)

Measured memory_bytes: 145896
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node
{
	int x,y;
}a[90005];
int main()
{
	int n,m,i,j,d,x,q,l,r,dp[90005]={0};
	scanf("%d%d%d",&n,&m,&d);
	for(i=1;i<=n;i++) for(j=1;j<=m;j++) scanf("%d",&x),a[x].x=i,a[x].y=j;
	for(i=d+1;i<=n*m;i++) dp[i]=dp[i-d]+abs(a[i].x-a[i-d].x)+abs(a[i].y-a[i-d].y);
	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d",&l,&r);
		cout<<dp[r]-dp[l]<<endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;
 
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)
 
typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;
 
constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
 
int main() {
    string S; cin>>S;
    i64 K; cin>>K;
    REP(i,S.size()) {
        if (S[i]!='1') {
            cout<<S[i]<<endl;
            break;
        }
        if (i==K-1) {
            cout<<S[i]<<endl;
            break;
        }
    }
}


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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

ll dp[N];
V adj[N];

bool vis[N];

void dfs(ll n){
    if(vis[n])  return;
    vis[n]=1;
    for(auto i:adj[n]){
        dfs(i);
    }
    priority_queue<ll> q;
    ll a=0;
    for(auto i:adj[n]){
        a=max(a,dp[i]);
    }
    dp[n] = a+1;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n,m;
    cin>>n>>m;
    rep(i,0,m){
        ll x,y;
        cin>>x>>y;
        adj[x].pb(y);
    }
    ll ans=0;
    rep(i,1,n+1)
        dfs(i);
    rep(i,1,n+1){
        ans = max(ans, dp[i]);
    }
    cout<<ans-1<<endl;
    return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, 0))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

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

  ll ans=0;
  for(ll i=1; i*i<=n; i++){
    if(n%i==0){
      ll m = n/i - 1;
      if(m<1) continue;
      if(n/m==n%m) ans += m;
    }
  }

  prt(ans);
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private static final long MOD = (long)Math.pow(10, 9) + 7;
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		long q = sc.nextLong();  // 0.25
		long h = sc.nextLong();  // 0.5
		long s = sc.nextLong(); // 1.0
		long d = sc.nextLong(); // 2.0
		long n = sc.nextLong();
		long res = 0;
		// N 為整數，所以購買0.25與0.5的次數一定是偶數
		
		// 找出新的1.0價格s，此價格為原來的s，或是0.25買四個，或是0.5買兩個，其中最小的
		s = Math.min(s, Math.min(q * 4, h * 2));
		
		// 找出新的2.0價格s，此價格為原來的d，或是s買兩個或是0.25買8個，或是0.5買4個，其中最小的。
		d = Math.min(Math.min(d, s * 2), Math.min(h * 4, q * 8));
		
		if (2*s < d) {
			// 買兩個s比一罐d划算時，全買s
			res = n * s;
		} else {
			// 買兩個s比一罐d貴時，盡可能買d，如果有剩下一瓶再買s
			res = (n/2)*d + (n%2)*s;
		}
		
		System.out.println(res);
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 23124
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    string S;
    cin >> S;
    int N = S.size(), res = 999;
    REP(i, N - 2) {
        int X = atoi(S.substr(i, 3).c_str());
        amin(res, abs(X - 753));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
import sys

x, n = map(int, input().split())
if(n==0):
  print(x)
  sys.exit()
c = 0
b = 0
p = list(map(int, input().split()))
for i in range(102):
  for j in range(n):
    if(p[j] - x + i == 0):
      c+=1
    if(p[j] - x - i==0):
      b+=1
  if(b==0 or c==0):
    if(c==0):
      print(x-i)
      sys.exit()
    else:
      print(x+i)
      sys.exit()
  else:
    b=0
    c=0

Measured memory_bytes: 27096
import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.io.*;

// AC
public class Main{
	Scanner sc=new Scanner(System.in);
	int INF=1<<28;
	double EPS=1e-9;

	int n, m, l;
	int[][] w;
	int[] p, t;

	void run(){
		for(;;){
			n=sc.nextInt();
			m=sc.nextInt();
			l=sc.nextInt();
			if((n|m|l)==0){
				break;
			}
			w=new int[n][n];
			p=new int[l];
			t=new int[l];
			for(int i=0; i<n; i++){
				Arrays.fill(w[i], INF);
				w[i][i]=0;
			}
			for(int i=0; i<m; i++){
				int u=sc.nextInt();
				int v=sc.nextInt();
				int d=sc.nextInt();
				w[u][v]=w[v][u]=d;
			}
			for(int i=0; i<l; i++){
				p[i]=sc.nextInt();
				t[i]=sc.nextInt();
			}
			solve();
		}
	}

	void solve(){
		for(int k=0; k<n; k++){
			for(int j=0; j<n; j++){
				for(int i=0; i<n; i++){
					w[i][j]=Math.min(w[i][j], w[i][k]+w[k][j]);
				}
			}
		}
		V[] vs=new V[l*2];
		for(int i=0; i<l*2; i++){
			vs[i]=new V(i%l);
		}
		for(int j=0; j<l; j++){
			for(int i=0; i<l; i++){
				if(i==j){
					continue;
				}
				int u=p[i];
				int v=p[j];
				if(t[i]+w[u][v]<=t[j]){
					vs[i].connect(vs[j+l]);
				}
			}
		}
		int match=hopcroftKarp(vs);
		int ans=l-match;
		println(ans+"");
	}

	int hopcroftKarp(V[] vs){
		for(int match=0;;){
			Queue<V> que=new LinkedList<V>();
			for(V v : vs){
				v.level=-1;
			}
			for(V v : vs){
				if(v.pair==null){
					v.level=0;
					que.offer(v);
				}
			}
			for(; !que.isEmpty();){
				V v=que.poll();
				for(V u : v){
					V w=u.pair;
					if(w!=null&&w.level<0){
						w.level=v.level+1;
						que.offer(w);
					}
				}
			}
			for(V v : vs){
				v.used=false;
			}
			int d=0;
			for(V v : vs){
				if(v.pair==null&&dfs(v)){
					d++;
				}
			}
			if(d==0){
				return match;
			}
			match+=d;
		}
	}

	boolean dfs(V v){
		v.used=true;
		for(V u : v){
			V w=u.pair;
			if(w==null||!w.used&&v.level<w.level&&dfs(w)){
				v.pair=u;
				u.pair=v;
				return true;
			}
		}
		return false;
	}

	class V extends LinkedList<V>{
		V pair;
		boolean used;
		int i, level;

		V(int i){
			this.i=i;
		}

		void connect(V v){
			add(v);
			v.add(this);
		}
	}

	void debug(Object... os){
	// System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 55000
def erat(n):
    n+=1
    l=[1 for _ in range(n)]
    l[0],l[1]=0,0
    for i in range(4,n,2):
        l[i]=0
    for i in range(9,n,6):
        l[i]=0
    for i in range(6,n,6):
        if l[i-1]:
            for j in range((i-1)*(i-1),n,i-1):
                l[j]=0
        if l[i+1]:
            for j in range((i+1)*(i+1),n,i+1):
                l[j]=0
    return l
prime=[]
for i in range(1001):
    if erat(1000)[i]:
        prime.append(i)
n=int(input())
u=[0]*1001
for i in range(1,n+1):
    for j in prime:
        while i%j==0:
            i//=j
            u[j]+=1
ans=1
for i in u:
    ans*=i+1
print(ans%(10**9+7))

Measured memory_bytes: 9264
#include <bits/stdc++.h>
using namespace std;
 
int main() {
long long A,B;
  cin >>A>>B;
  for(int i = 1; i <= B; i++){
    if((A * i) % B == 0){
      cout << A * i << endl;
      break;
    }
  }
 
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int p=0;p<n;p++){
		int a,b,c,d;
		cin>>a>>b>>c;
		if(c<a){
			d=c;
			c=a;
			a=d;
		}
		if(c<b){
			d=c;
			c=b;
			b=d;
		}
		int aa=a*a,bb=b*b,cc=c*c;
		if(aa+bb==cc){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
}


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


def main():
    A, B, C, X, Y = map(int, input().split())

    print(
        min(X * A + Y * B,
            2 * X * C + B * max(0, Y - X),
            2 * Y * C + A * max(0, X - Y)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n, m;
    int a[31]; INITA(a, 1, 30, 0);
    cin >> n >> m;
    REP(i, n) {
        int k;
        cin >> k;
        REP(j, k) {
            int tmp;
            cin >> tmp;
            a[tmp] += 1;
        }
    }

    int res = 0;
    FOR(i, 1, m) {
        if (a[i] == n) {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  int k;
  cin >> s >> k;
  if (s.size() == 1) {
    cout << k / 2 << endl;
    return 0;
  }
  t = s;
  long long ans = 0;
  long long nd1 = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == s[i - 1]) {
      s[i] = '.';
      ++nd1;
      ++i;
    }
  }
  if (t.front() != t.back() || s.back() == '.') {
    cout << nd1 * k << endl;
    return 0;
  }
  s = t;
  s[0] = '.';
  long long nd2 = 1;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == s[i - 1]) {
      s[i] = '.';
      ++nd2;
      ++i;
    }
  }
  if (s.back() == '.') {
    cout << nd1 * ((k + 1) / 2) + nd2 * (k / 2) << endl;
    return 0;
  }
  cout << nd1 + nd2 * (k - 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) 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 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int D, N; cin >> D >> N;
    int x = pow(100, D);
    if(N == 100) cout << x * (N + 1) << endl;
    else cout << x * N << endl;

    // int a, b; cin >> a >> b;


    return 0;
}

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

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int min_c = INT_MAX;
    int max_p = INT_MIN;
    int r;
    while(n--){
        cin >> r;
        max_p = max(r - min_c, max_p);
        min_c = min(min_c, r);
    }
    cout << max_p << endl;
    return 0;
}



Measured memory_bytes: 3108
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	Scanner sc;

	int dfs(int now, boolean[] used, int min, int max, int[][] map) {
		int ret = 0;
		for(int i =0 ; i < map.length; i++){
			if(map[now][i] >= min && map[now][i] <= max){
				if(!used[i]){
					used[i] = true;
					ret += dfs(i,used,min,max,map);
				}
			}
		}

		return ret+1;
	}

	void run() {
		for (;;) {

			int n = sc.nextInt();

			int m = sc.nextInt();

			if ((n | m) == 0) {
				break;
			}

			int map[][] = new int[n][n];
			for (int i = 0; i < m; i++) {
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1;
				int e = sc.nextInt();

				map[a][b] = e;
				map[b][a] = e;
			}

			int min = 1;
			int max = 1;

			int width = Integer.MAX_VALUE;
			for (;;) {
				if (min > max) {
					max++;
				}
				if (max > 10004) {
					break;
				}

				boolean b[] = new boolean[n];
				b[0] = true;
//				System.out.println(dfs(0, b, min, max, map) +" "+n+ " "+min+" "+max);
				if (dfs(0, b, min, max, map) == n ) {
					width = Math.min(max - min, width);
					min++;
				} else {
					max++;
				}
			}
			if(width > Integer.MAX_VALUE >> 1){
				width = -1;
			}
			System.out.println(width);
		}
	}

	Main() {
		sc = new Scanner(System.in);
		try {
			sc = new Scanner(new File(""));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<long double> V;
 
int main () {
    int N, T, L, B;
    while (cin >> N >> T >> L >> B, N || T || L || B) {
        V lose(L,0), back(B,0);
 
        for (int i = 0; i < L; i++) cin >> lose[i];
        for (int i = 0; i < B; i++) cin >> back[i];
 
        vector<V> dp(T+3, V(N+1));
        dp[0][0] = 1;
 
        for (int i = 0; i < T; i++) {
            dp[i+1][N] += dp[i][N];
            for (int j = 0; j < N; j++) {
                if (dp[i][j] > 0) {
                    for (int k = 1; k < 7; k++) {
                        int next = j + k <= N ? j + k : N * 2 - (j + k);
                        if (find(lose.begin(), lose.end(), next) != lose.end()) {
                            dp[i+2][next] += dp[i][j] / 6;
                        } else if (find(back.begin(), back.end(), next) != back.end()) {
                            dp[i+1][0] += dp[i][j] / 6;
                        } else {
                            dp[i+1][next] += dp[i][j] / 6;
                        }
                    }
                }
            }
        }
 
        printf("%.6Lf\n", dp[T][N]);
    }
 
    return 0;
}

Measured memory_bytes: 1384
#include <iostream>

int main()
{
	int X, Y;
	std::cin >> X >> Y;

	if (X <= 8 && Y <= 8)
	{
		std::cout << "Yay!";
	}
	else 
	{
		if (X <= Y)
		{
			if (4 * Y - 2 * X <= 16)
			{
				std::cout << "Yay!";
			}
			else
			{
				std::cout << ":(";
			}
		}
		else if (Y <= X)
		{
			if (4 * X - 2 * Y <= 16)
			{
				std::cout << "Yay!";
			}
			else
			{
				std::cout << ":(";
			}
		}
		else
		{
			std::cout << ":(";
		}
	}

	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>

using namespace std;

int main() {
	long long int n, m;
	cin >> n >> m;
	vector<long long int> d(n + 1, 0);
	long long int a, b;
	for (long long int i = 0; i < m; i++) {
		cin >> a >> b;
		d[a - 1]++;
		d[b-1]--;
	}
	bool h = true;
	for (long long int i = 0; i < n; i++) {
		d[i] %= 2;
		if (d[i] == 1) {
			h = false;
			break;
		}
		d[i + 1] += d[i];
	}
	if (h) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
 
int main(){
int a,b,w;
  cin>>w>>a>>b;
  int ans=b-(w+a);
  if(a>b+w){cout<<a-(b+w)<<endl;}
  else {
  if(ans<0)cout<<0<<endl;
  else cout<<ans<<endl;}
 
 
 
}

Measured memory_bytes: 256
//
import java.math.*;
import java.util.*;
import java.io.*;
  
public class Main { 
  
    static BufferedReader in;
    static PrintWriter out = new PrintWriter(System.out);
    static String file = "../in";
    static int test = 10; // 0 for local testing, 1 for std input
    static int inf = 1_000_000, mod = 1_000_000_007;

    void swap(int[]ary, int i, int j)
    {
        int t = ary[i];
        ary[i] = ary[j];
        ary[j] = t;
    }
    
    String[] split() throws Exception
    {
        return in.readLine().split(" ");
    }

    int readInt() throws Exception
    {
        return Integer.valueOf(in.readLine());
    }

    long[] toLongArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        long[] ary = new long[n];
        for(int i = 0; i < n; i++) ary[i] = Long.valueOf(sp[i]);
        return ary;
    }

    int[] toIntArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        int[] ary = new int[n];
        for(int i = 0; i < n; i++) ary[i] = Integer.valueOf(sp[i]);
        return ary;
    }

    String reverse(String str)
    {
        return new StringBuilder(str).reverse().toString();
    }


    long pow(long a, int pow)
    {
        long res = 1;
        while(pow > 0)
        {
            if(pow % 2 != 0) {
                res *= a;
                res %= mod;
            }
            a = a * a;
            a %= mod;
            pow /= 2;
        }

        return res;
    }

    public static void main(String[] args) throws Exception
    {
        int _k = Integer.valueOf("1");
        if(test > 0) in = new BufferedReader(new InputStreamReader(System.in));
        else in = new BufferedReader(new FileReader(file));
        if(test < 0) {String[] str = in.readLine().split(" ");}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
        // System.out.println((-100 + 0) / 2);

        new Main().a();
        out.flush();
    }

    void a() throws Exception
    {
        int[] ary = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k = readInt();
        out.println(ary[k - 1]);
    }

}

Measured memory_bytes: 21204
const input = require('fs').readFileSync('/dev/stdin', 'utf8')
const [a, b, c] = input.split(/\s/).map(s => parseInt(s, 10));

 var results = [];
    for(var i=1; i<=c; i++) {
        if( (c%i === 0) ) {
            results.push(i);
        }
    }
 let count = 0;
    for(i=0; i<=results.length; i++) {
        if (a <= results[i] && results[i] <= b) {
            count++;
        }
    }
console.log(count);


Measured memory_bytes: 16004
a, b = map(int, input().split())
from fractions import gcd
n = gcd(a, b)

i = 2
primes = []
while True:
    if i > 10**6 + 1:
        break
    if n % i == 0:
        n //= i
        primes.append(i)
    else:
        i += 1
print(len(set(primes)) + (n != 1) + 1)


Measured memory_bytes: 68712
import sys
import math

input = sys.stdin.readline
N = int(input())
F = []
for _ in range(N):
    f = 0
    for i, k in enumerate(input().split()):
        f += pow(2, i) * int(k)
    F.append(f)

P = [list(map(int, input().split())) for _ in range(N)]


def cal_prof(bit_flg):
    ret = 0
    for i in range(N):
        f = bin(F[i] & bit_flg).count('1')
        ret += P[i][f]
    return ret

ans = -math.inf
for i in range(1, pow(2, 10)):
    ans = max(ans, cal_prof(i))
print(ans)


Measured memory_bytes: 74116
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int map[500][500];
int ans1[500][500];
int main()
{
	int mx,my;
	scanf("%d%d",&mx,&my);
	for(int i=0;i<mx;i++)
	{
		for(int j=0;j<my;j++)
		{
			char z;
			scanf(" %c",&z);
			if(z=='#')map[i][j]=ans1[i][j]=1;
		}
	}
	for(int i=0;i<mx;i++)
	{
		for(int j=0;j<my;j++)
		{
			if(i==0||(0!=j&&j!=my-1&&0!=i&&i!=mx-1&&j%2==0)||map[i][j])printf("#");
			else printf(".");
		}
		printf("\n");
	}
	printf("\n");
	for(int i=0;i<mx;i++)
	{
		for(int j=0;j<my;j++)
		{
			if(i==mx-1||(0!=j&&j!=my-1&&0!=i&&i!=mx-1&&j%2==1)||map[i][j])printf("#");
			else printf(".");
		}
		printf("\n");
	}
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;
int main (){
    int n,d,x;
    cin >> n >> d >> x;
    int a[n];
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    int count = n+x;
    for (int i = 0; i < n; i++){
        count += (d-1)/a[i];
    }
    cout << count  << "\n";
}

Measured memory_bytes: 764
N= list(str(input()))
import numpy as np
nn = np.array(N).astype(int)
ans = 0
for i in range(1,len(nn))[::-1]:
    if(nn[i] == -1):
        nn[i - 1] -= 1
        nn[i] = 9
    if(9-nn[i] > 0):
        nn[i-1] -= 1
        nn[i] = 9
        ans += 9
    else:
        ans += nn[i]

ans += nn[0]
print(ans)

Measured memory_bytes: 21376
#include<bits/stdc++.h>
using namespace std;
int main(){
    char str[10001];
    cin>>str;
    int len=strlen(str);
    for(int i=0;i<len;i++){
        if(str[i]>67)str[i]=str[i]-3;
        else{
            if(str[i]=='A')str[i]=90-2;
            else if(str[i]=='B')str[i]=90-1;
            else if(str[i]=='C')str[i]=90;
        }
    }
    cout<<str<<endl;
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    int n;cin >> n;
    vector<int> d(n);rep(i,n)cin >> d[i];
    sort(d.begin(),d.end());
    if (d[n / 2 ] - d[n / 2-1] == 0 )
    {
        cout << 0 << endl;
        return 0;
    }
    cout << d[n / 2 ] - d[n / 2-1] << endl;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

//-----------------------------------------------------------------------------

int n,x;

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

	cin>>n>>x;
	if(n==1) {
		cout<<"Yes"<<endl<<1<<endl;
		return 0;
	}
	else if(n==2&&x==2) {
		cout<<"Yes"<<endl<<1<<endl<<2<<endl<<3<<endl;
		return 0;
	}
	if(x==1||x==2*n-1) {
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	set<int> st;
	st.insert(x-1),st.insert(x),st.insert(x+1);
	if(x==2) st.insert(x+2);
	else st.insert(x-2);
	int num=1;
	REP(i,n-2) {
		while(st.find(num)!=st.end()) num++;
		cout<<num<<endl;
		num++;
	}
	if(x==2) cout<<x+1<<endl<<x<<endl<<x-1<<endl<<x+2<<endl;
	else cout<<x-1<<endl<<x<<endl<<x+1<<endl<<x-2<<endl;
	REP(i,n-3) {
		while(st.find(num)!=st.end()) num++;
		cout<<num<<endl;
		num++;
	}

	return 0;
}


Measured memory_bytes: 1536
// AOJ 374 Paper Fortune
// 2018.4.1 bal4u

#include <stdio.h>
#include <string.h>
#include <math.h>

int  n;
char s[100005];
int  f[10];
int  diff;
int  mi, ma;

int mima(char *s)
{
	int a = 10* (*s) + *(s+1);
	if (a < mi) mi = a;
	if (a > ma) ma = a;
	return ma-mi > diff;
}

int check(int len)
{
	int w = len-2, k, d;
	char *p;
	
	mi = 100, ma = 0, p = s+len;
	for (k = len; k < n; k += len) {
		if (memcmp(p, s, w)) return 0;
		if (k == len) mima(s+w);
		if (mima(p+w)) return 0;
		p += len;
	}
	d = ma-mi;
	if (d < diff) diff = d;
	return !diff;
}

int main()
{
	int i, w, a, max, min;
	char *p;
	
	fgets(p=s, sizeof(s), stdin);
	while (*p >= '0') { *p &= 0xf, f[*p]++, p++; }
	*p = 0;
	n = p - s;
	min = 10, max = 0;
	for (i = 1; i < 10; i++) if (f[i]) {
		if (i < min) min = i;
		if (i > max) max = i;
	}
	diff = max-min;
	if (n ==2 || !diff) goto done;
	
	if (n >= 4) {
		w = sqrt(n);
		for (i = 2; i <= w; i++) {
			if (n % i) continue;
			if (check(i)) goto done;
			if (n == i*i) continue;
			if (check(n/i)) goto done;
		}
	}

	max = 0; min = 99;
	for (p = s; *p > 0; p++) {
		if (*p == 1) {
			if (*(p+1) > 0) {
				a = 10 + *++p;
				if (a < min) min = a;
				if (a > max) max = a;
			} else min = 1;
		} else {
			if (*p < min) min = *p;
			if (*p > max) max = *p;
		}
		if (max-min > diff) break;
	}
	if (max-min < diff) diff = max-min;
done: printf("%d\n", diff);
	return 0;
}

				


Measured memory_bytes: 2104
#include<stdio.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P);
P dequeue();

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  tail=n+1;
  head=1;
  
  while(head!=tail){
    u=dequeue();
    if(u.t<=q){
      elaps+=u.t;
      printf("%s %d\n",u.name,elaps);
    }
    else{
      u.t-=q;
      elaps+=q;
      enqueue(u);
    }
  }
  
  
  return 0;
}

void enqueue(P x){
  Q[tail] = x;
  if(tail+1==LEN) tail=1;
  else tail++;
}

P dequeue(){
  P x;
  x=Q[head];
  if(head+1==LEN)head=1;
  else head++;
  return x;
}



Measured memory_bytes: 11940
#include "bits/stdc++.h"

using namespace std;

using ld = long double;

const ld PI = (acos(-1));

ld solve(ld a, ld b, ld x) {
	if (a * a * b / 2.0 <= x) {
		return atan(2 * (a * a * b - x) / (a * a * a));
	} else {
		return PI / 2 - atan(2 * x / (a * b * b));
	}
}

int main() {
	// がっつり公式解説を観たので非AC

	ld a, b, x;
	cin >> a >> b >> x;

	cout << fixed << setprecision(10) << solve(a, b, x) * 180.0 / PI << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0 ; i < n ; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		long ans = 1L<<62;
		for(int i = 0 ; i < n ; i++) {
			for(int j = 0 ; j < n ; j++) {
				for(int k = 0 ; k < n ; k++) {
					for(int l = 0 ; l < n ; l++) {
						long cnt = 0;
						for(int m = 0 ; m < n ; m++) {
							if(x[i] <= x[m] && x[m] <= x[j] && y[k] <= y[m] && y[m] <= y[l]) {
								cnt++;
							}
						}
						if(cnt >= a) {
							ans = Math.min(ans, 1L * (x[j] - x[i]) * (y[l] - y[k]));
						}
					}
				}
			}
		}
		System.out.println(ans);
	}
}


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

int main() {
  int N, i; cin >> N >> i;
  cout << N + 1 - i << endl;
  return 0;
}

Measured memory_bytes: 3192
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
char G[8][8];
bool p(int i, int j){
if ( !(0 <= i && i < 8 && 0 <= j && j < 8) ) return false;
return G[i][j] == '1';
}
main(){
    while( cin >> G[0][0] ){
	int si = 0, sj = 0;
	rep(i, 8) rep(j, 8) {
	    if (i + j == 0) continue;
	    cin >> G[i][j];
	    if(G[i][j] == '1') { si = i; sj = j;}
	}
	if ( p(si-3, sj) ) cout << "B" << endl;
	else if ( p(si, sj-3) ) cout << "C" << endl;
	else if ( p(si-2, sj+1)) cout << "D" << endl;
	else if ( p(si-1, sj-2)) cout << "E" << endl;
	else if ( p(si-2, sj-1)) cout << "F" << endl;
	else if ( p(si, sj-1) && p(si-1, sj+1) ) cout << "G" << endl;
	else cout << "A" << endl;
    }
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    int n,m;
    cin>>n>>m;
    
    if(n<=m) rep(i,m) cout<<n;
    else rep(i,n) cout<<m;
}



Measured memory_bytes: 256