akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main{



    public static void main(String[] args) {
        FastReader in = new FastReader();
        int dp[][][][] = new int[105][4][4][4], ans = 0;
        dp[0][3][3][3] = 1;
        int n = in.nextInt();
        for (int l = 0; l < n; ++l){
            for (int l2 = 0; l2 < 4; ++l2){
                for (int l3 = 0; l3 < 4; ++l3){
                    for (int l4 = 0; l4 < 4; ++l4){
                        for (int l5 = 0; l5 < 4; ++l5){
                            if (l2 == 0 && l3 == 1 && l4 == 2 || //ACG_
                                l2 == 0 && l3 == 2 && l4 == 1 || //AGC_
                                l3 == 0 && l4 == 1 && l5 == 2 || //_ACG
                                l3 == 0 && l4 == 2 && l5 == 1 || //_AGC
                                l2 == 2 && l3 == 0 && l4 == 1 || //GAC_
                                l3 == 2 && l4 == 0 && l5 == 1 || //_GAC
                                l2 == 0 && l4 == 2 && l5 == 1 || //A_GC
                                l2 == 0 && l3 == 2 && l5 == 1) continue;
                                dp[l+1][l3][l4][l5] = (dp[l+1][l3][l4][l5] + dp[l][l2][l3][l4]) % (1000000007);

                        }
                    }
                }
            }
        }
        for (int l2 = 0; l2 < 4; ++l2){
            for (int l3 = 0; l3 < 4; ++l3){
                for (int l4 = 0; l4 < 4; ++l4){
                    ans = (ans + dp[n][l2][l3][l4]) % (1000000007);
                }
            }
        }
        System.out.println(ans);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

vector<int> uf;
int root(int a){
    if(uf[a]>=0){
        int res=root(uf[a]);
        uf[a]=res;
        return res;
    }else{
        return a;
    }
}

void uni(int a,int b){
    int ra=root(a);
    int rb=root(b);
    if(ra==rb){

    }else if(uf[ra]<uf[rb]){
        uf[ra]+=uf[rb];
        uf[rb]=ra;
    }else{
        uf[rb]+=uf[ra];
        uf[ra]=rb;
    }
}

int main(){
    int N,M,K;
    cin>>N>>M>>K;
    uf.resize(N);
    for(int i=0;i<N;i++){
        uf[i]=-1;
    }
    
    int a,b;
    vector<int> fri(N,0);
    for(int i=0;i<M;i++){
        cin>>a>>b;
        uni(a-1,b-1);
        fri[a-1]++;
        fri[b-1]++;
    }

    vector<vector<int>> block(N);
    for(int i=0;i<K;i++){
        cin>>a>>b;
        block[a-1].push_back(b-1);
        block[b-1].push_back(a-1);
    }

    for(int i=0;i<N;i++){
        int r=root(i);
        int ans=uf[r]*-1;
        ans--;
        ans-=fri[i];
        for(auto p:block[i]){
            if(r==root(p)){
                ans--;
            }
        }
        cout<<ans<<" ";
    }

    return 0;
}

Measured memory_bytes: 9064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if ((a * b) % 2 == 0){
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 23508
#include <iostream>
#define INF 1<<30
using namespace std;

int N,M;
int c[17];
int dp[20002][256];
int main(){
	int num,cost;
	while(cin >> N >> M){
		if(N == 0)break;
		for(int i = 0;i < M;i++){
			cin >> c[i];
		}
		for(int i = 0;i <= N;i++){
			for(int j = 0;j < 256;j++){
				dp[i][j] = INF;
			}
		}
			dp[0][128] = 0;
		for(int i = 0;i < N;i++){
			cin >> num;
			for(int j = 0;j <= 255;j++){
				if(dp[i][j] == INF)continue;
				for(int m = 0;m < M;m++){
					int x = j + c[m];
					if(x > 255)x = 255;
					else if(x < 0)x = 0;
					cost = (num-x)*(num-x);
					dp[i+1][x] = min(dp[i+1][x],dp[i][j] + cost);
				}
			}
		}
		cost = INF;
		for(int i = 0;i <= 255;i++){
			cost = min(cost,dp[N][i]);
		}
		cout << cost <<endl;
	}
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
int deg[111111];

signed main(){
    cin>>N>>M;
    rep(i,M){
        int a,b ;
        cin>>a>>b;
        a--;b--;
        deg[a]++;deg[b]++;
    }

    rep(i,N)cout<<deg[i]<<endl;
    return 0;
}


Measured memory_bytes: 384
eval"H,W,K="+`tr \\  ,`
a=2
b=1,1,2,3,5,8,13,21
H.times{a=0,*(1..W).map{|i|(a[i]*b[i-1]*b[W-i]+a[i-1]*b[i-2]*b[W-i]+a[i+1]*b[i-1]*b[W-i-1])%(10**9+7)},0}
p a[K]

Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
#define mod 1000000007

ll w,e;
int main(void)
{
	CIN;
	ll tc,l,k=0,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n;
	string s;
	vector<pair<string,pair<ll,ll>>>v;
	for(ll i=1;i<=n;i++){
		cin>>s>>k;
		v.pb({s,{-k,i}});
	}
	sort(v.begin(),v.end());
	for(auto i:v) cout<<i.second.second<<nw;
}

Measured memory_bytes: 3604
from collections import defaultdict
s=input().strip()
t=input().strip()
def gg(cc, c, l, d):
    if d[c][-1] <= cc:
        return d[c][1], l+1
    ll = d[c]
    mx, mn = len(ll)-1, 0
    x = (mx + mn)//2
    while True:
#        print(x,cc,mx,mn,ll)
        if ll[x] <= cc and cc < ll[x+1]:
            return ll[x+1], l
        if cc < ll[x]:
            mx = x
            x = (mx+mn)//2
        else:
            mn = x
            x = (mx+mn)//2

def main():
    ss=set(s)
    tt=set(t)
    if len(tt - ss) != 0: 
        return -1
    d = dict()
    for i, c in enumerate(s):
        if c not in d:
            d[c] = [0]
        d[c].append(i+1)
    cc, l = 0, 0
    for c in t:
#        print(c)
        cc, l = gg(cc, c, l, d)
    return l*len(s) + cc

if __name__ == '__main__':
    print(main())



Measured memory_bytes: 7840
#include<bits/stdc++.h>
#define R(n)for(L i=0;i<n;i++)
#define M make_pair
typedef long long L;
using namespace std;
int main(){L n,k,s,t,a[50];cin>>n>>k>>s>>t;R(n)cin>>a[i];map<pair<L,L>,L> p[50];R(n){for(L j=k-2;j+1;j--)for(auto&l:p[j])p[j+1][M(l.first.first&a[i],l.first.second|a[i])]+=l.second;p[0][M(a[i],a[i])]=1;}n=0;R(k)n+=p[i][M(s,t)];cout<<n;}

Measured memory_bytes: 154108
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;
signed main() {
	int L, R, d;
	cin >> L >> R >> d;
	if (L % d == 0) {
		cout << (R / d) - (L / d)+1 << endl;
	}
	else {
		cout << R / d - L / d << endl;
	}
}

Measured memory_bytes: 3592
import sys
import numpy as np
import numba

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


@numba.njit("(i8, i2[:], i4[:,:], i2[:])", cache=True)
def optimize(D, C, S, sol):
    NUM_ITERS = 2400000

    def calc_score(sol):
        last = -np.ones((26, D + 1))
        score = 0
        for d in range(D):
            ct = sol[d]
            score += S[d, ct]
            for i in range(26):
                last[i, d + 1] = last[i, d]
            last[ct, d + 1] = d
            for i in range(26):
                score -= C[i] * (d - last[i, d + 1])
        return score, last

    sol_bak = sol.copy()
    max_score, last = calc_score(sol)
    last_bak = last.copy()

    def update(d, before, after):
        score = max_score
        score -= S[d, before]
        score += S[d, after]
        lb = last[before, d]
        la = last[after, d]
        da = db = 0
        for x in range(d, D):
            if x > d and sol[x] == before:
                break
            last[before, x + 1] = lb
            db += 1
        score -= C[before] * (d - lb) * db
        for x in range(d, D):
            if x > d and sol[x] == after:
                break
            last[after, x + 1] = d
            da += 1
        score += C[after] * (d - la) * da
        sol[d] = after
        return score

    tried = numba.typed.Dict.empty(
        key_type=numba.types.int32, value_type=numba.types.boolean
    )
    for i in range(NUM_ITERS):
        new_d = np.random.randint(0, D)
        c_before = sol[new_d]
        c_after = np.random.randint(0, 26)
        if c_before == c_after:
            continue
        candidate = new_d * 26 + c_after
        if candidate in tried:
            continue
        tried[candidate] = True
        new_score = update(new_d, c_before, c_after)
        if max_score < new_score:
            max_score = new_score
            sol_bak = sol.copy()
            last_bak[c_before, :] = last[c_before, :].copy()
            last_bak[c_after, :] = last[c_after, :].copy()
            tried.clear()
        else:
            sol = sol_bak.copy()
            last[c_before, :] = last_bak[c_before, :].copy()
            last[c_after, :] = last_bak[c_after, :].copy()
    return sol


def main():
    D = ini()
    C = np.array(inl(), dtype="int16")
    assert len(C) == 26
    S = np.zeros((D, 26), dtype="int32")
    for i in range(D):
        S[i, :] = inl()

    sol = np.zeros(D, dtype="int16")
    last = -np.ones(26, dtype="int16")
    for d in range(D):
        score = 0
        mi = -1
        for i in range(26):
            s = S[d, i] - C[i] * (d - last[i])
            if score < s:
                score = s
                mi = i
        sol[d] = mi
        last[mi] = d
    sol = optimize(D, C, S, sol)

    print(*(sol + 1), sep="\n")


main()


Measured memory_bytes: 106316
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main(void) {
  ll a, b;
  vector<pair<ll, ll>> v;
  cin>>a>>b;
  ll g = gcd(a, b);
  double sg = sqrt(g);
  for(ll i=2; i<=sg; i++) {
    if(i==sg and g%i==0)
      {
	v.push_back(make_pair(i, 0));
      }
    else if(g % i == 0) {
      v.push_back(make_pair(i, 0));
      v.push_back(make_pair(g/i, 0));
    }
  }
  if(g!=1)
    v.push_back(make_pair(g, 0));

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

  for(ll i=0; i<v.size(); i++) {
    if(v[i].second == 1) continue;
    for(ll j=i+1; j<v.size(); j++) {
      if(v[j].first%v[i].first==0) {
	v[j].second=1;
      }
    }
  }
  ll ans=0;
  for(ll i=0; i<v.size(); i++) {
    if(v[i].second==0)
      ans++;
  }
  std::cout << ans+1 << std::endl;
  return 0;
}



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

int main(){
    string s,t;
    ll ans=0;
    cin >> s >> t;
    ll l=s.size();
    string ss,tt;
    rep(i,l){
        ss=s[i];
        tt=t[i];
        if(ss!=tt){
            ++ans;
        }
    }

    cout <<ans << endl;
    

    return 0;
}

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

int main(){
	int n, a, b, maxDelta, minVal; 
	cin >> n; // n>=2
	cin >> a;
	cin >> b;
	maxDelta = b - a;
	if (a < b) {
		minVal = a;
	}
	else {
		minVal = b;
	}
	for (int i=2; i<n; i++) {
		cin >> a;
		if (maxDelta < a - minVal){
			maxDelta = a - minVal;
		}
		if (a < minVal){
			minVal = a;
		}
	}
	cout << maxDelta << endl;
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
int main()
{
    int n,i,t;
    long long max=1,m,k;
    scanf("%d",&n);
    long long s[n];
    for(i=0;i<n;i++)
    {
        t=2;
        m=max;
        scanf("%lld",&s[i]);
       if(m>=s[i])
       {
           while(max%s[i]!=0)max=m*t++;
       }
       else
       {
           max=s[i];
           while(max%m!=0)max=s[i]*t++;
       }
    }

    printf("%lld",max);
    return 0;
}


Measured memory_bytes: 128
def combination(n, k):
    if n < k:
        return 0
    n2, k2 = 1, 1
    for i in range(1, min(k, n - k) + 1):
        n2 *= n
        k2 *= i
        n -= 1
    return n2 // k2

mod = 10 ** 9 + 7
N, K = map(int, input().split())
for i in range(1, K+1):
    a = combination(N-K+1, i) * combination(K-1, i-1)
    print(a % mod)

Measured memory_bytes: 48092
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut map = HashMap::new();

    for a_i in a.iter() {
        map.entry(a_i).and_modify(|e| *e += 1).or_insert(1);
    }

    let sum: i64 = map.values().map(|v| (v - 1) * v / 2).sum();

    for a_i in a.iter() {
        let t = map[a_i];
        let ans = sum - (t - 1) * t / 2 + (t - 2) * (t - 1) / 2;
        println!("{}", ans);
    }
}


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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++){
		cin >> vec[i];
	}
	vector<int> sum(n);
	int cur = 0;
	for(int i = 0; i < n; i++){
		sum[i] = (int)(abs(cur - vec[i]));
		cur = vec[i];
	}
	for(int i = 1; i < n; i++) sum[i] += sum[i - 1];
	
	for(int i = 0; i < n; i++){
		int ans = 0;
		if(i == 0){
			ans = (int)abs(vec[1]);
			ans += sum[n - 1] - sum[1];
			ans += abs(vec[n - 1]);
		}
		else if(i == n - 1){
			ans += sum[n - 2];
			ans += abs(vec[n - 2]);
		}
		else{
			ans = (int)abs(vec[i + 1] - vec[i - 1]);
			ans += sum[n - 1] - sum[i + 1];
			ans += sum[i - 1];
			ans += abs(vec[n - 1]);
		}
		cout << ans << "\n";
	}
}

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

int main(){
    
    int d;
    cin >> d;
    
    if(d == 25){
        cout << "Christmas" << endl;
    }
    else if(d == 24){
        cout << "Christmas Eve" << endl;
    }
    else if(d == 23){
        cout << "Christmas Eve Eve" << endl;
    }
    else{
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

Measured memory_bytes: 3580
#!/usr/bin/env python


def get_all_values(N, v):
    all_values = []

    current = v
    while current <= N:
        all_values.append(current)
        current *= v

    return all_values


def get_min_number(memo, all_values, N):
    if N in memo:
        return memo[N]

    if N in all_values:
        return 1
    elif N < 6:
        return N
    else:
        min_number = min(
            [get_min_number(memo, all_values, N - v) + 1 for v in all_values if N - v > 0]
        )
        memo[N] = min_number
        return min_number


def solve(N):
    # Get all values and sort in descent order
    all_values = [1] + get_all_values(N, 6) + get_all_values(N, 9)
    sorted_all_values = list(reversed(sorted(all_values)))

    # Recursively get minimum number
    memo = {}
    ans = get_min_number(memo, sorted_all_values, N)

    return ans


def main():
    # Input
    N = int(input())

    # Solve
    ans = solve(N)

    # Answer
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 15148
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
const int MOD = 1000000007;

    class Pairs{
        public : ll a;
        ll b;
        void setpairs(ll _a, ll _b){
            a = _a;
            b = _b;
        }
    };

    bool cmp(const Pairs &A, const Pairs &B){
        return (A.a < B.a);
    }


int main(){    
    int X,A;
    cin >> X >> A;
    if(X < A) cout << "0";
    else cout << "10";
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(max(a,d),max(b,c))
#define MAX   1e9
#define MIN  -1e9
#define PI 3.14159265358979
#define eps 1e-9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(long long int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(long long int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl
#define inp(a,start,len) for(long long int i = start;i < len;i++) cin>>a[i]
struct Interval{ll start,end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}

ll dp[100005];
int main(){
	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll T = 1;
	// cin>>T;
	while(T--){
		ll n;
		cin>>n;
		pll d[n+1];
		repA(i,1,n){
			cin>>d[i].f>>d[i].s;
		}
		ll possible = 0;
		repA(i,3,n){
			if((d[i].f == d[i].s) && (d[i-1].f == d[i-1].s) && (d[i-2].f == d[i-2].s))
				possible = 1;
		}
		if(possible)
			cout<<"Yes";
		else
			cout<<"No";
	}
	return 0;
}


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

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

string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  int l = 0, r = s.length() - 1;
  int cnt = 0;
  while (l < r) {
    if (s[l] != s[r]) ++cnt;
    ++l;
    --r;
  }
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
namespace remoon {
    #define re register
    #define de double
    #define le long double
    #define ri register int
    #define ll long long
    #define sh short
	#define ui unsiged int
	#define ull unsigned long long
    #define pii pair<int, int>
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define tpr template <typename ra>
    #define rep(iu, st, ed) for(ri iu = st; iu <= ed; iu ++)
    #define drep(iu, ed, st) for(ri iu = ed; iu >= st; iu --)	
    #define gc getchar
    inline int read() {
        int p = 0, w = 1; char c = gc();
        while(c > '9' || c < '0') { if(c == '-') w = -1; c = gc(); }
        while(c >= '0' && c <= '9') p = p * 10 + c - '0', c = gc();
        return p * w;
    }
    int wr[50], rw;
    #define pc(iw) putchar(iw)
    tpr inline void write(ra o, char c = '\n') {
        if(!o) pc('0');
        if(o < 0) o = -o, pc('-');
        while(o) wr[++ rw] = o % 10, o /= 10;
        while(rw) pc(wr[rw --] + '0');
        pc(c);
    }
    tpr inline void cmin(ra &a, ra b) { if(a > b) a = b; }
    tpr inline void cmax(ra &a, ra b) { if(a < b) a = b; } 
    tpr inline bool ckmin(ra &a, ra b) { return (a > b) ? a = b, 1 : 0; }
    tpr inline bool ckmax(ra &a, ra b) { return (a < b) ? a = b, 1 : 0; }
}
using namespace std;
using namespace remoon;

namespace mod_zone {
	#define mod 1000000007
	inline void inc(int &a, int b) { a += b; if(a >= mod) a -= mod; }
	inline void dec(int &a, int b) { a -= b; if(a < 0) a += mod; }
	inline int Inc(int a, int b) { return (a + b >= mod) ? a + b - mod : a + b; }
	inline int Dec(int a, int b) { return (a - b < 0) ? a - b + mod : a - b; }
	inline int mul(int a, int b) { return 1ll * a * b % mod; }
	inline int fp(int a, int k) {
		int ret = 1;
		for( ; k; k >>= 1, a = mul(a, a))
		if(k & 1) ret = mul(ret, a);
		return ret;
	}
}
using namespace mod_zone;

#define sid 4055

int n;
int a[200050], b[200050];
int f[sid][sid], jc[sid * 2], ny[sid * 2];

inline void Init() {
	jc[0] = jc[1] = 1;
	ny[0] = ny[1] = 1;
	rep(i, 2, 8000) {
		jc[i] = mul(jc[i - 1], i);
		ny[i] = mul(mod - mod / i, ny[mod % i]);
	}
	rep(i, 2, 8000) ny[i] = mul(ny[i], ny[i - 1]);
}

inline int calc() {
	int ret = 0;
	rep(i, 1, n) f[2005 - a[i]][2005 - b[i]] ++;
	rep(i, 1, 4010) rep(j, 1, 4010)
	inc(f[i][j], Inc(f[i][j - 1], f[i - 1][j]));
	rep(i, 1, n) inc(ret, f[2005 + a[i]][2005 + b[i]]);
	return ret;
}

inline int C(int n, int m) {
	return mul(mul(jc[n], ny[m]), ny[n - m]);
}

inline int solve() {
	int ret = 0;
	rep(i, 1, n) 
	inc(ret, C((a[i] + b[i]) << 1, a[i] << 1));
	return ret;
}

int main() {
	Init();
	n = read();
	rep(i, 1, n) a[i] = read(), b[i] = read();
	write(mul(Dec(calc(), solve()), fp(2, mod - 2)));
	return 0;
}

Measured memory_bytes: 66048
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;//1000000007
#define N 1000000007
int main()
{
	ll i,n,sum=0,j,dp[2],max=-1,c=0;
	cin>>n;
	ll a[n+1];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]>max)max=a[i];
	}
	while(true)
	{
		max/=2;
		c++;
		if(max<=0)break;
	}
	for(j=1;j<=c;j++)
	{
		dp[0]=dp[1]=0;
		for(i=1;i<=n;i++)
		{
			if((a[i]>>(j-1))&1)dp[1]++;
			else dp[0]++;
		}
		sum=(sum+((dp[0]*dp[1])%N*((1ll<<(j-1))%N))%N)%N;
		//cout<<((dp[0]*dp[1])%N*((1<<(j-1))%N)%N)<<endl;
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 2560
using System;
using System.Linq;

namespace AtCoder0711
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] lrd = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int L = lrd[0];
            int R = lrd[1];
            int d = lrd[2];

            int ans = 0;

            for(var i = L; i <= R; i++)
            {
                if(i %d == 0) { ans++; }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28256
import java.util.Scanner;


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

        Scanner s = new Scanner(System.in);

          String sc = s.next();

        String[] strArray = sc.split("");

        // // 変数の長さ分回す
        // for (int i = 0; i < sc.length(); i++) {
        //     // 配列に順番に格納する
        //     strArray[i] = String.valueOf(sc.charAt(i));
        // }

        boolean flag = false;

        for (int i = 0; i < strArray.length; i++) {
            if(i%2 == 0){
                if(strArray[i].equals("L")) {
                    flag = true;
                    break;
                }
            } else {
                if(strArray[i].equals("R")) {
                    flag = true;
                    break;
                }
            }
        }

        if(flag){
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define nmax_def 2000000
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

vl divisor(ll n) {
	vl divlist;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			divlist.push_back(i);
			if (i * i != n)
				divlist.push_back(n / i);
		}
	}
	sort(divlist.begin(), divlist.end(), less<ll>());
	return divlist;
}

int main() {
	ll N;
	cin >> N;
	ll ans = 0;
	vl div1 = divisor(N);
	rep(i, div1.size()) {
		ll K = div1[i];
		if (K == 1)
			continue;
		ll n = N;
		while (1) {
			if (n % K != 0)
				break;
			n /= K;
		}
		if (n % K == 1)
			ans++;
	}
	vl div2 = divisor(N - 1);
	ans += div2.size();
	ans--;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long H, W;
	cin >> H >> W;

	if (H == 1 || W == 1) {
		cout << 1 << endl;
	}
	else if (H * W % 2 == 0) {
		cout << (H * W) / 2 << endl;
	}
	else {
		cout << (H * W) / 2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

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

  int n, m, x; cin >> n >> m >> x;
  int ans = MOD;

  vector<vi> a(n, vi(m+1));
  rep(i, n) rep(j, m+1) cin >> a[i][j];

  rep(bit, 1<<n) {
    int cost = 0;
    vi score(m,0);

    rep(i, n) if ((bit & (1<<i))) {
      cost += a[i][0];

      rep2(j, 1, m) score[j-1] += a[i][j];
    }

    bool ok = true;
    rep(i, m) if (score[i] < x) ok = false;

    if (ok) chmin(ans, cost);
  }

  cout << (ans == MOD ? -1 : ans) << endl;

  return (0);
}


Measured memory_bytes: 3668
#include<stdio.h>

int main (void){
    long long int a,b,c,d;
    long long int ans;

    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);


    if(a<=0){
        if(c<=0){
            ans=a*c;    //とりま

            if(ans<b*d){
                ans=b*d;

            }

        }else if(b<0){
            ans=b*c;

        }else{
            ans=b*d;
        }

    }else{ //0<a
        if(d<=0){
            ans=a*d;
        }else{
            ans=b*d;
        }
    }

    printf("%lld",ans);

    return 0 ;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll C[200005];
ll P[200005];
//! [iまでに]=何通りあるか
ll T[200005];

int main()
{
    ll N;
    cin >> N;
    REP(i, N)
    {
        cin >> C[i];
        P[C[i]] = -1;
    }
    T[0] = 1;
    REP(i, N)
    {
        if (P[C[i]] >= 0 && P[C[i]] != i - 1)
            T[i] = (T[i] + T[P[C[i]]]) % MOD;
        P[C[i]] = i;
        T[i + 1] = T[i];
    }
    cout << T[N] % MOD << endl;
    return 0;
}

Measured memory_bytes: 4992
/***************************************************
 * Problem Name : C - Walk on Multiplication Table.cpp
 * Problem Link : https://atcoder.jp/contests/abc144/tasks/abc144_c
 * OJ           : atCoder
 * Verdict      : Trying
 * Date         : 2019-10-31
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    ll n;
    cin >> n;
    ll res = INF;
    ll sq = (ll) sqrt (n);

    for (ll i = 1; i <= sq; i++) {
        if (n % i == 0) {
			res = min(res, i+(n/i)-2LL);
        }
    }
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
    int n;
    cin >> n;
    if(n == 7 || n == 5 || n == 3)
        cout << "YES"<< endl;
    else
        cout << "NO"<< endl;
}


Measured memory_bytes: 256
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {


	int a, b = 0, c = 0;
	//----------------------
	LL n, X, Z,A,B,N,ans1,ans2;
	LL ans, count=0 ;
	bool f=true;

	cin >> a;
	cin >> b;

	ans = a*b;

	if (ans % 2 == 0) {

		cout << "Even" << endl;

	}
	else cout << "Odd" << endl;

	//cout << count << endl;

	
	//------------------------
	//cin >> Z;

	return 0;
}

Measured memory_bytes: 256
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n,m=map(int, input().split())
p=list(map(int, input().split()))
uf1=UnionFind(n)
for i in range(m):
    a,b=map(int, input().split())
    uf1.union(a-1,b-1)
count=0
for i in range(n):
    if uf1.is_same(i,p[i]-1):count+=1
print(count)

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

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define fr(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define gf(i,n) for (int i=0 ; i<n ; i+=1)
#define rfor(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define rrep(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define prarr(a,n) gf(i,n){printf("%d ", a[i]);}printf("\n");
#define sumarr(a,n) int zserkd=0;gf(i,n){zserkd+=a[i];}cout<<zserkd<<endl;
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

/****** Template of some basic operations *****/
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main(){
	
	int n, k;
	cin >> n >> k;
	int pr[n+1]={0};
	gf(i,k)
	{
		int d;
		cin >> d;
		int A[d];
		gf(i,d)
		{
			cin >> A[d];
			pr[A[d]]=1;
		}
	}
		int ans =0;
		gf(i,n)
		{
			ans+=pr[i+1];
		}
		cout<<n-ans;
	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG 1

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

int array[200100];

int main(){
	int l, r, d;
	scanf("%d%d%d", &l, &r, &d);
	int count=0;
	for(int i=l; i<=r; i++){
		if(i%d==0) count++;
	}
	
	printf("%d\n", count);
	
	
	return 0;
}



Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
    int t,n,i,j,c,a,b,k,ss=0,l,m;
    cin>>a>>b>>c>>k;
    if((k-a)<0)
    {
        ss+=(k*1);
        cout<<ss<<endl;
        return 0;
    }
    else
    {
        if((k-a)>=0)
        ss+=(a*1);
        k-=a;
        k-=b;
        if(k>0)
        ss+=k*(-1);
    cout<<ss<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
using System;

namespace ABC134C
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            int max = 0;
            int secound = 0;
            int maxCnt = 0;
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
                if (a[i] == max) maxCnt++;
                else if (a[i] > max)
                {
                    secound = max;
                    maxCnt = 1;
                    max = a[i];
                }
                else
                {
                    secound = Math.Max(secound, a[i]);
                }
            }

            for (int i = 0; i < n; i++)
            {
                if (a[i] < max)
                {
                    Console.WriteLine(max);
                }
                else if(a[i] == max)
                {
                    Console.WriteLine(maxCnt > 1 ? max : secound);
                }
            }
        }
    }
}


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

#define ll long long

int main()
{
    ll x, i, j, a, b;

    cin >> x;

    for(i=-1000; i<=1000; i+=1)
    {
        if(i>=0)
            a=pow(i, 5)+0.5;
        else
            a=pow(i, 5)-0.5;
        for(j=-1000; j<=1000; j+=1)
        {
            if(j>=0)
                b=pow(j, 5)+0.5;
            else
                b=pow(j, 5)-0.5;    

            if(a-b==x)
            {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4072
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	int n; cin >> n;
    if(n % 2 == 0) {
        cout << 0.500 << endl;
    } else {
        cout << (ld)(n + 1) / (ld)(2 * n) << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

    static int N;
    static int K;
    static int Q;
    static int A;
    static long B;
    static long C;
    //    static int[][] map;
    static int min = 9999999;
    static long ans = 0;


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

        int[] map = new int[3];

        map[0] = scanner.nextInt();
        map[1] = scanner.nextInt();
        map[2] = scanner.nextInt();

        Arrays.sort(map);

        System.out.println(map[2] * 10 + map[1] + map[0]);

    }
}



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

using namespace std;

int main()
{
    string a, b, c;
    cin>>a>>b>>c;
    if(a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


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

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

  int x,y;
  cin>>x>>y;
  int ans = x - 1;
  ans += ( y >= x ) ? 1 : 0;
  cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
const int MAXN = 1e4 + 7, INF = 5e5 + 7;
int d[MAXN];
struct node {
	int id, dist;
	node(int id, int dist) :id(id), dist(dist) {}
	bool operator < (const node &rhs) const {
		return dist > rhs.dist;
	}
};
vector<pair<int, int> > G[MAXN];
priority_queue<node> nodes;
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
    	d[i] = INF;
	}
    for (int i = 0; i < n; i++) {
    	int u, k;
    	scanf("%d%d", &u, &k);
    	for (int j = 0; j < k; j++) {
    		int v, c;
    		scanf("%d%d", &v, &c);
    		G[u].push_back(make_pair(v, c));
		}
	}
	nodes.push(node(0, 0));
	while (!nodes.empty()) {
		node tmp = nodes.top();
		nodes.pop();
		if (tmp.dist > d[tmp.id]) continue;
		int cnt = G[tmp.id].size();
		for (int i = 0; i < cnt; i++) {
			if (d[G[tmp.id][i].first] > d[tmp.id] + G[tmp.id][i].second) {
				d[G[tmp.id][i].first] = d[tmp.id] + G[tmp.id][i].second;
				nodes.push(node(G[tmp.id][i].first, d[G[tmp.id][i].first]));
			}
		}
	}
	for (int i = 0; i < n; i++) {
		printf("%d %d\n", i, d[i]);
	}
	return 0;
}


Measured memory_bytes: 7656
#include "bits/stdc++.h"
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

string str;

signed main() {

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


	cin >> str;
	std::cout << str.substr(0, str.size()-8) << std::endl;

	return 0;

}

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

int main(){
	int n;
	vector<int> high;
	
	for(int i=0 ; i<10 ; i++){
		cin >> n;
		high.push_back( n );
	}
	
	sort( high.begin() , high.end() );

	for(int i=9 ; i>=7 ; i--){
		cout << high.at( i ) << endl;
	}
}

Measured memory_bytes: 3096
X,Y =map(int,input().split())
mod = 10**9+7

cnt = 0
for p in range(X//2+1):
  if Y == 2*X-3*p:
    A = 1
    for a in range(p):
      A *= (X-p)-a
      A %= mod
    B = 1
    for b in range(1,p+1):
      B *= b 
      B %= mod
    cnt +=( A*pow(B,mod-2,mod) )% mod
print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
//constexpr ll mod=1000000007;
constexpr ll mod=998244353;

int N,S,A[3000];
ll DP[3001][3001];

int main(){
	cin>>N>>S;
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	DP[0][0]=1;
	for(int i=0;i<N;i++){
		for(int j=0;j+A[i]<=S;j++){
			DP[i+1][j+A[i]]+=DP[i][j];
		}
		for(int j=0;j<=S;j++){
			DP[i+1][j]+=DP[i][j]*2;
			DP[i+1][j]%=mod;
		}
	}
	cout<<DP[N][S]<<endl;
}


Measured memory_bytes: 73984
#include<iostream>
#include<cmath>
using namespace std;
main()
{
    double ret=0;
    int n,k;cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        double tmp=1.0/n;
        int now=i;
        while(now<k)
        {
            now*=2;
            tmp/=2;
        }
        ret+=tmp;
    }
    printf( "%.12lf\n",ret);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define si set<int>
#define stk stack<int>
#define que queue<int>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std; 

int main(){
	string s,t,u;
	cin>>s;
	for(int i=0;i<s.size();i++)
		cout<<'x';
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;

using namespace std;

int main() {
    string s;
    cin >> s;
    
    if(s[0] == s[1]) {
        if(s[1] != s[2] && s[2] == s[3]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    else if(s[0] == s[2]){
        if(s[0] != s[1] && s[1] == s[3]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    else if(s[0] == s[3]) {
        if(s[0] != s[1] && s[1] == s[2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    z = S.count('0')
    i = S.count('1')
    print(min(z, i) * 2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        int n; cin >> n;
        string s; cin >> s;
        vector<int >left(26,0);
        vector<int>right(26,0);
        for(int i = 0; i<n; i++){
            right[s[i]-'a']++;
        }
        int res =0;
        for(int i = 0; i<n; i++){
            right[s[i]-'a']--;
            left[s[i]-'a']++;
            int ans = 0;
            for(int  j = 0; j<26; j++){
                if(left[j]!=0 and right[j]!= 0)ans++;
            }
            res = max(res,ans);
        }
        cout<<res<<endl;
return 0;
}



Measured memory_bytes: 3636