akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
 
using namespace std;

/**************************************************************************/
int main()
{
	fastIO;
	ll t,n,i,j,k,a[21],cnt=0,lst,one=0,idx,sum;
	fo(i,21)a[21]=0;
	cin>>n;
	fo(i,20)a[i]=n&(1<<i);
	fo(i,20)if(a[i]>0)lst=i,one++;
	cout<<lst+1<<" "<<2*(lst)+one-1<<endl;
	fo(i,lst)
	{
		cout<<i+1<<" "<<i+2<<" "<<(1<<i)<<endl;
		cout<<i+1<<" "<<i+2<<" "<<0<<endl;
	}
	one--;
	idx = lst - 1;
	sum = 1<<lst;
	while(one>0)
	{
		while(idx>=0 and a[idx]==0)idx--;
		cout<<idx+1<<" "<<lst+1<<" "<<sum<<endl;
		sum += 1<<idx;
		idx--;
		one--;
	}
}/*************************************************************************/ 

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void read(int &x){
    x=0;char ch;bool flag = false;
    while(ch=getchar(),ch<'!');if(ch == '-') ch=getchar(),flag = true;
    while(x=10*x+ch-'0',ch=getchar(),ch>'!');if(flag) x=-x;
}
#define rg register int
#define rep(i,a,b) for(rg i=(a);i<=(b);++i)
#define per(i,a,b) for(rg i=(a);i>=(b);--i)
const int maxn = 2048;
const int maxm = 100010;
char s[maxn][maxn];
int sum_node[maxn][maxn];
int sum_edgex[maxn][maxn];
int sum_edgey[maxn][maxn];
int n,m;
inline void init(){
    rep(i,1,n) rep(j,1,m){
        if(s[i][j] == '1') sum_node[i][j] = 1;
        else sum_node[i][j] = 0;
        sum_node[i][j] += sum_node[i-1][j] + sum_node[i][j-1] - sum_node[i-1][j-1];
    }
    rep(i,1,n) rep(j,1,m){
        if(s[i][j] == '1' && s[i-1][j] == '1') sum_edgex[i][j] = 1;
        else sum_edgex[i][j] = 0;
        if(s[i][j] == '1' && s[i][j-1] == '1') sum_edgey[i][j] = 1;
        else sum_edgey[i][j] = 0;
        sum_edgex[i][j] += sum_edgex[i-1][j] + sum_edgex[i][j-1] - sum_edgex[i-1][j-1];
        sum_edgey[i][j] += sum_edgey[i-1][j] + sum_edgey[i][j-1] - sum_edgey[i-1][j-1];
        //printf("sum_edgex[%d][%d] = %d\n",i,j,sum_edgex[i][j]);
        //printf("sum_edgey[%d][%d] = %d\n",i,j,sum_edgey[i][j]);
    }
}
inline int calc(int x2,int y2,int x1,int y1,int s[2048][2048]){
    return s[x2][y2] - s[x1-1][y2] - s[x2][y1-1] + s[x1-1][y1-1];
}
int main(){
    read(n);read(m);int q;read(q);
    rep(i,1,n) scanf("%s",s[i]+1);
    init();
    int x1,x2,y1,y2;
    while(q--){
        read(x1);read(y1);read(x2);read(y2);
        if(x1 > x2) swap(x1,x2);
        if(y1 > y1) swap(y1,y2);
        int ans = 0;
        ans -= calc(x2,y2,x1,y1+1,sum_edgey);
        ans -= calc(x2,y2,x1+1,y1,sum_edgex);
        ans += calc(x2,y2,x1,y1,sum_node);
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 54912
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
const ll MOD = 10007;

struct WarshallFloyd{
    int n;
    vector<vll> d;

    WarshallFloyd(int n) : n(n), d(n, vll(n, INF)) {
        REP(i, n) d[i][i] = 0;
    }

    void add_edge(int s, int t, ll c) {
        d[s][t] = c;
    }

    ll query(int s, int t) {
        return d[s][t];
    }

    WarshallFloyd& operator()() {
        REP(k, n) {
            REP(i, n) REP(j, n) {
                if (d[i][k] == INF || d[k][j] == INF) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }

        return *this;
    }

    bool neg_cycle() {
        REP(i, n) {
            if (d[i][i] < 0) return true;
        }

        return false;
    }
};

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

    int n; cin >> n;

    vector<vll> a(n, vll(n)), p(n, vll(n, 0));
    REP(i, n) REP(j, n) cin >> a[i][j];

    REP(i, n) REP(j, n) {
        ll d = a[i][j];
        bool f = true;
        REP(k, n) {
            if (i == k || j == k) continue;
            if (d > a[i][k] + a[k][j]) {
                print(-1);
                return 0;
            }

            f &= d < a[i][k] + a[k][j];
        }

        if(f) p[i][j] = a[i][j];
    }

    ll ans = 0;
    REP(i, n) REP(j, n) ans += p[i][j];

    print(ans / 2);
}

Measured memory_bytes: 4768
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	buf := make([]byte, 100001)
	scanner.Buffer(buf, 100001)

	rs := []rune(getString())
	cnt := -1
	now := '-'
	for _, r := range rs {
		if r != now {
			cnt++
			now = r
		}
	}

	fmt.Println(cnt)
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a;
	cin >> a;
	if (a >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1)res=res*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return res;
}

ll inverse_element(ll t){
	return mod_pow(t,MOD-2);
}
ll n,k;
ll a[100100];
int main(){
	cin>>n>>k;
	REP(i,n){
		cin>>a[i];
	}
	sort(a,a+n,greater<ll>());
	ll ans1=0;
	ll t=1;
	for(ll i=0;i<n-k+1;i++){
		ans1+=t*a[n-k-i];
		ans1%=MOD;
		t*=(k+i);
		t%=MOD;
		t*=inverse_element(i+1);
		t%=MOD;
	}
	ll ans2=0;
	t=1;
	sort(a,a+n);
	for(ll i=0;i<n-k+1;i++){
		ans2+=t*a[n-k-i];
		ans2%=MOD;
		t*=(k+i);
		t%=MOD;
		t*=inverse_element(i+1);
		t%=MOD;
	}
	cout<<(ans1-ans2+MOD)%MOD<<endl;
}

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

void dfs(int now, vector<set<int>> &G, vector<int> &group){
    for(auto next: G.at(now)){
        if(group.at(next) == -1){
            group.at(next) = group.at(now);
            dfs(next, G, group);
        }
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<set<int>> G(n);
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G.at(a).insert(b);
        G.at(b).insert(a);
    }
    vector<int> group(n,-1);
    int cnt=0;
    for(int i=0; i<n; i++){
        if(group.at(i) == -1){
            group.at(i) = cnt;
            cnt++;
            dfs(i, G, group);
        }
    }
    map<int, int> ma;
    for(int i=0; i<n; i++){
        int k=group.at(i);
        ma[k]++;
    }
    int ans=1;
    for(auto p: ma){
        ans = max(ans, p.second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 44544
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
alice_deck = [a[i] for i in range(len(a)) if i%2==0]
bob_deck = [a[i] for i in range(len(a)) if i%2==1]
print(sum(alice_deck) - sum(bob_deck))

Measured memory_bytes: 3060
import java.util.*;
import java.awt.geom.Line2D;

class Main{
    int n;
    int xa,ya,xb,yb;
    int[] xs,ys,xt,yt,o,l;
    Line2D a,b;
    Intersection[] inter;

    class Intersection{
	double dist;
	int owner,height;
	public Intersection(double dist,int owner,int height){
	    this.dist = dist;
	    this.owner = owner;
	    this.height = height;
	}
    }

    void solve(){
	Scanner sc = new Scanner(System.in);
	int T = sc.nextInt();
	while(T--!=0){
	    xa = sc.nextInt(); ya = sc.nextInt();
	    xb = sc.nextInt(); yb = sc.nextInt();
	    n = sc.nextInt();
	    xs = new int[n]; ys = new int[n];
	    xt = new int[n]; yt = new int[n];
	    o = new int[n];
	    l = new int[n];
	    for(int i=0; i<n; i++){
		xs[i] = sc.nextInt(); ys[i] = sc.nextInt();
		xt[i] = sc.nextInt(); yt[i] = sc.nextInt();
		o[i] = sc.nextInt();
		l[i] = sc.nextInt();
	    }

	    inter = new Intersection[n];
	    for(int i=0; i<n; i++){
		a = new Line2D.Double(xa,ya,xb,yb);
		b = new Line2D.Double(xs[i],ys[i],xt[i],yt[i]);
		if(!a.intersectsLine(b)){
		    inter[i] = new Intersection(-1,-1,-1);
		    continue;
		}
		double d = calcDist(xa,ya,xb,yb,xs[i],ys[i],xt[i],yt[i]);
		inter[i] = new Intersection(d,o[i],l[i]);
	    }

	    for(int i=0; i<n; i++){
		double minD = inter[i].dist;
		int minIndex = i;
		for(int j=i; j<n; j++){
		    if(inter[j].dist<minD){
			minD = inter[j].dist;
			minIndex = j;
		    }
		}
		Intersection tmp = inter[minIndex];
		inter[minIndex] = inter[i];
		inter[i] = tmp;
	    }

	    int ans = Math.min(countGate(0),countGate(1));

	    System.out.println(ans);
	}
    }

    double calcDist(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4){
	double bx = x4-x3;
	double by = y4-y3;
	double d1 = Math.abs(bx*(y1-y3)-by*(x1-x3));
	double d2 = Math.abs(bx*(y2-y3)-by*(x2-x3));
	double t = d1/(d1+d2);	
	double x = x1+(x2-x1)*t;
	double y = y1+(y2-y1)*t;

	return (xa-x)*(xa-x)+(ya-y)*(ya-y);
    }

    int countGate(int nowHeight){
	int count = 0;
	for(int i=0; i<n; i++){
	    if(inter[i].dist==-1)continue;
	    if(inter[i].owner==0){
		if(inter[i].height==nowHeight){
		    nowHeight = 1 - nowHeight;
		    count++;
		}
	    }else{
		if(inter[i].height!=nowHeight){
		    nowHeight = 1 - nowHeight;
		    count++;
		}
	    }
	}
	return count;
    }

    public static void main(String[] args){
	new Main().solve();
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

ll N;

ll solve() {
    ll ret = 0;
    FOR (k, 1, N+1) {
        ll n = N/k;
        ret += n*(n+1)/2*k;
    }
    return ret;
}

int main() {
    cout << fixed << setprecision(15);
    cin >> N;
    cout << solve() << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
	while(1){
		string s;
		cin >> s;
		if(s == "0") return 0;
		int num=0;
		for(int i=0;i<s.size();i++) num+=s[i]-'0';
		cout<<num<<endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, cnt, tmp, minj;
  bool flag = false;
  string s;
  vector<int> v;
  cin >> n;
  cin.ignore();
  getline(cin, s);
  stringstream ss(s);
  while (ss >> tmp)
    v.push_back(tmp);

  cnt = 0;

  for (int i = 0; i < n; i++) {
    minj = i;
    for (int j = i; j < n; j++) {
      if (v[j] < v[minj]) {
        minj = j;
        flag = true;
      }
    }
    if (flag) {
      tmp = v[i];
      v[i] = v[minj];
      v[minj] = tmp;
      cnt++;
      flag = false;
    }
  }

  for (int i = 0; i < n; i++) {
    if (i == n - 1)
      cout << v[i] << endl;
    else
      cout << v[i] << ' ';
  }

  cout << cnt << endl;

  return 0;
}



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

int main(){
  int n;
  char s[102],t[101];
  string ans;
  cin >> n;
  for(int i=0;i<n;i++)
    cin >> s[i];
  for(int i=0;i<n;i++)
    cin >> t[i];
  for(int i=0;i<n;i++)
    ans = ans+s[i]+t[i];
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <cassert>
#include <iostream>
#include <vector>
#include <set>

struct UnionFind {
  std::vector<int> data;
  UnionFind(const int size) : data(size, -1) {}
  int root(const int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(const int x) { return -data[root(x)]; }
  bool same(const int x, const int y) { return root(x) == root(y); }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    else {
      if (data[y] < data[x])
        std::swap(x, y);
      data[x] += data[y];
      data[y] = x;
      return true;
    }
  }
};

int main() {
  // Input
  int N, M;
  std::cin >> N >> M;
  std::vector<int> X(M), Y(M), Z(M);
  for (int i = 0; i < M; ++i)
    std::cin >> X[i] >> Y[i] >> Z[i];

  // Main
  UnionFind uf(N);
  for (int i = 0; i < M; ++i)
    uf.unite(X[i] - 1, Y[i] - 1);

  // Output
  std::set<int> res;
  for (int j = 0; j < N; ++j)
    res.insert(uf.root(j));
  std::cout << res.size() << std::endl;

  return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;

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

//素因数分解
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > res;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
int main(){
    int N,M;cin>>N>>M;
    COMinit();
    auto vec = prime_factor(M);
    long long res = 1;
    for (auto pa : vec) {
        int num = pa.second;
        long long tmp = COM(num+N-1, N-1);
        res = (res * tmp) % MOD;
    }
    cout << res << endl;
    return 0;
}

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

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        long[] A = in.ll(N);

        long ans = 0;
        int mod = 1_000_000_007;
        for (int i = 0; i < 60; i++) {
            long b = 1L << i;
            int z = 0;
            for (int j = 0; j < N; j++) {
                if ((A[j] & b) == 0) {
                    z++;
                }
            }
            ans = (ans + b % mod * z % mod * (N - z) % mod) % mod;
        }

        System.out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    long[] ll(final int N) {
        long[] a = new long[N];
        for (int j = 0; j < a.length; j++) a[j] = l();
        return a;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 37908
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define ll long long
//不要再爆long long了！！！！！！！！不要再爆long long了！！！！！！！ 

int main()
{
	int t,i,w;
	for(i=1;i<6;i++)
	{
		cin>>t;
		if(!t)w=i;
	}
	cout<<w;
	return 0;
}

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

int main ()
{
	int x, y;
	while ((cin >> x >> y), x, y)
	{
		for (int i=1; i<=x; i++)
		{
		
			for (int j=1; j<=y; j++)
			{
				cout << "#";
				if (j==y) cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
fn main() {
    let kx = read_vec::<i32>();
    let min: i32 = *[kx[1] - kx[0] + 1, -1000000].iter().max().unwrap();
    let max: i32 = *[kx[1] + kx[0] - 1, 1000000].iter().min().unwrap();
    let mut s = String::new();
    for i in min..(max + 1) {
        s = format!("{} {}", s, i.to_string());
    }
    println!("{}", s.trim());
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    string S;
    cin >> S;
    int N = S.size();

    vector<int> ans(N);

    for (int i = 0, j, k; i < N; i = k) {
        for (j = i + 1; j < N; ++j) {
            if (S[j] == 'L') break;
        }

        for (k = j; k < N; ++k) {
            if (S[k] == 'R') break;
        }

        int cr = j - i - 1;
        int cl = k - j - 1;
        ans[j] += (cr + 1) / 2;
        ans[j - 1] += cr / 2;
        ans[j] += 1;
        ans[j - 1] += 1;
        ans[j] += cl / 2;
        ans[j - 1] += (cl + 1) / 2;
    }

    rep(i, N) {
        cout << ans[i] << (i == N - 1 ? '\n' : ' ');
    }
}

Measured memory_bytes: 1104
#include <stdio.h>

int n, A[50];


int solve(int i, int m) {
    if(m==0) return 1;
    if(i>=n) return 0;
    int res = solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(void) {
    int q, M, i;

    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    scanf("%d",&q);
    for(i=0;i<q;i++) {
        scanf("%d", &M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<P> ab(n);
  for (int i = 0; i < n; i++) {
    cin >> ab[i].second >> ab[i].first;
  }
  sort(all(ab));
  int now = 0;
  for (int i = 0; i < n; i++) {
    if (ab[i].first - now >= ab[i].second) {
      now += ab[i].second;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 1920
a = list(map(int, input().split()))

cnt = 0
high = a[0]
low = a[1]
origin = 0
b = [a[2]+a[4], a[3]+a[4]]
for i in b:
    if high < i:
        print('No')
        break
    elif low < i:
        print('No')
        break
    elif origin > i - a[4] * 2:
        print('No')
        break
    else:
        cnt += 1
    
if cnt == 2:
    print('Yes')


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

int main(){
  double  W,H,x,y;
  cin >>W>>H>>x>>y;
  
  cout<<setprecision(15)<<W*H/2<<" ";
  if((x==W/2)&&(y==H/2)){
    cout<<1<<endl;
  }
  else cout<<0<<endl;
  return 0;
}

  
  
 

Measured memory_bytes: 256
N,M,C = map(int,input().split())
B = [int(i) for i in input().split()]
_input = []
for i in range(N):
    _input.append(list(map(int,input().split())))

res = 0

for A in _input:
    cal = 0
    for a,b in zip(A,B):
        cal += a * b
    if cal + C > 0:
        res += 1

print(res)

Measured memory_bytes: 3064
from math import ceil

# 入力
N, K = map(int, input().split())

# サイコロの各目について勝率を求め、それらの和を解とする
ans = sum(
    1 / (2**((ceil(K / i) - 1).bit_length()))
    for i in range(1, N + 1)
) / N

# 出力
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  int a,b;
  cin >> a >> b;
  vector<vector<char>> data(100, vector<char>(100,'.'));
  rep(i,50)rep(j,100){ data[i][j]='#'; }
  int cnt=a-1;
  rep(i,25)rep(j,50)if(cnt){ data[i*2][j*2]='.'; cnt--;}
  cnt=b-1;
  rep(i,25)rep(j,50)if(cnt){ data[51+i*2][j*2]='#'; cnt--;}

  cout << 100 << " " << 100 << endl;
  rep(i,100){ rep(j,100){ cout << data[i][j]; }  cout<<endl; }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int d,n;
  cin >> d >> n;
  if(n==100) n++;
  cout << (int)(n*pow(100,d)) << endl;
}


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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll N = (ll)5e5 + 2;
const ll MOD = (ll)1e9 + 7;
const ll MOD1 = (ll)998244353;
const ll inf = (ll)1e18 + 6;

template <class T>
bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll add(ll x, ll y)
{
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}

ll sub(ll x, ll y)
{
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}

ll mult(ll x, ll y)
{
    return (x * y) % MOD;
}

ll bin_pow(ll x, ll p)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return mult(x, bin_pow(x, p - 1));
    return bin_pow(mult(x, x), p / 2);
}

ll rev(ll x)
{
    return bin_pow(x, MOD - 2);
}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(20);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif
    ll n, m;
    cin >> n >> m;
    if (m >= n)
        cout << "unsafe\n";
    else
        cout << "safe\n";
}


Measured memory_bytes: 3648
a = int(input())
x = []
for i in range(a):
    if (i + 1) % 3 == 0:
        if (i + 1) % 5 == 0:
            continue
        else:
            continue
    elif (i + 1) % 5 == 0:
        continue
    else:
        x.append(i + 1)
print(sum(x))

Measured memory_bytes: 29980
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 1999999999
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

#ifdef INPUT
stringstream input(R"(
keyence
)");
#define cin input
#endif

int main()
{
    string s;
    cin >> s;
    string ans = "NO";
    int n = s.size();

    if (n>=7)
    {
        if (s.substr(0,7) == "keyence")
            ans = "YES";
        else if (s.substr(0,6) == "keyenc" && s.substr(n-1,1) == "e")
            ans = "YES";
        else if (s.substr(0,5) == "keyen" && s.substr(n-2,2) == "ce")
            ans = "YES";
        else if (s.substr(0,4) == "keye" && s.substr(n-3,3) == "nce")
            ans = "YES";
        else if (s.substr(0,3) == "key" && s.substr(n-4,4) == "ence")
            ans = "YES";
        else if (s.substr(0,2) == "ke" && s.substr(n-5,5) == "yence")
            ans = "YES";
        else if (s.substr(0,1) == "k" && s.substr(n-6,6) == "eyence")
            ans = "YES";
        else if (s.substr(n-7,7) == "keyence")
            ans = "YES";
    }

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

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
#define maxn 100010
struct Cut
{
    int left,right;
}cut[maxn];

bool compare(const Cut x,const Cut y)
{
    if(x.right!=y.right)
        return x.right<y.right;
    else
        return x.left<y.left;
}


int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&cut[i].left,&cut[i].right);
    }
    sort(cut,cut+m,compare);
    int now=0;
    int answer=0;
    for(int i=0;i<m;i++)
        if(cut[i].left>=now)
        {
            answer++;
            now=cut[i].right;
        }
    printf("%d\n",answer);
    return 0;
}


Measured memory_bytes: 896
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n,a[100004],sum=0;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2!=0) sum++;
	}
	if(sum%2==0) cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 640
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
void solve()
{
    string s;
    cin>>s;
    int n=s.len;
    int cu=0;
    char c=s[0];
    rep1(i,n-1){
        if(s[i]==c) continue;
        else{
            cu++;
            c=s[i];
        }
    }
    pr(cu);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
//const long long INF = 1LL << 60;
 int INF = 500000;
 int MAX = 1e5+10;
 ll mod = 998244353;

int main(){
  int a,p;
  cin >> a >> p;
  int total = 3*a + p;
  total /= 2;
  cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  rep(i, n) {
    int a;
    cin >> a;
    mp[a]++;
  }
  bool ans = true;
  int k = 0;
  for(auto v : mp) k = max(k, v.first);
  for(int i = k; i >= (k + 1) / 2; i--) {
    int num = k % 2 ? 2 : 1;
    if(mp[i] < num)
      ans = false;
    else
      mp[i] -= num;
  }
  for(auto v : mp)
    if(v.first <= (k + 1) / 2 && v.second > 0) ans = false;
  cout << (ans ? "Possible" : "Impossible") << endl;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int i##_to_ = (t), i = (f); i <= i##_to_; i++)
#define uptil(f, t, i)   for(int i##_to_ = (t), i = (f); i <  i##_to_; i++)
#define downto(f, t, i)  for(int i##_to_ = (t), i = (f); i >= i##_to_; i--)
#define downtil(f, t, i) for(int i##_to_ = (t), i = (f); i >  i##_to_; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 2
#define _LIBCPP_DEBUG2 2
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '



signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    long K;
    long N;
    scanf("%lld", &K);
    scanf("%lld", &N);

    if(K == 1) {
        cout << 1;
        times((N-1)/2, i) cout sp << 1;
        cout ln;
        return 0;
    }

    if(K % 2 == 0) {
        cout << K/2;
        times(N-1, i) cout sp << K;
        cout ln;
        return 0;
    }

    if(N == 1) {
        cout << (K+1) / 2 ln;
        return 0;
    }

    long X[50]; X[0] = 1;
    long xi = 0;

    times(N, h) {
        X[h+1] = X[h] * K + 1;
        if(X[h+1] > N * N) {
            xi = N-h-1; break;
        }
    }

    xi += !xi;

    if(debug) { upto(0, N-xi, i) cout << (i?" ":"") << X[i]; cout ln; }

    long dc2 = 0;
    times(xi, i) {
        --dc2;
        cout << (i ? " " : "") << (K+1)/2;
    }

    long pyon = (X[N-xi] + dc2) / 2;
    if(debug) cout sp << dc2 sp << X[N-xi] sp << pyon ln;

    uptil(xi, N, i) {
        if(pyon == 0) break;
        --pyon;
        if(pyon < 0) pyon /= !i;
        cout << (i ? " " : "") << pyon / X[N-1-i] + 1;
        pyon %= X[N-1-i];
    }
    cout ln;

    return 0;
}


Measured memory_bytes: 2304
n = gets.to_i
x,y = Array.new(), Array.new()
x = gets.split.map(&:to_f)
y = gets.split.map(&:to_f)
d1,d2,d3,d = 0,0,0,0
n.times do |i|
    d1 += (x[i]- y[i]).abs
    d2 += (x[i]- y[i])**2
    d3 += ((x[i]- y[i]).abs)**3
    d = (x[i]- y[i]).abs if (x[i]- y[i]).abs > d
end
d2 = Math.sqrt(d2)
d3 = Math.cbrt(d3)
puts d1
puts d2
puts d3
puts d


Measured memory_bytes: 6968
def inpl(): return input().split()
N, T = map(int, inpl())
t = list(map(int, inpl()))

ret = 0
for i in range(1, N):
    if (t[i] - t[i-1]) < T:
        ret += (t[i] - t[i-1])
    else:
        ret += T
ret += T
print(ret)

Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
int n;
int q[10005];
int main()
{
    scanf("%d",&n);
    q[1]=1;
    for(int i=2;i<=10001;i++)
            q[i]=q[i-1]+i;
    int x=lower_bound(q+1,q+10001,n)-q;
   // cout<<x<<endl;
   if(n==q[x])
   {
       for(int i=1;i<=x;i++)
        cout<<i<<endl;
   }
   else
    {
        //cout<<x<<endl;
        x--;
        for(int i=1;i<=x;i++)
    {
        if(i!=x-n+q[x]+1)
            printf("%d\n",i);
    }
    printf("%d\n",x+1);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll x,y;cin>>x>>y;
    ll mini=1e18;
    if(x<=y)chmin(mini,y-x);
    if(-x<=y)chmin(mini,y+x+1);
    if(x<=-y)chmin(mini,-y-x+1);
    if(-x<=-y)chmin(mini,-y+x+2);
    cout<<mini<<endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pii pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#define fio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define vll vector<long long int>
#define vpii vector<pair<int,int>>
#define dsc [](int a,int b)->bool {return a>b;}
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define MAX 1000000000000000000
#define test int t; cin>>t;
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()

using namespace std;

ll nxt(){
    ll x;
    cin>>x;
    return x;
}

int main()
{
    #ifndef ONLINE_JUDGE
        fio
    #endif
    IOS

    string s;
    cin>>s;
    int res = 0;
    for(int i = 0; i<3; i++){
        if(s[i] == 'R'){
            int cnt = 0;
            for(int j = i; j<3; j++,i++){
                if(s[j] == 'R'){
                    cnt++;
                }
                else break;
            }
            res = max(res,cnt);
        }
    }

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 3600
// inputに入力データ全体が入る
function Main(input) {
	var ans = 'NG'
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.trim().split("\n");
	s1 = input[0].split(' ').map((n) => (parseInt(n)))
	s2 = input[1].split(' ').map((n) => (parseInt(n)))
	for (var i = s2[0]; i<= s2[1]; i++ ) {
	  if (i % s1 == 0) {
			ans = 'OK'
			break
		}
	}



	//出力
	console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 29632
#include <iostream>
#include <cmath>
using namespace std;
int main (void)
{
    string a;
    string b;
    int ab;
    int n;
 
    cin >> a >> b;
 
    ab = stoi(a + b);
    n = sqrt(ab);
 
    if (n * n == ab) cout << "Yes" << endl;
    else cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let _n:usize = read();
    let m:i64 = read();
    let mut min:i64 = 0;
    let mut max:i64 = 100000;

    for _i in 0..m{
	let l:i64 = read();
	let r:i64 = read();
	min = if min < l { l } else { min };
	max = if max > r { r } else { max }; 
    }
    if max >= min {
	println!("{}",max-min+1);
    }else {
	println!("0");
    }
    
}


Measured memory_bytes: 4352
S = list(map(int,input().split()))
H = S[0]
W = S[1]
K = S[2]
fib = [1,2,3,5,8,13,21,0,1]
List = [1]
for x in range(0,W):
    List.append(0)

for x in range(0,H):
    X = tuple(List)
    for y in range(0,W):
        List[y] = fib[y-2]*fib[W-y-2]*X[y-1] + fib[y-1]*fib[W-y-2]*X[y] + fib[y-1]*fib[W-y-3]*X[y+1] 

ans = List[K-1] % 1000000007
print(ans)

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	parseProblem(os.Stdin)
}

func parseProblem(r io.Reader) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines

	n := scanInt(sc)
	xs := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		xs[i] = scanInt(sc)
		sum += xs[i]
	}
	avgL := sum / n
	costL := 0
	avgR := avgL + 1
	costR := 0
	for _, v := range xs {
		costL += (v - avgL) * (v - avgL)
		costR += (v - avgR) * (v - avgR)
	}
	fmt.Println(min(costL, costR))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
n,d=map(int,input().split())
a=[[int(i) for i in input().split()] for n in range(n)]
cnt=0
import math
for x,i in enumerate(a):
    for j in a[x+1:]:
        tmp=0
        for k in range(d):
            tmp+=(i[k]-j[k])**2
        num=math.sqrt(tmp)
        if num.is_integer()==True:
            cnt+=1
print(cnt) 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;

int main(){
    ll K; cin >> K;
    if(K % 7 == 0) K /= 7;
    if(K % 2 == 0 || K % 5 == 0){ cout << -1 << endl; return 0;}
    ll cnt = 1;
    ll X = 1;
    while(1){
        if(X % K == 0){ cout << cnt << endl; return 0;}
        X *= 10;
        X++;
        X %= K;
        cnt++;
    }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

// 2で何回割れるか
int divnum_2(int i) {
  double d = (double)i;
  int ans = 0;
  while (true) {
    d /= 2;
    if (ceil(d)==floor(d)) ans++;
    else break;
  }
  return ans;
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  int ans = divnum_2(A[0]);
  for (int i=1; i<N; i++) ans = min(ans, divnum_2(A[i]));
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,wmx,v,w;
	cin>>n>>wmx;
	vvl  dp(2,vl(10200,LINF));
	dp[0][0]=0;
	rep(i,n){
		cin>>v>>w;
		bool pn=(i%2==0);
		rep(j,10200){
			chmin(dp[pn][j],dp[!pn][j]);
			if(j-v<0)continue;
			chmin(dp[pn][j],dp[!pn][j-v]+w);
		}
	}
	ll ans=0;
	rep(i,10200)if(dp[(n-1)%2==0][i]<=wmx)chmax(ans,(ll)i);
	cout<<ans<<endl;
}



Measured memory_bytes: 3412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll h,w,ans=0x7fffffff;
void getf_ans(){
    if(h%3) ans=min(ans,w);
    else ans=0;
    ans=min(ans,max(abs(h/3*w-w/2*(h-h/3)),abs(h/3*w-(h-h/3)*(w-w/2))));
    ans=min(ans,max(abs((h/3+1)*w-w/2*(h-h/3-1)),abs((h/3+1)*w-(h-h/3-1)*(w-w/2))));
//    ans=min(ans,max(abs(h/3*w-w/2*(h-h/3)),abs(h/3*w-(h-h/3)*(w-w/2))));
//    ans=min(ans,max(abs((h/3+1)*w-w/2*(h-h/3-1)),abs((h/3+1)*w-(h-h/3-1)*(w-w/2))));
}
int main(){
//    std::ios::sync_with_stdio(false);
//    std::cin.tie();
    cin>>h>>w;
    getf_ans();
    swap(h,w);
    getf_ans();
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
typedef long long int ll;
string S;
int main()
{
    cin >> S;
    ll len = S.size(), mod = 1e9 + 7, ans = 1;
    for (long i = len - 1, d = 1; i >= 0; i--, d = d * 3 % mod) {
        if (S.at(i) == '1') ans = (ans * 2 + d) % mod;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3744
//Kagami Mochi;
#include<iostream>

int main()
{
	long long X,Y,current;

	std::cin >> X >> Y;	
	long long counter = 1;

	current = X;	
	
	while( true )
	{
		if( current*2 <= Y )
		{
			counter++;
			current = current*2;
		}
		else
		{
			break;
		}


	}	

	std::cout << counter;

}



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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N;

struct Edge {
  Edge(int _from, int _to, int _cost)
    : from(_from), to(_to), cost(_cost){}
  int from;
  int to;
  int cost;
};

vector< Edge > e;
bool state[MAX_N];

struct UnionFind {
  vector< int > par;
  UnionFind(int n = 1) {
    init(n);
  }

  void init(int n) {
    par.resize(n);
    for(int i = 0; i < n; i++)
      par[i] = -1;
  }
  
  int root(int n) {
    if (par[n] < 0) return n;
    return par[n] = root(par[n]);
  }

  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;

    return true;
  }
};

int kruscal()
{
  sort(ALL(e), [](Edge x, Edge y) {
      return x.cost < y.cost;
    });

  UnionFind uf(N);
  int res = 0;
  EACH(ei, e) {
    // if (state[ei.from] && state[ei.to]) continue;
    if (uf.root(ei.from) != uf.root(ei.to)){
      uf.unite(ei.from, ei.to);
      state[ei.from] = state[ei.to] = true;
      res += ei.cost;
    }
  }

  return res;
}


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

  cin >> N;
  // x, y, i
  vector< tuple< int, int, int > > x(N);
  // y, x, i
  vector< tuple< int, int, int > > y(N);
  REP(i, N) {
    CIN(p, q);
    x[i] = make_tuple(p, q, i);
    y[i] = make_tuple(q, p, i);
  }
  
  sort(ALL(x));
  sort(ALL(y));

  REP(i, N - 1) {
    // x
    int tmp1, tmp2, from, to, cost;
    tie(tmp1, tmp2, from) = x[i];
    tie(tmp2, cost, to) = x[i + 1];
    e.emplace_back(Edge(from, to, abs(tmp2 - tmp1)));
  }
  
  REP(i, N) {
    // y
    int tmp1, tmp2, from, to, cost;
    tie(tmp1, tmp2, from) = y[i];
    tie(tmp2, cost, to) = y[i + 1];
    e.emplace_back(Edge(from, to, abs(tmp2 - tmp1)));    
  }

  int ans = kruscal();
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 7284