akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();
	private static double ALLOWABLE_ERROR = 0.0000001;
	
	public static void main(String[] args) {
		Circle c1 = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble());
		Circle c2 = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble());
		
		double dist = distance(c1, c2);
		
		if(Math.abs(dist + c2.r - c1.r) < ALLOWABLE_ERROR || Math.abs(dist + c1.r - c2.r) < ALLOWABLE_ERROR) {
			System.out.println(1);
		} else if(dist + c2.r < c1.r + ALLOWABLE_ERROR || dist + c1.r < c2.r + ALLOWABLE_ERROR) {
			System.out.println(0);
		} else if(Math.abs(dist - c2.r - c1.r) < ALLOWABLE_ERROR) {
			System.out.println(3);
		} else if(dist < c1.r + c2.r + ALLOWABLE_ERROR) {
			System.out.println(2);
		} else {
			System.out.println(4);
		}
	}

	static double distance(Circle p1, Circle p2) {
		return Math.sqrt((p2.x-p1.x)*(p2.x-p1.x) + (p2.y-p1.y)*(p2.y-p1.y));
	}
	
	static class Circle {
		double x;
		double y;
		double r;
		Circle(double x, double y, double r) {
			this.x = x;
			this.y = y;
			this.r = r;
		}
	}
	
	static 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;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); 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() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

int h, w, n;

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

    cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
}

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

int main(void){
    string n;
    cin >> n;
    int min = 100000000;
    for(int i=0;i<=n.size()-3;++i){
        string ss = n.substr(i, 3);
        int n = atoi(ss.c_str());
        if(min > abs(n-753)) min = abs(n-753);
    }
    cout << min << endl;
}

Measured memory_bytes: 384
#!/usr/bin/python3

def calcDivisors(x):
    divs = []
    for i in range(1, int(x ** 0.5)+1):
        if x % i == 0:
            divs.append(i)
            if i * i != x:
                divs.append(x // i)
    return divs

n = int(input())
c = 0

#n = ak + 1
c += len(calcDivisors(n - 1)) - 1

#n = k^n(ak + 1)
divs = calcDivisors(n)
divs.sort()
for k in divs[1:]:
    r = n
    while r % k == 0:
        r //= k
    if r % k == 1:
        c += 1

print(c)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pdd;

int main() {
    string s;
    cin>>s;
    int a;
    if(s=="SUN") a=7;
    if(s=="MON") a=6;
    if(s=="TUE") a=5;
    if(s=="WED") a=4;
    if(s=="THU") a=3;
    if(s=="FRI") a=2;
    if(s=="SAT") a=1;
    cout<<a;



    return 0;
}


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

int main()
{
  int64_t N,M ;
  cin>>N>>M ;
  
  /*a[0]+....a[N-1]=Mとなるようなときの、数列a(N)の各行の最大公約数
    ・便宜上,a[0]<a[1]<....<a[N-1]とすると,数列aの各項は自然数なのでa[i]>=1を満たす
      max=M+1-N
    ・M/Nが整数の場合,M/Nが最大公約数
     最大公約数をdとすると、各項a[i]はdで割り切れるので各行はdの倍数である。
     つまり、Mはdで割り切れる.
     
  */
  if((M%N)==0) cout<<M/N<<endl ;
  else{
    for(int64_t d=(int64_t)(M/N);d>=1;d--){
      if((M%d)==0){
        if((M/(N*d))>=1){
          cout<<d<<endl ;
          return 0 ;
        }
      }
    }
  }
    
  return 0 ;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
H,W,K=map(int,input().split())
CO=[[0 for i in [0]*W] for j in [0]*H]
DO=[[0 for i in [0]*W] for j in [0]*H]
for i in range(H):
 C=input()
 for j in range(W):
  DO[i][j]=int(C[j])
CO[H-1]=DO[H-1]
F=1000000
for s in range(2**(H-1)):
 D=0
 E=0
 Sui=[0]*(H-1)
 for t in range(H-1):
  if ((s >> t) & 1):
   Sui[t]+=1
 for m in range(H-1):
  E+=Sui[m]
 for k in range(H-1):
  if Sui[k]==0:
   for i in range(W):
    CO[H-k-2][i]=DO[H-k-2][i]+CO[H-k-1][i]
  else:
   for i in range(W):
    CO[H-k-2][i]=DO[H-k-2][i]
 lst=[0]*H
 for h in range(W):
  c=max(CO[x][h] for x in range(H))
  d=max(lst[y]+CO[y][h] for y in range(H))
  if c>K:
   E=1000000
   break
  elif d>K:
   D+=1
   lst=[0]*H
  for z in range(H):
   lst[z]+=CO[z][h]
 F=min(F,D+E)
print(F)

Measured memory_bytes: 53852
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  ll a,b;
  cin>>a>>b;
  ll d[3];
  clr(d,0);
  rep(i,0,n){
    ll c;
    cin>>c;
    if(c<=a){
      d[0]++;
    }
    else if(b<c){
      d[2]++;
    }
    else{
      d[1]++;
    }
  }
  cout << min(d[0],min(d[1],d[2])) << endl;
  return 0;
}

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

int keta(int x){
  int ans=0;
  while(true){
    x/=10;
    ans++;
    if(x==0)break;
  }
  return ans;
}

int atai(int x,int n){
  for(int i=0; i<n-1; i++){
    x/=10;
  }
  int ans=x%10;
  return ans;
}

int main(){
  cin >> n;
  int ans=0;
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      ans+=cnt(i,j)*cnt(j,i);
    }
  }
  cout << ans << endl;
}

int cnt(int i ,int j){
  for(int k=1; k<=n; k++){
    if(atai(k,keta(k))==i&&atai(k,1)==j){
      c++;
    } 
  }
  int ans=c;
  c=0;
  return ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    string s;
    cin >> s;

    int64_t ans = 0;
    int64_t len_a = 0;
    for (int64_t i = 0; i < s.size(); ++i) {
        if (s[i] == 'A') {
            ++len_a;
        } else if (s[i] == 'B') {
            if (i + 1 < s.size() && s[i + 1] == 'C') {
                ans += len_a;
                ++i;
            } else {
                len_a = 0;
            }
        } else {
            len_a = 0;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
// author: arshit_babariya

#include <bits/stdc++.h>

using namespace std;
#define fast			ios::sync_with_stdio(0);cin.tie(0);
#define ll 				long long int
#define INF 			1e18L
#define precision(x)	fixed << setprecision(x)
const ll mod = 1e9 + 7;

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


ll powm(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * 1LL * a) % mod;
		b >>= 1LL;
		a = (a * 1LL * a) % mod;
	}
	return res;
}

//--------------------------------------------------------------------------------------------------------------------------//
ll a[405], dp[405][405], sum[405][405];
void solve() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	memset(dp, 0X3f3f3f3f3fLL, sizeof dp);
	for (int len = 1; len <= n; len++) {
		for (int i = 0; i <= n - len; i++) {
			int j = i + len - 1;

			if (len == 1) {
				dp[i][j] = 0;
				sum[i][j] = a[i];
				continue;
			}

			if (len == 2) {
				sum[i][j] = sum[i][j - 1] + a[j];
				dp[i][j] = sum[i][j];
				continue;
			}
			sum[i][j] = sum[i][j - 1] + a[j];
			for (int k = i; k < j; k++) {
				dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k + 1][j] + sum[i][j]);
			}
		}
	}
	cout << dp[0][n - 1] << endl;
}

int main() {
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int tc = 1;
	// cin >> tc;

	int _ = 0;
	while (_++ < tc) {
		solve();
	}

	return 0;
}




Measured memory_bytes: 6212
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) (a).begin(), (a).end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { assert(x > 0); return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { assert(x > 0); return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { assert(x > 0); return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { assert(x > 0); return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
void NG() { puts("-1"); exit(0); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
// const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


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

  priority_queue<P> pq;
  rep(i, n) if (a[i] < b[i]) pq.emplace(b[i], i);
  ll ans = 0;

  while (!pq.empty()) {
    auto [y, j] = pq.top(); pq.pop();
    int s = b[(j-1+n)%n] + b[(j+1)%n];
    int m = (y-s)/s + 1;
    chmin(m, (y-a[j])/s);

    if (m <= 0) NG();
    ans += m;
    b[j] -= s*m;
    if (a[j] < b[j]) pq.emplace(b[j], j);
  }

  rep(i, n) if (a[i] != b[i]) NG();
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 6892
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a<=c && b<=c)
        cout<<0;
    else if (a<=c && b<=d)
        cout<<b-c;
    else if (a<=c && b>=d)
        cout<<d-c;
    else if (a>=c && b<=d)
        cout<<b-a;
    else if (a<=d && b>=d)
        cout<<d-a;
    else
        cout<<0;
        
}

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

int main() {
    
    int N;
    cin >> N;
    
    string s = to_string(N);
    
    if(s.back() == '3'){
        cout << "bon";
    }else if(s.back() == '0' || s.back() == '1' || s.back() == '6' || s.back() == '8'){
        cout << "pon";
    }else{
        cout << "hon";
    }
    
    return 0;
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		scanner.close();
		String ans = null;
		if (a < b && b < c) {
			ans = "Yes";
		} else {
			ans = "No";
		}
		System.out.println(ans);
	}
}

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

int main() {
  int H,W;
  cin >> H >> W;
  for (int i; i<W+2; i++){
    if (i < W+1){
    cout << "#";
    }
    
    else if(i == W+1){
      cout << "#" << endl;
    }
  }
  
  for(int j=0; j<H; j++) {
   cout << "#";
  
    vector<char>vec(W);
  for (int i=0; i<W; i++) {
    cin >> vec.at(i);
    if(i == W-1){
      
    cout << vec.at(i) << "#" << endl;
    }
    else if (i < W-1){
      
      cout << vec.at(i);
    }
   
  }
   
  }
  
   for (int i; i<W+2; i++){
    cout << "#";
  }
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(){
#define int long long
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,cnt=0,num=0,start=0,end=0;
    cin>>n;
    int a[n];
    rep(i,0,n)cin>>a[i];
    num=a[0];
    while (start-n) {
        if(end+1<n&&(a[end+1]&num)==0){
            end++;
            num|=a[end];
        }
        else{
            num^=a[start];
            cnt+=end-start+1;
            start++;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int N;
    double T, A;
	double H[10000];
	cin >> N >> T >> A;
	for (int i = 0; i < N; i++)cin >> H[i];
	double min_T = 1e9;
	int min_i;
	for (int i = 0; i < N; i++) {
		if (fabs(A - (T - 0.006*H[i])) < min_T) {
			min_T = fabs(A-(T - 0.006*H[i]));
			min_i = i;
		}
	}

	cout << min_i + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
    
    public static void main(String[] args){
    StringBuilder cout = new StringBuilder();
     Scanner s = new Scanner(System.in);
   int  n=s.nextInt();
    
   for(int i=1;i<=n;i++){
       int x=i;
       if(x%3==0){
           cout.append(" "+i);
           continue;
       }do{
           if(x%10==3){
               cout.append(" "+i);
               break;}
               x/=10;
           }while(x!=0);
       }
       System.out.println(cout);
       
}
}
 
   



Measured memory_bytes: 28528
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

template<typename T>
T calc_mod(string s, T d) {
    T r = 0;
    int n = sz(s);
    REP(i, n) r = (r * 10 + (s[i] - '0')) % d;
    return r;
}

void solve() {
    string s, t;
    cin >> s >> t;
    SORT(s);
    SORT(t);
    REV(t);
    cout << (s < t ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
from collections import defaultdict

n, k = [int(x) for x in input().split()]

a = [int(x) for x in input().split()]

d = defaultdict(int)

for x in a:
    d[x] += 1

e = sorted(d.items(), key=lambda v:v[1])

m = len(e)

ans = 0

if m-k >= 0:
    for i in range(m-k):
        ans += e[i][1]

print(ans)


Measured memory_bytes: 39288
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x = read::<i64>();
    let k = read::<i64>();
    let l = k - (x - 1);
    let r = k + (x - 1);
    for i in l..r + 1 {
        if i != l {
            print!(" ");
        }
        print!("{}", i);
    }
    println!("");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define lli long long int
#define inf 2147483647
#define infll LLONG_MAX
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli n, k;
    cin >> n >> k;

    int cnt = 0;
    while(n > 0){
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
A, B, C, X, Y = list(map(int, input().split()))

if A+B <= 2*C:
    cost = A*X + B*Y
else:
    if X >= Y:
        if A < 2*C:
            cost = Y*2*C + (X -Y)*A
        else:
            cost = X*2*C
    else:
        if B < 2*C:
            cost = X*2*C + (Y-X)*B
        else:
            cost = Y*2*C

print(cost)

Measured memory_bytes: 3064
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll H, A; cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,m,n) for(ll i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

    ll x,k,d;
    cin>>x>>k>>d;

    ll tmp;
    tmp=abs(x/d);
  



    ll answer=0;


    if (tmp>=k){
        answer=abs(abs(x)-d*k);
    }

    else if (tmp+1==k){
        answer=abs(min(abs(x)-d*(tmp-1),abs(x)-d*(tmp+1)));
    }

    else if (tmp+2==k){
        answer=abs(abs(x)-d*tmp);
    }

    else if ((tmp-k)%2==0){
        answer=abs(abs(x)-d*tmp);
    }

    else if (abs(tmp-k)%2==1){
         answer=abs(min(abs(x)-d*(tmp-1),abs(x)-d*(tmp+1)));
    }



    if (x==0 and k%2==0){
        answer=0;
    }

    if (x==0 and k%2==1){
        answer=d;
    }

  
  	cout<<answer<<endl;














}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }

bool check(string t) {
  rep(i, t.length()) {
    if (t[i] == '0') return true;
  }
  return false;
}

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

  string s;
  cin >> s;

  int ans = inf;
  rep(i, 26) {
    char c = 'a' + i;
    string t;
    rep(i, s.length()) t += (s[i] == c ? '1' : '0');
    //cout << t << '\n';
    int res = 0;
    while (check(t)) {
      res++;
      string nxtt;
      rep(i, t.length() - 1) {
        if (t[i] == '1' || t[i + 1] == '1') nxtt += '1';
        else nxtt += '0';
      }
      t = nxtt;
    }
    chmin(ans, res);
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	int t1=0;
	if(a>=b)
	{
		while(a>=b)
		{
			b*=2;
			t1++;
		}
	}
	int t2=k-t1;
	for(int i=1;i<=t2;i++) c*=2;
	if(c<=b ||c<=a) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	
}

Measured memory_bytes: 3632
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
for i in range(N):
  b=int(input())
  if b in A1:
    t=A1.index(b)
    A1[t]=0
  elif b in A2:
    t=A2.index(b)
    A2[t]=0
  elif b in A3:
    t=A3.index(b)
    A3[t]=0
if sum(A1)==0 or sum(A2)==0 or sum(A3)==0:
  print("Yes")
else:
  for j in range(3):
    if A1[j]+A2[j]+A3[j]==0:
      print("Yes")
      break
  else:
    if A1[0]+A2[1]+A3[2]==0 or A1[2]+A2[1]+A3[0]==0:
      print("Yes")
    else:
      print("No")

Measured memory_bytes: 9164
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = long.Parse(Console.ReadLine());
            var count = 0L;

            if (N % 2 == 0)
            {
                while (true)
                {
                    N = N / 5;
                    if (N == 0)
                    {
                        break;
                    }

                    count += N / 2;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
	int n;
	string s;
	while (cin >> n && n != 0) {
		cin >> s;
		for (int i=0; i<n; i++) {
			int x=0;
			char ch = s[0];
			string tmp="";
			for (int j=0; j<s.length(); j++) {
				if (ch == s[j]) {
					x++;
				} else {
					stringstream ss; ss<<x;
					string cnt=ss.str();
					tmp+=cnt;
					tmp.push_back(ch);
					ch = s[j];
					x = 1;
				}
			}
			stringstream ss; ss<<x;
			string cnt=ss.str();
			tmp+=cnt;
			tmp.push_back(ch);
			s=tmp;
		}
		cout << s << endl;
	}
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    vector<string> S(3);
    vector<int> x(3,-1);
    cin >>S[0]>>S[1]>>S[2];
    int n=0;
    while(true){
        x[n]++;
        if(x[n]>=S[n].size())break;
        n=S[n][x[n]]-'a';
    }
    printf("%c\n",'A'+n);
    return (0);
}


Measured memory_bytes: 256
/**OOO**/
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mems(x,y) memset(x,y,sizeof(x))
#define pf printf
#define sc scanf
using namespace std;


int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    ll n,y,a,b,c;
    cin>>n>>y;

    if(y%10000==0 && y/10000==n)cout<<y/10000<<" "<<0<<" "<<0<<endl;
    else if(y%5000==0 && y/5000==n)cout<<0<<" "<<y/5000<<" "<<0<<endl;
    else if(y%1000==0 && y/1000==n)cout<<0<<" "<<0<<" "<<y/1000<<endl;
    else{

        for(int i=0;i<=n;i++){
            a=10000*i;
            for(int j=0;j<=n-i;j++){
                b=5000*j;
                for(int k=0;k<=n-i-j;k++){
                    c=1000*k;
                    if(a+b+c==y && i+j+k==n){
                        cout<<i<<" "<<j<<" "<<k<<endl;
                        return 0;
                    }
                }
            }
        }
        cout<<-1<<" "<<-1<<" "<<-1<<endl;
    }

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>

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

using namespace std;
typedef long long ll;

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

vector<vector<int>> g;
vector<int> dist;

int dfs(int v) {
    int d = 0;
    for (int nv: g[v]) {
        if (dist[nv] != -1) d = max(d, dist[nv]+1);
        else d = max(d, dfs(nv)+1);
    }
    dist[v] = d;
    return d;
}

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

    g.resize(n);
    dist.assign(n, -1);

    rep(i, m) {
        int x, y; cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
    }

    rep(i, n) {
        if (dist[i] != -1) continue;
        dfs(i);
    }

    int ans = 0;
    rep(i, n) ans = max(ans, dist[i]);
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 8192
import Control.Applicative
import Data.List

main = do
  [a,b,c] <- map (read ::String -> Int) . words <$> getLine
  print $ countDivs a b c

countDivs a b c = length  $ filter (\x -> a<=x && b>=x) $ divisorList c
  where
    divisorList :: Int -> [Int]
    divisorList c = divisor c c []
      where
        divisor :: Int -> Int -> [Int] -> [Int]
        divisor c n xs
          | n == 1 = 1:xs
          | c `mod` n == 0 = divisor c (n-1) (n:xs)
          | otherwise = divisor c (n-1) xs

Measured memory_bytes: 4072
#include <bits/stdc++.h>
using namespace std;
bool Lets_see_who_wins(vector< int > &stones,int n,int k)
{
     bool win[k+1] = {};//initially all false.
     for(int i=1;i<k+1;i++){
          for(int j=0;j<n;j++){
               if(i>=stones[j] && win[i-stones[j]] == false){
                    win[i] = true;
                    break;
               }
          }
     }
     return win[k];
}
int main()
{
     //freopen("in.txt","r",stdin);
     int n,k;
     cin >> n >> k;
     vector< int >  stones(n);
     for(int i=0;i<n;i++){
          cin >> stones[i];
     }
      bool ans = Lets_see_who_wins(stones,n,k);
      if(ans)  cout << "First" << endl;
      else     cout << "Second" << endl;
}


Measured memory_bytes: 384
/*
h3110_fr13nd,
 
AUTHOR : @sam_jn
*/
 
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot1(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}

//----------------------------------SOLUTION-BELOW-------------------------------------------// 

void solve(){   
    string s, t;
    cin >> s >> t;
    if(s.compare(t.substr(0, (int)t.size() - 1)) == 0) cout << "Yes";
    else cout << "No";

}
int main(){


                                                            // #ifndef ONLINE_JUDGE    
                                                            // freopen("/home/samyak/Desktop/CP/input.txt", "r", stdin);
                                                            // freopen("/home/samyak/Desktop/CP/output2.txt", "w", stdout);
                                                            // #else
                                                            // // online submission
                                                            // #endif


    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}

Measured memory_bytes: 3656
#include <iostream>

using namespace std;

int main()
{
    int a, b, x;
    cin >> a >> b >> x;

    if (a > x)
    {
        cout << "NO" << endl;
    }
    else if ((x-a) <= b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
def main():
    s = input().rstrip()

    black_first = '0'
    white_first = '1'
    black_first_count = 0
    white_first_count = 0

    for c in s:
        if c == black_first:
            white_first_count += 1
        else:
            black_first_count += 1

        temp = black_first
        black_first = white_first
        white_first = temp
    
    print(min(black_first_count, white_first_count))
             


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int a,b;
    cin>>a>>b;
    if(b%a)cout<<b-a;
    else    cout<<b+a;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<vector>
using namespace std;
long long int a[200001];
int main() {


	int i;
	long long int n;
	cin >> n;
	long long int sum = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = a[i] - (i + 1);
		//sum = sum + a[i] - i;
	}
	sort(a, a + n);
	//long long int b = sum / n;
	//int j;
	//long long int sum2 = 0;
	//sum = 10000000000000000;
	
	//for (j = b - 10000; j <= b + 10000; j++) {

	//	sum2 = 0;
		for (i = 0; i < n; i++) {
			sum = sum + abs(a[i] - a[n / 2]);
		}
	//	sum = min(sum, sum2);
	//}
		
	
	cout << sum << endl;
	return 0;

	

}

Measured memory_bytes: 5136
puts 9394,a=?+,0,1,m=9,?<,2,9,u=3,
[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,u,3,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},
[a,5-u+=1,3,9]+(0..59).map{[a,u,u,u,a,u,3,6,[a,6,6,6]*(59-_1),?<,6,9,m+=1,a,u,m,u]},
(0..59).map{|m|[a,2,2,2]+(1..m).map{[a,40+m-_1,99+_1,u,?<,3,u,u,a,u,2,2]}}

Measured memory_bytes: 15040
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)

const int INF = 100000000;

using namespace std;


int main() {
	int v[13];
	for (int i = 1; i < 13; i++)v[i] = i - 1;
	v[0] = 12;

	int a, b;
	cin >> a >> b;
	a--; b--;
	if (v[a] > v[b])cout << "Alice" << endl;
	else if (v[a] < v[b])cout << "Bob" << endl;
	else cout << "Draw" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
	long long point;
	scanf("%lld",&point);
	long long move=point/11*2;
	
	if(point%11==0){
		
	}else if(point%11<=6){
		move++;
	}else{
		move+=2;
	}
	
	printf("%lld\n",move);
	
    return 0;
}


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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = int_fast64_t;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

int main() {
  ll a, b, c; cin >> a  >> b >> c;
  ll v = a*b*c;
  cout << min({abs(a*b*(c/2)-(v-a*b*(c/2))), abs(a*(b/2)*c-(v-a*(b/2)*c)), abs(a/2*b*c-(v-a/2*b*c))}) << endl;;
  return 0;
}


Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
 
gcd = as[0]
as.each do |a|
    gcd = gcd.gcd(a)
end
 
if K % gcd == 0 && K <= as.max
    puts 'POSSIBLE'
else
    puts 'IMPOSSIBLE'
end

Measured memory_bytes: 8452
use std::io::*;

fn main() {
    let i = stdin();
    solve(&mut i.lock(), &mut stdout());
}

fn solve(i: &mut BufRead, o: &mut Write) {
    let n = read_num(i);
    let mut a = read_nums(i);
    a.sort();

    let mut alice = 0;
    let mut bob = 0;

    for i in 0..n {
        let c = a[n - i - 1];
        if i % 2 == 0 {
            alice += c;
        } else {
            bob += c;
        }
    }

    writeln!(o, "{}", alice - bob).unwrap();
}

fn read_line(i: &mut BufRead) -> String {
    let mut line = String::new();
    i.read_line(&mut line).unwrap();
    line.trim().to_string()
}
fn read_num(i: &mut BufRead) -> usize {
    read_line(i).parse().unwrap()
}
fn read_nums(i: &mut BufRead) -> Vec<usize> {
    read_line(i)
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

string solve(int n, vector<int> &a) {
    int v = a[0];
    rep(i, 1, n) v = gcd(v, a[i]);
    vector<int> yakusu(1000001);
    bool notPw = false;
    rep(i, n) {
        for(int j = 1;j*j <= a[i];j++) {
            if(a[i]%j == 0) {
                yakusu[j]++;
                if(a[i]/j != j) yakusu[a[i]/j]++;
                if((j != 1 && yakusu[j] == 2) || (a[i] != 1 && yakusu[a[i]/j] == 2)) notPw = true;
            }
            if(notPw) break;
        }
        if(notPw) break;
    }
    if(!notPw) return "pairwise coprime";
    else if(v == 1) return "setwise coprime";
    else return "not coprime";
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    srand(time(NULL));
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    cout << solve(n, a) << endl;
}

Measured memory_bytes: 11104
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int n,k,j,i;
	cin>>n>>k;

	ll ar[n],ans[n],m;
	for(int i=0;i<n;i++)
		cin>>ar[i];

	ans[0]=0;
	for(int h=1;h<=k && h<=n;h++)
		ans[h]=abs(ar[h]-ar[0]);

	for(j=k+1;j<n;j++)
	{
		m=ans[j-1]+abs(ar[j]-ar[j-1]);
		for(i=2;i<=k;i++)
		{
			if(ans[j-i]+abs(ar[j]-ar[j-i])<m)
			{
				m=ans[j-i]+abs(ar[j]-ar[j-i]);
			}
		}	
		ans[j]=m;
	}

	cout<<ans[n-1];
}

Measured memory_bytes: 1792
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

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

int main()
{
	LL a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		LL gcdz=gcd(a,b);
		LL lcm=(a*b)/gcdz;
		printf("%lld %lld\n",gcdz,lcm);
	}
	
	return 0;
}

Measured memory_bytes: 3144
#include  <iostream>
#include  <vector>
#include  <algorithm>
#include  <queue>
using namespace std;

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; }
#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef pair<int, int> the;

const int INF = 1 << 29;
const ll LINF = 1LL << 60;
const int R = 1e9 + 7;

int main()
{
	int n, m;
	cin >> n >> m;
	priority_queue<ll> Q;
	rep(i, n) {
		int v;
		cin >> v;
		Q.push(v);
	}
	while (m > 0) {
		ll v = Q.top();
		Q.pop();
		m--;
		Q.push(v / 2);
	}

	ll sum = 0;
	while (!Q.empty()) {
		sum += Q.top();
		Q.pop();
	}
	cout << sum << endl;
}

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

void solve() {
    int n, k;
    cin >> n >> k;
    int cnt = 0, len = 1;
    while (len < n) len += k - 1, cnt++;
    cout << cnt;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    ll n;
    cin >> n;
    vector<ll> prices(n);
    for(int i = 0; i < n; i++) {
        cin >> prices[i];
    }
    ll i = 0;
    ll valley = prices[0];
    ll peak = prices[0];
    ll now = 1000;
    ll rem = 0;
    ll stock = 0;
    while(i < prices.size() - 1) {
        while(i < prices.size() - 1 && prices[i] >= prices[i + 1])
            i++;
        valley = prices[i];
        while(i < prices.size() - 1 && prices[i] <= prices[i + 1])
            i++;
        peak = prices[i];
        stock = now / valley;
        rem = now % valley;
        now = stock * peak + rem;
    }
    cout << now << endl;
}


Measured memory_bytes: 3628
# AtCoder Beginner Contest 109 20180908
# Question:B

def main(N, words):
	answer = "Yes"
	
	for j in range(1,N):
		
		if words[j] in words[:j]+words[j+1:]:
			answer = "No"
			break
		elif words[j-1][len(words[j-1])-1] != words[j][0]:
			answer = "No"
			break
	return answer
		
	
	
	
N = int(input())
words = []
try:
	while True:
		words.append(input())
except EOFError:
	pass
print(main(N,words))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

int main() {

    zoom;    
    string s, t; cin >> s >> t;
    ll nS = (ll)s.size(), nT = (ll)t.size();
    s = ' ' + s;
    t = ' ' + t;
    vector<vector<pair<ll, ll> > > dp(nS + 1, vector<pair<ll, ll> >(nT + 1, make_pair(-1, -1)));
    vector<vector<ll> > dp1(nS + 1, vector<ll>(nT + 1, 0));
    for(ll i = 1; i <= nS; i += 1) {
        for(ll j = 1; j <= nT; j += 1) {
            if(dp1[i - 1][j] > dp1[i][j - 1]) {
                dp1[i][j] = dp1[i - 1][j];
                dp[i][j] = make_pair(i - 1, j);
            }
            else {
                dp1[i][j] = dp1[i][j - 1];
                dp[i][j] = make_pair(i, j - 1);
            }
            if(s[i] == t[j]) {
                if(dp1[i - 1][j - 1] + 1 > dp1[i][j]) {
                    dp1[i][j] = dp1[i - 1][j - 1] + 1;
                    dp[i][j] = make_pair(i - 1, j - 1);
                }
            }
        }
    }
    pair<ll, ll> curr = make_pair(nS, nT);
    pair<ll, ll> strt = dp[nS][nT];
    string ans = "";
    while(strt.first != -1) {
        if(strt.first != curr.first && strt.second != curr.second) 
            ans += s[curr.first];
        curr = strt;
        strt = dp[strt.first][strt.second];
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}

Measured memory_bytes: 211584