akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>
#include <stdlib.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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
#define PI 3.141592653589793


int main(){
    int N;
    cin >> N;
    vector<ll> a(N+1);
    for(int i = 1; i < N+1; i++){
        int a_tmp;
        cin >> a_tmp;
        a[i] = a_tmp;
    }

    int ans=0;
    int cnt=1;
    for( int i = 1; i < N+1; i++){   
        if(cnt != a[i]){
            ans++;
            continue;
        }
        cnt++;
        //cout <<  cnt << endl;
    }
    if(cnt == 1){
        cout << "-1" << endl;
    }else{
        cout <<  ans << endl;
    }

    /*
    int min_ans = INF;
    for( int i = 1; i < N+1; i++){   
        if(i >= a[i]){
            int min_tmp = i - a[i];
            min_ans = min(min_ans,min_tmp);
        }
    }
    if(min_ans == INF){
        cout << "-1" << endl;
    }else{
        cout <<  min_ans << endl;
    }
    */
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    string X;
    cin >> X;
    int scnt=0,tcnt=0;
    int res = X.size();
    rep(i,X.size()){
        if(X[i]=='S'){
            scnt++;
        }
        else{
            if(scnt>0){
                scnt--;
                res-=2;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(){
    
    int N;
    cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i];
    }
    string T="NOT";
    int cnt=1;
    for(int i=1;i<N;i++){
        if(S[i]>S[i-1]){
            if(T=="NOT"){
                T="UP";
            }
            else if(T=="DOWN"){
                T="NOT";
                cnt++;
            }
        }
        else if(S[i]<S[i-1]){
            if(T=="NOT"){
                T="DOWN";
            }
            else if(T=="UP"){
                T="NOT";
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
int main() {
int n,k;
cin >> n >> k;
map<int,int> mp;
rep(i,n){
  int x;
  cin >> x;
  mp[x]++;
}
if(mp.size() <= k) cout << 0 << endl;
else{
  int a = mp.size()-k;
  vector<int> b;
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    b.push_back(itr->second);
  }
  sort(b.begin(),b.end());
  int ans = 0;
  rep(i,a) ans += b.at(i);
  cout << ans << endl;
}


} 

Measured memory_bytes: 13516
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, k = map(int, input().split())
a = list( map(int, input().split()))
p = 10**9+7

a.sort()

from bisect import bisect_left, bisect_right
zerostart = bisect_left(a, 0)
posstart = bisect_right(a, 0)

aneg = a[:zerostart]
cntzero = posstart - zerostart
apos = a[posstart:]

cntneg = len(aneg)
cntpos = len(apos)

# 答えが0になる時
if k > n-cntzero:
    print(0)
    exit()

# 答えが正になる時
if k <= cntpos or (k%2==0 and  k <= (cntneg//2)*2 + cntpos) or (k%2==1 and cntpos%2==1 and k <= (cntneg//2)*2 + cntpos-1):
    pos_pair_mix=[]

    apos.sort(reverse=True)
    for i in range(cntpos//2):
        pos_pair_mix.append((apos[2*i]*apos[2*i+1],+1,2*i))

    for i in range(cntneg//2):
        pos_pair_mix.append((aneg[2*i]*aneg[2*i+1],-1,2*i))

    pos_pair_mix.sort(key=lambda x:x[0],reverse=True)

    ans = 1
    i_last_apos=0

    for i in range(k//2):
        ans*=pos_pair_mix[i][0]%p
        ans%=p
        if pos_pair_mix[i][1]==1:
            i_last_apos = pos_pair_mix[i][2]+2

    if k%2==0:
        print(ans%p)
        exit()
    else:
        print((ans*apos[i_last_apos])%p)
        exit()

# 答えが負になる時
a.sort(key=lambda x:abs(x) )

ans = 1
for i in range(k):
    ans*=a[i]
    ans%=p

print(ans%p)


Measured memory_bytes: 102672
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<unordered_map>
#include<map>
#include<climits>
#include<cstring>
using namespace std;
using ll = long long;
const ll MOD = (1e+9) + 7;
int main() {
	ll a, b, sa, sb, res = 0;
	cin >> a >> b;
	sa = (b - 1) * b / 2;
	sb = (a + a - b + 1) * b / 2;
	ll pa = b - 1, pb = a - b + 1;
	while (pa <= a) {
		res = (res - (sa - sb) + 1) % MOD;
		pa++;
		pb--;
		sa = sa + pa;
		sb = sb + pb;
	}
	cout << res;
	return 0;
}

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

int main(){
  
  int n,a,b;
  cin >> n >> a >> b;
  n *= a;
  
  if(n < b){
    cout << n << endl;
  }else if(n > b){
    cout << b << endl;
  }else{
    cout << n << endl;
  }
}

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

a, p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
    
def f(n, x):
    if n == 0:
        if x <= 0:
            return 0
        else:
            return 1
    elif x <= 1 + a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1] + 1 + f(n-1, x-2-a[n-1])
    
print(f(n, x))

Measured memory_bytes: 3064
open System

let arr = stdin.ReadLine().Split(' ') |> Array.map int
let n = float arr.[0]
let d = float arr.[1]

let list = [|for i in [1.0..n] do stdin.ReadLine().Split(' ') |> Array.map float|]

let f (x: float[]) = if Math.Sqrt (x.[0] * x.[0] + x.[1] * x.[1]) <= d then 1 else 0

list
|> Array.sumBy f
|> Console.WriteLine

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

int main(){
    int n;
    cin >> n;
  cout << (n*800)-(int)((n/15)*200)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int n,ans;

int main(){
    int N=1000000;
    int prime[N];
    rep(i,N) prime[i] = 1;
    prime[0] = prime[1] = 0;
    rep(i,N){
        if(prime[i]){
            for(int j = i + i; j < N; j+=i){
                prime[j] = 0;
            }
        }
    }
    while(cin>>n){
        ans=0;
        rep(i,n+1)ans+=prime[i];
        out(ans);
    }
}



Measured memory_bytes: 7012
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
   return *(int*)a - *(int*)b;
}
int min(int a,int b){
  if(a>b) return b;
  return a;
}
int max(int a,int b){
  if(a>b) return a;
  return b;
}
int main(void){
  int n,k,r,i,j,l,ans=0;
  scanf("%d %d",&n,&k);
  int v[n];
  for(i=0;i<n;i++) scanf("%d",&v[i]);
  r = min(n,k);
  
  for(i=0;i<=r;i++){
    for(j=0;j<=r;j++){
      if(i+j>r) break;
      int tmp=0;
      int d = k-i-j;
      int arr[i+j];
      int k = 0;
      for(l=0;l<i;l++) arr[l] = v[l];
      int co = i;
      for(l=0;l<j;l++){
        arr[co] = v[n-l-1];
        co++;
      }
      qsort(arr,co,sizeof(int),cmp);
      //for(l=0;l<co;l++) printf("%d ",arr[l]);
      //printf("\n");
      int tnp = min(i+j,d);
      for (l=0;l<tnp;l++){
        if (arr[l]<0){
          tmp -=arr[l];
        }
      }
      //printf("tmp::%d\n",tmp);
      for (l=0;l<co;l++) tmp += arr[l];
      //printf("ttmp::%d\n",tmp);
      ans = max(ans,tmp);
    }
  }
  printf("%d\n",ans);
  return 0;
}


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

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    vector<int> T = {111, 222, 333, 444, 555, 666, 777, 888, 999, 1111};
    int n;
    cin >> n;
    cout << *lower_bound(T.begin(), T.end(), n) << endl;
}


Measured memory_bytes: 256
n = int(input())
red = sorted([list(map(int, input().split())) for i in range(n)])
blu = sorted([list(map(int, input().split())) for i in range(n)])
ans = 0
for x,y in blu:
    r = [z for z in red if (z[0] < x) & (z[1] < y)]
    if r:
        r.sort(key=lambda x:x[1])
        red.remove(r[-1])
        ans += 1
print(ans)

Measured memory_bytes: 3064
#!/usr/bin/env python3


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    i = input()
    if i.lower() == i:
        print("a")
    else:
        print("A")

    

if __name__ == '__main__':
    main()


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

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

    int h, w, d;
    cin >> h >> w >> d;
    map<int, pair<int, int>> A;
    REP(i, h){
        REP(j, w){
            int a;
            cin >> a;
            A[a - 1] = {i, j};
        }
    }

    vector<int> B(h * w);
    for(int i = 0; i < d; i++){
        B[i] = 0;
        for(int j = i + d; j < h * w; j += d){
            B[j] = B[j - d] + abs(A[j].first - A[j - d].first) + abs(A[j].second - A[j - d].second);
        }
    }
    
    int q;
    cin >> q;
    REP(i, q){
        int x, y;
        cin >> x >> y;
        cout << B[y - 1] - B[x - 1] << endl;
    }

    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));


		  try{


			  String ab;
			  String[] strAry;
			  int a;
			  int b;
			  int d;
			  int r;
			  double e;
			  double h;
			  double f;

			
			  ab = input.readLine();
		      strAry = ab.split(" ");
		      a=Integer.parseInt(strAry[0]);
	          b=Integer.parseInt(strAry[1]);

			  d=a/b;
			  r=a%b;
			  e=a;
			  h=b;
			  f=e/h;

			  System.out.printf(d+" "+r+" "+"%f",f);



		    }catch(IOException e) {   System.out.println("Exception : " + e);
		    }

	}
}

Measured memory_bytes: 24908
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    t = input()
    print('Yes') if len(s) + 1 == len(t) and s == t[:-1] else print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9096
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(void)
{
    int n, m;
    int A[100];

    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += A[i];
    }

    std::sort(A, A + n, std::greater<>());

    for (int i = 0; i < n; i++) {
        //cout << A[i] << " ";
    }

    //cout << endl;

    int min = A[m - 1];
    if ((double) min < sum / (4.0 * m)) {
        //cout << min << " " << sum / (4.0 * m) << " ";
        cout << "No";
    } else {
        //cout << min << " " << sum / (4 * m) << " " ;
        cout << "Yes";
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << "  " << y << endl
#define dbg3(x, y, z) cout << x << "  " << y << "  " << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    if(n % 2){
        n = n/2 + 1;
    }
    else {
        n = n/2;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC081D solver = new ABC081D();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC081D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int[] targetPos = new int[2];
            targetPos[0] = in.nextInt();
            targetPos[1] = in.nextInt();
            ArrayList<Integer> xList = new ArrayList<Integer>();
            ArrayList<Integer> yList = new ArrayList<Integer>();

            int count = 0;
            boolean turnX = true;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == 'F') count++;
                else if (turnX) {
                    xList.add(count);
                    count = 0;
                    turnX = false;
                } else {
                    yList.add(count);
                    count = 0;
                    turnX = true;
                }
            }
            if (turnX) {
                xList.add(count);
            } else {
                yList.add(count);
            }

            int[] pos = {xList.get(0), 0};
            xList.remove(0);
            Collections.sort(xList);
            Collections.sort(yList);

            for (int i = xList.size() - 1; i >= 0; i--) {
                int cn = xList.get(i);
                if (pos[0] < targetPos[0]) pos[0] += cn;
                else pos[0] -= cn;
            }
            for (int i = yList.size() - 1; i >= 0; i--) {
                int cn = yList.get(i);
                if (pos[1] < targetPos[1]) pos[1] += cn;
                else pos[1] -= cn;
            }

            String ans = (pos[0] == targetPos[0] && pos[1] == targetPos[1]) ? "Yes" : "No";
            out.println(ans);
        }

    }
}


Measured memory_bytes: 22356
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N,M = map(int,input().split())

uf = UnionFind(N)
for _ in range(M):
    A,B = map(int,input().split())
    uf.union(A-1,B-1)

ans = 0
for i in range(N):
    ans = max(ans,uf.size(i))

print(ans)

Measured memory_bytes: 79400
while True:
    a, L = map(int, input().split())
    if a == 0 and L == 0: break

    nums = [a]
    for i in range(20):
       ds = list(str(a))
       while len(ds) != L:
           ds.append('0')
       ln = int("".join(sorted(ds)))
       gn = int("".join(sorted(ds, reverse=True)))
       n = gn - ln
       if n in nums:
           j = nums.index(n)
           print(j, n, i-j+1)
           break
       else:
           nums.append(n)
           a = n

Measured memory_bytes: 6724
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
#define unrep(i,n) for(int i = n - 1; i >= 0; i--)
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  long long total = 0;
  rep(i,n){
    cin >> a[i];
    total += a[i];
  }
  rep(i,n){
    for(int j = n - 1; j > i; j--){
      if(a[j] > a[j-1]){
        int temp = a[j];
        a[j] = a[j-1];
        a[j-1] = temp;
      }
    }
  }
  if(a[m - 1] * 4 * m < total){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
    vector<int> ans(n);
    int a;
    rep(i,n-1) {
        cin >> a;
        ans[a-1] += 1;
    }
    rep(i,n) {
        cout << ans[i] << endl;
    }
	return 0;
}


Measured memory_bytes: 3988
public class Main {


  private static void solve() {
    double n = ni();
    double m = ni();
    int d = ni();
    
    
    double p = (d == 0 ? 1 : 2) * (n - d) / (n * n);
    System.out.printf("%.12f\n", p * (m-1));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 22868
class UnionFind
  attr_accessor(:table)

  def initialize(n)
    @table = Array.new(n, -1)
  end

  def root(x)
    st = []
    tb = @table
    while tb[x] >= 0
      st.push(x)
      x = tb[x]
    end
    
    st.each do |y|
      @table[y] = x
    end
    
    return x
  end
  
  def find(x, y)
    return root(x) == root(y)
  end

  def unite(x, y)
    r1 = root(x)
    r2 = root(y)
    return if r1 == r2
    
    d1 = @table[r1]
    d2 = @table[r2]
    if d1 <= d2
      @table[r2] = r1
      @table[r1] += d2
    else
      @table[r1] = r2
      @table[r2] += d1
    end
  end
end

n, m = $stdin.readline.chomp.split.map(&:to_i)
e = []

m.times do
  a, b = $stdin.readline.chomp.split.map(&:to_i)
  e << [a - 1, b - 1]
end

res = 0
m.times do |i|
  uf = UnionFind.new(n)
  m.times do |j|
    next if i == j
    uf.unite(*e[j])
  end
  res += 1 if uf.table.min != - n
end
puts res

Measured memory_bytes: 14312
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        WriteLine($"{n[0] * n[1]}");
    }
}


Measured memory_bytes: 19048
#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() {
    int n;
    cin >> n;
    map<string, int> m;
    rep(i, n) {
        string tmp;
        cin >> tmp;
        if(m.find(tmp) == m.end())
            m[tmp] = 1;
        else {
            m[tmp] += 1;
        }
    }
    cout << m.size() << endl;

    return 0;
}

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

int main() {
    long long n;
    cin >> n;

    long long o = 1;
    char c;
    string ans;
    n--;
    while (1) {
        if (n < o && o != 1) break;
        if (o != 1) n -= o;
        c = n % (o*26) / o + 'a';
        ans = c + ans;
        n -= n % (o*26);
        o *= 26;
    }
    cout << ans << endl;
}

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

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

  int cards[4][13];

  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      cards[i][j] = 0;
    }
  }

  char a;
  int num;
  for(int i=0;i<n;i++){
    cin >> a >> num ;
    switch(a){
      case 'S':
        cards[0][num-1] = 1;
        break;
      case 'H':
        cards[1][num-1] = 1;
        break;
      case 'C':
        cards[2][num-1] = 1;
        break;
      case 'D':
        cards[3][num-1] = 1;
        break;
    }
  }

  /*for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      cout << cards[i][j] << " ";
    }
    cout << endl;
  }*/

  for(int i=0;i<13;i++){
    if(cards[0][i]==0){
      cout << "S " << i+1 << endl;
    }
  }
  for(int i=0;i<13;i++){
    if(cards[1][i]==0){
      cout << "H " << i+1 << endl;
    }
  }
  for(int i=0;i<13;i++){
    if(cards[2][i]==0){
      cout << "C " << i+1 << endl;
    }
  }
  for(int i=0;i<13;i++){
    if(cards[3][i]==0){
      cout << "D " << i+1 << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int n, k, h;
  ll hsum = 0;
  vector<int> v;
  cin >> n >> k;
  if (n <= k) {
    cout << 0 << endl;
    return 0;
  }

  REP(i, n) {
    cin >> h;
    v.push_back(h);
  }

  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for(int i = k; i < (n); ++i) {
    hsum += v[i];
  }

  cout << hsum << endl;
  return 0;
}

Measured memory_bytes: 1400
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;




//繰り返し2乗法
//N^aの、Mで割った余りを求める。
//M = 1000000007 (1e9 + 7) など。
//M = 1000000009 (1e9 + 9) もある。
//M = 998244353 もある。
ll my_pow(ll N, ll a, ll M) {
    ll tempo;
    if (a == 0) {
        return 1;
    }
    else {
        if (a % 2 == 0) {
            tempo = my_pow(N, a / 2, M);
            return (tempo * tempo) % M;
        }
        else {
            tempo = my_pow(N, a - 1, M);
            return (tempo * N) % M;
        }
    }
}


//N_C_a
ll my_combination(ll N, ll a, ll M) {
    ll answer = 1;

    rep(i, a) {
        answer *= (N - i);
        answer %= M;
    }

    rep(i, a) {
        answer *= my_pow(i + 1, M - 2, M);
        answer %= M;
    }

    return answer;
}





signed main() {
    ll N, K;
    cin >> N >> K;


    ll res = 0;
    for (ll i = K; i <= N + 1; i++) {
        res += (2 * N - i + 1) * i / 2 - (i-1)*i/2 + 1;
        //cout << res << endl;
        res %= large_P;
    }

    cout << res << endl;

}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long ll;
#define MAX_N 101


int dp[MAX_N][MAX_N];
int p[MAX_N];



int main()
{
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>p[i-1]>>p[i];
	}
	for(int i = 1; i <= n; i++) dp[i][i] = 0;
	for(int l = 2; l <= n; l++){
		for(int i = 1; i <= n - l + 1; i++){
			int j = i + l -1;
			dp[i][j] = (1<<21);
			for(int k = i; k <= j-1; k++){
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + p[i-1]*p[k]*p[j]);
			}
		}
	}
	cout<< dp[1][n]<<endl;
	return 0;
}




Measured memory_bytes: 3116
n, k, l = map(int, input().split())
from collections import defaultdict

class UnionFind( ):
    def __init__(self, N):
        self.rank = [0] * N
        self.par = [i for i 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 unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] > self.rank[y]:
            self.par[y] = x
        else:
            self.par[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

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


uf1 = UnionFind(n)
uf2 = UnionFind(n)

for i in range(k):
    p, q = map(int, input().split())
    uf1.unite(p - 1, q - 1)


for i in range(l):
    r, s = map(int, input().split())
    uf2.unite(r - 1, s - 1)

pair = defaultdict(int)
for i in range(n):
    a = uf1.find(i)
    b = uf2.find(i)
    pair[(a, b)] += 1

ans = []
for i in range(n):
    ans.append(pair[(uf1.find(i), uf2.find(i))])

print(" ".join(map(str, ans)))


Measured memory_bytes: 127652
#include <iostream>
#include<vector>
#include <cmath>
 
using namespace std;
 
int main() 
{
   
   int n;
   long long int result=1;
   cin>>n;
   long long int input;
   long long int wrong=pow(10,18);
   bool hasZero = false;
   bool isBad = false;
   for (int i = 0; i < n; i++)
   {
       cin>>input;

      if (input == 0) {
          hasZero = true;
      }

       if (log10(input) + log10(result) > 18) {
           isBad = true;
       }
       result=result*input;
   }

   if (hasZero == true) {
       cout << 0;
       return 0;
   }


   if (result>wrong || isBad == true)
   {
   cout<<-1;
   }
   else
    {
    	cout<<result;
    }
}

Measured memory_bytes: 3976
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int A,B,X,yc=1;
    cin >>A>>B>>X;
    if(A>X) yc=0;
    if((X-A)>B) yc=0;
    
    YN(yc);

    return 0;
}

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

enum Direction{SOUTH,EAST};

int main()
{
  int H,W,N;
  int y,x;
  while(cin>>H>>W>>N,H|W|N){
    vector< vector<int> >v(H+1,vector<int>(W+1,SOUTH));
    vector< vector<int> >dp(H+1,vector<int>(W+1,0));
    for(int i=1;i<=H;i++)for(int j=1;j<=W;j++)cin>>v[i][j];
    dp[1][1]=N-1;
    for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
	if(dp[i-1][j]&1){
	  if(v[i-1][j]==SOUTH)dp[i][j]+=(dp[i-1][j]+1)/2;
	  else dp[i][j]+=(dp[i-1][j]-1)/2;
	}else{
	  dp[i][j]+=dp[i-1][j]/2;
	}
	if(dp[i][j-1]&1){
	  if(v[i][j-1]==EAST)dp[i][j]+=(dp[i][j-1]+1)/2;
	  else dp[i][j]+=(dp[i][j-1]-1)/2;
	}else{
	  dp[i][j]+=dp[i][j-1]/2;
	}
      }
    }
    //for(int i=0;i<H;i++,puts(""))for(int j=0;j<W;j++)cout<<v[i][j]<<",";
    //puts("");
    //for(int i=0;i<=H;i++,puts(""))for(int j=0;j<=W;j++)cout<<dp[i][j]<<",";
    //puts("");
    //for(int i=0;i<H;i++,puts(""))for(int j=0;j<W;j++)cout<<((v[i][j]+dp[i][j])&1)<<",";
    //puts("");
    y=x=1;
    while(x<=W && y<=H){
      v[y][x]^=dp[y][x]&1;
      //cout<<y<<","<<x<<":"<<v[y][x]<<endl;
      if(v[y][x]==SOUTH)y++;
      else x++;
    }
    cout<<y<<" "<<x<<endl;
  }
}

Measured memory_bytes: 8772
#include <stdio.h>

int main(void) {
    long long X, n, a, i;
    scanf("%lld", &X);
    n=100; i=0;
    while (1) {
        a=n/100;
        n+=a;
        i++;
        if (n>=X) break;
    }
    printf("%lld", i);
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

ll modpow(ll a, ll n) {
  if (n == 0) return 1;
  if (n == 1) return a % mod;
  if (n % 2 == 1) return (a * modpow(a, n - 1)) % mod;
  ll t = modpow(a, n / 2);
  return (t * t) % mod;
}

int main() {
    ll n, a, b; cin >> n >> a >> b;
    const ll Max = 200001;
    ll niko[Max], inv[Max];
    niko[0] = 1;
    niko[1] = n;
    inv[1] = 1;
    for (int i = 2; i < Max; i++) {
        niko[i] = ((n - i + 1) * niko[i - 1]) % mod;
        inv[i] = modpow(i, mod - 2);
        niko[i] = niko[i] * inv[i] % mod;
        
    }
    ll ans = modpow(2, n);
    ans--;
    if (ans < 0) ans += mod;
    ans -= niko[a];
    if (ans < 0) ans += mod;
    ans -= niko[b];
    if (ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5156
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};
#[allow(unused_imports)]
use rand::prelude::*;

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

#[allow(unused)]
fn calc(i: usize, day: usize, s: &Vec<Vec<isize>>, c: &Vec<isize>, last: &mut Vec<usize>) -> isize {
    last[i] = day;
    let up = s[day - 1][i];
    let mut down = 0;

    for j in 0..26 {
        down += (day - last[j]) as isize * c[j];
    }

    up - down
}

fn calc_all(contests: &Vec<usize>, s: &Vec<Vec<isize>>, c: &Vec<isize>) -> isize {
    let mut last = vec![0; 26];
    let mut score = 0;

    for (day, &i) in contests.iter().enumerate() {
        score += calc(i, day + 1, s, c, &mut last);
    }

    score
}

fn main() {
    input! {
        d: usize,
        c: [isize; 26],
        s: [[isize; 26]; d],
    }

    let now = std::time::SystemTime::now();

    let mut last = vec![0; 26];
    let mut score = 0;
    let mut contests = vec![];

    // greedy
    for day in 1..=d {
        let mut max = std::isize::MIN;
        let mut best_i = 0;
        for i in 0..26 {
            let tmp = last[i];
            let score = calc(i, day, &s, &c, &mut last);
            if score > max {
                max = score;
                best_i = i;
            }
            last[i] = tmp;
        }
        score += calc(best_i, day, &s, &c, &mut last);
        last[best_i] = day;
        contests.push(best_i);
    }

    let seed = [13; 32];
    let mut rng: rand::rngs::StdRng = rand::SeedableRng::from_seed(seed);
    let ch_contest: Vec<_> = (0..26).collect();
    let ch_day: Vec<_> = (1..=d).collect();

    while std::time::SystemTime::now().duration_since(now).unwrap()
        < std::time::Duration::new(1, 900)
    {
        if let Some(&contest) = ch_contest.choose(&mut rng) {
            if let Some(&day) = ch_day.choose(&mut rng) {
                let tmp = contests[day - 1];

                contests[day - 1] = contest;
                let new_score = calc_all(&contests, &s, &c);

                if new_score > score {
                    score = new_score;
                } else {
                    contests[day - 1] = tmp;
                }
            };
        };
    }

    for e in contests {
        echo!(e + 1);
    }
    // dbg!(score);
}


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

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

void solve()
{
    vi a(3);
    rep(i, 3)
    {
        in(a[i]);
    }
    int ans = 0;
    while (1)
    {
        sort(all(a));
        if (a[0] == a[1] && a[1] == a[2])
        {
            break;
        }
        if (a[0] == a[1])
        {
            a[0]++;
            a[1]++;
            ans++;
        }
        else
        {
            a[0] += 2;
            ans++;
        }
    }
    out(ans);
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int sum[400005],lazy[400005],n,m;;
struct obj
{
    int l,r;
}p[300005];
bool cmp(obj x,obj y)
{
    return x.r-x.l<y.r-y.l;
}
void push_down(int k,int l,int r)
{
    if(l==r)
    {
        sum[k]+=lazy[k];
    }
    else
    {
        lazy[k<<1]+=lazy[k];
        lazy[k<<1|1]+=lazy[k];
        sum[k]+=lazy[k]*(r-l+1);
    }
    lazy[k]=0;
}
void change(int k,int l,int r,int x,int y,int w)
{
    if(l>=x&&r<=y)
    {
        lazy[k]+=w;
    }
    else
    {
        push_down(k,l,r);
        int mid=(l+r)>>1;
        if(!(y<l||x>mid))
        {                 
            change(k<<1,l,mid,x,y,w);
        }             
        if(!(y<mid+1||x>r))
        {                
            change(k<<1|1,mid+1,r,x,y,w);
    	}
    }
}
int query(int k,int l,int r,int x)
{
    push_down(k,l,r);
    if(l==r)
    {
        return sum[k];
    }
    int mid=(l+r)>>1;
    if(x<=mid)
    {
        return query(k<<1,l,mid,x);
    }
    return query(k<<1|1,mid+1,r,x);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&p[i].l,&p[i].r);
    }
    int i=0;
    sort(p,p+n,cmp);
    for(int d=1;d<=m;d++)
    {
        while(i<n&&p[i].r-p[i].l<d)
        {
            change(1,1,m,p[i].l,p[i].r,1);
            i++;
        }
        int ans=n-i;
        for(int k=d;k<=m;k+=d)
        {
            ans+=query(1,1,m,k);
        }
        printf("%d\n",ans);
    }
    return 0;
}//pwq

Measured memory_bytes: 5760
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

#define MAX 100000
#define INFTY 1 << 30
int v,r;
vector<pair<int,int> > adj[MAX];

void dijkstra(){
    priority_queue<pair<int,int> > PQ;
    int d[MAX];
    for(int i = 0; i < v; i++){
        d[i] = INFTY;
    }    
    d[r] = 0;
    PQ.push(make_pair(0,r));
    
    while(!PQ.empty()){
        pair<int,int> m = PQ.top(); PQ.pop();
        int u = m.second;

        if(d[u] < m.first*(-1)) continue;

        for(int i = 0; i < adj[u].size(); i++){
            int v = adj[u][i].first;
            if(d[u]+adj[u][i].second < d[v]){
                d[v] = d[u]+adj[u][i].second;
                PQ.push(make_pair(d[v]*(-1),v));
            }
        }
    }
        for(int i = 0; i < v; i++){
        if(d[i] < INFTY) printf("%d\n",d[i]);
        else printf("INF\n");
    }
}

int main(){
    int e,s,t,d;
    scanf("%d %d %d", &v, &e, &r);
    for(int i = 0; i < e; i++){
        scanf("%d %d %d", &s, &t, &d);
        adj[s].push_back(make_pair(t,d));
    }
    dijkstra();

    return 0;
}


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

int main(){
  int a,b,n;
  cin>>a>>b;
  for(int i=a;i<=b;i++){
    int c,d,f,g;
    c=i%10;
    d=(i%100)/10;
    f=(i%10000)/1000;
    g=(i%100000)/10000;
   if(c==g && d==f)
     n++;
  }
  cout<<n<<endl;
}
  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[][] load = new int[M][2];
		for(int i = 0;i < M;++i) {
			load[i][0] = sc.nextInt()-1;
			load[i][1] = sc.nextInt()-1;
		}
		sc.close();
		
		int[] ans = new int[N];
		for(int i = 0;i < M;++i) {
			if(load[i][0] != load[i][1]) {
				ans[load[i][0]]++;
				ans[load[i][1]]++;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < N;++i) {
			sb.append(ans[i]);
			sb.append("\n");
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 23252
A, B = map(int, input().split())

import math

if A < B:
    A, B = B, A
    
while A % B != 0:
    A, B = B, A%B
    
ans = 1

for i in range(2, int(math.sqrt(B))+1):
    if B % i == 0:
        ans += 1
        
        while B % i == 0:
            B //= i
            
if B > 1:
    ans += 1
    
print(ans)

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

MIN = []
MAX = []
for i in range(N):
  a,b = map(int,input().split())
  MIN.append(a)
  MAX.append(b)

MIN.sort()
MAX.sort()

if N%2 == 1:#奇数の時
  C = (N+1)//2-1 #3なら2個目なのでIndexは1
  ans = MAX[C]-MIN[C]+1
else:
  C = N//2-1
  D = C+1
  small = (MIN[C]+MIN[D])/2
  big = (MAX[C]+MAX[D])/2
  #print(small,big)
  ans = (big-small)/0.5+1
  ans = int(ans)
print(ans)



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

#define ll                 long long
#define pb                 push_back
#define ppb                pop_back
#define endl               '\n'
#define mii                map<ll, ll>
#define pii                pair<ll, ll>
#define vi                 vector<ll>
#define all(a)             (a).begin(), (a).end()
#define mem0(x)            memset(x, 0, sizeof(x))
#define mem1(x)            memset(x, -1, sizeof(x))
#define F                  first
#define S                  second
#define sz(x)              ((ll)x.size())
#define DECIMAL(n)         cout<<fixed<<setprecision(n);
#define rep(i, a, b)       for (ll i=a; i<b; i++)
#define repr(i, a, b)      for (ll i=a-1; i>=b; i--)
#define bitcount(a)        (ll)__builtin_popcount(a)
#define lbnd               lower_bound
#define ubnd               upper_bound
#define ios                ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define trace(...)         __f(#__VA_ARGS__, __VA_ARGS__)

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0
// order_of_key(k) returns count of elements strictly smaller than k

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    std::cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names+1, ','); std::cerr.write(names, comma-names)<<" : "<<arg1<<" | "; 
    __f(comma+1, args...);
}

const long double PI=3.14159265358979323846264338;
const double eps=1e-10;
ll hell=1e9+7;
ll inf=((ll)5e18+5);
const ll nax=1e5+10;
ll n, m;
vi a[nax];
bool vis[nax];
void dfs(ll node) {
    vis[node]=1;
    for(auto i:a[node]) {
        if(!vis[i]) {
            dfs(i);
        }
    }
}

void solve() {
    cin>>n>>m;
    rep(i, 0, m) {
        ll x, y;
        cin>>x>>y;
        a[x].pb(y);
        a[y].pb(x);
    }
    ll ans=0;
    rep(i, 1, n+1) {
        if (!vis[i]) {ans++; dfs(i);}
    }
    cout<<ans-1<<endl;
}

signed main() {
    ios
    ll test=1;
    // cin>>test;
    while (test--) solve();
    return 0;
}

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

using namespace std;

int main(){
    int n, q; cin >> n >> q;
    string s; cin >> s;
    vector<int> a(n);
    vector<int> cs(n+1);
    for (int i = 0; i < n-1; i++) {
        if (s[i] == 'A' && s[i+1] == 'C') a[i] = 1;
    }
    for (int i = 0; i < n; i++) {
        cs[i+1] = cs[i] + a[i];
    }

    for (int i = 0; i < q; i++) {
        int l, r; cin >> l >> r;
        l--;
        r--;
        cout << cs[r] - cs[l] << endl;
    }


}



Measured memory_bytes: 1792
import numpy as np
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**18
def solve(N,A):
    P = set()

    fl = True
    for i in range(N):
        n = A[i]
        if n % 2 == 0 and 2 in P: 
            fl = False
            break
        while n % 2 == 0:
            P.add(2)
            n //= 2
            
        f = 3
        while f * f <= n:
            if n % f == 0:
                if f in P: 
                    fl = False
                    break
                
                P.add(f)
                while n % f == 0:
                    n //= f
            else:
                f += 2

        if n != 1:
            if n in P:
                fl = False
                break
            P.add(n)
            
        if not fl:
            break

        
    return fl



def main():
    N=ii()
    A=np.array(list(mi()))

    flag = solve(N,A)
    if flag:
        print("pairwise coprime")
    else:
        gcd = np.gcd.reduce(A)
        if gcd == 1:
            print("setwise coprime")
        else:
            print("not coprime")
       

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')

    # basic types: https://numba.pydata.org/numba-doc/0.13/types.html
    cc.export('solve', '(i8,i8[:])')(solve)
    cc.compile()

if __name__ == '__main__':
    # cc_export()
    try:
        from my_module import solve
    except:
        cc_export()
        exit()

    main()


Measured memory_bytes: 145144