akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
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 int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    ll ans = LINF;
    REP(bits,1<<N){
        if(__builtin_popcount(bits) < K) continue;
        ll tmp = 0;
        ll ma = 0;
        REP(j,N){
            if(bits >> j & 1){
                if(ma < A[j]) ma = A[j];
                else tmp += ma + 1 - A[j], ma++;
            }
            else chmax(ma, A[j]);
        }
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>

using namespace std;

int main(){
	int n;
	while(cin >> n && n!=0){
		vector<int> v(n);
		for(int i=0;i<n;i++){
			cin >> v[i];
		}
		sort(v.begin(),v.end());
		int mi = 100000000;
		for(int i=0;i<n-1;i++){
			mi = min(mi,v[i+1]-v[i]);
		}
		cout << mi << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
L,R=map(int,input().split())
a=[]
if R-L>=2019:
	print(0)
else:
	for i in range(L,R+1):
		for j in range(i+1,R+1):
			a.append(((i%2019)*(j%2019))%2019)

	print(min(a))

Measured memory_bytes: 75412
n=input()
arr=map(int, raw_input().split())
count=[0]*(n+1)
for i in arr:
  count[i]+=1
res=0
for i in xrange(n+1):
  if count[i]>1:
    res+=count[i]*(count[i]-1)/2
# print count
for i in xrange(n):
  s=count[arr[i]]
  if s>1:
    if s-1>1:
        print res-s*(s-1)/2+(s-1)*(s-2)/2
    else:
        print res-s*(s-1)/2
  else:
    print res

Measured memory_bytes: 55264
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b);i++)
#define rrep1(i,a,b) for(long i=(a);i<=(b);i++)
#define rrrep(i,a,b) for(long i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define X first
#define Y second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int> >
#define vpl vector<pair<long, long> >

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;

int printYes() {
    cout << "YES" << endl;
    return 0;
}

int printNo() {
    cout << "NO" << endl;
    return 0;
}

int ans;

int printAns() {
    cout << ans << endl;
    return 0;
}


int pow(int x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow(x - 1) * 2;
	}
}

int main(int argc, char const *argv[])
{
    int n,k;
    cin >> n >> k;
    if (n >= k * 2 - 1) {
        printYes();
    } else
    {
        printNo();
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
////#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
//#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int main() {
	char s[6] = "ABCDE";
	int i,max,t,a,b;
	for (; ~fscanf(stdin, "%d%d", &a, &b), a || b; fprintf(stdout, "%c %d\n", s[i], max)) {
		i = 0, max = a + b;
		for (t = 1; t < 5; t++) {
			fscanf(stdin, "%d%d", &a, &b);
			if (a + b > max) max = a + b, i = t;
		}
	}
	return 0;
}

Measured memory_bytes: 604
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    map <int,int> cnt;
    int n,t; cin>>n>>t; 
    int  mn = 3e10, x, mx = 0 ; 
    for (int i=0;i<n;i++){
        cin >> x ; 
        mn = min(mn,x);
        cnt[x-mn]++;
        mx = max(mx,x-mn);
    }
    cout << cnt[mx] << endl ; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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


int main() {
	
	int x, y, z;
	cin >> x >> y >> z;
	int i=1;
	while(1){
		if(y*i + z*(i+1) > x) break;
		i++;
	}
	cout << i-1 << endl;
	
	return 0;
}

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

Measured memory_bytes: 128
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *h = map(int, read().split())
    for i1 in range(n - 1, 0, -1):
        if h[i1] >= h[i1-1]:
            pass
        elif h[i1] == h[i1-1] - 1:
            h[i1-1] -= 1
        else:
            print('No')
            sys.exit()
    print('Yes')

if __name__ == '__main__':
    main()

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

int main(){
    ll n;
    cin >> n;
    
    vector<P> vec;
    rep(i,1,n+1){
        rep(j,i+1,n+1){
            if(n % 2){
                if(i+j != n || j == n){
                    vec.push_back(P(i,j));
                }
            }
            else{
                if(i+j != n+1){
                    vec.push_back(P(i,j));
                }
            }
        }
    }

    cout << vec.size() << endl;
    rep(i,0,vec.size()){
        cout << vec[i].fs << " " << vec[i].sc << endl;
    }
    return 0;
}




Measured memory_bytes: 3736
#スペース区切りの整数を入力し連結
rgb_list = list(map(int, input().split()))
rgb_list = map(str, rgb_list) # join関数は文字列の結合をするからmap関数で型変換
rgb = ''.join(rgb_list)
# 4で割り切れるか
if int(rgb)%4 == 0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
string s1, s2;
cin>> s1 >> s2;
for(int i = 0 ; i < s1.length();i++){
    if(s1[i]!=s2[i]){
        cout << "No"<<endl;
        return 0;
    }

}    
    cout << "Yes" <<endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int d[140][140];
int previous[140][140];
int reached[140][140];

void printpath(int start,int goal){
    for(int cur=goal;cur!=start;cur=previous[start][cur]){
        reached[cur][(previous[start][cur])]=1;
        reached[(previous[start][cur])][cur]=1;
    }
}

int main(){
    int n,m;
    cin>>n>>m;
    rep(i,n) rep(j,n) d[i][j]=1000000000;
    rep(i,n) rep(j,n) previous[i][j]=i;
    rep(i,m){
        int src,to,weight;
        cin>>src>>to>>weight;
        --src;--to;
        d[src][to]=weight;
        d[to][src]=weight;
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                if(d[i][j]>d[i][k]+d[k][j]){
                    d[i][j]=d[i][k]+d[k][j];
                    previous[i][j]=previous[k][j];
                }
            }
        }
    }
    rep(i,n) rep(j,n) printpath(i,j);
    int res=0;
    rep(i,n) rep(j,n){
        if(reached[i][j])++res;
    }
    res/=2;
    cout<<m-res<<endl;
}
    

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


const int N = 505, INF = 1e9 + 7;
const char colors[2][2] = {{'R', 'Y'}, {'G', 'B'}};


int n, m, d;
char cl[N][N];

inline pair < int, int > tr(int x, int y){
    return make_pair(x + y, x - y);
}
inline pair < int, int > inv_tr(int x, int y){
    if((x + y) % 2 || (x - y) % 2){
        return make_pair(-1, -1);
    }
    return make_pair((x + y) / 2, (x - y) / 2);
}
inline bool check(pair < int, int > a){
    return 1 <= a.first && a.first <= n && 1 <= a.second && a.second <= m;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> m >> d;
    vector < pair < int, int > > q;
    q.push_back(tr(1, 1));
    q.push_back(tr(n, 1));
    q.push_back(tr(1, m));
    q.push_back(tr(n, m));
    int mnX = +INF, mnY = +INF,
        mxX = -INF, mxY = -INF;
    for(auto it : q){
        mnX = min(mnX, it.first);
        mnY = min(mnY, it.second);
        mxX = max(mxX, it.first);
        mxY = max(mxY, it.second);
    }
    bool cl1 = 0, cl2 = 0;
    for(int i = mnX; i <= mxX; i += d){
        for(int j = mnY; j <= mxY; j += d){
            for(int ii = i; ii <= i + d - 1; ii++){
                for(int jj = j; jj <= j + d - 1; jj++){
                    auto it = inv_tr(ii, jj);
                    if(check(it)){
                        cl[it.first][it.second] = colors[cl1][cl2];
                    }
                }
            }
            cl2 ^= 1;
        }
        cl1 ^= 1;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            cout << cl[i][j];
        }
        cout << "\n";
    }
}


Measured memory_bytes: 3876
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;

struct edge {
    int to; int num;
    edge() {}
    ~edge() {}
    edge(int to, int num): to(to), num(num) {}
};

struct state {
    int pos; int cost; int num;
    state() {}
    ~state() {}
    state(int pos, int cost, int num): pos(pos), cost(cost), num(num) {}

    bool operator < (const state o) const {
        return cost > o.cost;
    }
};

int N, M;

map<pair<int, int>, vector<edge>> graph;
map<pair<int, int>, int> md;
priority_queue<state> pq;

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

    for (int j = 0; j < M; ++j) {
        int p, q, c;
        cin >> p >> q >> c; --p; --q; --c;

        if (graph.find(make_pair(p, c)) == end(graph)) graph[make_pair(p, c)] = vector<edge>();
        graph[make_pair(p, c)].emplace_back(q, c);
        graph[make_pair(p, -1)].emplace_back(q, c);

        if (graph.find(make_pair(q, c)) == end(graph)) graph[make_pair(q, c)] = vector<edge>();
        graph[make_pair(q, c)].emplace_back(p, c);
        graph[make_pair(q, -1)].emplace_back(p, c);
    }

    pq.emplace(0, 0, -1);
    md[make_pair(0, -1)] = 0;
    while (!pq.empty()) {
        state st = pq.top(); pq.pop();
        int v = st.pos, cost = st.cost, num = st.num;

        if (cost > md[make_pair(v, st.num)]) continue;

        auto it = md.find(make_pair(v, -1));
        if (it == end(md) || cost < it->second) {
            md[make_pair(v, -1)] = cost;
            pq.emplace(v, cost, -1);
        }

        for (const edge& e: graph[make_pair(v, num)]) {
            int ncost = cost + (st.num == -1 ? 1 : 0);
            auto it = md.find(make_pair(e.to, e.num));
            if (it == end(md) || ncost < it->second) {
                md[make_pair(e.to, e.num)] = ncost;
                pq.emplace(e.to, ncost, e.num);
            }
        }
    }

    auto ans = md.find(make_pair(N-1, -1));
    cout << (ans == end(md) ? -1 : ans->second) << endl;

    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int x=0, max=0;
    for(int i=0; i<n; i++)
    {
        if(s[i]=='I')
        {
            x++;
            if(x>max)
            max=x;

        }
        else if(s[i]=='D')
        {
            x--;
        }
    }
    cout<<max<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;


int main()
{
	int n,x,y;
	cin >> n;
	x = 800 * n;
	y = (n / 15) * 200;
	cout << x - y << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
		sc.close();

		int x3 = 0;
		int y3 = 0;
		int x4 = 0;
		int y4 = 0;

		double h = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));

		x3 = x2 + y1 - y2;
		y3 = y2 - x1 + x2;
		x4 = x1 + y1 - y2;
		y4 = x2 - x1 + y1;

		System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);

	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 92233720ll;

void solve()
 { 
  int a;
  cin>>a;
  cout<<(a + a*a + a*a*a);
 }
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
 
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
} 

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long
using namespace std;
int c=1000000007;
signed main()
{
   int n,t=0,p;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
   sort(a,a+n);
   for(int i=0;i<n;i++)
   {
       for(int j=i+1;j<n;j++)
       {
           int high,low,mid,y=a[i]+a[j];
           high=n-1;
           low=j+1;
           mid=(high+low)/2;
           if(a[low]>=y)
            continue;
           while(high-low>1)
           {
               if(a[mid]<y) low=mid;
               else high=mid;
               mid=(high+low)/2;
           }
           if(a[high]<y) p=high;
           else p=low;
           t+=p-j;
       }
   }
   cout<<t;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define N 100001
#define int long long
inline int read(){int x=0;char c=getchar();while(c<'0' || c>'9')c=getchar();while(c>='0' && c<='9')x=(x<<3)+(x<<1)+(c^'0'),c=getchar();return x;}
int n,m,fa[N],dis[N];
inline int find(const int &x)
{
    if(x==fa[x])return x;
    int y=find(fa[x]);
    dis[x]+=dis[fa[x]];
    return fa[x]=y;
}
signed main()
{
    n=read(),m=read();
    for(register int i=1;i<=n;i++)fa[i]=i;
    while(m--)
    {
        int l=read(),r=read(),d=read();
        int x=find(l),y=find(r);
        if(x!=y)
        {
            fa[y]=x;
            dis[y]=dis[l]+d-dis[r];
        }
        else
        {
            if(dis[r]-dis[l]!=d){printf("No\n");return 0;}
        }
    }
    printf("Yes\n");
}


Measured memory_bytes: 1792
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
//#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
int main(){
    ll n,x;
    cin>>n>>x;
    ll ans=0;
    rep(i,0,n){
        ll p;
        cin>>p;
        if(i==0)ans=abs(p-x);
        else ans=gcd(abs(x-p),ans);
    }
    cout<<ans<<endl;
    return 0;

}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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



int main(){
    ll n; cin >> n;
    if(n % 2){
        cout << 0 << "\n";
        return 0;
    }
    ll ans = 0;
    n /= 2;
    while(n){
        ans += n / 5;
        n /= 5;
    }
    cout << ans << "\n";
    return 0;
}


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

vector<ll> to[100010];

int main(){
    ll n,m;cin>>n>>m;
    ll a[100010];
    rep(i,0,n)cin>>a[i];
    rep(i,0,m){
        ll x,y;
        cin>>x>>y;
        x--;y--;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    vector<ll> cl(n,-1);
    queue<ll> q;
    ll clr=0;
    
    rep(i,0,n){
        if(cl[i]!=-1)continue;
        q.push(i);
        cl[i]=clr;
        while(!q.empty()){
            ll v=q.front();
            q.pop();
            for(auto nx:to[v]){
                if(cl[nx]!=-1)continue;
                cl[nx]=clr;
                q.push(nx);
            }
        }
        clr++;
    }
    ll cn=0;
    rep(i,0,n)if(cl[a[i]-1]==cl[i])cn++;
    cout<<cn<<endl;
}







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

int main(void) {

    string S;
    cin >> S;

    const int end = S.size() - 1;
    int count = 0;
    for (int i = 0; i < S.size() / 2; i++) {
        if (S[i] != S[end - i]) count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
def func(n):
    if n%2 == 0:
        return n/2
    return 3*n+1

def solve():
    s = int(input())
    l = []
    l.append(s)

    n = s
    count = 1
    while True:
        n = func(n)

        if n in l:
            print(count+1)
            return

        l.append(n)
        count += 1


if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
using namespace std;

int main()
{
    int k,x;
    cin>>k>>x;
    int m=max(x-k+1,-1000000);
    int M=min(x+k-1,1000000);
    for (int i=m;i<=M;++i){
        cout<<i<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define MOD 1000000007

void solve(int test_case) {//209
	int n,x;
	cin>>n>>x;
	vi arr(n);
	for(int &i:arr)cin>>i;
	sort(arr.begin(),arr.end());
	int cnt=0;
	REP(i,0,n-2) {
		if(arr[i]>x)break;
		x-=arr[i];
		cnt++;
	}
	if(x>0) {
		if(arr[n-1]==x)cnt++;
	}
	cout<<cnt;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	//prefill();
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
vector<int> v[30],v1[30];
string s,s1;
long long k=0,ans=0;
void st(char c,int x)
{
	int l=0,r=v[c-'a'].size(),w;
	while(r-l!=1)
	{
		w=(r+l)/2;
		if(v[c-'a'][w]<x)
			l=w;
		else if(v[c-'a'][w]>x)
			r=w;
		else
			break;		
	}
	w=(r+l)/2;
	if(v[c-'a'][w]>x)
	{
		ans+=v[c-'a'][w]-x;
		k=v[c-'a'][w];
	}
	else if(w==v[c-'a'].size()-1)
	{
		ans+=s.size()-(x-v[c-'a'][0]);
		k=v[c-'a'][0];
	}
	else
	{
		ans+=(v[c-'a'][w+1]-x);
		k=v[c-'a'][w+1];
	}
	return ;
}
int main()
{
	bool no=false;
	cin>>s>>s1;
	for(int i=0;i<s.size();i++)
		v[s[i]-'a'].push_back(i);
	for(int i=0;i<s1.size();i++)
		v1[s1[i]-'a'].push_back(i);
	for(int i=0;i<s1.size();i++)
	{
		if(v[s1[i]-'a'].size()==0)
		{
			no=true;
			break;
		}
	}
	if(no==true)
		cout<<-1<<endl;
	else
	{
		for(int i=0;i<s.size();i++)
			if(s[i]==s1[0])
			{
				k=i;
				ans+=i+1;
				break;
			}
		for(int i=1;i<s1.size();i++)
			st(s1[i],k);
		cout<<ans<<endl;			
	}		
} 

Measured memory_bytes: 1724
#include <stdio.h>
#include <string.h>

int main(){
    char hoge[101];
    int a;

    scanf("%s", hoge);
    a = strlen(hoge);

    for(int i = 0; i < a; i++){
        if(i % 2 == 0){
            if(hoge[i] == 'L'){
                printf("No\n");
                return 0;
            }
        }else{
            if(hoge[i] == 'R'){
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

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

  cout << ((X == 7 || X == 5 || X == 3) ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    using namespace std;
    int n, total;
    total = 0;
    cin >> n;
    int comp, cnt;
    for (int i=1; i<=n; i++) {
        comp = i;
        cnt = 0;
        while (comp != 0) {
            comp /= 10;
            cnt++;
            // cout << cnt << endl;
        }
        if (cnt & 1 == 1) total++;
    }
    cout << total;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int n; cin >> n;
  string s; cin >> s;
  int ans = 1;
  rep(i,n-1){
    if(s[i] != s[i+1]) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 512
import copy
n = int(input())
def point_shift(s,i):
    p = s.index(".")
    tale = len(s[p+1:])
    if tale <= i:
        return int(s[:p]+s[p+1:].ljust(i,"0"))
    else:
        return int(s[:p]+s[p+1:p+i+1])

a = []
for i in range(n):
    s = input()
    if "." not in s:
        a.append(int(s)*10**9)
    else:
        a.append(point_shift(s,9))

memo = [[0,0] for _ in range(n)]
for i in range(n):
    t = a[i]
    while t%2 == 0:
        t //= 2
        memo[i][0] += 1
    while t%5 == 0:
        t //= 5
        memo[i][1] += 1

l0 = [[0]*100 for _  in range(100)]
for i in range(n):
    l0[memo[i][0]][memo[i][1]] += 1

l1 = copy.deepcopy(l0)
for i in range(100):
    for j in range(98,-1,-1):
        l1[i][j] += l1[i][j+1]
for i in range(98,-1,-1):
    for j in range(100):
        l1[i][j] += l1[i+1][j]


ans = 0
for i in range(100):
    for j in range(100):
        x0,y0 = i,j
        x1,y1 = max(0,18-x0),max(0,18-y0)
        if x0 >= 9 and y0 >= 9:
            ans += l0[x0][y0]*(l1[x1][y1]-1)
        else:
            ans += l0[x0][y0]*l1[x1][y1]
print(ans//2)

Measured memory_bytes: 117764
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdint>
using namespace std;

int main() {
    int n, k; cin >> n >> k;
    vector<int> p(n), c(n);
    for (auto &e : p) cin >> e;
    for (auto &e : c) cin >> e;

    int64_t ans = -1e18;

    for (int i = 0; i < n; ++i) {
        vector<int> cycle;
        int cpos = i;
        int64_t csum = 0;

        do {
            cpos = p[cpos] - 1;
            cycle.push_back(c[cpos]);
            csum += c[cpos];
        } while (cpos != i);

        int64_t ians = 0;

        if (0 < csum) {
            int64_t pmax = -1e18, psum = 0;
            for (int j = 0; j < cycle.size() && j < k; ++j) {
                psum += cycle[j];
                pmax = max(pmax, (int64_t)(psum + csum * ((k - (j + 1)) / cycle.size())));
            }
            ians += pmax;

            // プラス側のコードが間違っている？
            /*ians += csum * (k / cycle.size());
            int64_t pmax = 0, psum = 0;
            for (int j = 0; j < k % cycle.size(); ++j) {
                psum += cycle[j];
                pmax = max(pmax, psum);
            }
            ians += pmax;*/
        }
        else {
            int64_t mmax = cycle[0], msum = cycle[0];
            for (int j = 1; j < min((size_t)k, cycle.size()); ++j) {
                msum += cycle[j];
                mmax = max(mmax, msum);
            }
            ians += mmax;
        }

        ans = max(ans, ians);

        /*
        int64_t ians = 0;
        int rest = k;

        if (0 < csum && cycle.size() < rest) {
            ians = csum * (rest / cycle.size());
            rest %= cycle.size();
        }

        int j = 0;
        int64_t pans = 0;
        int64_t psum = 0;
        if (csum <= 0) {
            j = 1;
            pans = cycle[0];
            psum = cycle[0];
        }

        while (j < min((size_t)rest, cycle.size())) {
            psum += cycle[j];
            pans = max(pans, psum);
            ++j;
        }

        ians += pans;

        ans = max(ans, ians);
        */
    }

    cout << ans << endl;
}



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

result = 0
increase = None

for i in range(1, n):
    if a[i] < a[i - 1]:
        if increase is None:
            increase = False
        elif increase:
            result += 1
            increase = None
    elif a[i] > a[i - 1]:
        if increase is None:
            increase = True
        elif not increase:
            result += 1
            increase = None
result += 1
print(result)
            

Measured memory_bytes: 14252
#include<iostream>

int main (){
    std::cin.tie(0); 
	std::ios::sync_with_stdio(false);
    
    long long A,V ; std::cin >> A >> V ;
    long long B,W ; std::cin >> B >> W ;
    long long T ; std::cin >> T;
    
    std::string ans="NO";

    long long distance = std::abs(B - A); 
    long long approach = V - W;

    if (distance <= T * approach){
        ans="YES";
    } 
    
    std::cout << ans;
    return 0;
}

Measured memory_bytes: 3640
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] a = new int[10000 + 1];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }
    in.close();

    int cnt = 0;
    for (int i = 0; i < N; i++) {
      int t = a[i];
      while (t % 2 == 0) {
        t /= 2;
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 34144
n=int(input())
high=[]
for _ in range(n):
  a=list(map(int,input().split()))
  high.append(a)
inf=float('inf')
  
for x in range(0,101):
  
  for y in range(0,101):
    highlimit=inf
    ans=-1
    ch=-1
    for hi1 in high:
      p,q,r=hi1
      g=r+abs(p-x)+abs(q-y)
      if r<=0:
        G=abs(p-x)+abs(q-y)
        if ans>G:
          ch+=1
          break
        if G<=highlimit:
          highlimit=G
        
        continue
      else:
        if g>highlimit:
          ch+=1
          break
        else:
          if ans!=-1 and ans!=g:
            ch+=1
            break
          else:
            ans=g
    
    if ans!=-1 and ch==-1:
      print(x,y,ans)
      exit()
        
      

Measured memory_bytes: 73520
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int main(){
  int N,x,y;
  cin>>N;

  x = N*800;
  y = N/15*200;

  cout<<x-y;

  return 0;
}

Measured memory_bytes: 256
//author-micheal corleone
//the godfather
#include <bits/stdc++.h>
#include <set> 
#include<algorithm>
#include <set> 
#include<algorithm>
#define ll long long int
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define out(n) printf("%lld\n",n)
#define inf 100000000000000
#define endl "\n"
#define precise(x) fixed << setprecision(x) 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
const int MOD =1000000007;
#define f(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
 
using namespace std;

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[1] < v2[1]; 
}
 ll mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}
 //ll power(ll x, ll y) 
//{ 
  //  ll temp; 
    //if( y == 0) 
     //   return 1; 
    //temp = power(x, y/2); 
    //temp=temp%MOD;
    //if (y%2 == 0) 
     //   return (temp%MOD)*(temp%MOD); 
    //else
      //  return (x%MOD)*(temp%MOD)*(temp%MOD); 
//} 
 
 
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
    if(n==1 || r==0)return 1;
  //  ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=((((ans * n)%MOD )*modinv(i,MOD))%mod);n--;sum+=ans;sum%=mod;}return sum;
}
 //diamond[2000005],ans[1000006];
 const int maxn=2e5+100;
 

int main()
{
	ios_base::sync_with_stdio(0);
   cin.tie(0);
    cout.tie(0);
     ll t;
   //cin>>t;
   
   t=1;	
   while(t--)
    {
        ll i1,i2,k,j,j1,a1,i31,i3,j2,i5,i4,i6,i7,i,n,m;
        ll x,y,z;
        ll total=0,cnt=0;
        ll flag=0;
        y=0;
        ll res,res1,ans,res2,q;
        ans=0;
        res1=0,res=0;
        ll s1,s2,s3;
        s2=0;
        ll sum=0,flag1=0;
        s1=0;
        ll k1,k2,k3;
        k1=0,k2=0;
        ll d,required,days,h,w;
        //cin>>h>>c>>required;
         char s[1009][1009];
         cin>>h>>w;
         f(i,0,h)
         {
         	f(j,0,w)
         	{
         		cin>>s[i][j];
			 }
		 }
		 ll dp[h][w];
         memset(dp,-1,sizeof dp);
          dp[0][0]=0;
          flag=1;
          for(i=1;i<w;i++)
          {
          	  if(s[0][i]=='.' && flag)
          	  {
          	  	 dp[0][i]=1;
				}
				else
				{
					dp[0][i]=0;
					flag=0;
				}
		  }
         flag=1;
         for(j=1;j<h;j++)
         {
         	if(s[j][0]=='.' && flag) dp[j][0]=1;
         	else
         	{
         		dp[j][0]=0;
         		flag=0;
			 }
         	
		 }
		 for(i=1;i<h;i++)
		 {
		 	for(j=1;j<w;j++)
		 	{
		 		if(s[i][j]=='#')
		 		{
		 			dp[i][j]=0;
				 }
				 else
				 {
				 	dp[i][j]=dp[i][j-1]+dp[i-1][j];
				 	dp[i][j]%=MOD;
				 }
			 }
		 }
         
	     cout<<dp[h-1][w-1]<<endl;
     }
    
}
	

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

int main(){
  int n;
  bool f = false;
  cin >> n;

  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>> a[i];
    if(a[i]%2==1)
      f = true;
  }
  if(f) cout << "first\n";
  else  cout << "second\n";
  return 0;
}


Measured memory_bytes: 640
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)
for i in range(M):
  x, y, c = map(int, input().split())
  ans = min(ans, a[x-1] + b[y-1] - c)
print(ans)

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

int T;
ll H,W;
int main(){
  cin >> T;
  while( T-- ){
    cin >> H >> W;
    ll d = __gcd( H, W );
    H/=d; W/=d;
    if( H == W ){
      cout << "1 0" << endl;
    } else if( (H + W)&1LL ){
      cout << "1 1" << endl;
    } else {
      cout << H*W/2LL+1LL << " " << H*W/2LL << endl;
    }
  }
}

Measured memory_bytes: 3092
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};
const int MAX = 510000;
int n,k; 
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int func(int x){
  int red = n-k;
  int blue = k;
  
  return (COM(red + 1,x) * COM(blue-1,x-1))%MOD;
}

int main(){
  cin >> n >> k;
  COMinit();
  
  for(int i = 1; i <= k; i++){
    cout << func(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 12160
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;
import core.bitop;

alias X = Tuple!(int, "n", int, "f", int, "t");

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(int[]);
    auto BS = readln.split.to!(int[]);

    auto DP = new int[][](1<<N, 51);
    foreach (ref dp; DP) dp[] = -1;

    int solve(uint s, int p) {
        auto i = popcnt(s);
        if (i == N) return 0;

        if (DP[s][p] == -1) {
            int r = int.max/3;
            foreach (j; 0..N) if (!(s&(1<<j))) {
                auto x = (i+j)%2 == 0 ? AS[j] : BS[j];
                if (x < p) continue;
                int d;
                foreach (k; j+1..N) if (s&(1<<k)) ++d;
                r = min(r, solve(s | (1<<j), x) + d);
            }
            DP[s][p] = r;
        }
        return DP[s][p];
    }
    auto r = solve(0, 0);
    writeln(r >= int.max/3 ? -1 : r);
}

Measured memory_bytes: 74640
#include<iostream>
using namespace std;
int main()
{
          int a,b,c;
          cin>>a>>b;
          if((a%2==0 && b%2!=0)||(a%2!=0 && b%2==0))
                    cout<<"IMPOSSIBLE\n";
          else
                    cout<<(a+b)/2<<endl;
return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
                using namespace std;
                typedef long long ll;
                #define INPUT()              freopen("input.txt", "r", stdin)
                #define OUTPUT()             freopen("output.txt", "w", stdout)
                #define F                    first
                #define S                    second
            //Templatefunctions
                template<typename T>T gcd(T x, T y) { if (y == 0)return x; else return gcd(y, x%y);}
                template <class T> T euclideanDistance(T x1 , T x2 , T y1 , T y2){return sqrt(( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ));}
                template <class T> T digitSum(T n){T sum = 0;while(n > 0)sum += n % 10,n /= 10;return sum;}
            //datatypes
                typedef long long int ll;
                typedef unsigned long long int ull;
                typedef long double ld;
            //constants
                const double INF = 1e+9;
                const double INFLL = 1e+18;
                const double EPS = 1e-9;
                const double PI = acos(-1);
                const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
                       //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
                       //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
                const int dx[] = {0 , 1 , 0 , -1};
                const int dy[] = {1 , 0 , -1 , 0};
            //helpers
                //#define MOD         1000000007LL
                #define MAX         1000005
                const ll MOD = 1000000000 + 7;
                int arr[MAX];
                char str[MAX+10];
            //Global Variables
                int price[MAX] = {0 , 1 , 5 , 8 , 9 , 10 , 17 , 17 , 20 , 24 , 30};
                int dp[MAX],n;
                int main()
                {
                   int ans = 0;
                   
                   scanf("%s",str);
                   int len = strlen(str);
                   for(int i = 0 ; i < len ; i++)
                   {
                        if(str[i] != str[i+1])
                        {
                            ans++;
                        }
                   }
                   printf("%d\n",ans-1);
                }


Measured memory_bytes: 2304
use proconio::input;
use num::integer::*;

fn main() {
  input! {
    k: isize,
    a: isize,
    b: isize,
  }
  // are there k such that a <= k n <= b ?
  let lb = -(-a).div_floor(&k); // n >= lb
  let ub = b.div_floor(&k); // n <= ub
  if lb <= ub {
    println!("OK");
  } else {
    println!("NG");
  }
}


Measured memory_bytes: 2088
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll q;cin>>q;
  ll B = 0;
  priority_queue<ll> low;
  priority_queue<ll, vector<ll>, greater<ll>> high;
  ll sumL=0, sumH=0;
  low.push(-LINF);
  high.push(LINF);
  rep(t_,q){
    int mode;cin>>mode;
    if(mode==1){
      ll a,b;cin>>a>>b;
      B += b;
      if(a < low.top()){
        low.push(a);
        sumL += a;
      }else if(a > high.top()){
        high.push(a);
        sumH += a;
      }else{
        low.push(a);
        sumL += a;
      }
      if(low.size() < high.size()){
        ll h = high.top();
        high.pop();
        sumH -= h;
        sumL += h;
        low.push(h);
      }
      if(low.size() >= high.size()+2){
        ll l = low.top();
        low.pop();
        sumL -= l;
        sumH += l;
        high.push(l);
      }
    }else{
      ll median = low.top();
      cout << median << " " << (median  * ((ll)low.size() - 1) - sumL) + (sumH - median * ((ll)high.size() - 1)) + B << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3828
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	int x;
	cin >> x;
	if(x >= 30){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        System.out.println(Math.max(0, Math.min(b, d) - Math.max(a, c)));
    }
}

Measured memory_bytes: 23380
import heapq
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list(map(lambda x: x*(-1), A))

heapq.heapify(A)


for _ in range(M):
    a = heapq.heappop(A)
    a = -(-a//2)
    heapq.heappush(A,a)

print(-1*sum(A))

Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
  int N;
  cin >> N;
  lli data[N-1][3];
  
  
  rep(i, N-1){
    cin >> data[i][0] >> data[i][1] >> data[i][2];
  }
  
  
    lli ans=0;
  rep(i, N){
    ans=0;
    rep2(j, i, N-1){
      if(j==i)
        ans+=data[j][1]+data[j][0];
      else{
        if(ans<=data[j][1]){
          ans=data[j][1]+data[j][0];
        }
        else if((ans-data[j][1])%data[j][2]!=0){
          ans=data[j][1]+((ans-data[j][1])/data[j][2]+1)*data[j][2]+data[j][0];
        }
        else{
         ans=data[j][1]+((ans-data[j][1])/data[j][2])*data[j][2]+data[j][0];
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const w = input[0][0];

  const chars = new Set<string>();

  w.split("").forEach((char) => {
    if (chars.has(char)) {
      chars.delete(char);
    } else {
      chars.add(char);
    }
  });

  return chars.size === 0 ? "Yes" : "No";
};

console.log(main(read()));


Measured memory_bytes: 29616
#include<bits/stdc++.h>
#define int long long
using namespace std;
int gcd(int a,int b){
	if(b==0)return a;
	else
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
	
signed main() {
	int t;
	cin>>t;
	int ans=1;
	for(int i=0 ; i< t;++i){
		int num;
		cin>>num;
	
		ans=lcm(num,ans);
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256