akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define INF 1e18
#define eps 0.00001
#define le length
#define debug(n1) cout << n1 << endl
#define rep(i , j , n) for(ll i = j ; i <= n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)
const ll N = 2e3 + 5;
const ll M = 1e7 + 5;
const ll mod = 1e18 + 7;
ll MODULAR_POWER(ll a , ll b , ll MOD) {
    if(b == 0) return 1LL;
    ll d = MODULAR_POWER(a , b / 2 , MOD);
    d *= d;
    d %= MOD;
    if(b % 2) d *= a;
    d %= MOD;
    return d;
}
ll BINARY_SEARCH(ll dp[] , ll n , ll key) {
    ll s = 1;
    ll e = n;
    while(s <= e) {
        ll mid = (s + e) / 2;
        if(dp[mid] == key) return mid;
        else if (dp[mid] > key) e = mid - 1;
        else s = mid + 1;
    }
    return -1;
}
string CONVERT_TO_BINARY(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}
bool PALIN(string s) {
    int i = 0;
    int j = s.le() - 1;
    while(i <= j) {
        if(s[i] != s[j]) return false;
        j-- , i++;
    }
    return true;
}
ll n , z , w;
ll a[N];
int main() {
    SPEED;
    cout.precision(8);
    cout << fixed;
    cin >> n >> z >> w;
    rep(i , 1 , n) cin >> a[i];
    if(n == 1) {
        cout << abs(a[1] - w) << endl;
    }
    else {
        cout << max(abs(a[n - 1] - a[n]) , abs(a[n] - w));
    }
    return 0;
}

Measured memory_bytes: 256
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fastestiointhewest   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{ 
  string s; cin>>s;
  int k; cin>>k;
  int n=s.size();
  rep(i,0,n-1)
  {
    if(s[i]=='a') continue;
    if(26-(s[i]-'a')<=k)
    {
      k-=(26-(s[i]-'a'));
      s[i]='a';
    }
  }
  if(k)
  {
    s[n-1]=(s[n-1]-'a'+k)%26 + 'a';
  }
  cout<<s; 
} 
int main()
{   
    fastestiointhewest;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 592
X, K, D = map(int, input().split())
X = abs(X)
if D * K > X:
    if (K - X // D )% 2 == 0:
        print(X - D * (X // D))
    else:
        print(abs(X - D * (X // D) - D))
else:
    print(X - D * K)

Measured memory_bytes: 9152
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	var p1, p2 float64
	p1 = math.Ceil(float64(N) / 1.08)
	p2 = math.Trunc(float64(N) / 1.08)
	p2 = math.Trunc(p2 * 1.08)
	if int(math.Trunc(p1*1.08)) == N {
		fmt.Println(int(p1))
	} else if int(math.Trunc(p2*1.08)) == N {
		fmt.Println(int(p2))
	} else {
		fmt.Println(":(")
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}

// ここから拝借
// https://shoman.hatenablog.com/entry/2020/02/25/185456
// Stackは[]intのエイリアス
type Stack []int

// Push adds an element
func (s *Stack) Push(v int) {
	*s = append(*s, v)
}

// Pop removes the top element and return it
func (s *Stack) Pop() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	v := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return v, nil
}

// Peek returns the top value
func (s *Stack) Peek() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	return (*s)[len(*s)-1], nil
}

// Size returns the length of stack
func (s *Stack) Size() int {
	return len(*s)
}

// Empty returns true when stack is empty
func (s *Stack) Empty() bool {
	return s.Size() == 0
}

// NewStack generates stack
func NewStack() *Stack {
	s := new(Stack)
	return s
}


Measured memory_bytes: 1812
#include<bits/stdc++.h>
using namespace std;
int a,b,c,ans,K;
int main()
{
	cin>>a>>b>>c;
	ans=min(a,c);
	a-=ans;c-=ans;
	K=min(b,c);
	ans+=K+b;
	b-=K;c-=K;
	if(c)ans++;
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<vector>


using namespace std;

const int MAX=301;
double dp[MAX+5][MAX+5][MAX+5]; // Hold expectation value for each state.
int main()
{   
    
	int N;
	cin >> N; 
	
	vector<int> count(4, 0);// We count how many Sushi plates with 1-sushi, 2-sushi and 3-sushi.
	for (int i = 0; i < N; ++i)
	{
		int t;
		cin >>t;
		++count[t];
	}
	for (int i = 0; i <= MAX; ++i) // Loop for 3 Sushi
		for (int j = 0; i + j <= MAX; ++j)// Loop for 2 Sushi
			for (int k = 0; i + j + k <= MAX; ++k)// Loop for 1 Sushi
			{
				if(i ==0 && j==0 && k==0) //All Sushi over
					continue;
				if(i+j+k > MAX) // Sushi count > N , not possible
					continue;
				
				double K = 1.0 * ( k + j + i); // Total plates with 1-2-3 Sushi 
				
				
				// Add the expectation of choosing plate with 1 Sushi , multiply with probability of choosing 1 over total (K)
				if(k) // if count#1 is !=0
					dp[k][j][i] += ((1.0 * k)  /K ) * dp[k-1][j][i]; 
				
				if(j) // if count#2 is !=0
					dp[k][j][i] += ((1.0 * j)  /K )* dp[k+1][j-1][i]; 
				
				if(i) // if count#1 is !=0
					dp[k][j][i] += ((1.0 * i)  /K )* dp[k][j+1][i-1];
					
				dp[k][j][i] += (1.0 *N)/K;	
			}
			
	cout.precision(15);
    cout << fixed << dp[count[1]][count[2]][count[3]] << "\n";
}


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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front ///for list
#define     mp             make_pair
#define     is             insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));


int main()
{
    int n,m,a,b;
    cin>>n>>m;
    vi adj[100005];
    int ar[n+5];
    for(int i=1;i<=n;i++){
        cin>>ar[i];
    }
    while(m--){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int cnt=0,ans=0;
    for(int i=1;i<=n;i++){
            cnt=0;
        for(int j=0;j<adj[i].size();j++){
            if(ar[i]>ar[adj[i][j]]){
                cnt++;
                //break;
            }
        }
    if(cnt==adj[i].size())ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 9128
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    string s;
    long long a=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        a+=s[i]-'0';
    }
    if(a%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return(0);
}

Measured memory_bytes: 3720
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#endif

//#define P 1000000007

int comp(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return (*(int*)a<*(int*)b)-(*(int*)a>*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint64_t nextplong(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}
inline int abs2(const int a){return a>=0?a:-a;}

int main(void){
	int m=nextpint();
	int n=1<<m;
	int k=nextpint();
	if(k>=n){
		puts("-1");
	}else if(m==0){
		puts("0 0");
	}else if(m==1){
		puts(k==0?"0 0 1 1":"-1");
	}else{
		for(int i=0; i<k; i++){
			printf("%d ", i);
		}
		for(int i=k+1; i<n; i++){
			printf("%d ", i);
		}
		printf("%d ", k);
		for(int i=n-1; i>k; i--){
			printf("%d ", i);
		}
		for(int i=k-1; i>=0; i--){
			printf("%d ", i);
		}
		printf("%d\n", k);
	}
}


Measured memory_bytes: 1792
using System;

namespace hellounihara
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			for (int i = 0; i < 200; i++) {
			int a = 0;
			string arr02 =Console.ReadLine();
				if (arr02 == null) {
					break;
				}
		    string[] starr02 = arr02.Split();
			foreach (var item in starr02) {
				a += int.Parse(item);
			}
			int digit = a.ToString().Length;
			Console.WriteLine(digit);

			}
		}
	}
}

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

bool comp(int a, int b){
    return a < b;
}

int main(){

    int n; cin >> n;
    vector<int> a(100010, 0);
    for(int i = 0; i < n; i++){
        int input; cin >> input;
        a[input]++;
    }

    int counter = 0;
    for(int i = 0; i < 100010; i++){
        if(a[i] > 1) counter += a[i] - 1;
    }

    if(counter % 2 == 0) cout << n - counter << endl;
    else cout << n - counter - 1 << endl;
    
    return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B_LRUDGame solver = new B_LRUDGame();
        solver.solve(1, in, out);
        out.close();
    }

    static class B_LRUDGame {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int height = in.nextInt();
            int width = in.nextInt();
            int n = in.nextInt();
            int sr = in.nextInt() - 1;
            int sc = in.nextInt() - 1;
            char[] s = in.next().toCharArray();
            char[] t = in.next().toCharArray();
            if (canRemove(n, s, t, height, sr, 'U', 'D')) {
                out.println("NO");
                return;
            }
            if (canRemove(n, s, t, width, sc, 'L', 'R')) {
                out.println("NO");
                return;
            }
            out.println("YES");
        }

        private boolean canRemove(int n, char[] s, char[] t, int len, int x, char neg, char pos) {
            if (canForce(n, s, t, len, x, neg, pos)) {
                return true;
            }
            if (canForce(n, s, t, len, len - x - 1, pos, neg)) {
                return true;
            }
            return false;
        }

        private boolean canForce(int n, char[] s, char[] t, int len, int x, char neg, char pos) {
            for (int i = 0; i < n; i++) {
                if (s[i] == neg) {
                    --x;
                }
                if (x < 0) {
                    return true;
                }
                if (t[i] == pos && x + 1 < len) {
                    ++x;
                }
            }
            return false;
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 27844
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.ST                 as ST
import qualified Data.Array.Unboxed            as AU
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [n] <- readInt
  as<-readInt
  let as'=head $ sortOn Down $ map length $ group $ sort $ concatMap (\x->[x-1,x,x+1]) as in print as'

Measured memory_bytes: 45436
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ll X,Y,A,B,C; cin>>X>>Y>>A>>B>>C; vector<ll> hoge={A,B,C};
  vector<vector<ll>> vec(3,vector<ll>(0));
  rep(i,3) rep(j,hoge[i]) {ll piyo; cin>>piyo; vec.at(i).push_back(piyo);}
  for(auto &svec:vec) sort(svec.rbegin(),svec.rend());
  
  vector<ll> next={0,0,0};
  ll ans=0;
  rep(i,X+Y){
    ll sans=0,sep=-1;
    rep(j,3){
      if(j==0&&(next[0]>=X||next[0]>=A)) continue;
      if(j==1&&(next[1]>=Y||next[1]>=B)) continue;
      if(j==2&&next[2]>=C) continue;
      if(chmax(sans,vec[j][next[j]])) sep=j;
    }
    //cout<<sans<<endl;
    ans+=sans; next[sep]++;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 6496
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

type Range struct {
	begin int
	end   int
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	n := nextInt()
	k := nextInt()

	ranges := make([]Range, k)
	for i := 0; i < k; i++ {
		ranges[i].begin = nextInt()
		ranges[i].end = nextInt() + 1
	}

	fmt.Println(solve(n, k, ranges))
}

const M = 998244353

func solve(n int, k int, ranges []Range) int64 {
	dp := make([]int64, n)
	dp[0] = 1
	dp[1] = -1
	var cur int64 = 0

	for i := 0; i < n; i++ {
		cur = modM(cur + dp[i])

		if cur == 0 {
			continue
		}

		for j := 0; j < k; j++ {
			update(dp, n, i+ranges[j].begin, cur)
			update(dp, n, i+ranges[j].end, -cur)
		}
	}

	return cur
}

func update(dp []int64, n int, index int, cur int64) {
	if index < n {
		dp[index] = modM(dp[index] + cur)
	}
}

func modM(a int64) int64 {
	b := a % M
	if b < 0 {
		return b + M
	} else {
		return b
	}
}


Measured memory_bytes: 3440
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(a: usize, b: usize);

    println!(
        "{}",
        if a >= 13 {
            b
        } else if a >= 6 {
            b / 2
        } else {
            0
        }
    );
}


Measured memory_bytes: 2156
fn main() {
    input! {
        n: usize,
        k: i32,
        a: [i64; n]
    }

    let mut s: Vec<i64> = Vec::new();
    let mut cum = vec![0; n];
    cum[0] = a[0];
    for i in 1..n as usize {
        cum[i] = cum[i - 1] + a[i];
    }
    for i in 0..n {
        for j in i + 1..n {
            if i == 0 {
                let v = cum[j];
                s.push(v);
            } else {
                let v = cum[j] - cum[i - 1];
                s.push(v);
            }
        }
    }

    let mut x: i64 = 0;
    for i in (1..41).rev() {
        let add = 2i64.pow(i - 1);
        let mut cnt = 0;
        for j in &s {
            if (x + add) & j == x + add {
                cnt += 1;
            }
        }
        if cnt >= k {
            x += add;
        }
    }

    println!("{}", x);
}

#[macro_export(local_inner_maccros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[macro_export(lcal_inner_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[macro_export(lcal_inner_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


Measured memory_bytes: 6104
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

bef_val = ''
rsp_str = ['r','s','p']
all_sum = 0
for i in range(0,k):
    max_count = 0
    for ss in rsp_str:
        count = 0
        if t[i] == 'r' and ss == 'p':
            count = count + p
        elif t[i] == 's' and ss == 'r':
            count = count + r
        elif t[i] == 'p' and ss == 's':
            count = count + s
        bef_val = ss
        for j in range(i+k,n,k):
            if t[j] == 'r':
                if bef_val != 'p':
                    count = count + p
                    bef_val = 'p'
                else:
                    bef_val = ''
            elif t[j] == 's':
                if bef_val != 'r':
                    count = count + r
                    bef_val = 'r'
                else:
                    bef_val = ''
            else:
                if bef_val != 's':
                    count = count + s
                    bef_val = 's'
                else:
                    bef_val = ''
        if(max_count < count):
            max_count = count
    all_sum = all_sum + max_count
print(all_sum)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n, k;
	cin >> n >> k;
	
	int ans = 0;
	for(int i=0; i<n; i++){
		int x;
		cin >> x;
		if(k-x <x){
			ans += 2 * (k-x);
		}else{
			ans += 2 * x;
		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#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()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	string	s;
	cin >> s;
	bitset<200> bs;
	rep(i, s.size())
		bs.flip(s.at(i));
	if (bs.any())
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 256
a = list(map(str, input().split()))


stack = []
i = 0
 
for i in range(len(a)):
    if a[i] == '+':
        stack.append(stack.pop() + stack.pop())
    elif a[i] == '-':
        stack.append(- stack.pop() + stack.pop())
    elif a[i] == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(a[i]))
else:
    print(stack[0])
    



Measured memory_bytes: 5604
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, K = map(int, readline().split())
AB = np.array(read().split(), np.int64)
A = AB[:N]
B = AB[N:]

Acum = np.zeros(N + 1, np.int64)
Acum[1:] = np.cumsum(A)
Bcum = np.zeros(M + 1, np.int64)
Bcum[1:] = np.cumsum(B)

Acum = Acum[Acum <= K]
Bcum = Bcum[Bcum <= K]

x = np.searchsorted(Acum, K - Bcum, side='right') - 1
x += np.arange(len(Bcum))

print(x.max())

Measured memory_bytes: 53636
#include <iostream>
#include <algorithm> // sort, min, max, swap
#include <utility> // pair
using namespace std;

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

typedef pair<int,int> P;

#define ft first
#define sd second

int main() {
	ios::sync_with_stdio(false);
	
	int n, m, a;
	P p[100];
	
	while(cin>>n>>m,n|m) {
		rep(i, m) {
			p[i].ft = 0;
			p[i].sd = m-i-1;
		}
		
		rep(i, n) {
			rep(j, m) {
				cin>>a;
				if(a)p[j].ft++;
			}
		}
		
		sort(p, p+m, greater<P>());
		
		cout<<m-p[0].sd;
		repi(i, 1, m)cout<<" "<<m-p[i].sd;
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin>>N;
  vector<int> A(N);
  cin>>A;

  vector<int> B = A;
  for(int i=1;i<N;i++) Min(B[i], B[i-1]);

  int ans = 0;
  for(int i=0;i<N;i++) ans += A[i] == B[i];
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?":(":"Yay!")
#define YN(f) ((f)?"YES":"NO")

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int a[10], k, ma;
	
	for(int i = 1; i <= 5; i++){
		cin>>a[i];
		// if(i!=1)ma = max(a[i]-a[i-1],ma);
	}
	
	cin>>k;
	
	cout<<yn(a[5]-a[1] > k)<<endl;
	
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))
    modcnt = [0] * M
    pairs = [0] * M
    cnt = defaultdict(lambda: 0)
    for x in X:
        cnt[x] += 1
        key = x % M
        modcnt[key] += 1
        if cnt[x] % 2 == 0:
            pairs[key] += 1
    ans = modcnt[0] // 2
    for i in range(1, M//2+1):
        if i * 2 == M:
            ans += modcnt[i] // 2
        else:
            tmp = min(modcnt[i], modcnt[M-i])
            ans += tmp
            ans += min((modcnt[i] - tmp) // 2, pairs[i])
            ans += min((modcnt[M-i] - tmp) // 2, pairs[M-i])
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 63724
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
using ull =unsigned long long;
const ll INF =1001001001;

//10億7。　　　100000007

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}


int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);

int A,B,C;
  cin>>A>>B>>C;
  
  cout<<C<<" "<<A<<" "<<B<<endl;

  
  
}



Measured memory_bytes: 256
# 入力
s=input()

a=''
for x in s:
  if x=='0':
    a+='0'
  elif x=='1':
    a+='1'
  else:
    # 文字列が空でない場合、末尾を削除
    if a!='':
      a=a[:-1]

# 出力
print(a)

Measured memory_bytes: 2940
def init(par, n):
    global rank
    par = [i for i in range(n)]
    rank = [0] * n

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

def unite(par, x, y):
    global rank
    x = find(par, x)
    y = find(par, y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

N, K, L = map(int, input().split())
roads = [i for i in range(N)]
rank = [0] * N
for i in range(K):
    p, q = map(int, input().split())
    unite(roads, p - 1, q - 1)
rails = [i for i in range(N)]
rank = [0] * N
for i in range(L):
    p, q = map(int, input().split())
    unite(rails, p - 1, q - 1)
d = {}
for i in range(N):
    d[find(roads, i), find(rails, i)] = d.get((find(roads, i), find(rails, i)), 0) + 1
for i in range(N):
    print(d[find(roads, i), find(rails, i)], end = " ")
print()

Measured memory_bytes: 127048
#include <cstdio>
#include <cstdint>
#include <vector>

constexpr intmax_t mod = 1e9+7;

namespace detail {
template <typename Tp, size_t N>
std::vector<Tp> make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N == 1), Tp const&>::type x
) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N > 1), Tp const&>::type x
) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector<Tp, N-1>(sizes, x))>(
      size, make_vector<Tp, N-1>(sizes, x)
  );
}
}  // detail::

template <typename Tp, size_t N>
auto make_vector(size_t const(&sizes)[N], Tp const& x) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return detail::make_vector<Tp, N>(s, x);
}

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

int main() {
  size_t n, k;
  scanf("%zu %zu", &n, &k);

  if (n < k) return puts("0"), 0;

  auto dp = make_vector<intmax_t>({k+1, n+1}, 0_jd);
  dp[0][0] = 1;
  for (size_t i = 1; i <= k; ++i) {
    for (size_t j = 0; j <= n; ++j) {
      dp[i][j] = dp[i-1][j];
      if (j >= i)
        (dp[i][j] += dp[i][j-i]) %= mod;
    }
  }

  printf("%jd\n", dp[k][n-k]);
}



Measured memory_bytes: 10296
#include<bits/stdc++.h>
using namespace std;
long long n , m ;
int ans = 1 ;
signed main() {
  scanf("%lld %lld", & n , & m) ;
	for(register int i = 2 ; 1ll * i * i <= n ; i ++)
  	if(n % i == 0) {
  		while(n % i == 0) n /= i ;
  		if(m % i == 0) ans ++ ;
  		while(m % i == 0) m /= i ;
  	}
	if(n != 1 && m % n == 0) ans ++ ;
	printf("%d\n" , ans) ;
  return 0 ;
}

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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))
//#define int long long

signed main(){
    string s;
    cin >> s;
    rep(i, s.length()){
        if(i % 2 == 0){
            cout << s[i];
        }
    }
    cout << endl;
}

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

int main(){
	int n, h;
	int count = 0;
	cin >> n >> h;
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	int i = n - 1;
	while(h > 0 && b[i] > a[n-1] && i >= 0){
		h -= b[i];
		count++;
		i--;
	}
	if(h>0){
		count += (h + a.back() - 1) / a.back();
	}
	cout << count;
	return 0;
}


Measured memory_bytes: 1024
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  ll x;
  cin >> x;

  ll ans = x / 11 * 2;
  if (0 < x % 11 && x % 11 < 7) ans++;
  else if (x % 11 >= 7) ans += 2;
  cout << ans << endl;

  
  return 0;
}

Measured memory_bytes: 256
import math

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

ans = 0
for i in range(N):
    n = math.log2(k) - math.log2(i+1)
    if n < 0:
        n = 0
    if n > 0:
        n = math.ceil(n)
    ans = ans + 1/((2**n)*N)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif


const int MAXA = 1e6+10;

int qq[MAXA];
bool fatto[MAXA];
bool diviso[MAXA];


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        //~ A[i] = 2;
        qq[A[i]]++;
    }
    sort(A.begin(), A.end());
    for (int i = 0; i < N; i++) {
        if (fatto[A[i]]) continue;
        fatto[A[i]] = true;
        if (qq[A[i]] > 1) diviso[A[i]] = true;
        for (int k = 2*A[i]; k < MAXA; k+=A[i]) diviso[k] = true;
    }
    int res = 0;
    for (int i = 0; i < N; i++) if (!diviso[A[i]]) res++;
    cout << res << "\n";
}


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

namespace AAirplane
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var p = inputs[0];
            var q = inputs[1];
            var r = inputs[2];

            var sum = inputs.OrderBy(x => x).Take(2).Sum();

            // 解答の出力
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;
import java.io.*;
import java.util.stream.Stream;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] strA = br.readLine().split(" ");
        int[] A = Stream.of(strA).mapToInt(Integer::parseInt).toArray();
        
        double total = 0;
        for(int i = 0; i < N; i++){
            total += 1.0/A[i];
        }
        
        System.out.println(1.0/total);

    }
}


Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

#define _deb(x) cout<<x;
void _print() {cerr << "]\n";} template <typename T, typename... V>void _print(T t, V... v) {_deb(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
template <class T, class U> void print_m(const map<T,U> &m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}
template<class T, class U>void debp(const pair<T, U> &pr, bool end_line=1){cout<<"{"<<pr.first<<" "<<pr.second<<"}"; cout<<(end_line ? "\n" : ", ");}
template <class T> void print_vp(const T &vp, int sep_line=0){if(vp.empty()){cout<<"Empty"<<endl; return;}if(!sep_line) cout<<"{ ";for(auto x: vp) debp(x,sep_line);if(!sep_line) cout<<"}\n";cout<<endl;}
template <typename T>void print(const T &v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<sz(v); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<endl;}
template <typename T>void print_vv(const T &vv){if(sz(vv)==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<sz(*vv.begin()); j++)cout<<setw(w)<<j<<" ";cout<<endl;int i = 0;for(auto &v: vv){cout<<i++<<" {";for(auto &el: v) cout<<setw(w)<<el<<" ";cout<<"},\n";}cout<<endl;}

ll n, K;
vl a;

bool can(ll len){
    ll cuts = 0;
    for(auto x: a){
        cuts+=max(0ll, (x+len-1)/len -1);
        if(cuts>K) return 0;
    }
    return 1;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    while(cin>>n>>K){
        a.resize(n);
        forn(i,n) cin>>a[i];

        ll lt = 0, rt = 1e9+10, ans = 0;
        while(1+lt<rt){
            ll mid = lt + (rt-lt)/2;
            if(can(mid))
                ans = mid, rt = mid;
            else 
                lt = mid;
        }
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 4692
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll bit[100010], num;
ll n, par[100010], k, kai[2010];

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= num)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll po(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return po(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = po(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return po(x, mod - 2);
}

int main(void)
{
	cin >> n >> k;
	kai[0] = 1;
	for (int i = 1; i <= 2005; i++)
	{
		kai[i] = kai[i - 1] * i % mod;
	}
	for (ll i = 1; i <= k; i++)
	{
		if (k < i || n - k + 1 < i)
		{
			cout << 0 << endl;
			continue;
		}
		ll ans = kai[k - 1] * div(kai[i - 1]) % mod * div(kai[k - i]) % mod;
		cout << ans * kai[n - k + 1] % mod * div(kai[i]) % mod * div(kai[n - k + 1 - i]) % mod << endl;
	}
	int www;
	cin >> www;
}


Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l,r,d=map(int,input().split())
print(r//d-(l-1)//d)

Measured memory_bytes: 68108
package main

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

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, 100)
	sc.Buffer(buf, 100+1024)
	sc.Split(bufio.ScanWords)
	a, _ := strconv.Atoi(readLine(sc))
	b, _ := strconv.Atoi(readLine(sc))
	c, _ := strconv.Atoi(readLine(sc))

	if a < c && c < b {
		fmt.Println("Yes")
	} else if b < c && c < a {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void readin(T &x) {
    x = 0;
    T fh = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
    x *= fh;
}
inline void d_read(double &x) {
    x = 0.0;
    int fh = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
    if (ch == '.') {
        double num = 1.0;
        ch = getchar();
        for (; isdigit(ch); ch = getchar()) x = x + (num /= 10) * (ch ^ 48);
    }
    x *= fh;
}
template <typename T>
inline void wt(T x) {
    if (x > 9) wt(x / 10);
    putchar(x % 10 + 48);
}
template <typename T>
inline void writeln(T x, char c) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    wt(x);
    putchar(c);
}
const int N = 2e5 + 5;
long long inv, sum, res, x;
const int mod = 1e9 + 7;
inline void qp() {
    inv = 1;
    long long si = 2ll;
    int cnt = mod - 2;
    while(cnt) {
        if (cnt & 1) inv = (inv * si) % mod;
        si = (si * si) % mod;
        cnt >>= 1;
    }
}
int main() {
    int n;
    readin(n);
    for (int i = 1; i <= n; i ++) {
        readin(x);
        res = (res + x * x) % mod;
        sum = (sum + x) % mod;
    }
    qp();
    sum = (sum * sum - res + 1ll * mod) % mod * inv % mod;
    writeln(sum, '\n');
    return 0;
}

Measured memory_bytes: 3632
from collections import defaultdict

def prime_factorization(n):
    result = defaultdict(int)
    if n < 2:
        return result
    while n % 2 == 0:
        result[2] += 1
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            n = n // p
            result[p] += 1
        p += 2
    if n > 1:
        result[n] += 1
    return result

n = int(input())
factors = prime_factorization(n)
ans = '{}:'.format(n)
for p, num in sorted(factors.items()):
    ans += ' {}'.format(p) * num
print(ans)


Measured memory_bytes: 6000
/*
 * ITP1_3D.c
 *
 *  Created on: 2016/05/28
 *      Author: TakaakiShogaki
 */

#include<stdio.h>

int main(){
	int a,b,c,i,count;
	count=0;

	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0)
			count++;
	}
printf("%d\n",count);
return 0;
}

Measured memory_bytes: 596
S = input()
mod = 13
mp = 10**9+7
n = len(S)
dp = [[0]*13 for i in range(n+1)]
dp[-1][0] = 1
d = 1
for i in range(n):
    s = S[-i-1]
    if s=="?":
        for k in range(10):
            for j in range(13):
                l = (k*d + j)%mod
                dp[i][l] +=dp[i-1][j]
                dp[i][l] %=mp
    else:
        for j in range(13):
            l = (int(s)*d + j)%mod  
            dp[i][l] = dp[i-1][j]
    d = d*10 %mod
print(dp[n-1][5])


Measured memory_bytes: 61916
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
long long int ll;
using namespace std;

int main(){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s=="abc"){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

struct Res
{
    string name;
    int score;
    int num;

    bool operator<(const Res &r1) const
    {
        return name == r1.name ? score > r1.score : name < r1.name;
    }

    bool operator>(const Res &r1) const
    {
        return name == r1.name ? score < r1.score : name > r1.name;
    }
    /*
    bool operator==(const Res &r1, const Res &r2) const
    {
        return r1.NeighborsList.size() == r2.NeighborsList.size();
    }
    */
};
// Resの次数の大きさを比較

int main()
{

    int n;
    cin >> n;

    vector<Res> res(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> res[i].name >> res[i].score;
        res[i].num = i + 1;
    }

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

    for (const auto &r : res)
    {
        cout << r.num << endl;
    }
    

    return 0;
}


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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,ii>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

const int INF = 1e9+10;

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

int h,w,k,X1,Y1,X2,Y2;
vector<string> g;

int bfs(int x,int y){
	vector<vi> dist(h+10,vi(w+10,-1));
	dist[x][y]=0;
	queue<ii> q;
	q.push({x,y});
	while(!q.empty()){
		ii cur = q.front();
		q.pop();
		for(int i=0;i<4;++i){
			int dxx=cur.ff;
			int dyy=cur.ss;
			for(int j=0;j<k;++j){
				dxx+=dx[i];
				dyy+=dy[i];
				if(dxx<0||dyy<0||dxx>=h||dyy>=w)
					break;
				if(g[dxx][dyy]=='@')
					break;
				if(dist[dxx][dyy]!=-1 && dist[dxx][dyy]<dist[cur.ff][cur.ss]+1)
					break;
				if(dist[dxx][dyy]!=-1 && dist[dxx][dyy]<=dist[cur.ff][cur.ss]+1)
					continue;
				dist[dxx][dyy]=dist[cur.ff][cur.ss]+1;
				q.push(mp(dxx,dyy));
			}
		}
	}
	return dist[X2-1][Y2-1];
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>h>>w>>k>>X1>>Y1>>X2>>Y2;
	g=vector<string>(h);
	for(int i=0;i<h;++i){
		cin>>g[i];
	}
	int ans = bfs(X1-1,Y1-1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 51172
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  string S;
  cin>>S;
  if(S == "ABC"){
    cout<<"ARC"<<'\n';
  }else if(S == "ARC"){
    cout<<"ABC"<<'\n';
  }
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		// ------------------------------------------------
		int n = Integer.parseInt(sc.next());
		List<Integer> d = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			d.add(Integer.parseInt(sc.next()));
		}

		int ret = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				ret += d.get(i) * d.get(j);
			}
		}
		out.println(ret);

		// ------------------------------------------------
		sc.close();
		out.flush();
	}
}

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

int main(){
  int n, l;
  cin >> n;
  cin >> l;
  string str[n];
  string temp;
  for(int i = 0; i < n; i++) cin >> str[i];
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      if(str[i].compare(str[j]) > 0){
	temp = str[i];
	str[i] = str[j];
	str[j] = temp;
      }
    }
  }
  for(int i = 0; i < n; i++) cout << str[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 256