akhauriyash/Code-Regression huggingface dataset:
/* Just_Do_It ___________ICARUS__________________*/
                 
#include <bits/stdc++.h>
using namespace std;
       
typedef long long ll;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define te ll t; std::cin >> t; while(t--)
#define SZ 100001
//# define M_PIl  3.141592653589793238462643383279502884L 
/*   Proceed with CAUTION   */

ll a[600][600];

int main(){
	fastio;
	ll n,m,q;
	cin>>n>>m>>q;
	rep(i,0,m) {
		ll l,r;
		cin>>l>>r;
		a[r][l]++;
	}
	rep(i,1,n+1){
		rep(j,1,n+1){
			a[i][j] = a[i][j] + a[i][j-1] + a[i-1][j] -a[i-1][j-1];
		}
	}
	rep(i,0,q){
		ll l,r;
		cin>>l>>r;
		cout<< a[r][r] -a[r][l-1] - a[l-1][r] + a[l-1][l-1]<<endl;
	}
	return 0;
} 

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  int64 A = 0, B;
  for (int i = 0; i < n; ++i) {
    A += b[i] - a[i];
  }
  if (A < 0) {
    puts("No");
    return 0;
  }
  B = A;
  bool found = false;
  for (int i = 0; i < n; ++i) {
    if (a[i] < b[i]) {
      int useA = (b[i] - a[i] + 1) / 2;
      int useB = (b[i] - a[i]) % 2;
      if (A < useA || B < useB) {
        found = true;
        break;
      }
      A -= useA;
      B -= useB;
    } else if (a[i] > b[i]) {
      int useB = a[i] - b[i];
      if (B < useB) {
        found = true;
        break;
      }
      B -= useB;
    }
  }
  if (found) {
    puts("No");
  } else {
    puts("Yes");
  }
  return 0;
}


Measured memory_bytes: 384
def isprime(x):

	if x == 2:
		return 1

	if x < 2 or x%2 == 0:
		return 0

	i = 3
	while i <= x**0.5:
		if x%i == 0:
			return 0
		i += 2

	return 1


def test():

	n = int(input())
	prime_counter = 0

	for i in range(n):

		x = int(input())

		prime_counter += isprime(x)
	
	print(prime_counter)


if __name__ == "__main__":
	test()



Measured memory_bytes: 5676
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  cin >> n >> x;
  int mn = INF, sum = 0;
  rep(i, n) {
    int m;
    cin >> m;
    sum += m;
    chmin(mn, m);
  }
  x -= sum;
  cout << n+x/mn << endl;
  return 0;
}

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

using namespace std;

int main()
{
    vector<char> G;

    for(;;){
        int m, f, r;
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1) break;
        if(m == -1 || f == -1){
            G.push_back('F');
        }else if(m + f >= 80){
            G.push_back('A');
        }else if(m + f >= 65){
            G.push_back('B');
        }else if(m + f >= 50){
            G.push_back('C');
        }else if(m + f >= 30){
            if(r >= 50){
                G.push_back('C');
            }else{
                G.push_back('D');
            }
        }else{
            G.push_back('F');
        }
    }

    for(int i = 0; i < G.size(); i++){
        cout << G.at(i) << endl;
    }
}


Measured memory_bytes: 3156
N = int(input())
A = list(map(int, input().split()))
money = 1000
kabu = 0

if A[0] < A[1]:
    kabu += money // A[0]
    money = money % A[0]

for i in range(1, N-1):
  if A[i-1] >= A[i] and A[i] < A[i+1]:
    kabu += money // A[i]
    money = money % A[i]
  elif A[i-1] <= A[i] and A[i] > A[i+1]:
    money += kabu * A[i]
    kabu = 0

money += kabu * A[N-1]
kabu = 0
print(money)

Measured memory_bytes: 9248
N, M, Q = map(int, input().split())
X = []
for i in range(M):
    l, r = map(int, input().split())
    l, r = l - 1, r - 1
    X.append((l, r))


class Ruisekiwa2D:
    def __init__(self, h, w):
        self.H = h
        self.W = w
        self.G = [[0] * w for _ in range(h)]

    def load(self, points):
        # 問題によってイメージしやすいよう書き換えてください
        for x, y in points:
            self.G[x][y] += 1

    def load_imos(self, points):
        # pointsは[[左上h, 左上w, 右下h, 右下w], ...]であること
        for i1, j1, i2, j2 in points:
            self.G[i1][j1] += 1  # 左上
            if j2 + 1 < self.W:  # 右上
                self.G[i1][j2+1] -= 1
            if i2 + 1 < self.H:
                self.G[i2+1][j1] -= 1  # 左下
            if j2 + 1 < self.W and i2 + 1 < self.H:  # 右下
                self.G[i2+1][j2+1] += 1

    def calc(self):
        for y in range(self.W):
            for x in range(1, self.H):
                self.G[x][y] += self.G[x-1][y]

        for y in range(1, self.W):
            for x in range(self.H):
                self.G[x][y] += self.G[x][y-1]

    def get(self, i1, j1, i2, j2):
        if i1 > i2 or j1 > j2 or i1 < 0 or j1 < 0 or i2 < 0 or j2 < 0:
            return 0
        elif i1 > 0 and j1 > 0:
            return self.G[i2][j2] - self.G[i1-1][j2] - self.G[i2][j1-1] + self.G[i1-1][j1-1]
        elif i1 <= 0 < j1:
            return self.G[i2][j2] - self.G[i2][j1-1]
        elif j1 <= 0 < i1:
            return self.G[i2][j2] - self.G[i1 - 1][j2]
        else:
            return self.G[i2][j2]


R2D = Ruisekiwa2D(N, N)
R2D.load(X)
R2D.calc()

for q in range(Q):
    p, q = map(int, input().split())
    p, q = p - 1, q - 1
    print(R2D.get(p, p, q, q))


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

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long DIV = (ll)1e9+7;

bool IsPrime(int num)
{
   if (num < 2) return false;
   else if (num == 2) return true;
   else if (num % 2 == 0) return false;
   double sqrtNum = sqrt(num);
   for (int i = 3; i <= sqrtNum; i += 2) {
      if (num % i == 0) return false;
   }
    return true;
}

int main(void) {
   ll N;
   cin>>N;
   map<ll,ll> A;
   rep(i,2,N+1) {
      if(!IsPrime(i)) continue;
      ll M = N;
      while(1) {
         M /= i;
         if (M==0) break;
         A[i] += M;
      }
   }
   ll ans = 1;
   // for (auto el: A) cout<<el.first<<" "<<el.second<<endl;
   for (auto el: A) {
      ans *= (el.second+1);
      ans %= DIV;
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
    ll n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> cnt(n, 0);
    REP(i, n){
        cin >> v[i];
        cnt[v[i]-1]++;
    }

    ll sum = 0;
    REP(i, n) sum += cnt[i] * (cnt[i] - 1) / 2;

    REP(k, n){
        ll ans = sum;
        if(cnt[v[k]-1] >= 2){
            ans -= cnt[v[k]-1] * (cnt[v[k]-1] - 1) / 2;
            ans += (cnt[v[k]-1] - 1) * (cnt[v[k]-1] - 2) / 2;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 5760
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        string[] s = SpRead(' ');
        int sx = int.Parse(s[0]);
        int sy = int.Parse(s[1]);
        int tx = int.Parse(s[2]);
        int ty = int.Parse(s[3]);
        string ans = "";
        for (int i = 0; i < (ty - sy); i++) ans += "U";
        for (int i = 0; i < (tx - sx); i++) ans += "R";
        for (int i = 0; i < (ty - sy); i++) ans += "D";
        for (int i = 0; i < (tx - sx); i++) ans += "L";
        ans += "L";
        for (int i = 0; i <= (ty - sy); i++) ans += "U";
        for (int i = 0; i <= (tx - sx); i++) ans += "R";
        ans += "DR";
        for (int i = 0; i <= (ty - sy); i++) ans += "D";
        for (int i = 0; i <= (tx - sx); i++) ans += "L";
        ans += "U";
        Console.WriteLine(ans);
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 34772
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Integer order_num = Integer.parseInt(s.next());
        HashSet<String> hs = new HashSet<String>();

        for(int i=0; i < order_num; ++i) {
            String order = s.next();
            String str = s.next();
            if(order.equals("insert")) {
                hs.add(str);
            }

            else if(order.equals("find")) {
                if(hs.contains(str)) {
                    System.out.println("yes");
                } else {
                    System.out.println("no");
                }
            }
        }
        s.close();
    }
}


Measured memory_bytes: 210428
#include<stdio.h>
int main(void){
	char op;
	int a,b,i,s=0,out[1000];
	for(i=0;i<1000;i++){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='?')
			break;
		switch(op){
			case '+':
						out[i]=a+b;
						break;
			case '-':
						out[i]=a-b;
						break;
			case '*':
						out[i]=a*b;
						break;
			case '/':
						out[i]=a/b;
						break;
		}
		s++;
	}
	for(i=0;i<s;i++)
		printf("%d\n",out[i]);
	return 0;
}


Measured memory_bytes: 1788
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

using ll = long long;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple

/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)

/* ---------- container ---------- */

#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) (LL((v).size()))

#define FIND(v, k) (v).find(k) != (v).end()
#define VFIND(v, k) find(ALL(v), k) != (v).end()

#define gsort(b, e) sort(b, e, greater<decltype(*b)>())

/* ----------- debug ---------- */

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.fst << "," << p.snd << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
T sq(T a) {
    return a * a;
}

template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
    ll N, C, K;
    cin >> N >> C >> K;

    ll T[N + 1];
    for (int i = 0; i < N; ++i) {
        cin >> T[i];
    }
    T[N] = INF;
    sort(T, T + N + 1);

    ll ans = 0;
    ll limit = -1, cap = 0;

    for (int i = 0; i <= N; ++i) {
        if (cap == C || T[i] > limit) {
            ++ans;
            limit = T[i] + K;
            cap = 0;
        }
        ++cap;
    }

    cout << ans - 1 << endl;
    return 0;
}


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

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

  int a[N];
  for (int i=0; i < N; ++i) cin >>a[i];
  sort(a, a + N, greater<int>());

  int w = 0;
  for (int i=0; i < N; ++i) {
    if (i % 2 == 0 ) w += a[i];
    else w -= a[i];
  }
  cout << w << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define il inline
#define ri register
#define ll long long
#define Size 200050
using namespace std;
namespace{
	template<class free>
		il void read(free&x){
		x^=x;ri char c;while(c=getchar(),c<'0'||c>'9');
		while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
	}
	template<class f1,class...f2>
		il void read(f1&x,f2&...y){
		read(x),read(y...);
	}
}
template<class free>
struct heap{
	free a[Size];int n;
	il void down(int p){
		int s(p<<1);
		while(s<=n){
			if(s<n&&a[s+1]<a[s])++s;
			if(a[s]<a[p])
				swap(a[s],a[p]),
					p=s,s<<=1;
			else break;
		}
	}
	il void up(int p){
		while(p)
			if(a[p]<a[p>>1])
				swap(a[p],a[p>>1]),
					p>>=1;
			else break;
	}
	il void push(const free&x){
		a[++n]=x,up(n);
	}
	il void pop(){
		a[1]=a[n--],down(1);
	}
	il void build(){
		for(int i(n);i;--i)down(i);
	}
};
struct san{
	int x,y,z;
	il bool operator<(const san&A)const{
		return y*1ll*A.x<A.y*1ll*x;
	}
};
ll ans;
heap<san>H;
int fa[Size],a[Size];
int fa1[Size],a1[Size],a2[Size];
il int find(int);
il void Union(int,int);
int main(){
	//freopen("in","r",stdin);
	int n;read(n);
	for(int i(2);i<=n;++i)read(fa[i]);
	for(int i(1);i<=n;++i)
		read(a[i]),fa1[i]=i,a1[i]=!a[i],a2[i]=a[i];
	for(int i(2);i<=n;++i)
		H.a[i-1]={a1[i],a2[i],i};
	H.n=n-1,H.build();while(H.n){
		san top(H.a[1]);H.pop();
		if(top.x==a1[top.z]&&top.y==a2[top.z])
			Union(top.z,fa[top.z]);
	}return printf("%lld",ans),0;
}
il int find(int x){
	return x^fa1[x]?fa1[x]=find(fa1[x]):x;
}
il void Union(int u,int v){
	u=find(u),v=find(v);
	if(u==v)return;fa1[u]=v;
	ans+=a2[v]*1ll*a1[u];
	a1[v]+=a1[u],a2[v]+=a2[u];
	if(v^1)H.push({a1[v],a2[v],v});
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
static const int INFTY = 1 << 30;

bool isValid(int ch, int cw, int h, int w, vector<string> &s){
  if(ch>=0 && ch<h && cw>=0 && cw<w && s[ch][cw] == '.') return true;
  return false;
}

int main(){
  int h, w;
  cin >> h >> w;
  
  int ch, cw, dh, dw;
  cin >> ch >> cw >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  
  vector<string> s(h);
  for(int i=0; i<h; ++i){
    cin >> s[i];
  }
  
  int dx[] = {1, 0, -1, 0};
  int dy[] = {0, 1, 0, -1};
  
  if(s[ch][cw] == '#' || s[dh][dw] == '#'){
    cout << -1 << endl;
    return 0;
  }
  
  vector<vector<int>> dist(h, vector<int>(w, INFTY));
  vector<vector<bool>> visited(h, vector<bool>(w, false));
  
  deque<pair<int, int>> dq;
  
  dist[ch][cw] = 0;
  dq.push_front({ch, cw});
  
  while(!dq.empty()){
    int a = dq.front().first;
    int b = dq.front().second;
    dq.pop_front();
    visited[a][b] = true;
    
    for(int i=0; i<4; ++i){
      int x = a + dx[i];
      int y = b + dy[i];
      
      if(isValid(x,y,h,w,s) && !(visited[x][y])){
        if(dist[x][y] > dist[a][b]){
          dist[x][y] = dist[a][b];
          dq.push_front({x, y});
        }
      }
    }
    
    for(int i=a-2; i<=a+2; ++i){
      for(int j=b-2; j<=b+2; ++j){
        if(isValid(i,j,h,w,s) && !(visited[i][j])){
          if(dist[i][j] > dist[a][b] + 1){
            dist[i][j] = dist[a][b] + 1;
            dq.push_back({i,j});
          }
        }
      }
    }
  }
  
  if(dist[dh][dw] == INFTY) cout << -1 << endl;
  else cout << dist[dh][dw] << endl;
  
  return 0;
}
    
    

Measured memory_bytes: 9704
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 100007;

struct uft{
    int par[MAX_N], rank[MAX_N], size[MAX_N];
    void init(int n){
        rep(i,n){
            par[i] = i;
            rank[i] = 0;
            size[i] = 1;
        }
        return ;
    }

    int find(int x){
        if(par[x]==x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(rank[x] < rank[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rank[x] == rank[y])  ++rank[x];
        }
        size[x] = size[y] = size[x] + size[y];
        return ;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
};

uft u;
int n;
P x[MAX_N], y[MAX_N];
pair<int, P> cost[MAX_N*2];
bool used[MAX_N];
ll ans = 0;

int main(){

    int n;
    cin >> n;
    
    u.init(n);
    rep(i,n){
        cin >> x[i].first >> y[i].first;
        x[i].second = y[i].second = i;
    }
    sort(x, x+n);
    sort(y, y+n);
    fill(used, used+n, false);

    pair<int, P> temp;
    rep(i,n-1){
        temp.first = x[i+1].first - x[i].first;
        temp.second = P(x[i].second, x[i+1].second);
        cost[i] = temp;
    }

    rep(i,n-1){
        temp.first = y[i+1].first - y[i].first;
        temp.second = P(y[i].second, y[i+1].second);
        cost[n-1+i] = temp;
    }
    sort(cost, cost+2*(n-1));

    ll ans = 0;

    rep(i, 2*(n-1)){
        int a, b, c;
        c = cost[i].first;
        a = cost[i].second.first;
        b = cost[i].second.second;
        if(u.same(a,b)) continue;
        else{
            ans += ll(c);
            u.unite(a,b);
        }
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 5376
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoderPractice0802
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            long[] NAB = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            long N = NAB[0];
            long A = NAB[1];
            long B = NAB[2];
            long ans = 0;


                long shou = N / (A + B);
                long mod = N % (A + B);

                if (A == 0)
                {
                    Console.WriteLine(ans);
                }
                else
                {
                if (mod >= A)
                {
                    Console.WriteLine(A * shou + A);
                }
                else
                {
                    Console.WriteLine(A * shou + mod);
                }

                }
            }
        }
    }


Measured memory_bytes: 28024
#include<stdio.h>
int main(void)
{
	int a[100],n,m,i,j=0,g=0;

	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		g+=a[i];
	}
	//a[n+1]='\0';
	for(i=0;i<n;i++)
		if(a[i]*4*m>=g)
			j++;
	if(j>=m)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

    long long N;
    cin >> N;

    vector<long long> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            if (i == 0) B[i] = 1;
            else if (i == N - 1) B[i] = 1;
            else B[i] = 2;
        }
        if (i % 2 == 1) {
            if (i == 0) B[i] = -1;
            else if (i == N - 1) B[i] = -1;
            else B[i] = -2;
        }
    }


    long long ans1 = 0, ans2 = 0;

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    for (int i = 0; i < N; i++) ans1 += A[i] * B[i];
    for (int i = 0; i < N; i++) B[i] *= -1;
    reverse(B.begin(), B.end());
    for (int i = 0; i < N; i++) ans2 += A[i] * B[i];

    cout << max(ans1, ans2) << endl;

}













































Measured memory_bytes: 1792
fun main(args: Array<String>) {
    var printFlag = true
    while (printFlag){
        val inputs: List<Int> = readLine()?.
                split(" ")?.
                map { it.toInt() }?.
                sorted()
                ?: return
        if(inputs[0] == 0 && inputs[1] == 0){
            printFlag = false
        }else{
            println("${inputs[0]} ${inputs[1]}")
        }
    }
}


Measured memory_bytes: 32984
#include <math.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)
#define MIN(a, b) ((a) < (b)) ? (a) : (b)
#define LLONG_MAX     9223372036854775807i64

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vp> vvp;
typedef vector<vpl> vvpl;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 29;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

struct edge { ll to; ll cost; };

ll Pow(ll a, ll b) {
	ll x = 1;
	while (b > 0) {
		if (b & 1) x = x * a;
		a = a * a;
		b = b >> 1;
	}
	return x;
}

/*<ここから>***********************************************************/


int main()
{
	int D, N;

	cin >> D >> N;

	ll n = Pow(100, D);
	ll ans = 0;

	rep(i, N) {
		ans += n;
		
		if (D == 0) {
			if (ans % 100 == 0) ans += n;
		}
		else if (D == 1) {
			if (ans % 10000 == 0) ans += n;
		}
		else {
			if (ans % 1000000 == 0) ans += n;
		}
	}



	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

LL dp[1<<16];

int main() {
  int N; std::cin >> N;
  int a[17][17];
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      std::cin >> a[i][j];
    }
  }

  // Calculate initial score(=dp[mask]),
  // which means that all rabbits included in the mask are used.
  for (int mask = 0; mask < (1 << N); ++mask) {
    dp[mask] = 0;

    // Get rabbit indices included in mask.
    for (int i = 0; i < N; ++i) {
      for (int j = i; j < N; ++j) {
        if ((mask & (1<<i)) && (mask & (1<<j))) {
          dp[mask] += a[i][j];
        }
      }
    }
  }

  for (int mask = 0; mask < (1<<N); ++mask) {
    for (int used = mask; used > 0; used = (--used)&mask) {
      int unused = mask - used;
      dp[mask] = std::max(dp[mask], dp[used] + dp[unused]);
    }
  }

  std::cout << dp[(1<<N)-1] << std::endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int h, w;
string s[100];

int main() {
	cin >> h >> w;
	rep(i, h)cin >> s[i];
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '.') {
				int cnt = 0;
				FOR(k, -1,2) {
					FOR(l, -1, 2) {
						int y = i + k;
						int x = j + l;
						if (y >= 0 && y < h&&x >= 0 && x < w) {
							if (s[y][x] == '#')cnt++;
						}
					}
				}
				cout << (char)(cnt + '0');
			}
			else cout << s[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
"use strict";
function main(input) {
    const line = input.split("\n");
    let arr = line[0].split(" ");
    const A = arr.shift() * 1;
    const B = arr.shift() * 1;
    const C = arr.shift() * 1;
    const D = arr.shift() * 1;
    console.log(Math.ceil(C / B) <= Math.ceil(A / D) ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
	int a,b;
	cin >> a >> b;
	if(a >= 13)cout << b;
	if(a <= 5)cout << 0;
	if(a >= 6 && a <= 12)cout << b/2;
	return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    int n,d;
    cin>>n>>d;
    d=(d*2)+1;
    cout<<ceil((n*1.0)/d);
}


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

int main(){
	int h, r, ans;
	scanf("%d%d", &h, &r);
	if(h+r == 0)ans = 0;
	if(h+r > 0)ans = 1;
	if(h+r < 0)ans = -1;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3216
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 200005;
 
void task(){
 	ll a,b; cin >> a >> b;
 	cout << (a+b)/2 + (a+b)%2 << endl;
}

int main(){
        _
        #ifdef OJ
        freopen("inputf.in", "r", stdin);
        freopen("outputf.in", "w", stdout);
        #endif

        int T = 1; //cin >> T;
        while(T--){
            task();
        }
        
return 0;
}




Measured memory_bytes: 3616
module S = Set.Make (struct type t = int let compare = compare end) ;;

Scanf.scanf "%d" (fun n ->
    let add k acc =
        let rec loop i acc =
            if i > 100000 then acc else loop (i * k) (S.add i acc)
        in
        loop k acc
    in
    let l = add 9 (add 6 (S.singleton 1)) in
    let a = Array.make (n + 1) n in
    a.(0) <- 0;
    S.iter (fun i ->
        for j = i to n do
            if a.(j - i) + 1 < a.(j) then a.(j) <- a.(j - i) + 1
        done
    ) l;
    Printf.printf "%d\n" a.(n)
)

Measured memory_bytes: 1152
import sys
L, A, B, M = map(int, input().split())
mod = M
sys.setrecursionlimit(pow(10, 8))

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, (y-1)//2)**2 * x % mod
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def G(n, i):
    # G = 1 + R + (R**2) + (R**3) ... (R**(n-1))
    # R = 10**i
    if n == 1:
        return 1
    tn = n//2
    return (G(tn, i) * (1 + power(10, tn*i)) %mod + (n%2)*power(10, (n-1)*i)) % mod

def G2(n, i):
    # G2 = R + 2(R**2) + 3(R**3) ... n(R**n)
    # R = 10**i
    if n ==0 :
        return 0
    if n == 1:
        return power(10, i) % mod
    tn = n//2
    X = G2(tn, i)
    I = power(10, tn*i)
    Y = (X*(I+1)%mod + mul(mul(tn, I), (G(tn+1, i)-1))%mod) + mul(n%2, mul(n, power(10, n*i)))
    return Y%mod


def f(a, b, n, i):
    if n == 0:
        return 0
    aa = mul(a, G(n, i))
    bb = mul(b, G2(n-1, i))
    return (aa - bb) % mod

SL = A + (L-1) * B
ts = 0
ks = [0]
for i in range(len(str(SL))+1):
    # ks[i] = Count(10**i <= Si <10**(i+1))
    ks.append(max(min((10**(i+1)-1),SL)-(A-B), 0) // B - ts)
    ts += ks[-1]
ti = 0
a = SL
R = 0
# i = 2, n = 3, a = 17, B=2
# 17 * 1500 * 130000
# r += Sum_{0<=j<=n-1}((a-Bj)*pow(10**i, j)) * pow(10, ti)
# j = 0 -> (a+Bj)*pow(10**i, j) = a
for i in range(len(str(SL))+1,0,-1):
    n = ks[i]
    R = (R + f(a, B, n, i)*power(10, ti)) % mod
    ti += i*n
    a -= n*B
print(R)


Measured memory_bytes: 95936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<vector<int> >pat[55];
vector<vector<int> >rec(int num){
	if(num <= 1){
		vector<vector<int> >ret;
		ret.pb(vector<int>());
		return pat[num] = ret;
	}
	if(pat[num].size()) return pat[num];
	pat[num].pb(vector<int>());
	for(int i=1;i<num;i++){
		vector<int>hoge;
		int zan = num;
		for(int j=i;(j == i || zan >= 2*i);j+=i){
			hoge.pb(j);
			zan -= i;
		}
		vector<vector<int> >pl = rec(zan);
		for(int j=0;j<pl.size();j++){
			vector<int>vi = hoge;
			for(int k=0;k<pl[j].size();k++) vi.pb(hoge[hoge.size()-1]+pl[j][k]);
			pat[num].pb(vi);
		}
	}
	return pat[num];
}
int s,t,n;
int dp[(1<<15)];
bitset<64>ok[(1<<15)];
struct UF{
	int par[55],ran[55];
	void init(){ for(int i=0;i<55;i++) par[i] = i; }
	int find(int x){ if(x == par[x]) return x; else return par[x] = find(par[x]); }
	void unite(int x,int y){
		x = find(x); y = find(y); if(x==y) return;
		if(ran[x] < ran[y]) par[x] = y;
		else{
			par[y] = x;
			if(ran[x] == ran[y]) ran[x]++;
		}
	}
	bool same(int x,int y){ return find(x)==find(y); }
}uf[(1<<15)];
bool cmp(const vector<int>& a,const vector<int>& b){
	return a.size() > b.size();
}
ll DP[205][2];
int main(){
	cin>>s>>t>>n;
	rec(t);
	sort(pat[t].begin(),pat[t].end(),cmp);
	for(int i=0;i<pat[t].size();i++){
		uf[i].init();
		for(int j=0;j<pat[t][i].size();j++){
			ok[i][pat[t][i][j]] = 1;
			int a = pat[t][i][j];
			assert(1<=a && a<t);
			for(int k=0;k+a<t;k++) uf[i].unite(k,k+a);
		}
		ll x = 1;
		for(int k=0;k<t;k++){
			if(uf[i].find(k) == k){
				x = x*1LL*n%mod;
			}
		}
		dp[i] = int(x);
		for(int j=0;j<i;j++){
			if((ok[j]&ok[i]) == ok[i]){
				dp[i] -= dp[j];
				if(dp[i] < 0) dp[i] += mod;
			}
		}
	}
	ll ans = 0;
	for(int i=0;i<pat[t].size();i++){
		for(int j=0;j<=s;j++) DP[j][0] = DP[j][1] = 0;
		DP[0][0] = 1;
		ll cur[2] = {};
		cur[0] = 1;
		ll res = 0;
		for(int j=1;j<=s-t+1;j++){
			for(int k=0;k<2;k++){
				DP[j][k] += cur[1-k];
				for(int a=0;a<pat[t][i].size();a++){
					if(j-pat[t][i][a] <= 0) break;
					DP[j][k] += DP[j-pat[t][i][a]][1-k];
				}
				DP[j][k] %= mod;
			}
			cur[0] = cur[0]*1LL*n%mod;
			cur[1] = cur[1]*1LL*n%mod;
			if(j>=t){
				cur[0] = (cur[0]+DP[j-t+1][0])%mod;
				cur[1] = (cur[1]+DP[j-t+1][1])%mod;
			}
		}
		ll tg = 1;
		for(int j=s-t+1;j>=1;j--){
			res += DP[j][1] * tg % mod;
			res -= DP[j][0] * tg % mod;
			tg = tg*1LL*n%mod;
		}
		res %= mod;
		ans += dp[i]*res%mod;
	}
	cout << (ans%mod+mod)%mod << endl;
}


Measured memory_bytes: 16296
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		x=(double)(e*c-b*f)/(double)(a*e-b*d);
		y=(double)(a*f-c*d)/(double)(a*e-b*d);
		if(x==-0.00000)
			x=0.000000;
		if(y==-0.00000)
			y=0.000000;
		printf("%.3f %.3f\n",x,y);
	}
	
	return 0;
}

Measured memory_bytes: 636
#include <stdio.h>
#include <string.h>
struct dice{
  int d1;
  int d2;
  int d3;
  int d4;
  int d5;
  int d6;
};
  struct dice d; 
void W(){
  int tmp;
  tmp=d.d1;
  d.d1=d.d3;
  d.d3=d.d6;
  d.d6=d.d4;
  d.d4=tmp;
}
void N(){
  int tmp;
  tmp=d.d1;
  d.d1=d.d2;
  d.d2=d.d6;
  d.d6=d.d5;
  d.d5=tmp;
}
void S(){
  int tmp;
  tmp=d.d1;
  d.d1=d.d5;
  d.d5=d.d6;
  d.d6=d.d2;
  d.d2=tmp;
}
void E(){
  int tmp;
  tmp=d.d1;
  d.d1=d.d4;
  d.d4=d.d6;
  d.d6=d.d3;
  d.d3=tmp;
 }
int main(){

  int i;
  for(i=0; i<6; ++i){
	scanf("%d", &d.d1);
	scanf("%d", &d.d2);
	scanf("%d", &d.d3);
	scanf("%d", &d.d4);
	scanf("%d", &d.d5);
	scanf("%d", &d.d6);
  }
   char c;
  while(scanf("%c", &c)!=EOF){
	if(c=='\n')
	  break;
	switch(c){
	case 'S':
	  S();
	  break;
	case 'E':
	  E();
	  break;
	case 'N':
	  N();
	  break;
	case 'W':
	  W();
	  break;
	default:
	  break;
	}
 
  }
  printf("%d\n", d.d1);
  return 0;
}



Measured memory_bytes: 2104
#!/usr/bin/python
import sys,math
if sys.version_info[0]>=3: raw_input=input
while True:
	a,b=[int(e) for e in raw_input().split()]
	if not a: break
	print(min(abs(b-math.hypot(i,a-i)) for i in range(a//2+1)))

Measured memory_bytes: 7712
def main():
    h = int(input())
    w = int(input())
    n = int(input())

    if h >= w:
        big = h
    else:
        big = w

    if n <= big:
        print(1)
        exit()

    for i in range(big+1):
        if i * big >= n:
            count = i
            print(count)
            exit()
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}

int main()
{
   int n,k;
   while(cin>>n>>k)
   {
       if(n%k == 0)
        cout<<0<<endl;
       else
        cout<<1<<endl;
   }
}
















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

int main() {
  int n; cin >> n;
  int a; cin >> a;
  int ans = a;
  rep(i,n-1){
    int b; cin >> b;
    if(ans > __gcd(a,b)) ans = __gcd(a,b);
  }
  
  cout << ans << endl;
}

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

int main() {

  int X;

  cin >> X ;

  int64_t a=X/500,b=X%500;

  b/=5;

  int64_t ans=1000*a+5*b;
  
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	long double r;
	cin>>r;
	cout<<3.14159265358979*2*r;
	return 0;
}


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


int main(){
  string s;
  cin >> s;
  int res = 0;
  int ans = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C'){
      res++;
    }
    else{
      if(res > ans){ans = res;}
      res = 0;
    }
    if(i == s.size()-1){if(res > ans) ans = res;}
  }
  cout << ans << endl; 
}

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

int main(){
	int N,M,a,b,mc=0,tc=0;
	cin>>N>>M;
	for(int i=0;i<M;i++){
		cin>>a>>b;
		if(a<N){
			mc=max(mc,N-a);
			tc+=N-a;
		}
	}
	tc-=mc;
	cout<<tc<<endl;
	return 0;
}


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

int main(){
    int A,B,C;
    cin >> A>>B>>C;
    if(A==B){
        cout << C <<endl;
    }
    else if(A==C){
        cout << B <<endl;
    }
    else{
        cout << A <<endl;
    }
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())
ans = ''
for i in range(tx-sx):
    ans += 'R'
for i in range(ty-sy):
    ans += 'U'
for i in range(tx-sx):
    ans += 'L'
for i in range(ty-sy):
    ans += 'D'
ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-sy+1):
    ans += 'U'
ans += 'L'
ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-sy+1):
    ans += 'D'
ans += 'R'
print(ans)

Measured memory_bytes: 3064
program AESE
    implicit none
    integer :: i=0,j=0
    character(len=4) :: str

    read(*,*) str
    do i=1,4
        if(str(i:i) == '+')then
            j = j+1
        else if(str(i:i) == '-')then
            j = j-1
        else
        endif
    enddo
    write(*,*) j

end program AESE

Measured memory_bytes: 256
n=int(input())
l=[0]*n
for i in range(n):
    l[i]=int(input())

vi=[0]*n
vi[0]=1
ans=0
st=l[0]
f=0
while vi[1]==0:
    vi[st-1]+=1
    if vi[st-1]>1:
        f=1
        break
    st=l[st-1]
    ans+=1
if f==0:
    print(ans)
else:
    print(-1)
    
    
  
  
    

Measured memory_bytes: 7668
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BDigits {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N, K;
        cin >> N >> K;
        int cnt = 0;
        while (N > 0) {
            N /= K;
            cnt++;
        }
        cout << cnt << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BDigits solver;
    solver.solve(in, out);
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; ++i)
#define reps(i,f,n) for(int i = f; i <= n; ++i)
#define eb emplace_back
#define all(x) x.begin(), x.end()

using namespace std;
using PII=pair<int,int>;
using PPI=pair<int,PII>;
using ll=long long;

const ll MOD = 1000000007;
const int HW = 300000;
ll f[HW];
ll fr[HW];
int h[HW];

ll pow_mod(ll a, ll b, ll p){
  ll r = 1;
  for(;b>0; b>>=1){
    if(b&1) r = (r*a) %p;
    a = (a * a)%p;
  }
  return r;
}

ll c(ll n, ll r){
//   cout <<  "c(" << n << "," << r << ") " << endl;
  if(n < 0 || r < 0 || n < r){
    return 0;
  }
  return (((f[n] * fr[r])%MOD) * fr[n-r])%MOD;
}

ll p(ll n, ll r){
//   cout <<  "c(" << n << "," << r << ") " << endl;
  if(n < 0 || r < 0 || n < r){
    return 0;
  }
  return (f[n] *fr[n-r])%MOD;
}
ll dup(ll a, ll b){
  return (((f[a+b] * fr[a])%MOD) * fr[b])%MOD;
}

ll w[HW];
ll w2[HW];

int main(void){
  ll H, W, A, B;
  ll ans = 0;
  cin >> H >> W >> A >> B;

  f[0] = 1;
  fr[0] = pow_mod(f[0], MOD-2, MOD);
  reps(i, 1, HW-1){
    f[i] = (f[i-1] * i) %MOD;
    fr[i] = pow_mod(f[i], MOD-2, MOD);
  }


  for(int i = B; i < W; ++i){
    w[i] = dup(A, W-i-1)%MOD;
  }
//   rep(i, W){
//     cout << w[i] << ", ";
//   }cout << endl;

  for(int i = W-1; i >= B; --i){
    w2[i] = w[i] - w[i+1];
  }

//   rep(i, W){
//     cout << w2[i] << ", ";
//   }cout << endl;

  for(int i = B; i < W; ++i){
    ans += w2[i]*dup(H-A-1, i)% MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}


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

using namespace std;

vector<bool> vis;
vector<vector<int>> adj;
vector<int> dp;

void dfs(int k) {
  vis[k] = 1;
  for (int v : adj[k]) {
    if (!vis[v])
      dfs(v);
    dp[k] = max(dp[k], 1 + dp[v]);
  }
}

int main() {
  int n, m;
  int e[2];
  cin >> n >> m;
  vis.assign(n+1, 0);
  dp.assign(n+1, 0);
  adj = vector<vector<int>> (n+1);
  for (int i=0; i<m; ++i) {
    cin >> e[0] >> e[1];
    adj[e[0]].push_back(e[1]);
  }
  for (int i=1; i<=n; ++i)
    if (!vis[i])
      dfs(i);
  cout << *max_element(dp.begin(), dp.end()) << '\n';
  return 0;
}


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

int main(){
    
    string S;
    cin>>S;
    for(int i=0; i < (1<<4);i++){
        string ans;
        ans += S[0];
        int sum = S[0] - '0';
        for(int j = 1; j<4;j++){
            if((i>>j) & 1) ans += "+" , sum += S[j] - '0';
            else ans += "-" , sum -= S[j] - '0'; 
            ans += S[j];
        }
        if(sum == 7){
            cout<<ans<<"=7"<<endl;
            return 0;
        }
    
    }

}

Measured memory_bytes: 256