akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
class city{
    public :
    int prefecture,year,index,indexi;
};
bool cmp(city a,city b){
    return a.year < b.year;
}
bool cmp2(city a,city b){
    return a.index < b.index;
}
int main(){
    int n,m,temp1,temp2,i;
    cin >> n >> m;
    vector< city > Vect(m);
    for(i=0;i<m;i++){
        cin >> temp1 >> temp2;
        Vect[i].prefecture = temp1;
        Vect[i].year = temp2;
        Vect[i].index = i;
    }
    sort(Vect.begin(),Vect.end(),cmp);
    vector<int> Vect2(n+1);
    for(i=1;i<n+1;i++) Vect2[i] = 0;
    for(i=0;i<m;i++){
        Vect2[Vect[i].prefecture]++;
        Vect[i].indexi = Vect2[Vect[i].prefecture];
    }
    sort(Vect.begin(),Vect.end(),cmp2);
    for(i=0;i<m;i++)
        printf("%06d%06d\n",Vect[i].prefecture,Vect[i].indexi);
    return 0;
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main()
 {
	int n , q,x;
	cin >> n >> q;
	ll sum = 0;
	for(int i= 0 ; i < q ; i++){
		cin >> x;
		sum+=x;
	}
	ll k = n - sum;
	if(k < 0)
		cout<<-1;
	else
		cout<<k;
	
	
	
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n, k);
	VEC(int, a, n);
	sort(ALL(a));
	reverse(ALL(a));
	int ans = 0;
	REP(i, k) ans += a[i];
	OUT(ans)BR;
  
  return 0;
}


Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	ll tmp;
	int n; string s;
	cin >> n >> s;
	tmp = 0;
	REP(i, n){
		if(s[i]== 'D') tmp --;
		else tmp ++;
		ans = max(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long LL;
const LL N=19;
const LL p1=10007;
LL n; char s[N*2];
map <LL,LL> M[19];
inline LL pw(LL x,LL y){
	LL ans=1;
	while(y){
		if(y&1)ans*=x;
		x=x*x; y>>=1;
	}
	return ans;
}
inline void dfs1(LL pos,LL kR,LL kB,LL cntR){
	if(pos==n+1){
		M[cntR][kB*pw(p1,cntR)-kR]++;
		return ;
	}
	dfs1(pos+1,kR+s[pos]*pw(p1,cntR),kB,cntR+1);
	dfs1(pos+1,kR,kB*p1+s[pos],cntR);
}
LL ans=0;
inline void dfs2(LL pos,LL kR,LL kB,LL cntR){
	if(pos==2*n+1){
		ans+=M[n-cntR][kR*pw(p1,n-cntR)-kB];
		return ;
	}
	dfs2(pos+1,kR+s[pos]*pw(p1,cntR),kB,cntR+1);
	dfs2(pos+1,kR,kB*p1+s[pos],cntR);
}
int main(){
	scanf("%lld%s",&n,s+1);
	dfs1(1,0,0,0); dfs2(n+1,0,0,0);
	printf("%lld",ans);
	return 0;
}

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

long long N;
long long h[105];
long long cur[105];

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		cin >> h[i];
	}
	long long ans = 0;

	while(true){
		long long begin = -1;
		long long end = N;
		for(long long i = 0; i < N; i++){
			if(h[i] > cur[i]){
				begin = i;
				break;
			}
		}
		if(begin == -1){
			break;
		}

		for(long long i = begin; i < N; i++){
			if(h[i] <= cur[i]){
				end = i;
				break;
			}
		}

		ans++;
		for(long long i = begin; i < end; i++){
			cur[i]++;
		}
	}
	cout << ans << endl;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; ll k; cin >> n >> k;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    sort(a.begin(), a.end());

    auto ok = [&](ll x) {
        ll cnt = 0;
        for (int i = 0; i < n - 1; i++) {
            if (a[i] == 0) {
                if (x > 0) cnt += n - i - 1;
            } else if (a[i] > 0) {
                int l = -1, r = n;
                while (r - l > 1) {
                    int m = (l + r) / 2;
                    if (a[i] * a[m] < x) l = m;
                    else r = m;
                }
                cnt += max(0, l - i);
            } else {
                int l = -1, r = n;
                while (r - l > 1) {
                    int m = (l + r) / 2;
                    if (a[i] * a[m] < x) r = m;
                    else l = m;
                }
                cnt += min(n - r, n - i - 1);
            }
        }
        return cnt < k;
    };

    ll l = (ll)-1e18 - 1, r = (ll)1e18 + 1;
    while (r - l > 1) {
        ll m = (l + r) / 2;
        if (ok(m)) l = m;
        else r = m;
    }
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll A[N]; F0R(i, N) cin >> A[i];
    F0R(i, N) {
        if (A[i] == 0) {
            cout << 0 << nl; return 0;
        }
    }
    ld L = 0;
    F0R(i, N) {
        L += log10(A[i]);
    }
    if (L > 18.1) {
        cout << -1 << nl; return 0;
    }
    ll ans = 1; F0R(i, N) ans *= A[i];
    if (ans > 1000000000000000000) {
        cout << -1 << nl; return 0;
    }
    cout << ans << nl;
	
	return 0;
}
 



Measured memory_bytes: 4668
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
           int n;
           cin >>n;
  int sum=0;
  int a,b;
  cin>>a>>b;

for(int i=1;i<=n;i++){
if(i<10){if(i>=a && i<=b)sum+=i;}
  else if(i<100 && i>=10){int c=i/10 %10,d=i%10;
                 if(c+d>=a && c+d <=b)sum+=i;}
  else if(i<1000 && i>=100){int c=i/10 %10,d=i%10,e=i/100%10;
                 if(c+d+e>=a && c+d+e <=b)sum+=i;}
   else if(i<10000&& i>=1000){int c=i/10 %10,d=i%10,e=i/100%10,f=i/1000%10;
                 if(c+d+e+f>=a && c+d+e+f<=b)sum+=i;}
  else{int c=i/10 %10,d=i%10,e=i/100%10,f=i/1000%10,g=i/10000%10;
                 if(c+d+e+f+g>=a && c+d+e+f+g <=b)sum+=i;}



}
  cout << sum <<endl;
}


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

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] p = sc.nextIntArray(n);
    Arrays.sort(p);
    int sum = 0;
    for (int i = 0; i < n; i++) {
      if (i == n - 1) sum += p[i] / 2;
      else sum += p[i];
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 21204
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<time.h>
#include<sstream>
#define MINN -1e8 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INF=0x3f3f3f3f3f3f;
const int P=1e9+7;
const int MAXN=32000;
const double pi=3.1415926;
const ll mod=1000000007;
int n;
ll ans=1;
char c[200005];
ll f(ll len)
{
	ll cur=1;
	for(ll i=1;i<=len;i++)
	{
		cur=cur*i%mod;
	}
	return cur; 
}
int main()
{
	cin>>n;getchar();
	ll tmp=1,len=1;
	for(int i=0;i<2*n;i++)c[i]=getchar();
	if(c[0]!='B'||c[n*2-1]!='B')
	{
		cout<<0;return 0;
	}
	for(int i=1;i<2*n-1;i++)
	{
		if(c[i]=='B')  
		{
			if(tmp%2==1)
			{
				ans=ans*tmp%mod;
				tmp--;len++;
			}
			else tmp++;
		}
		else 
		{
			if(tmp%2==1) tmp++;
			else
			{
				ans=ans*tmp%mod;
				tmp--;len++;
			}
		}
	}
	if(tmp!=1)
	{
		cout<<0;return 0;
	}
	else
	{
		ans=ans*f(len)%mod;
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    int main() {
   
     int long n;
     cin >> n;
     int a[n];
     rep(i,n)	cin >> a[i];
     for(int i = n-1; i>=0; i--){
     	cout << a[i];
     	if(i!=0)	cout << ' ';
     }
     cout << '\n';
     return 0;
    }


Measured memory_bytes: 3048
/**
*    author:  yuya1234
*    created: 30.06.2020 11:42:41
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

// 初項:a, 公差:a で, 上限:lim の数列の総和を返す関数
ll sn(ll a, ll lim)
{
    ll n = lim / a;         // 項数:n  =  上限:lim / 公差:a
    ll l = n * a;           // 末項:l  =  項数:n   * 公差:a
    return (a + l) * n / 2;  // 総和:sn = (初項:a   + 末項:l) * 項数:n / 2
}

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

    int n;
    cin>>n;

    ll ans=0;
    // FOR(i,1,n)
    // {
    //     FOR(j,1,n)
    //     {
    //         if(i%j==0)ans+=i;
    //     }
    // }

    FOR(i,1,n)
    {
        ans+=sn(i,n);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    int n;
    std::cin >> n;
    std::vector<string>s(n) ;
    rep(i,n)std::cin >> s[i];
    rep(i,n)sort(all(s[i]));
    sort(all(s));
    int c=1;
    std::vector<ll> v;
    rep(i,n-1){
        if(s[i]==s[i+1])c++;
        else{
            v.pb(c);
            c=1;
        }
    }
    v.pb(c);
    ll ans=0;
    erep(i,v){
        ans+=i*(i-1)/2;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 8444
#include <cstdio>
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
	char in[2][100001],key,temp[100001];
	int n,now,cnt,wrt;
	bool turn;

	while(cin >> n && n){
		cin >> in[0];
		turn = 1;
		for(int i = 0; i < n; i++){
			turn = !turn;
			now = 0;
			wrt = 0;
			while(now < strlen(in[turn])){
				key = in[turn][now];
				cnt = 0;
				while(now < strlen(in[turn]) && key == in[turn][now]){
					now++;
					cnt++;
				}
				sprintf(temp,"%d",cnt);
				for(int j = 0; j < strlen(temp); j++){
					in[!turn][wrt] = temp[j];
					wrt++;
				}
				in[!turn][wrt] = key;
				wrt++;
			}
			in[!turn][wrt] = '\0';
		}
		cout << in[!turn] << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
// #define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

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


Measured memory_bytes: 640
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors + upper_divisors[::-1])


n = int(input())

ans = 0
for i in range(1, n + 1, 2):
    if make_divisors(i) == 8:
        ans += 1
        
print(ans)

Measured memory_bytes: 9104
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

const int INF = 1e+9;
typedef pair<int,int> P;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};

int w, h, n;
string m[1001];
int ans = -1;
bool ans_flag = false;

// open[y][x] : (x,y)ªJ­ÔÍopen[y][x]AJ©È¢Æ«Í-1
int open[1001][1001] = {0};
// is_door[i] : iÔãÉJ­hAªX^[g©çBÂ\©Ç¤©
bool is_door[1001];
// vp[i] : iÔãÉJ­hAÌÀW
vector<P> vp(1001);

void debug(){
	for(int y=0 ; y < h ; y++ ){
		cout << m[y] << endl;
	}
	cout << endl;
}

void solve(){	
	is_door[0] = true;
	vp[0].first = 0;
	vp[0].second = 0;
	for(int i=0 ; i <= n && ans_flag == false ; i++ ){
		m[vp[i].second][vp[i].first] = '.';
		if( is_door[i] == false ) continue;
		
		stack<P> st;
		int sx = vp[i].first;
		int sy = vp[i].second;
		P sp(sx,sy);
		st.push( sp );
		while( !st.empty() && ans_flag == false ){
			P p = st.top(); st.pop();
			int x = p.first;
			int y = p.second;
			
			for(int j=0 ; j < 4 && ans_flag == false ; j++ ){
				int mx = x + dx[j];
				int my = y + dy[j];
				if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
				
				if( m[my][mx] == 't' ){
					ans = i;
					ans_flag = true;
				}
				if( open[my][mx] != -1 ){
					is_door[open[my][mx]] = true;
				}
				if( m[my][mx] == '.' ){
					P p(mx,my);
					st.push( p );
					m[my][mx] = '*';
				}
			}
		}
	}
}

int main(){
	// ú»
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			open[y][x] = -1;
		}
	}
	for(int i=0 ; i < n ; i++ ){
		is_door[i] = false;
	}
	
	cin >> w >> h;
	for(int y=0 ; y < h ; y++ ){
		cin >> m[y];
	}
	cin >> n;
	for(int i=0 ; i < n ; i++ ){
		int x, y;
		cin >> x >> y;
		open[y][x] = i+1;
		P p(x,y);
		vp[i+1] = p; 
	}
	if( m[0][0] == 't' ){
		cout << 0 << endl;
	}else{
		solve();
		//debug();
		cout << ans << endl;
	}
}

Measured memory_bytes: 9516
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	if(a>c){
		d=a;
		a=c;
		c=d;
	}
	if(b>c){
		d=b;
		b=c;
		c=d;
	}
	printf("%d %d %d\n",a,b,c);
	

return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define inf 2e18
#define pi acos(-1)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>p;
const int me=5025;
int dp[me][me];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    if(abs(b-a)%2==0){
        cout<<abs(b-a)/2<<endl;
    }
    else{
        ll mx1=max((a-1),(b-1));

        ll mx2=max((n-a),(n-b));
        ll mx3=a+(b-a)/2;
        ll mx4=n-b+1+(b-a)/2;
        cout<<min(min(mx1,mx2),min(mx3,mx4))<<endl;
    }
}



Measured memory_bytes: 256
/**
  @date Time-stamp: <2019-05-25 21:08:58 tagashira>
  @file a.cpp
  @title A - Ferris Wheel
  @brief https://atcoder.jp/contests/abc127/tasks/abc127_a
**/

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  uint A, B;
  cin >> A >> B;

  if (A >= 13) {
    cout << B << endl;
  } else if (A >= 6) {
    cout << B / 2 << endl;
  } else {
    cout << "0" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    def segfunc(x, y):
        return max(x, y)

    class SegmentTree:
        def __init__(self, init_val, ide_ele):
            self.n = len(init_val)
            self.ide_ele = ide_ele
            self.num = 2 ** (self.n - 1).bit_length()
            self.seg = [self.ide_ele] * 2 * self.num
            for i in range(self.n):
                self.seg[i + self.num - 1] = init_val[i]

            for i in range(self.num - 2, -1, -1):
                self.seg[i] = segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2])

        def update(self, k, x):
            k += self.num - 1
            self.seg[k] = x
            while k:
                k = (k - 1) // 2
                self.seg[k] = segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2])

        def query(self, p, q):
            if q <= p:
                return self.ide_ele
            p += self.num - 1
            q += self.num - 2
            res = self.ide_ele
            while q - p > 1:
                if p & 1 == 0:
                    res = segfunc(res, self.seg[p])
                if q & 1 == 1:
                    res = segfunc(res, self.seg[q])
                    q -= 1
                p = p // 2
                q = (q - 1) // 2
            if p == q:
                res = segfunc(res, self.seg[p])
            else:
                res = segfunc(segfunc(res, self.seg[p]), self.seg[q])
            return res

    s = SegmentTree(A, 0)

    def isOK(mid, m, value):
        a = s.query(m, mid)
        return a >= value

    B = A[::]

    for _ in range(Q):
        T, X, V = [int(x) for x in input().split()]
        if T == 1:
            s.update(X - 1, V)
            B[X - 1] = V
        elif T == 2:
            print(s.query(X - 1, V))
        else:
            a = s.query(X - 1, N)
            if a < V:
                print(N + 1)
            else:
                if B[X - 1] >= V:
                    print(X)
                    continue
                ok = N - 1
                ng = X - 1

                while abs(ok - ng) > 1:
                    mid = (ok + ng) // 2
                    if isOK(mid, X - 1, V):
                        ok = mid
                    else:
                        ng = mid

                print(ok)


if __name__ == '__main__':
    main()


Measured memory_bytes: 106956
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct union_find{
  vector<int> par,r;
  int cmp;

  union_find(int n) : par(n),r(n){init(n);}

  void init(int n){
	cmp=n;
    for(int i = 0; i < n; i++) par[i] = i;
    for(int i = 0; i < n; i++) r[i] = 0;
  }

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

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

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

int main()
{
	ll w,h;
	cin>>w>>h;
	vector<P> p(w+h);
	for (int i = 0; i < w; i++){
		cin>>p[i].first;
		p[i].second = i;
	}
	for (int i = w; i < w+h; i++){
		cin>>p[i].first;
		p[i].second = i;
	}
	sort(all(p));

	union_find uf_x(w+1),uf_y(h+1);


	ll ans=0;
	rep(i,w+h){
		int pos = p[i].second;
		if(pos<w){
			// cout<< pos<<" "<<pos+1 <<" "<< uf_y.cmp<<" " <<(ll)uf_y.cmp*p[i].first<<endl;
			ans += (ll)uf_y.cmp*p[i].first;
			// cout<<uf_x.find(pos)<<" "<<uf_x.find(pos+1)<<endl;
			if(!uf_x.same(pos,pos+1)){
				uf_x.unite(pos,pos+1);
			}
		}else{
			pos -= w;
			// cout<<uf_x.cmp<<" " <<(ll)uf_x.cmp*p[i].first<<endl;
			ans += (ll)uf_x.cmp*p[i].first;
			if(!uf_y.same(pos,pos+1)) uf_y.unite(pos,pos+1);
		}
	}


	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4992
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0:
      if A[i] % 5 != 0:
        print("DENIED")
        quit()
        
print("APPROVED")


Measured memory_bytes: 2940
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	string str;
	while(getline(cin,str)){
		for(int j=0;j<=26;j++){
			for(int i=0;i<str.size();i++){
				if(str[i]>='a' && str[i] <='z'){
					if(str[i] != 'z'){
						str[i]+=1;
					}else{
						str[i] = 'a';
					}
				}
			}
			if(str.find("the") != string::npos || str.find("this") != string::npos || str.find("that") != string::npos){
				cout << str << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1176
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>

using namespace std;

int sum(int x) {
  return x == 1 ? 1 : x + sum(x - 1);
}

int main() {
  int n;
  cin >> n;
  cout << sum(n) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(void)
{
    string str;
    char c;
    int counter = 0;

    cin>>str;
    c = str[0];
    for(int i = 1;i < str.size();i++) {
	if(str[i] != c)
	{
	    c = str[i];
	    counter++;
	}

    }

    cout<<counter<<endl;
    return 0;
}



Measured memory_bytes: 512
n,a,b = map(int,input().split())
s = list(input())

cnt = 0
b_cnt = 0

for i in range(n):
    if s[i] == "a":
        if a+b > cnt:
            print("Yes")
            cnt += 1
        else:
            print("No")
    elif s[i] == "b":
        b_cnt += 1
        if a+b > cnt and b >= b_cnt:
            print("Yes")
            cnt += 1
        else:
            print("No")
    else:
        print("No")
        
        

Measured memory_bytes: 4708
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <cstring>
#include <cctype>
#include <climits>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <sstream>
#include <queue>
#include <stack>
using namespace std;
vector<int> high;
int n;

int main(){
	scanf("%d",&n);
	high.resize(n+1);
	for(int i=1;i<=n;i++){
		scanf("%d",&high[i]);
	}
	vector<int> dp(n+1);
	dp[1]=0;
	dp[2]=abs(high[2]-high[1]);
	for(int i=3;i<=n;i++){
		dp[i]=min(abs(high[i]-high[i-1])+dp[i-1],abs(high[i]-high[i-2])+dp[i-2]);
	}
	printf("%d",dp[n]);
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner


object Main {

  case class Gate(l: Int, r: Int)

  def read() = {
    val sc = new Scanner(System.in)
    val n,m = sc.nextInt()
    val gates = IndexedSeq.fill(m)(Gate(sc.nextInt(), sc.nextInt()))
    (n, gates)
  }

  def solve(n: Int, gates: IndexedSeq[Gate]): Int = {
    val result = gates.foldLeft(Gate(1, n))((acc, gate) =>
      Gate(math.max(acc.l, gate.l), math.min(acc.r, gate.r))
    )
    math.max(0, result.r - result.l + 1)
  }

  def solve2(n: Int, gates: IndexedSeq[Gate]): Int = {
    val left = gates.map(_.l).max
    val right = gates.map(_.r).min
    math.max(0, right - left + 1)
  }

  def main(args: Array[String]): Unit = {
    val (n, gates) = read()
    println(solve2(n, gates))
  }
}

Measured memory_bytes: 75148
// 課題3_3 AtCoder Beginner Contest 156 B - Digits
// nk777
 
#include <stdio.h>
 
int main(void){
    // 整数NのK進数のnum,k_notation、途中計算の値の格納n_cal、結果の格納result
    // 1の位分があるので初期設定はresult = 1(log_K(N)+1の1の部分)
    int num, k_notation, n_cal, result = 1;
 
    // n,kを受け取る
    scanf("%d %d", &num, &k_notation);
 
    // 最初の値を代入
    n_cal = num;
 
    while (n_cal >= k_notation)
    {
        result++;
        n_cal = n_cal / k_notation;
    }
    
    printf("%d\n", result);
 
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>

using namespace std;


int main() {
	
	string N;

	cin >> N;

	int m = 0;
	m = N[0] - '0';

	int x = 0;
	for (int i = 0; i < N.length(); i++)
	{
		x = x + ( m * pow(10,i));
	}

	if (atoi(N.c_str()) > x)
	{
		for (int i = 0; i < N.length(); i++)
		{
			cout << m+1;
		}
	}
	else
	{
		cout << x;
	}
	
	

	return 0;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int ans = 1e8;
    rep(i, N) {
        if (A[i] == 1) {
            for (int k=max(0, i-K+1); k<N; ++k) {
                int a = k + K - 1;
                a = min(a, N-1);
                if (k <= i and i <= a) {
                    int left = k, right = (N - (a+1));
                    int tmp = (left/(K-1))+bool((left)%(K-1)) + (right/(K-1))+bool(right%(K-1)) + 1;
                    ans = min(ans, tmp);
                }
            }
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        java.util.Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        double r = Double.parseDouble(str);
        scan.close();

        double s = r*r*Math.PI, l = 2*r*Math.PI;

        System.out.println(String.format("%.6f %.6f", s, l));
    }
}


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

#define int long long

int32_t main() {
	// your code goes here
	int n;
	cin>>n;
	vector<int> v(n+1);
	for(int i=1; i<=n; i++)cin>>v[i];
	vector<int> dp(n+1);
	dp[1]=0, dp[2]=abs(v[1]-v[2]);
	for(int i=3; i<=n; i++){
	    dp[i]=min({ dp[i-1]+abs(v[i]-v[i-1]), dp[i-2]+abs(v[i]-v[i-2]) });
	}
	cout<<dp[n];
	return 0;
}


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

using ll = long long;
template<class T> inline void chmin(T& a, T b) { if (a>b) a=b; }

#define INF (LLONG_MAX>>2)

int main() {
    int N, M, L; cin >> N >> M >> L;
    vector<vector<ll>> dist(N+1, vector<ll>(N+1, INF));
    for (int i = 0; i < M; i++) {
        int a, b, c; cin >> a >> b >> c;
        dist[a][b] = dist[b][a] = c;
    }

    for (int k = 1; k <= N; k++) {
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            dist[i][j] = dist[i][j] <= L ? 1 : INF; 
        }
    }
    for (int k = 1; k <= N; k++) {
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        int s, t; cin >> s >> t;
        int ans = (dist[s][t] == INF) ? -1 : (dist[s][t]-1);
        cout << ans << endl;
    }
}


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

typedef long long ll;

ll g1(ll n, int p)
{
    if (n == 0)
        return 0;
    return n / p + g1(n / p, p);
}

ll g2(ll n, int p)
{
    if (n % 2 == 1)
    {
        return 0;
    }
    ll res = g1(n / 2, p);
    if (p == 2)
        res += n / 2;
    return res;
}

int main()
{
    ll n;
    cin >> n;
    ll ans = min(g2(n, 2), g2(n, 5));
    cout << ans << endl;
    return 0;
}

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

int a,b,c;

int main()
{
	scanf("%d/%d/%d",&a,&b,&c);
	a=a*10000+b*100+c;
	if(a<=20190430) printf("Heisei\n");
	else printf("TBD\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main(void)
{
    int a, b;
    cin >> a >> b;
    if(a >= 13) {
        cout << b << endl;
    }
    else if(a > 5) {
        cout << b/2 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		int n=in.nextInt();
		treeNode[] tree=new treeNode[n];
		for(int i=0;i<n;i++)tree[i]=new treeNode();
		
		for(int i=0;i<n;i++) {
			int id=Integer.parseInt(in.next()),k=Integer.parseInt(in.next());
			
			int lb=-1;
			for(int j=0;j<k;j++) {
				int c=Integer.parseInt(in.next());
				
				tree[c].p=id;
				if(j==0)tree[id].lc=c;
				else tree[lb].rb=c;
				
				lb=c;
			}
		}
		
		/*for(int i=0;i<n;i++) {
			System.out.println(tree[i].p+" "+tree[i].lc+" "+tree[i].rb);
		}*/
		
		//print
		PrintWriter out=new PrintWriter(System.out);
		for(int i=0;i<n;i++) {
			out.print("node "+i+": ");
			out.print("parent = "+tree[i].p+", ");
			out.print("depth = "+depth(tree,i)+", ");
			out.print(nodeType(tree,i)+", ");
			out.println(printChildlen(tree,i));
			out.flush();
		}
	}
	
	static int depth(treeNode[] tree,int p) {
		int cnt=0,pos=p;
		
		while(tree[pos].p!=-1) {
			pos=tree[pos].p;
			cnt++;
		}
		
		return cnt;
	}

	static String nodeType(treeNode[] tree,int p) {
		if(tree[p].p==-1)return "root";
		else if(tree[p].lc==-1)return "leaf";
		else return "internal node";
	}
	
	static List<Integer> printChildlen(treeNode[] tree,int p){
		List<Integer> ls=new ArrayList<>();
		int pos=tree[p].lc;
		
		while(pos!=-1) {
			ls.add(pos);
			pos=tree[pos].rb;
		}
		
		return ls;
	}
}

class treeNode{
	int p=-1,lc=-1,rb=-1;//parent leftChildlen rightBrother
}



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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    multiset<int> mp;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        auto x = mp.upper_bound(-v[i]);
        if (x == mp.end()) {
            ans++;
            mp.insert(-v[i]);
        } else {
            mp.erase(x);
            mp.insert(-v[i]);
        }
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {
    final static int COST_MAX = 1001;

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

        int N = scanner.nextInt();
        int T = scanner.nextInt();
        int cost = COST_MAX;

        for (int i = 0; i < N; i ++){
            int c = scanner.nextInt();
            int t = scanner.nextInt();

            if (t <= T){
                cost = Math.min(cost, c);
            }
        }

        if (cost == COST_MAX){
            System.out.println("TLE");
        } else {
            System.out.println(cost);
        }
    }
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define inf 1e18 
 
using namespace std;

int h,w,k,ans=0;
vector<pair<int,int> > v;
void func(int r,vi rc)
{
    if(r==h+w+1)
    {
        int count=0;
        for(int i=0;i<v.size();i++)
        {
            int x=v[i].F;
            int y=v[i].S;
            int flag=1;
            for(int j=0;j<rc.size();j++)
            {
                if(rc[j]==x||rc[j]==y)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                count++;
            }
        }
        // cout<<count<<endl;
        // for(int i=0;i<rc.size();i++) cout<<rc[i]<<" ";
        // cout<<endl;
        if(count==k) ans++;
        return;
    }
    func(r+1,rc);
    rc.pb(r);
    func(r+1,rc);
}
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int i,j;
    cin>>h>>w>>k;
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            char c;
            cin>>c;
            if(c=='#') v.pb(mp(i+1,j+1+h));
        }
    }
    // for(i=0;i<v.size();i++) cout<<v[i].F<<" "<<v[i].S<<endl;
    vi row,col;
    func(1,row);
    cout<<ans;
}

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

using namespace std;

int first(int n){
	while(n >= 10){
		n /= 10;
	}
	return n;
}

int last(int n){
	return n%10; 
}


int main(){

	int n;
	cin >> n;

	int count[10][10]={};

	for (int i = 1; i <= n; i++){
		int f = first(i);
		int l = last(i);
		count[f][l]++;
	}

	int answer = 0;

	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			answer += count[i][j] * count[j][i];
		}
	}

	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split())

A = [[0 for _ in range(m)] for _ in range(n)]
B = [[0 for _ in range(l)] for _ in range(m)]
C = [[0 for _ in range(l)] for _ in range(n)]

for i in range(n):
    row = list(map(int, input().split()))
    for j in range(m):
        A[i][j] = row[j]

for i in range(m):
    row = list(map(int, input().split()))
    for j in range(l):
        B[i][j] = row[j]

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for row in C:
    print(' '.join(map(str, row)))


Measured memory_bytes: 6884
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [a,b] = nextIntArray()
    if(b == 1){
        console.log(0)
        return
    }
    let cnt = 1
    while(b > (a-1)*(cnt-1) + a){
        cnt++
    }
    console.log(cnt)

}
Main()


Measured memory_bytes: 29552
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
typedef long long li;

const int inf = ~0U >> 1;

int Get(int x) {
  int sum = 0;
  while (x) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

int main(void) {
  int n;
  scanf("%d", &n);
  int ans = inf;
  for (int i = 1; i <= n - 1; ++i) {
    ans = min(ans, Get(i) + Get(n - i));
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); i++)
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int w[n];
    int sum = 0;
    REP(i,n) {
        cin >> w[i];
        sum += w[i];
    }
    int ans = 100000, sum2;
    REP(i,n) {
        sum2 = 0;
        for (int j = 0; j <= i; j++) {
            sum2 += w[j];
        }
        int sum3 = sum - sum2;
        ans = min(ans, abs(sum2 - sum3));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
#include<tuple>
#include<iomanip>
#include<stack>
#include<cmath>
#define int long long
#define INF 1<<40
#define N 100
using namespace std;
signed main() {
	int h, w; cin >> h >> w;
	if (w == 1 || h == 1) cout << "1" << endl;
	else cout << h * w / 2 + h * w % 2 << endl;
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
L=[tuple(map(int,input().split())) for i in range(N)]
L.sort()
ans=10**37
for i in range(N):
    for j in range(i+1,N):
        t=L[j][0]-L[i][0]
        S=sorted(x[1] for x in L[i:j+1])
        for k in range(len(S)-K+1):
            u=S[K+k-1]-S[k]
            ans=min(ans,u*t)
print(ans)

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    string s;
    cin >> s;
    int n = sz(s);
    vi cnt(26);
    rep(i, n) cnt[s[i]-'a']++;
    rep(i, 26) {
        if (cnt[i]==0) {
            cout << (char)(i+'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


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

typedef long long lint;

const int MAXN = 200010;
const int MAXA = 1000010;
const int MOD = 998244353;

int A[MAXN];
int s[MAXA];

void pls(int &a, int b) {
	a += b;
	if(a >= MOD) a -= MOD;
}

void mns(int &a, int b) {
	a += MOD - b;
	if(a >= MOD) a -= MOD;
}

lint pw(int a, int b) {
	lint ans = 1;
	for(lint aa = a; b; b /= 2, aa = aa * aa % MOD) if(b & 1) ans = ans * aa % MOD;
	return ans;
}

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

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

	int tot = 0;
	for(int i = 0; i < N; i++) {
		pls(s[A[i]], A[i]);
		pls(tot, A[i]);
	}
	for(int i = 1; i < MAXA; i++) {
		for(int j = i * 2; j < MAXA; j += i) pls(s[i], s[j]);
		s[i] = lint(s[i]) * s[i] % MOD;
	}
	//printf("*\n");
	for(int i = MAXA - 1; i > 0; i--) 
		for(int j = i * 2; j < MAXA; j += i) mns(s[i], s[j]);
	int ans = 0;
	for(int i = 1; i < MAXA; i++) pls(ans, int(s[i] * pw(i, MOD - 2) % MOD));
	mns(ans, tot);
	ans = ans * pw(2, MOD - 2) % MOD;

	cout << ans;
	return 0;
}


Measured memory_bytes: 5120
N = int(input())

allList = []
for _ in range(N):
    allList.append(list(map(int,input().split())))
allList.sort(key=lambda x: x[1])

s = "Yes"
time=0
for t, shime in allList:
    time += t
    if time > shime:
        s = "No"
print(s)

Measured memory_bytes: 53720
#include <stdio.h>

int main(){
	int N,X,T,time,wari;
	
	scanf("%d %d %d",&N,&X,&T);
	
	wari = (double)N / (double)X + 0.999999;
	
	time = T * wari;
	
	printf("%d\n",time);
	return 0;
}

Measured memory_bytes: 1676
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    }
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt), * )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}



fn main() {
    input!(n: usize, a:[usize; n]);
    let mut v: Vec<(usize, usize)> = Vec::new();
    for (i, x) in a.iter().enumerate() {
        v.push((*x, i + 1));
    }
    v.sort();
    for x in v.iter() {
        print!("{} ", x.1);
    }
    println!("");
}


Measured memory_bytes: 8956