akhauriyash/Code-Regression huggingface dataset:
A, B, K = map(int, input().split())
ans = set()
for i in range(A, A + K):
  if i > B:
    break
  ans.add(i)
for i in range(B, B - K, -1):
  if i < A:
    break
  ans.add(i)
for i in sorted(ans):
  print(i)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define F first
#define S second
using namespace std;
int r,c,k,ans = INT_MAX;
int A[3005],dp[3005][3005],sum[3005][3005],n,s;
const int MOD = 998244353;	
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin >> n >> s;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
	}
	for (int l = 1; l <= s; l ++) {
		for (int j = 1; j <= n; j++){
			if (A[j] > l) continue;
			if (A[j] == l) dp[j][l] = j,sum[j][l] = (sum[j][l]+ j)%MOD;
			else {
				dp[j][l] = sum[j-1][l - A[j]];
			//	sum[j][l] += j;
				sum[j][l] = (sum[j][l] + dp[j][l])%MOD;		
			}
		}
		for (int j = 1; j <= n; j++)
			sum[j][l] = (sum[j][l] + sum[j-1][l])%MOD;
		}
	int ans = 0;
//	cout << sum[1][s];
	for (int i = 1; i <= n; i++)
	ans = (ans + 1ll*dp[i][s]*(n-i+1)%MOD)%MOD;
cout << ans%MOD;
}

Measured memory_bytes: 70784
#include "bits/stdc++.h"
using namespace std;

int A[1000000],n;

int binarySearch(int key){
	int left=0;
	int right=n;
	int mid;
	while(left<right){
		mid=(left+right)/2;
		if(key==A[mid])return 1;
		if(key>A[mid])left=mid+1;
		else if(key<A[mid])right=mid;
	}
	return 0;
}

int main() {
int i,q,k,sum=0;
scanf("%d",&n);
for (int i = 0; i < n; ++i) {
	scanf("%d",&A[i]);
}

scanf("%d",&q);
for (int i = 0; i < q; ++i) {
	scanf("%d",&k);
	if(binarySearch(k))sum++;
}
printf("%d\n",sum);
return 0;
}

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

// #define int long long
#define endl '\n'
string make(string s,int k)
{
	string ans="";
	for(int i=0;i<k;i++)
		ans+=s;
	return ans;
}

int32_t main()
{

   string s;
   cin>>s;
   int n=s.size();
   if(n==1){
   	cout<<'0';return 0;
   }
   string f,se;
   if(n&1){
   	f=make("01",n/2)+"0";
	se=make("10",n/2)+"1";
   }
   else{
   	f=make("01",n/2);
   	se=make("10",n/2);
   }
   int cnt1=0,cnt2=0;
   // cout<<se<<" "<<f;
   for(int i=0;i<n;i++)
   {
   	if(s[i]!=f[i])
   		cnt1++;
   	else
   		cnt2++;
   }
   cout<<min(cnt1,cnt2);
   	return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll a,b;
    cin>>a>>b;

    
    cout<<a*b<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;

int main()
{
  string s;
  cin >> s;
  bool ok = false;
  if (s.length() == 6 && s[2] == s[3] && s[4] == s[5])
    ok = true;
  puts(ok ? "Yes" : "No");
  return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===


const int INF = int(1e9 + 7);
array<array<int, 3>, 100005> dist;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;
	vector<Vi> to(N);
	for (int i = 0; i < M; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		to[u].push_back(v);
	}
	int S, T;
	cin >> S >> T;
	--S; --T;

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 3; ++j) {
			dist[i][j] = INF;
		}
	}

	queue<Pii> q;
	q.emplace(S, 0);
	dist[S][0] = 0;
	while (!q.empty()) {
		int v = q.front().first;
		int l = q.front().second;
		q.pop();
		for (const auto& u : to[v]) {
			int nl = (l + 1) % 3;
			if (dist[u][nl] != INF) continue;
			dist[u][nl] = dist[v][l] + 1;
			q.emplace(u, nl);
		}
	}

	int ans = dist[T][0];
	if (ans == INF) ans = -1;
	else ans /= 3;
	cout << ans << endl;
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vllvll = vector<vll>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
void vdeb(string s, vll x) {cout<<s<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<endl;}

//=======================================================================================================

int main()
{
    ll n;
    cin >> n;
    vll a(n+1);
    vll b(n);
    rep(i,n+1) cin >> a[i];
    rep(i,n) cin >> b[i];

    ll sumo = sm(a);
    rep(i,n) {
        if(a[i]<=b[i]) {
            ll ao = a[i];
            a[i] = 0;
            if((a[i+1] - b[i]+ao) < 0)
                a[i+1] = 0;
            else a[i+1] -= b[i]-ao;
        }
        else {
            a[i] = a[i] - b[i];
        }
    }
    ll ans = sumo - sm(a);
    cout << ans << endl;
    //vdeb("x",a);

    return 0;   
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p.at(i);
  int ans = 1, increase = 0, nochange = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p.at(i) > p.at(i + 1)) {
      increase = 0;
    } else {
      increase++;
      if (increase == k - 1) nochange++;
    }
  }
  set<int> s;
  for (int i = 0; i < k; i++) s.insert(p.at(i));
  for (int i = k; i < n; i++) {
    int prevmin = *s.begin(), prevmax = *s.rbegin();
    s.erase(p.at(i - k));
    s.insert(p.at(i));
    if (prevmin == p.at(i - k) && prevmax <= p.at(i)) continue;
    ans++;
  }
  cout << ans - max(0, nochange - 1) << endl;
}


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

int main() {
  string w;
  cin >> w;
  int n = w.size(), i, ans = 1;
  map<char, int> mp;
  for (i = 0; i < n; i++) {
    mp[w[i]]++;
  }
  for (auto p : mp) {
    if (p.second % 2 != 0) {
      ans = 0;
      break;
    }
  }
  if (ans) {
    cout << "Yes"
         << "\n";
  } else {
    cout << "No"
         << "\n";
  }
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    bool isCounting = false;
    int cnt = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            isCounting = true;
            cnt++;
        } else {
            isCounting = false;
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 100030
#define ll long long
#define x first
#define y second
#define all(v) v.begin(),v.end()
using namespace std;
ll ar[N];
int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            cout.tie(NULL);
            ll n,k,s;
            cin>>n>>k>>s;
            ll fl = -1;
            if(s==1)fl= 10;
            for(int i=0;i<k;i++)
                ar[i]=s;
            for(int i=k;i<n;i++)
                ar[i]=s+fl;
            for(int i=0;i<n;i++)
                cout<<ar[i]<< " " ;
                         return 0;
}


Measured memory_bytes: 2176
package main

import (
	"fmt"
	"sort"
)

type point struct{ x, y int }
type sortByX []point

func (s sortByX) Len() int           { return len(s) }
func (s sortByX) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortByX) Less(i, j int) bool { return s[i].x < s[j].x }

type sortByY []point

func (s sortByY) Len() int           { return len(s) }
func (s sortByY) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortByY) Less(i, j int) bool { return s[i].y > s[j].y }

func main() {
	var n int
	fmt.Scan(&n)

	rs := make(map[point]bool, n)
	for i := 0; i < n; i++ {
		p := point{}
		fmt.Scan(&p.x, &p.y)
		rs[p] = true
	}
	bs := sortByX(make([]point, n))
	for i := range bs {
		fmt.Scan(&bs[i].x, &bs[i].y)
	}

	sort.Sort(bs)
	ans := 0
	for _, b := range bs {
		ps := sortByY(make([]point, 0, n))
		for r := range rs {
			if r.x < b.x && r.y < b.y {
				ps = append(ps, r)
			}
		}

		if len(ps) > 0 {
			sort.Sort(ps)
			delete(rs, ps[0])
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string b;
    cin >> b;
    if (b == "A") {
        cout << "T" << endl;
    } else if (b == "T") {
        cout << "A" << endl;
    } else if (b == "G") {
        cout << "C" << endl;
    } else {
        cout << "G" << endl;
    }
}


Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2019/12/29
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;

int sort_dec(const void *a, const void *b)
{
    ll da = *(ll*)a;
    ll db = *(ll*)b;
    int val = 0;
    if(da > db) {
        val = -1;
    } else if (da == db) {
        val = 0;
    } else {
        val = 1;
    }

    return val;
}


ll H[200002] = {0};
int main()
{
	ll N = 0, K = 0, ans = 0, i = 0;
	scanf("%lld %lld", &N, &K);
	for (i = 0; i < N; i++) {
		scanf("%lld", &H[i]);
	}
	qsort(H, N, sizeof(ll), sort_dec);
	for (i = 0; i < N; i++) {
		if (K > 0) {
			K--;
		} else {
			ans += H[i];
		}
	}
	printf("%lld\n", ans);
    return 0;
}


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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
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; }

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
   return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 
ll fff(ll n, vector<ll>& v, ll i, ll j, ll rl){
  ll can = 0;
  ll can_i = 0;

  cout << v[0]<<endl;
  
  // right
  if(rl == 0){
    rep(k, n){
      if(v[k]*(j-k)>can){
	can = v[k]*(j-k);
	can_i = k;
      }
      //cout << can<<endl;
    }
    v[can_i] = 0;
    return can;
  }
  // left
  else{
    rep(k, n){
      if(v[k]*(k-i)>can){
	can = v[k]*(k-i);
	can_i = k;
      }
      //cout << can<<endl;

    }
    v[can_i] = 0;
    return can;
  }
  
}


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

  if(s[2]==s[3] && s[4]==s[5]) cout << "Yes"<<endl;
  else cout << "No" <<endl;
  
}


Measured memory_bytes: 256
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    string s;
    cin >> s;

    if (s[0] != s[1] || s[1] != s[2]) cout << "Yes";
    else cout << "No";



    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

  void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
      cout << 0;
      return;
    } 
    if(a > b){
      swap(a, b);
    }
    else{
      swap(a, c);
    }
    cout << ll(a * 1ll * min(b, c));
  }

int main(){

 int tt = 1;
 while (tt--) {
    solve();
 }

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
char *strpick(char *str, int start)
{
	static char result[4];
	for (int i = 0; i < 3; i++)
	{
		result[i] = str[start+i];
	}
	result[3] = '\0';
	return result;
}
int main()
{
	char str[10001];
	char *tmp;
	int ioi, joi, i;
	while (cin >> str)
	{
		if (cin.eof()) break;
		ioi = joi = 0;
		for (i = 0; i < signed(strlen(str))-2;)
		{
			if (str[i] == 'I' || str[i] == 'J')
			{
				tmp = strpick(str, i);
				if (strcmp(tmp, "IOI") == 0)
					ioi++, i+=2;
				else if (strcmp(tmp, "JOI") == 0)
					joi++, i+=2;
				else
					i++;
			}
			else
				i++;
		}
		cout << joi << endl << ioi << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;



const int N = 55;
int d[N];

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    int x = 12;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &d[i] );
        x = min(x, d[i] );
    }
    d[n] = 0;
    n++;
    sort(d, d + n);

    for (int y = x; y >= 0; y--)
    {
        eprintf("y = %d\n", y);
        int a = 0, b = 0;
        for (int i = 1; i < n; i++)
        {
            if (d[i] - a >= y)
                a = d[i];
            else if (d[i] - b >= y)
            {
                b = a;
                a = d[i];
            }
            else
            {
                a = b = 24;
                break;
            }
        }
        if (a + b + y <= 24)
        {
            printf("%d\n", y);
            return 0;
        }
    }
    throw;




	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-4;
const int MAX=1e6+10;
const ll mod=1e9+7;
/****************************************  head  ****************************************/
int main()
{
	int n,m,i,a,b,pre,ans;
	while(~scanf("%d%d",&n,&m))
	{
		vector<PII > res;
		while(m--)
		{
			scanf("%d%d",&a,&b);
			res.pb(MP(a,b));
		}
		sort(all(res));
		ans=0;
		pre=-INF;
		for(auto it:res)
		{
			if(pre<=it.fi)
			{
				ans++;
				pre=it.se;
			}
			pre=min(pre,it.se);
		}
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------

void _main() {
	string S;
	int N,K;
	cin >> N >> K >> S;
	string ABC = "ABC";
	string abc = "abc";
	S[K-1] = S[K - 1] == ABC[0] ? abc[0] : S[K - 1] == ABC[1] ? abc[1] : abc[2];
	cout << S << endl;
}

Measured memory_bytes: 256
def resolve():
    n = int(input())
    a = [0] * (n+1)

    nn = int(n ** 0.5) + 1
    for x in range(1, nn):
        for y in range(1, nn):
            for z in range(1, nn):
                tmp = x**2 + y**2 + z**2 + x * y + y * z + z * x
                if tmp <= n:
                    a[tmp] += 1
    [print(i) for i in a[1:]]

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9584
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const int MAX_K = 1000;

int n, k, m;
int grid[2 * MAX_K + 1][2 * MAX_K + 1];

int f(int y, int x) {
  int cnt = 0;
  int ym = (y + k) % m;
  int xm = (x + k) % m;

  if (y + k <= m && x + k <= m) {
    cnt += grid[y + k][x + k] - grid[y + k][x] - grid[y][x + k] + grid[y][x];
  }

  if (y + k <= m && x + k > m) {
    cnt += grid[y + k][m] - grid[y + k][x] - grid[y][m] + grid[y][x];
    cnt += grid[y + k][xm] - grid[y + k][0] - grid[y][xm] + grid[y][0];
  }

  if (y + k > m && x + k <= m) {
    cnt += grid[m][x + k] - grid[m][x] - grid[y][x + k] + grid[y][x];
    cnt += grid[ym][x + k] - grid[ym][x] - grid[0][x + k] + grid[0][x];
  }

  if (y + k > m && x + k > m) {
    cnt += grid[m][m] - grid[m][x] - grid[y][m] + grid[y][x];
    cnt += grid[ym][xm] - grid[ym][0] - grid[0][xm] + grid[0][0];
    cnt += grid[ym][m] - grid[ym][x] - grid[0][m] + grid[0][x];
    cnt += grid[m][xm] - grid[y][0] - grid[y][xm] + grid[y][0];
  }

  return cnt;
}

int main() {
  cin >> n >> k;
  memset(grid, 0, sizeof(grid));
  m = 2 * k;

  char c;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> c;

    x++;
    y++;

    if (c == 'W') {
      y += k;
    }

    grid[y % m + 1][x % m + 1]++;
  }

  for (int y = 1; y <= m; y++) {
    for (int x = 1; x <= m; x++) {
      grid[y][x] += grid[y][x - 1];
    }
  }

  for (int x = 1; x <= m; x++) {
    for (int y = 1; y <= m; y++) {
      grid[y][x] += grid[y - 1][x];
    }
  }

  int ans = 0;

  for (int y = 0; y < m; y++) {
    for (int x = 0; x < m; x++) {
      int oy = (y + k) % m;
      int ox = (x + k) % m;

      int cnt = f(y, x) + f(oy, ox);

      ans = max(ans, cnt);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N;

int main(){
	cin >> N;
	if(N % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}

	long long fivecount = 0;
	for(long long i = 5; i <= N/2; i*=5) {
		fivecount += N/2/i;
	}

	long long twocount = N/2;
	for(long long i = 2; i <= N/2; i*=2) {
		twocount += N/2/i;
	}

	cout << min(twocount, fivecount) << endl;

}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int k ;
  cin >> k;
  vector<int> v ={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  cout << v.at(k-1);
 


}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string.h>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

int n;
int adj[105][105];

int main()
{
	cin >> n;
	int u, k, v;
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			adj[i][v]++;
		}
	}
	
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n-1; j++) {
			cout << adj[i][j] << " ";
		}
		cout << adj[i][n - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 3108
import sys

def main():
    sinputl = sys.stdin.readline

    input = sinputl().strip()
    length = len(input)
    string1 = "10" * (length // 2) + "1" * (length % 2)
    string2 = "01" * (length // 2) + "0" * (length % 2)
    count1 = 0
    count2 = 0

    for i in range(length):
        if input[i] != string1[i]:
            count1 += 1

    for i in range(length):
        if input[i] != string2[i]:
            count2 += 1

    print(min(count1, count2))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
    for(ll i : x) {
        cout << i << " ";
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vl A, B;
void input() {
    cin>>k;
}
void solve() {
    a=7;
    vl check(k,0);
    a=a%k;
    while(1){
        ans++;
        if(a==0){
            print(ans);
            return;
        }
        if(check[a]){
            print(-1);
            return;
        }
        check[a]=1;
        a=(a*10+7)%k;
    }
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}

Measured memory_bytes: 11116
from collections import defaultdict
from math import gcd

N = int(input())
A = list(map(int, input().split()))
A_set = set(A)

num = 10 ** 6
primes = [0] * (num + 1)
primes[0] = 1
primes[1] = 1

for i in range(2, num + 1):
    if primes[i] != 0:
        continue

    cnt = 1
    while i * cnt <= num:
        primes[i * cnt] = i
        cnt += 1


def func(n):
    res_dic = defaultdict(int)
    while n > 1:
        x = primes[n]
        res_dic[x] += 1
        n //= x

    return res_dic


pairwise = True
cnt_dic = defaultdict(int)
for a in A:
    dic = func(a)

    for k in dic.keys():
        cnt_dic[k] += 1
        if cnt_dic[k] > 1:
            pairwise = False
            break

g = A[0]
for a in A[1:]:
    g = gcd(g, a)

if pairwise:
    print('pairwise coprime')
elif g == 1:
    print('setwise coprime')
else:
    print('not coprime')



Measured memory_bytes: 228376
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = 0;
        int tmp = a;
        for(int i = 0;i<String.valueOf(a).length();i++){
            b += tmp % 10;
            tmp = tmp/10;
        }
        if(a % b == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define ld long double
#define pii pair <int,int>
#define pll pair <ll,ll>
#define pil pair <int,ll>
#define pli pair <ll,int>
#define ull unsigned long long
#define pdd pair <ld,ld>
#define pb push_back
#define mp make_pair
#define puu pair<ull,ull>
#define pvv pair<vector<int>, vector<int> >
#define _bp __builtin_popcount
#define ptt pair <Tree*,Tree*>
#define all(v) v.begin(),v.end()
#define en "\n"
//const long double pi = acos(-1);
void boos()
{
     ios_base :: sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
}
void file()
{
   freopen("robot.in","r",stdin);
   freopen("robot.out","w",stdout);
}
const ll INF = (ll)1e9 + 7ll;
const ll INF1 = 998244353;
const ll INF2 = (ll)1e9 + 9ll;
const ll LLINF = (ll)1e18 + 1;
const ll INTmx = (int)2e9;
const ld EPS = (ld)1e-15;
const int N = 3e5 + 100;
int main()
{
    //file();
    boos();
	int x;
	cin >> x;
	int dd = 2000 - x;
	int kol = 0;
	for(int i = 200;i <= 2000;i += 200)
	{
		++kol;
		if(dd <= i)
		{
			cout << kol;
			return 0;
		}
	}
}

Measured memory_bytes: 3612
import bisect
n=int(input())
six=[6**(i) for i in range(10)]
nine=[9**(i) for i in range(10)]
times=[0,1,2,3,4,5,1,2,3]
times.extend([0]*100000)
for i in range(6):
    times[i]=i

def solve(n):
    if n==0 or times[n]!=0:
        return times[n]
    six_ex=bisect.bisect_right(six,n)-1
    nine_ex=bisect.bisect_right(nine,n)-1
    six_n=1+solve(n-six[six_ex])
    nine_n=1+solve(n-nine[nine_ex])

    times[n]=min(six_n, nine_n)
    return times[n]

print(solve(n))

Measured memory_bytes: 4596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	string a, b;
	cin >> a >> b;
	if (a.size() > b.size()) {
		puts("GREATER");
		return 0;
	}
	else if (a.size() < b.size()) {
		puts("LESS");
		return 0;
	}
	else {
		for (int i = 0; i < a.size(); i++) {
			if (a[i] > b[i]) {
				puts("GREATER");
				return 0;
			}
			else if (a[i] < b[i]) {
				puts("LESS");
				return 0;
			}
		}
	}
	puts("EQUAL");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
 
int main(){
  ll int n,m,ans=0,w=0;
  scanf("%lld %lld",&n,&m);
  ll int s[m],c[m];
  for(ll int i=0;i<m;i++){
  scanf("%lld %lld",&s[i],&c[i]);
  }
 
  if(n==1 && m==0){
    printf("0");
    return 0;
  }
  
  for(int i=0;i<m;i++){
    if(c[i]!=0){
      w++;
    }
  }
  
  if(w==0 && n==1){
    printf("0");
    return 0;
  }
  
  if((s[0]==s[1] && c[0]!=c[1])||(s[0]==s[2] && c[0]!=c[2]) || (s[0]==s[3] && c[0]!=c[3])|| (s[0]==s[4] && c[0]!=c[4])|| (s[1]==s[2] && c[1]!=c[2])|| (s[1]==s[3] && c[1]!=c[3])|| (s[1]==s[4] && c[1]!=c[4])|| (s[2]==s[3] && c[2]!=c[3])|| (s[2]==s[4] && c[2]!=c[4])|| (s[4]==s[3] && c[4]!=c[3])){
    printf("-1");
    return 0;
  }
  
  for(ll int i=0;i<m;i++){
  if(s[i]==1 && c[i]==0){
    printf("-1");
    return 0;
  }
  }
  
 ll int sum[m];
  for(ll int i=0;i<m;i++){
    sum[i]=c[i]*pow(10,n-s[i]);
  }
  
  ll int compare(const void *a, const void *b){
  return (*(ll int *)a)- (*(ll int *)b);
}
 
qsort(sum,m,sizeof(ll int),compare);
for(ll int i=0;i<m;i++){
  if(sum[i]!=sum[i+1]){
    ans+=sum[i];
  }
}
 
  if(ans<pow(10,n-1)){
    ans+=pow(10,n-1);
  }
  
  printf("%lld",ans);
  
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int[][] works = new int[N][2];
    for(int i = 0; i < N; i++){
      works[i][1] = Integer.parseInt(sc.next());
      works[i][0] = Integer.parseInt(sc.next());
    }
    Arrays.sort(works, (a, b) -> Integer.compare(a[0], b[0]));
    
    int sum = 0;
    String ans = "Yes";
    for(int i = 0; i < N; i++){
      sum += works[i][1];
      if(works[i][0] < sum){
        ans = "No";
        break;
      }
    }
    System.out.println(ans);
  }
}

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

int main(){

    l1 a,b,n;
    cin>>a>>b>>n;
    l1 ans=0;
    l1 i = min(b-1,n);
    l1 x = a*i/b;
    l1 y = i/b;
    ans =  x-a*y;
    

    cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < (n-1)/2; ++i) {
    if (s.at(i) != s.at((n-1)/2 - i - 1)) {
      puts("No");
      return 0;
    }
    if (s.at((n+3)/2 + i - 1) != s.at(n - i - 1)) {
      puts("No");
      return 0;
    }
    if (s.at(i) != s.at(n - i - 1)) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 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> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;


struct Sieve {
        int n;
        vector<int> f,primes;
        
        Sieve(int n=1):n(n),f(n+1){
                f[0] = f[1] = -1;
                for(long long i=2;i<=n;++i){
                        if(f[i]) continue;
                        primes.push_back(i);
                        f[i] = i;
                        for(long long j = i*i;j <= n;j += i) {
                                if(!f[j]) f[j] = i;
                        }
                }
        }
        
        bool isPrime(int x){return f[x] == x;}
        
        ll factorList(ll x){
                ll res = 1;
                ll now = -1;
                ll p = 0;
                while(x != 1){
                    if(now==f[x]) ++p;
                    else{
                        res *= p+1;
                        now = f[x];
                        p = 1;
                    }
                    //cout << f[x] << endl;
                    x /= f[x];
                }
                res *= p+1;
                return res;
        }
        /*
        vector<pair<ll,ll>> factor(ll x){
                vector<ll> fl = factorList(x);
                if(fl.size() == 0) return {};
                vector<pair<ll,ll>> res(1,pair<ll,ll>(fl[0],0));
                for(ll p:fl){
                        if(res.back().first == p){
                                res.back().second ++;
                        }else{
                                res.emplace_back(p,1);
                        }
                }
                return res;
        }
        */
        
};


int main(){
    ll n;
    scanf("%lld",&n);
    ll ans = 0;
    Sieve sieve(n+1);
    for(ll i=1;i<=n;i++){
        ll p = sieve.factorList(i);
        //cout << p << endl;
        //cout << endl;
        p *= i;
        ans += p;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 46512
#include <stdio.h>

int main() {
  int year=0, month=0, day=0;
  scanf("%d%*c%d%*c%d", &year, &month, &day);
  int check = (year - 2019) * 10000 + (month - 4) * 100 + day - 30;
  if (check <= 0) printf("Heisei\n");
  else printf("TBD\n");
  return 0;
}


Measured memory_bytes: 384
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n - 1)]

for i, [ci, si, fi] in enumerate(csf):
    time = si + ci
    for cj,sj,fj in csf[i + 1:]:
        time = max(sj, time)
        time += (fj - (time % fj)) % fj + cj
    print(time)
print(0)


Measured memory_bytes: 73792
import heapq
n, queries = map(int, input().split())
Q = [[] for i in range(n)]

for i in range(queries):
    q, t, *x = map(int, input().split())
    if q == 0: heapq.heappush(Q[t], -x[0])
    elif q == 1 and Q[t]: print(-Q[t][0])
    elif q == 2 and Q[t]: heapq.heappop(Q[t])


Measured memory_bytes: 13172
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long n, i, j, k, s, ss;
	cin >> n;
	s = 0; ss = 0;
	vector<long long> a(n), ans(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) ss += a[i];
	}
	ans[0] = ss - s / 2;
	for (i = 1; i < n; i++) ans[i] = a[i - 1] - ans[i - 1];

	for (auto p : ans) cout << p * 2 << " ";
	cout << "\n";

	return 0;
}


Measured memory_bytes: 2944
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <math.h>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <utility>
#include <vector>
#include <stdio.h>
#include <numeric>
#include <array>

using namespace std;

#define REP(i, from, to) for (long long int i = (from); i < (to); i++)
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort(ALL(v));
#define LAST(v) v[v.size() - 1]
#define ZERO(a) memset(a, 0, sizeof(a));
#define MINUS(a) memset(a, -1, sizeof(a));
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define IIN(a) \
    int a;     \
    cin >> a;
#define LIN(a) \
    ll a;      \
    cin >> a;
#define SIN(a) \
    string a;  \
    cin >> a;
#define VL(v, n) vector<ll> v(n);
#define Read_VL(v, n) \
    vector<ll> v(n);  \
    REP(i, 0, n)      \
        cin >> v[i];
#define sumV(v, n) Vl(acm, n) REP(i, 0, n) acm[i] = v[i] + (i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b)
{
    cout << (b ? "YES" : "NO") << "\n";
}
void Yn(bool b) { cout << (b ? "Yes" : "No") << "\n"; }
void yn(bool b) { cout << (b ? "yes" : "no") << "\n"; }

template <class S>
S max(vector<S> &a) { return *max_element(all(a)); }
template <class S>
S min(vector<S> &a) { return *min_element(all(a)); }

template <class T>
void puta(T &&t) { cout << t << "\n"; }
template <class H, class... T>
void puta(H &&h, T &&... t)
{
    cout << h << ' ';
    puta(t...);
}

template <typename ELEMENT_TYPE>
struct _setfillw
{
    ELEMENT_TYPE c;
    std::streamsize w;
    _setfillw(ELEMENT_TYPE c, std::streamsize w) : w(w), c(c) {}
};

template <typename ELEMENT_TYPE>
inline _setfillw<ELEMENT_TYPE> setfillw(ELEMENT_TYPE c, std::streamsize w)
{
    return _setfillw<ELEMENT_TYPE>(c, w);
}

template <typename ELEMENT_TYPE>
inline std::ostream &operator<<(std::ostream &os, const _setfillw<ELEMENT_TYPE> &manip)
{
    return os << std::setw(manip.w) << std::setfill(manip.c);
}

bool length_cmp(string &a, string &b)
{
    return a.size() < b.size();
}

ll StoLL(string s)
{
    ll num = 0;
    REP(i, 0, s.size())
    {
        num = num * 10 + (s[i] ^ 48);
    }
    return num;
}

ll CtoLL(char c)
{
    if ('a' <= c && c <= 'z')
    {
        return (ll)(c ^ 96);
    }
    else if ('A' <= c && c <= 'Z')
    {
        return (ll)(c ^ 64);
    }
    return 0;
}

const ll MAX = 100000000;
const ll MOD = 1000000007;
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll ans = 0;
    ll index;
    LIN(n)
    ll min = 1e16;
    REP( i, 0, 5 ){
        LIN(a) 
        min = fmin( a, min );
    }
    ans = ceil( (double) n / min ) +  4;
    
    puta( ans );
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1'000'000'007;
// const ll MOD = 998244353;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    ll H, W, M;
    cin >> H >> W >> M;
    vvec<int> vx(H);
    map<l_l, int> mp;
    vvec<int> vy(W);
    vector<l_l> cnty(1, {-1,-1});
    rep(i,M){
        int h, w;
        cin >> h >> w;
        h--; w--;
        vx[h].emplace_back(w);
        vy[w].emplace_back(h);
        mp[{h,w}]++;
    }
    // rep(i,H)sort(all(vx[i]));
    // rep(j,W)sort(all(vy[j]));
    // rep(i,H)print(vx[i]);
    // rep(j,W)print(vy[j]);
    
    rep(j,W){
        cnty.emplace_back(vy[j].size(), j);
    }
    sort(all(cnty));
    // print(cnty);
    ll maxxy = cnty.back().first;
    vector<int> kouho_y;
    for(int i = W; i >= 0; i--){
        kouho_y.emplace_back(cnty[i].second);
        if(cnty[i].first != cnty[i-1].first)break;
    }
    // sort(all(kouho_y));
    // print(kouho_y);
    // dump(maxxy);
    ll ans = 0;
    rep(i,H){
        ll tmp = vx[i].size();
        if(ans >= tmp + maxxy)continue;
        for(auto y: kouho_y){
            if(mp[{i,y}] > 0){
                chmax(ans, tmp + maxxy-1);
            }
            else{
                chmax(ans, tmp + maxxy);
            }
            if(ans >= tmp + maxxy)break;
        }
    }
    cout << ans << endl;
}
/*

行を固定する
列は、最大の列を試す、一番大きいのだけで良い
*/

Measured memory_bytes: 63188
import java.util.*;

class Main {

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

    while (true) {
      int n = sc.nextInt();
      if (n == 0) return;
      String s[] = new String[n];
      for (int i = 0; i < n; i++)
        s[i] = sc.next();

      int c[] = {5, 7, 5, 7, 7};
      int cn = 0;
      int count = 0;
      loop: for (int i = 0; i <= n-5; i++) {
        for (int j = i; j < n; j++) {
          count += s[j].length();
          if (count == c[cn]) {
            cn++;
            count = 0;
            if (cn == 5){
              System.out.println(i + 1);
              break loop;
            }
          }
          else if (count > c[cn]) {
            cn = 0;
            count = 0;
            break;
          }
        }
      }
    }
  }
}



Measured memory_bytes: 31900
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int s[31];
    for (int i=1; i<=30; ++i) {
        s[i] = i;
    }

    int w, n;
    cin >> w >> n;
    int a,b;
    char delim;
    for (int i=0; i<n; ++i) {
        cin >> a >> delim >> b;
        swap(s[a],s[b]);
    }

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

    return 0;
}

Measured memory_bytes: 1192
#include <iostream>

/**
 * @brief Result Output
 * @param [in] A[] Data
 * @param [in] N   DataNumber
 * @return none
 */
void output(int A[], int N)
{
	using namespace std;
	for( int i = 0; i < N; i++ )
	{
		if(i != 0)
		{
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
	return;
}

/**
 * @brief Execute InserSort
 * @param [in]  A[] Data
 * @param [in]  N   DataNumber
 * @param [out] A[] Data
 * @return none
 */
void insertionSort(int A[], int N)
{
	output(A,N);
	int v;
	int j;
	for( int i = 1; i <= N-1; i++ )
	{
		v = A[i];
		j = i - 1;
		while( (j >= 0) && (A[j]>v) )
		{
			A[j+1] = A[j];
			j--;
			A[j+1] = v;
		}
		output(A,N);
	}
	return;
}
 
int main(void)
{
	using namespace std;
	
	int input[1000];
	int rows;
	 
	cin >> rows;
	int inputNum = 0;
	while( cin >> input[inputNum] )
	{
		inputNum++;
	}
	 
	insertionSort(input,rows);
	return 0;
}

Measured memory_bytes: 3096
N,A,B = [int(x) for x in input().split()]
S = input()
domestic = 0
foreign = 0

for s in S:
    if(s=='a'):
        if(domestic+foreign<A+B):
            domestic += 1
            print('Yes')
        else:
            print('No')
    elif(s=='b'):
        if(domestic+foreign<A+B and foreign<B):
            foreign += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 4016
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int a,b,c;
        Scanner scan = new Scanner(System.in);
        a = scan.nextInt();
        b = scan.nextInt();
        c = scan.nextInt();
        int min=0;
        int max=0;
        int mid=0;
        if(a <= b){
            if(a<=c){
                min=a;
                if(c<=b){
                    max=b; 
                    mid=c;
                }else{
                    max=c; 
                    mid=b;
                }
            }else{
                min=c;
                mid=a;
                max=b;
            }
        }else if(a>b){
            if(b<=c){
                min=b;
                if(c<=a){
                    max=a; 
                    mid=c;
                }else{
                    max=c; 
                    mid=a;
                }
            }else{
                min=c;
                mid=b;
                max=a;
            }
        }
        System.out.println(min +" "+ mid +" "+ max);
        scan.close();
        return;
    }
}


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

using namespace std;

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

Measured memory_bytes: 3612
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-06-27 15:30:40 +0900
# LastModified: 2020-06-27 15:33:43 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    h, a = map(int, input().split())
    if float(h/a).is_integer():
        print(h//a)
    else:
        print(h//a+1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9108