akhauriyash/Code-Regression huggingface dataset:
def dot_v(a,b):
    sum=0
    for i in range(len(a)):
        sum+=a[i]*b[i]
    return sum

def dot(A,x):
    xx=[0]*len(x)
    for i in range(len(A)):
        xx[i]=dot_v(A[i],x)

    return xx


x=list(map(int,input().split(" ")))
A=[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]
count=0
flg=False
equal=False
for i in range(10**6):
    if x[0]==x[1] and x[1]==x[2]:
        if x[0]%2==0:
            equal=True
            break
    for sx in x:
        if (sx%2)!=0:
            flg=True
            break
    if flg:
        break
    count+=1
    x=dot(A,x)
    #print(x)
    if i==10**6-1:
        equal=True


if equal:
    print(-1)
else:
    print(count)

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
  char b;
  scanf("%c",&b);
  switch(b){
    case 'A': b='T'; break;
    case 'C': b='G'; break;
    case 'G': b='C'; break;
    case 'T': b='A'; break;
  }
  printf("%c",b);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll MOD = 1e9 + 7;

int main() {
    string x;
    cin >> x;
    int dc = 0, sc = 0;
    for (char c : x) {
        if (c == 'S') ++sc;
        else {
            if (sc > 0) {--sc; dc+=2;}
        } 
    } 
    int ret = x.size() - dc;
    cout << ret << endl; 
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
typedef pair<int,int> P;
typedef pair<int,P> PP; 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto &ai:a)cin>>ai;
  vector<int> b=a;
  sort(all(b));
  for(auto ai:a){
    if(ai==b[n-1])cout<<b[n-2]<<endl;
    else cout<<b[n-1]<<endl;
  }
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  int h[n];
  int dp[n];
  for(int i=0;i<n;i++) cin>>h[i];
  dp[0] = 0;
  dp[1] = abs(h[0]-h[1]);
  for(int i=2;i<n;i++){
    dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
  }
  cout<<dp[n-1];
  return 0;
}

Measured memory_bytes: 1024
use std::cmp::min;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;
use std::time::Instant;

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    let d: i32 = read();
    println!("{}", min(a, b) + min(c, d));
}

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


Measured memory_bytes: 4352
//#pragma GCC optimize("trapv")
#include <iostream>
#include <vector>
#include <tuple>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cassert>
#include <iomanip>
#include <algorithm>
#include <unordered_set>
#define int long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

using namespace std;

const int MOD = 1e9 + 7;
const int INF = 2e9;

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

signed main()
{
	fast();
	int n;
	cin >> n;
	int ans = 0;
	vector <int> a(n);
	for (int & e : a)
		cin >> e;
	int mx = a[0];
	for (int i = 0; i < n; ++i)
	{
		mx = max(mx, a[i]);
		int need = mx - a[i];
		ans += need;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

struct dsu {
	public:
		dsu() : _n(0) {}
		dsu(int n) : _n(n), parent_or_size(n, -1) {}

		int merge(int a, int b) {
			assert(0 <= a && a < _n);
			assert(0 <= b && b < _n);
			int x = leader(a), y = leader(b);
			if (x == y) return x;
			if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
			parent_or_size[x] += parent_or_size[y];
			parent_or_size[y] = x;
			return x;
		}

		bool same(int a, int b) {
			assert(0 <= a && a < _n);
			assert(0 <= b && b < _n);
			return leader(a) == leader(b);
		}

		int leader(int a) {
			assert(0 <= a && a < _n);
			if (parent_or_size[a] < 0) return a;
			return parent_or_size[a] = leader(parent_or_size[a]);
		}

		int size(int a) {
			assert(0 <= a && a < _n);
			return -parent_or_size[leader(a)];
		}

		std::vector<std::vector<int>> groups() {
			std::vector<int> leader_buf(_n), group_size(_n);
			for (int i = 0; i < _n; i++) {
			leader_buf[i] = leader(i);
			group_size[leader_buf[i]]++;
			}
			std::vector<std::vector<int>> result(_n);
			for (int i = 0; i < _n; i++) {
			result[i].reserve(group_size[i]);
			}
			for (int i = 0; i < _n; i++) {
			result[leader_buf[i]].push_back(i);
			}
			result.erase(
			std::remove_if(result.begin(), result.end(),
					   [&](const std::vector<int>& v) { return v.empty(); }),
			result.end());
			return result;
		}

	private:
		int _n;
		// root node: -1 * component size
		// otherwise: parent
		std::vector<int> parent_or_size;
};

int main() {
	int N, Q;
	cin >> N >> Q;
	dsu d(N);
	vector<int> ans;
	for (int i = 0; i < Q; ++i) {
		int t, u, v;
		cin >> t >> u >> v;
		if (t) { ans.emplace_back(d.same(u, v)); }
		else { d.merge(u, v); }
	}

	for (auto v : ans) { cout << v << "\n"; }

	return 0;
}


Measured memory_bytes: 4416
x =  int(input())
 
def primes(z, n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if (is_prime[i]) and (i>=z) ]

Prime = primes(x, (10**5)+4)
ans = Prime[0]
print(ans)

Measured memory_bytes: 4172
x,k,d=map(int, input().split())
if x<0:
  x=-1*x

if x==0:
  if k%2==0:
    print(0)
  else:
    print(d)

else:
  if x-d*k<0:
    a=x%d
    b=x%d-d
    if ((x-x%d)//d)%2==k%2:
      print(a)
    else:
      print(-1*b)
  else:
    print(x-d*k)

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
const int MOD = 1e9 + 7;
const ld PI = 3.141592653589793;
const int maxn = 600001;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}


signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");
    auto solve = [](int _) {
        int n, m;
        cin >> n >> m;
        vector<int> a(n + 1);
        for (int i = 1; i <= n; ++i) {
            cin >> a[i];
        }
        vector<pair<int, int>> seg;
        ll sum = 0;
        for (int i = 1; i < n; ++i) {
            sum += (a[i + 1] - a[i] + m) % m;
            if (a[i + 1] < a[i]) {
                seg.push_back({a[i] - m, a[i + 1]});
                seg.push_back({a[i], a[i + 1] + m});
            } else {
                seg.push_back({a[i], a[i + 1]});
                seg.push_back({a[i] + m, a[i + 1] + m});
            }
        }
        map<int, vector<pair<int, int>>> events;
        for (int i = 0; i < seg.size(); ++i) {
            int x, y;
            tie(x, y) = seg[i];
            events[x + 1].emplace_back(1, i);
            events[y + 1].emplace_back(-1, i);
        }
        ll best = 1e18;
        ll cur = 0;
        for (auto p:seg) {
            cur += p.second - p.first;
        }
        int open_cnt = 0;
        for (int x = -3 * m; x <= 3 * m; ++x) {
            for (auto ev:events[x]) {
                if (ev.first == -1) {
                    --open_cnt;
                    cur += seg[ev.second].second - seg[ev.second].first - 1;
                }
            }
            cur -= open_cnt;
            best = min(best, cur - sum);
            for (auto ev:events[x]) {
                if (ev.first == 1) {
                    ++open_cnt;
                }
            }
        }
        cout<<best;
    };


    fast_io();

    cout.precision(9);
    cout <<
         fixed;
    for (int i = 1; i <= 1; ++i)
        solve(1);


}


Measured memory_bytes: 59516
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

///////////////ここから
ll n,k;
vll a,f;


bool check(ll x){//全員x以内
  ll cnt=0;
  rep(i,0,n){
   if(a[i]*f[i]>x){
     cnt+=a[i]-x/f[i];
   }
  }
  return cnt<=k;
}

int main(){cout<<fixed<<setprecision(20);
		   //二分探索
           //O(nlog10^12)
           cin>>n>>k;
           a.resize(n);
           f.resize(n);
           rep(i,0,n)cin>>a[i];
           rep(i,0,n)cin>>f[i];
           sort(all(a));
           sort(all(f));
           reverse(all(a));
           ///////////////
           ll ok=1e12,ng=-1;
           while(ok-ng>1){
            ll mid=(ok+ng)/2;
             if(check(mid))ok=mid;
             else ng=mid;
           }
           cout<<ok<<endl;
}

Measured memory_bytes: 6404
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ansac = 0;
        int answa = 0;
        int anstle = 0;
        int ansre = 0;
        String str;
        for (int i=0; i<N; i++) {
            str = sc.next();
            if(str.equals("AC")) {
            	ansac = ansac + 1;
            }else if(str.equals("WA")){
            	answa = answa + 1;
            }else if(str.equals("TLE")){
            	anstle = anstle + 1;
            }else if(str.equals("RE")){
            	ansre = ansre + 1;
            }            
        }        
      		// 文字列の入力
		System.out.println("AC x " + String.valueOf(ansac));
		System.out.println("WA x " + String.valueOf(answa));
		System.out.println("TLE x " + String.valueOf(anstle));
		System.out.println("RE x " + String.valueOf(ansre));
	}
}

Measured memory_bytes: 49440
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  int a, b, c;
  cin >> a >> b >> c;
  if (abs(a-b) < abs(a-c)) cout << 'A';
  else cout << 'B';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

class UF {
public:
	int par[100000];
	int size[100000];
	
	UF() { for (int i = 0; i < 100000; i++) { par[i] = i; size[i] = 1; } }
	int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); }
	void marge(int x, int y) { x = root(x); y = root(y); if (x != y) { par[x] = y; size[y] += size[x]; } }
	int getSize(int x) { return size[root(x)]; }
};

int f(int x) { return x * (x - 1) / 2; }

UF uf;
int n, m;
int a, b;

signed main() {
	int i;
	
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> a >> b; a--; b--;
		uf.marge(a, b);
	}
	
	int A = uf.getSize(0);
	int B = uf.getSize(1);
	int C = n - A - B;
	
	int ans = 0;
	for (int x = 0; x <= C; x++) {
		ans = max(ans, f(A + x) + f(B + C - x) - m);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688
import collections as c
n = int(input())
P = list(map(int,input().split()))
ans = 0
x = []
y = []
for i in range(n):
    if i % 2 == 0:
        x.append(P[i])
    else:
        y.append(P[i])
p = c.Counter(x)
q = c.Counter(y)

values1, counts1 = zip(*p.most_common())
values2, counts2 = zip(*q.most_common())
if values1[0] == values2[0]:
    if len(values1) == 1 and len(values2) == 1:
        f = n // 2
        g = n // 2
    else:
        f = counts1[0] + counts2[1]
        g = counts1[1] + counts2[0]
    ans = n - max(f, g)
else:
    ans = n - (counts1[0] + counts2[0])

print(ans)

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

int main() {
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;
  double N,max_N=0;
  int max_X=0,max_Y=0;
  for(int i=0;i<101;i++){
    for(int j=0;j<101;j++){
      for(int k=0;k<101;k++){
        for(int l=0;l<101;l++){
          int X=100*A*i+100*B*j;
          int Y=C*k+D*l;
          if(X+Y<=F && X*E/100>=Y){
            N=(double)Y/(X+Y);
            if(N>=max_N){
              max_N=N;
              max_X=X;
              max_Y=Y;
            }
          }
        }
      }
    }
  }
  cout << max_X+max_Y << " " << max_Y << endl;
}
              


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

using namespace std;
using i64 = int64_t;
#define mp make_pair

i64 dp[3005][3005][4];
i64 v[3005][3005];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r, c, k;
    cin >> r >> c >> k;
    map<pair<int, int>, i64> item;
    for (int i = 0; i < k; i++)
    {
        int rr, cc;
        i64 vv;
        cin >> rr >> cc >> vv;
        v[rr][cc] = vv;
    }

    for (int i = 0; i <= r; i++)
    {
        for (int j = 0; j <= c; j++)
        {
            for (int k = 0; k <= 3; k++)
            {
                dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
                dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
                for (int l = 1; l <= 3; l++)
                    dp[i + 1][j][l] = max(dp[i + 1][j][l], dp[i][j][k] + v[i + 1][j]);
                for (int l = k + 1; l <= 3; l++)
                    dp[i][j + 1][l] = max(dp[i][j + 1][l], dp[i][j][k] + v[i][j + 1]);
            }
        }
    }
    // for (int k = 0; k <= 3; k++)
    // {
    //     for (int i = 0; i <= r; i++)
    //     {
    //         for (int j = 0; j <= c; j++)
    //         {
    //             cerr << dp[i][j][k] << " ";
    //         }
    //         cerr << endl;
    //     }
    //     cerr << "---" << endl;
    // }
    i64 ans = 0;
    for (int i = 0; i <= 3; i++)
        ans = max(ans, dp[r][c][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 355912
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N; cin >> N;
    veci A(N);
    REP(i,N) {
        cin >> A[i];
        A[i]--;
    }
    int ans = 0;
    REP(i,N) {
        if(A[A[i]] == i) ans++;
    }
    cout << ans/2 << endl;
}

Measured memory_bytes: 3728
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    static boolean binarySearch(int[] x, int index, int start, int end) {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    }
}


Measured memory_bytes: 51764
#include <stdio.h>
#include <vector>
#include <math.h>
#include <iostream>
 int main(){

     using namespace std;
     
     long n, r, b, sum, set, amari;
     long ans = 0;
     cin >> n >> b >> r;
     
     sum = r + b;
     
     set = n / sum;
     ans += b * set;
     
     amari = n % sum;

     if(amari >= b)
     {
         ans += b;
     } else{
         ans += amari;
     }
     
     cout << ans << endl;
     
     
     return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pi 3.141592653589793116
#define mod 1e9+7
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int main() {
  off;
  int t;
  //cin>>t;
  t=1;
  while(t--){ 
      long long a[6];
      for(int i=0;i<6;i++)
          cin>>a[i];
      double x=*min_element(a+1,a+6);
      x=ceil(a[0]/x);
      long long ans=x;
        cout<<ans+4<<" ";
  }
    return 0;
}

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

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

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

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

map<int_fast64_t, int> primeFactorize(int_fast64_t n) {
    map<int_fast64_t, int> ret;
    for (int_fast64_t i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            ++ret[i];
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

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

    intmax_t N;
    cin >> N;

    vector<intmax_t> cnt(1010);
    for (intmax_t i = 1; i <= N; ++i) {
        for (auto &elem: primeFactorize(i)) {
            while (elem.second--) cnt[elem.first]++;
        }
    }

    intmax_t res = 1;
    const intmax_t MOD = int(1e9) + 7;
    for (intmax_t i = 1; i <= N; ++i) {
        if (cnt[i]) {
            (res *= cnt[i] + 1) %= MOD;
        }
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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; }

using Weight = int;
using Flow = int;
struct Edge {
	int s, d; Weight w; Flow c;
	Edge() {};
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	Graph g(N);
	vector<int> in(N);
	vector<int> A(M), B(M); rep(i, 0, M) {
		cin >> A[i] >> B[i];
		A[i]--, B[i]--;
		addEdge(g, A[i], B[i]);
	}
	int s = 0;
	vector<int> ans;
	vector<bool> flag(N);
	flag[s] = true;

	ans.push_back(s);
	bool a = true;
	while (a) {
		a = false;
		for (auto e : g[s]) {
			if (!flag[e.d]) {
				s = e.d;
				a = true;
				ans.push_back(s);
				flag[s] = true;
				break;
			}
		}
	}

	vector<int> ans2;
	s = 0;
	a = true;
	while (a) {
		a = false;
		for (auto e : g[s]) {
			if (!flag[e.d]) {
				s = e.d;
				a = true;
				ans2.push_back(s);
				flag[s] = true;
				break;
			}
		}
	}
	reverse(all(ans2));
	ans2.insert(ans2.end(), all(ans));

	cout << ans2.size() << endl;
	cout << ans2[0] + 1; rep(i, 1, ans2.size()) { cout << " " << ans2[i] + 1; } cout << endl;
	return 0;
}

Measured memory_bytes: 10488
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include <complex>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const double EPS = 1e-6;
const int MAX = 250 * 1000 + 47;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int l = b - a;
    if (l % 2 == 0)
        cout << "Alice" << endl;
    else cout << "Borys" << endl;
    
    
}


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

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

    int sum = a+b;
    int sub = a-b;
    int mul = a*b;

    if(sum>=sub && sum>=mul) cout << sum;
    else if(sub>=sum && sub>=mul) cout << sub;
    else if(mul>=sum && mul>=sub) cout << mul;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			double l = sc.nextDouble();
			
			double edge = l/3;
			
			System.out.println(String.format("%f", Math.pow(edge, 3)));
		}
	}

}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int dp[100001][4];
ll maxHappiness(int arr[][3], int n, int i){
	//base condition
	if(n==0) return 0;
	//choice diagram
	if(dp[n][i]!=-1) return dp[n][i];
	ll x,y,z;
	if(i!=0) x = (ll)arr[n-1][0] + maxHappiness(arr, n-1, 0);
	else x=0;
	if(i!=1) y = (ll)arr[n-1][1] + maxHappiness(arr, n-1, 1);
	else y=0;
	if(i!=2) z = (ll)arr[n-1][2] + maxHappiness(arr, n-1, 2);
	else z=0;
	return dp[n][i] = max(x,max(y,z));
} 

int main(){
	memset(dp, -1, sizeof(dp));
	int n; cin>>n;
	int arr[n][3];
	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	ll ans = maxHappiness(arr, n, 3);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	int x;
	cin >> x;
	cout << (x >= 30 ? "Yes" : "No") << '\n';
}

Measured memory_bytes: 3648
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
if n%1000 == 0:
	print(0)
else:
	print( 1000 - n%1000)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a, b; cin >> a >> b;
  int N = stoi(a+b);
  REP(i, 320){
    if(i*i == N){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1e9+1;

/*

*/

set<int> st;

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
      st.insert(i);
    }
  }
  if(n != 1) {
    ret[n] = 1;
    st.insert(n);
  }
  return ret;
}

const int MAX = 110000;

ll 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;
    }
}

// 二項係数計算
ll 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;
}



void solve(){
    int n,m;
    cin >> n >> m;
    auto r = prime_factor(m);

    ll ans=1;
    COMinit();
    for(int i:st){
      //cout << i << endl;
      ans = (ans * COM(n+r[i]-1,r[i])) % MOD;
    }
    
    cout << ans << endl;
}

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


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

int main(){
    const int M =13;
    int n,i,x;
    bool s[M] = {0}, h[M] = {0}, c[M] = {0}, d[M] = {0};
    char l;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> l >> x;
        if(l == 'S') s[x-1] = 1;
        if(l == 'H') h[x-1] = 1;
        if(l == 'C') c[x-1] = 1;
        if(l == 'D') d[x-1] = 1;
            }
    for(i=0;i<M;i++){
        if(s[i] == 0) cout << "S " << i+1 <<endl;
    }
    for(i=0;i<M;i++){
        if(h[i] == 0) cout << "H " << i+1 <<endl;
    }
    for(i=0;i<M;i++){
        if(c[i] == 0) cout << "C " << i+1 <<endl;
    }
    for(i=0;i<M;i++){
        if(d[i] == 0) cout << "D " << i+1 <<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
n,m = map(int, input().split())
data = []
for i in range(n):
  a,b = map(int, input().split())
  data.append([a,b])
  
data = sorted(data)
res = 0

for i in range(n):
  a = data[i][0]
  b = data[i][1]
  c = 0
  while b > 0:
    if m <= 0:
      break
    m -= 1
    b -= 1
    c += 1
    
  res += a * c
print(res)
  

Measured memory_bytes: 20816
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    cout << n * n * n << endl;

    return 0;
}

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

/***** MAIN *****/
signed main() {
  int n;
  scanf("%d", &n);

  vector<int> v(n);
  int nums[n];
  REP(i,n) {
    scanf("%d", &nums[i]);
    v[i] = nums[i];
  }

  SORTR(v);
  int max = v[0];
  int second = v[1];
  REP(i,n) {
    if(nums[i] == max) {
      cout << second << endl;
      continue;
    }
    cout << max << endl;
  }
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define ld long double
#define int long long
#define double long double
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pi 3.141592653589793238
const int MOD = 1e9+7;
const int INF = 1LL<<60;


const int N = 2e5+5;

// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


void solve(){
    int n; cin>>n;
    vector<int> dp(n+1, 0);
    dp[0]=1;
    For(i, 3, n+1){
        For(j, 3, i+1){
            dp[i] += dp[i-j];
        }
        dp[i]%=MOD;
    }
    cout<<dp[n];
}   


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1; 
    // cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3572
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int dp[100050] = {0};
int main() {
	int n;
	cin >> n;
	vector<int> s;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	dp[0] = 0;
	dp[1] = dp[0] + abs(s[0]-s[1]);
	if (n == 2) {
		cout << dp[1];
	}
	else {
		for (int i = 2; i < n; i++) {
			dp[i] = min(dp[i - 2] + abs(s[i - 2] - s[i]), dp[i - 1] + abs(s[i - 1] - s[i]));
			if (i == n - 1) {
				cout << dp[i];
			}
		}
	}
}

Measured memory_bytes: 1144
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let s: Vec<char> = get!(String).chars().collect();
    let t: Vec<char> = get!(String).chars().collect();
    let mut t_answers: Vec<Vec<char>> = Vec::new();
    if s.len() < t.len() {
        println!("UNRESTORABLE");
        return;
    }
    'outer: for i in (0..s.len() - t.len() + 1).rev() {
        let mut t_answer: Vec<char> = s.clone();
        for j in 0..t.len() {
            if !(s[i + j] == t[j] || s[i + j] == '?') {
                continue 'outer;
            }
        }
        for j in 0..t.len() {
            t_answer[i + j] = t[j];
        }
        t_answers.push(t_answer);
    }
    let mut answers: Vec<String> = Vec::new();
    if t_answers.len() == 0 {
        println!("UNRESTORABLE");
    } else {
        for i in t_answers.iter_mut() {
            for j in 0..s.len() {
                if s[j] == '?' && i[j] == '?' {
                    i[j] = 'a';
                }
            }
            let mut tmp = String::new();
            for j in 0..i.len() {
                tmp += &i[j].to_string();
            }
            answers.push(tmp);
        }
        answers.sort();
        println!("{}", answers[0]);
    }
}


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

signed main(void)
{
	int n, m, tmp;
	string s;
	ll cnt, ans; 
	cin >> n >> s;
	vector<ll> w(n + 1, 0), b(n + 1, 0);

	for (int i = 1; i <= n; i++)
	{
		if (s[i - 1]  == '#')
			b[i]++;
		if (s[i - 1] == '.')
			w[i]++;
	}
	rep(i, n)
	{
		b[i + 1] += b[i];
		w[i + 1] += w[i];
	}
	ans = 200010;
	rep(i, n + 1)
	{
		cnt = b[i] + (w[n] - w[i]);
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6796
N, X = map(int, input().split())
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

# print(a, p)

def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= a[N-1]+1:
        #端のバンズを消すのでXから1引く
        return f(N-1, X-1)
    else:
        #N-1層のパティ数＋真ん中のパティ＋... X-2-a[i]は追加したBPと下側のN-1層の分を引く
        return p[N-1]+1+f(N-1, X-2-a[N-1])
print(f(N, X))


Measured memory_bytes: 9168
#include <stdio.h>
int main(void){
        int i,j,h,w;

        while(1){
                scanf("%d %d",&h,&w);
                if(h==0 && w==0) break;

                for(i=0;i<h;i++){
                        for(j=0;j<w;j++){
                                printf("#");
                        }puts("");
                }puts("");
        }
        return 0;
}


Measured memory_bytes: 2072
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdint>
#include <cmath>
#include <numeric>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

int main()
{
  int n;
  string s;


  cin >> n;
  cin >> s;


  vector<bool> bc;
  vector<int> num;

  int num_w = 0;
  if(s[0] == '.')
    {
      bc.push_back(false);
      ++num_w;
    }
  else
    {
      bc.push_back(true);
    }
  num.push_back(1);

  // run length encoding
  for(int i = 1;
      i < n;
      ++i)
    {
      if(s[i] != s[i - 1])
        {
          if(s[i] == '.')
            {
              bc.push_back(false);
              ++num_w;
            }
          else
            {
              bc.push_back(true);
            }
          num.push_back(1);
        }
      else
        {
          if(s[i] == '.')
            {
              ++num_w;
            }
          ++num.back();
        }
    }

  int ret = n;
  int num_b = 0;

  for(int i = 0;
      i < bc.size();
      ++i)
    {
      ret = min(ret,num_w + num_b);
      if(bc[i])
        {
          num_b += num[i];
        }
      else
        {
          num_w -= num[i];
        }
    }
  ret = min(ret,num_w + num_b);

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 1532
s = gets.chomp
a = Array.new(s.size + 1, 0)

n = s.size + 1
n.times do |i|
  if i == 0
    # a[0] = 0 if s[i] == "<"
    next
  else
    if s[i-1] == "<"
      a[i] = a[i-1] + 1
    end
  end
end
# p a
(n-1).downto(0) do |i|
  if i == n-1
    next
  else
    if s[i] == ">"
      a[i] = a[i+1] + 1 if a[i+1] + 1 > a[i]
    end
  end
end
# p a
p a.inject(&:+)
  


Measured memory_bytes: 6788
N = int(input())
As, Bs = list(), list()
for i in range(N):
    A, B = map(int, input().split())
    As.append(A)
    Bs.append(B)

Bs_with_index = sorted([(Bs[i], i) for i in range(len(Bs))])
indices = list(map(lambda b: b[1], Bs_with_index))

time = 0
for index in indices:
    time += As[index]
    if time > Bs[index]:
        print('No')
        break

else:
    print('Yes')

Measured memory_bytes: 40516
#include <stdio.h>
#include <stack>

int main(void) {
  int n;
  scanf("%d", &n);
  std::stack<int> s;
  if(!n) s.push(0);
  while(n) {
    s.push(n % 2 ? 1 : 0);
    if(n % 2) n -= 1;
    n /= -2;
  }
  while(!s.empty()) {
    printf("%d",s.top()); s.pop();
  }
  return 0; 
}

Measured memory_bytes: 256
#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>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll h[1000000];
ll v[1000000];
ll a[1000000];
ll acopy[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	cin>>N>>M;
	ans =1;
	if(N==1){
		cout<<M<<endl;
		return 0;
	}
	urep(i,sqrt(M)+1,2){
		if(M%i==0){
			ll num = M/i;
			if(M>=num*N){
				ans=max(ans,num);
			}else{
				if(M>=i*N){
					ans=max(ans,i);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N == 1) {
            System.out.println("Hello World");
        } else {
            int A = sc.nextInt();
            int B = sc.nextInt();
            System.out.println(A + B);
        }
        sc.close();
    }
}

Measured memory_bytes: 22100
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int A, B, C;

	public static void main(String[] args) {
		while (true) {
			A = sc.nextInt();
			if (A == 0) break;
			B = sc.nextInt();
			int rem = B - A;
			int t = rem / 1000;
			rem -= t * 1000;
			int f = rem / 500;
			rem -= f * 500;
			System.out.println(rem / 100 + " " + f + " " + t);
		}
	}

}

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

int main(){
    int c=0;
    string s,t;
    cin >> s >> t;
    string ans="No";
    rep(i,s.length()){
        if(s[i]!=t[i]){
            break;
            }else if(s[i]==t[i]){
                c++;
                if(s.length()+1==t.length() and c==s.length()){
                cout << "Yes" << endl;
                return 0;
                }   
            }
        }
        
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3520
#include<stdio.h>
#define MAX 10000

int main(void)
{

    int a;
    int i;

    for(i = 1;i <= MAX;i++){
      scanf("%d",&a);

      if(a == 0)
        break;
      else
        printf("Case %d: %d\n",i,a);
    }

    return 0;
}



Measured memory_bytes: 2596
import sys


def prepare(n):
    fact = [1] * (n + 1)
    for i in range(1, n + 1):
        fact[i] = fact[i - 1] * i % MOD
    inv = [1] * (n + 1)
    inv[n] = pow(fact[n], MOD - 2, MOD)
    for i in range(n - 1, 0, -1):
        inv[i] = inv[i + 1] * (i + 1) % MOD
    return fact, inv


MOD = 10 ** 9 + 7
h, w, n = map(int, input().split())
walls = [tuple(map(int, line.split())) for line in sys.stdin.readlines()]
walls.append((1, 1))
walls.append((h, w))
walls.sort()
fact, inv = prepare(h + w)
dp = [1]
for i, (cy, cx) in enumerate(walls[1:], start=1):
    res = 0
    for j, (py, px) in enumerate(walls[:i]):
        if cx < px:
            continue
        dy, dx = cy - py, cx - px
        res -= dp[j] * fact[dy + dx] % MOD * inv[dy] % MOD * inv[dx] % MOD
        res %= MOD
    dp.append(res)
print(-dp[-1] % MOD)


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


int main(void){
    // Your code here!
    int N = 0;
    
    cin >> N;
    
    int a = N / 100;
    if (a == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N = N - a * 100;
    int b = N / 10;
    if (b == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N = N - b * 10;
    int c = N;
    if (c == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
    
}


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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int main(){
  int H, W;cin>>H>>W;
  int L=W-1+(H-1)*W;
  vvi a;
  for (int i=0;i<H;++i){
    vi ai;
    for (int j=0;j<W;++j){
      int aij;cin>>aij;
      ai.push_back(aij);
    }
    a.push_back(ai);
  }

  vii path;
  ii position=make_pair(0,0);
  path.push_back(position);
  while(position.first<H&&position.second<W){
    if(position.first==H-1&&position.second%2==0){
      int x=position.second;
      position=make_pair(H-1, x+1);
      path.push_back(position);
    }
    else if(position.first==0&&position.second%2==1){
      int x=position.second;
      position=make_pair(0, x+1);
      path.push_back(position);
    }
    else if(position.second%2==0){
      int y=position.first;
      int x=position.second;
      position=make_pair(y+1, x);
      path.push_back(position);
    }
    else{
      int y=position.first;
      int x=position.second;
      position=make_pair(y-1, x);
      path.push_back(position);
    }
  }

  vector<pair<ii, ii>> move;
  int count=0;

  for(int n=0;n<L;++n){
    ii position = path[n];
    ii nxt_pos=path[n+1];
    int i=position.first;
    int j=position.second;
    int i_=nxt_pos.first;
    int j_=nxt_pos.second;
    if (a[i][j]%2==1){
      ii p=make_pair(i+1,j+1);
      ii q=make_pair(i_+1,j_+1);
      pair<ii, ii> r=make_pair(p,q);
      move.push_back(r);
      count++;
      a[i_][j_]++;
    }
  }

  cout << count << endl;

  for (int c=0;c<count;++c){
    ii p=move[c].first;
    ii q=move[c].second;
    int y=p.first;
    int x=p.second;
    int y_=q.first;
    int x_=q.second;
    printf("%d %d %d %d\n",
                y,
                x,
                y_,
                x_);
  }
  return 0;
}


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

using namespace std;
using LL = long long;
const int N = 1024;
const int INF = INT32_MAX - 1;
const double EPS = 1E-9;

int a[N];
int n, m;

int main() {
    ios_base::sync_with_stdio(false);

#ifdef CF_DEBUG
    freopen("../cf/input.txt", "r", stdin);
#endif
    LL n, a, b;
    cin >> n >> a >> b;
    LL res = 0;
    res += n / (a + b) * a;
    LL v = n % (a + b);
    res += min(v, a);
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int64 h; cin >> h;
	int64 ans = 0;
	int64 loop_cnt = 0;
	if (h == 1) {
		cout << 1 << endl;
		return;
	}
	while (h > 0) {
		ans += pow(2, loop_cnt);
		h /= 2;
		loop_cnt++;
	}
	cout << ans << endl;
	return;
}

int main() {
	solve();
  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
aa = [list(map(int, input().split())) for i in range(H)]
ans =[]
for i in range(H):
    if i % 2 == 0:
        for j in range(W):
            if aa[i][j]%2 == 1:
                aa[i][j] -= 1
                if j == W-1and i <H-1:
                    aa[i+1][j] += 1
                    ans.append([i+1, j+1, i+2, j+1])
                elif 0 <= j <= W-2:
                    aa[i][j+1] += 1
                    ans.append([i+1, j+1, i+1, j+2 ])
    if i%2 == 1:
        for j in range(W-1,-1, -1):
            if aa[i][j]%2 == 1:
                aa[i][j] -= 1
                if j == 0 and i < H-1:
                    aa[i+1][j] += 1
                    ans.append([i+1, j+1, i+2, j+1])
                elif 1<= j <= W-1:
                    aa[i][j-1] += 1
                    ans.append([i+1, j+1, i+1, j])
num = len(ans)
print(num)
for i in range(num):
    print(ans[i][0], ans[i][1], ans[i][2], ans[i][3])

Measured memory_bytes: 30256