akhauriyash/Code-Regression huggingface dataset:
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define int ll
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    // https://www.geeksforgeeks.org/find-excel-column-name-given-number/

    #define MAX 50 
using namespace std; 
  
// Function to print Excel column name for a given column number 
void printString(int n) 
{ 
    char str[MAX]; // To store result (Excel column name) 
    int i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return; 
} 

    signed   main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n;
            cin>>n;
            printString(n);
        }
        return 0;
    }


Measured memory_bytes: 3648
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
sum = 0
c = collections.Counter(prime_factorize(n))
index = 1
for i in c.values():
    tmp = i
    # print(str(tmp) + " tmp")
    for j in range(i):
        if j+1 > tmp:
            break
        tmp -= j+1
        sum += 1
print(sum)
# print(c)


Measured memory_bytes: 9456
#include <stdio.h>

int main() {

	int N,cnt;
	char S[100];

	scanf("%d", &N);
	scanf("%s", S);

	for (int i = 0; i <= N; i++) {
		if (S[i] == 'A' && S[i+1]=='B' && S[i+2] =='C') {
			cnt = cnt + 1;
		}
	}

	printf("%d", cnt);

	return 0;
}

Measured memory_bytes: 128
import java.io.*;

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

            int n, x;
            int cnt, ave3, ave2;
            String[] tmpArray;  
            while( true ) {
                String str = kb.readLine();
                tmpArray = str.split( " " );
                n = Integer.parseInt( tmpArray[0] );
                x = Integer.parseInt( tmpArray[1] );

                if( 0 == n && 0 == x ) {  break; }

                cnt = 0;
                ave3 = x / 3;
                int i, j, k;
                for( i=1; i<ave3; i++ ) {
                    ave2 = ( x-i ) / 2;
                    for( j=i+1; j<=ave2; j++ ) {
                        k = x - i - j;
                        if( j < k && k <= n ) {
                            cnt++;
                        }
                    }
                }
                System.out.println( cnt );    
            }
        } catch( IOException e ) {
            System.err.println( e );
        }
    }
}



Measured memory_bytes: 24160
#include<iostream>
using namespace std;
int N, T;
int t[2000000];
int main() {
	cin >> N >> T;
	int wa = 0;
	for (int i = 0; i < N; i++) {
		cin >> t[i];
		if (i == 0) {
			wa = T;
		}
		else {
			if (t[i]-t[i-1]<=T) {
				int len = T-(t[i]-t[i-1]);
				wa = +wa - len+T;
			}
			else {
				wa = wa + T;
			}
		}
	}
	cout << wa << endl;
}

Measured memory_bytes: 1024
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] p = new int[m];
        int[] y = new int[m];
        Map<Integer, Integer> yearTree = new TreeMap<>();

        for (int i = 0; i < m ; i++) {
            p[i] = sc.nextInt();
            y[i] = sc.nextInt();
            yearTree.put(y[i], p[i]);
        }
        int[] pCounter = new int[n];
        for (int yi : yearTree.keySet()) {
            yearTree.put(yi, ++pCounter[yearTree.get(yi) - 1]);
        }
        for (int i = 0; i < m; i++) {
            System.out.println(String.format("%06d%06d", p[i], yearTree.get(y[i])));
        }

    }
}

Measured memory_bytes: 140232
#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 c[31];

int main() {
  int n, m, k, a, cnt = 0;
  cin >> n >> m;
  REP(i, n) {
    cin >> k;
    REP(j, k) {
      cin >> a;
      c[a - 1]++;
    }
  }

  REP(i, m) {
    if (c[i] == n) cnt++;
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
answer :: Int -> Int -> String
answer a b
  | a < b = "a < b"
  | a > b = "a > b"
  | a == b = "a == b"
  | otherwise = "Immpossible!!"

main = do
  hoge <- getLine
  let a = head $ words hoge
      b = last $ words hoge
  putStrLn $ answer (read a) (read b)


Measured memory_bytes: 3628
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int N;
int main()
{
	for(;scanf("%d",&N),N;)
	{
		set<int>dp[99];
		vector<int>D[99];
		for(int i=0;i<N;i++)
		{
			int t,d;
			dp[i].insert(i);
			scanf("%d",&t);
			for(int j=0;j<t;j++)
			{
				scanf("%d",&d);
				D[d].push_back(i);
			}
		}
		for(int i=0;i<31;i++)
		{
			set<int>a;
			for(int j=0;j<D[i].size();j++)
			{
				for(set<int>::iterator it=dp[D[i][j]].begin();it!=dp[D[i][j]].end();it++)
					a.insert(*it);
			}
			if(a.size()==N)
			{
				printf("%d\n",i);
				goto e;
			}
			for(int j=0;j<D[i].size();j++)
				dp[D[i][j]]=a;
		}
		puts("-1");
		e:;
	}
}

Measured memory_bytes: 1348
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
    }
    for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int k, a, b;
    cin >> k >> a >> b;
    REP(i, a, b + 1)
    {
        if (i % k == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;


class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
      
    int n = sc.nextInt();
    int[] p = new int[n];
    int cnt = 0;
    for(int i=0;i<n;i++){
    	p[i] = sc.nextInt();
    }
      for(int i=1;i<n-1;i++){
      	if(p[i-1] < p[i] && p[i+1] > p[i] || p[i-1] > p[i] && p[i+1] < p[i]){
        	cnt++;
        }
      }
      System.out.println(cnt);
	}
}

Measured memory_bytes: 35952
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC125B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine()); //宝石の個数　N個
            string[] inputV = Console.ReadLine().Split(' ');
            string[] inputC = Console.ReadLine().Split(' ');
            int[] V = new int[N];
            int[] C = new int[N];

            int ans = 0; //答えを入れる変数
            for (int i = 0; i < N; i++)
            {
                V[i] = int.Parse(inputV[i]);
                C[i] = int.Parse(inputC[i]);
                if ((V[i] - C[i]) > 0) ans += (V[i] - C[i]);//プラスの時だけ、その宝石を選ぶ
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
<?php

fscanf(STDIN, "%d %d %d %d %d", $ho, $mo, $he, $me, $k);

$o = $ho * 60 + $mo;
$e = $he * 60 + $me;

$ans = $e - $o - $k;
if ($ans > 0) {
  echo $ans;
} else {
  echo 0;
}


Measured memory_bytes: 16020
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    float p;
    cin>>n;
    if(n%2==0 && n!=1)
        p=n/2;
    else if(n%2!=0 && n!=1)
        p=(n/2)+1;
    else if(n==1)
        p=1;
    p=(p/n)*1.00;
    cout.precision(10);
    cout<<fixed<<p<<endl;
    return 0;
}

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

const int max_digit = 50;
ll dp[100][2];

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    memset(dp,-1,sizeof(dp));
    dp[0][0] = 0;
    rep(d,max_digit) {
        ll mask = 1LL << (max_digit - d - 1);

        int num = 0;
        rep(i,n) if (a[i] & mask) num++;

        ll cost0 = mask * num;
        ll cost1 = mask * (n-num);

        //exact -> exact
        if (dp[d][0] != -1) {
            if (k & mask) chmax(dp[d+1][0], dp[d][0] + cost1);
            else chmax(dp[d+1][0],dp[d][0] + cost0);
        }
        //exact -> smaller
        if (dp[d][0] != -1) {
            if (k & mask) chmax(dp[d+1][1], dp[d][0] + cost0);
        }
        //smaller -> smaller
        if (dp[d][1] != -1) {
            chmax(dp[d+1][1], dp[d][1] + cost0);
            chmax(dp[d+1][1], dp[d][1] + cost1);
        }
    }
    cout << max(dp[max_digit][0],dp[max_digit][1]) << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
/*!* [intutil] *!*/
/*+* 整数演算いろいろ *+*/
i64 divceil(i64 a, i64 b) {
    return a / b + (a > 0 && a % b ? 1 : 0);
}
i64 logceil(i64 a, i64 b) {
    for(i64 i = 0, x = 1; a >= 2; x *= a, i++) if(x <= b) return i; return 0;
}
i64 gcd(i64 a, i64 b) {
    for (i64 c; a;) c = a, a = b % a, b = c; return b;
}
i64 lcm(i64 a, i64 b) {
    return (a / gcd(a, b) * b);
}
int main() {
    int N;
    cin >> N;
    vector<i64> A(N);
    for(i64 &a : A) cin >> a;
    bool ans;
    // i : ターン数 (0 mod 2 で自分のターン)
    for(int i = 0; true; i++) {
        i64 g = A[0];
        for(i64 a : A) g = gcd(g, a);
        for(i64 &a : A) a /= g;
        
        int even_num = 0;
        for(i64 a : A) even_num += (a % 2 == 0);
        if(even_num % 2) { // 偶数が奇数個
            ans = i % 2 == 0;
            break;
        } else { // 偶数が偶数個
            i64 odd = 0;
            for(i64 a : A) if(a % 2 == 1) odd = a; 
            if(N - even_num == 1 && odd > 2) { // 奇数が一つだけで、それは1でない
                for(i64 &a : A) if(a % 2 == 1) a--;
                continue;
            } else {
                ans = i % 2 == 1;
                break;
            }
        }
    }
    cout << (ans ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 1024
n=int(input())
listA=[list(map(str,input().split())) for i in range(n)]
for j in range(n):
    listA[j].append(j+1)
    listA[j][1]=int(listA[j][1])
listB = sorted(listA, key= lambda x:x[1], reverse=True)
listC = sorted(listB, key=lambda x:x[0])
for k in range(n):
    print(listC[k][2])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		for(int i=0;i<a;i++) cout<<b;
	}else{
		for(int i=0;i<b;i++) cout<<a;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    string s;
    cin >> s;
    size_t c = 1;
    for (size_t i = 1; i < s.size(); ++i) {
        if (s[i - 1] != s[i])
            ++c;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 999;// 1e25;
static const ll MAX_N = 100001;

int main() {
	string s; cin >> s;
	if (s == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if (s == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else {
		cout << "Sunny" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<iomanip>
#include<map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
int dx[8] = { 1,0,-1,0,1,1,-1,-1 };
int dy[8] = { 0,1,0,-1,1,-1,1,-1 };



int main() {

	ll l, r;
	cin >> l >> r;
	ll ans = INF;

	if (r - l >= 2019) {
		cout << 0 << endl;
		return 0;
	}
	else if (l % 2019 >= r % 2019) {
		cout << 0 << endl;
		return 0;
	}
	else {
		for (ll i = l % 2019; i < r % 2019; i++) {
			for (ll j = i + 1; j <= r % 2019; j++) {
				
				ans = min(ans, (i * j) % 2019);
			}
		}
	}

	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
vector<vector<int>> rui;
int n, m;
void dfs(vector<int> v) {
    if(v.size() == n) {
        rui.push_back(v);
    } else {
        if(v.empty()) {
            for(int i = 1; i <= m; i++) {
                v.push_back(i);
                dfs(v);
                v.pop_back();
            }
        } else {
            for(int i = v.back(); i <= m; i++) {
                v.push_back(i);
                dfs(v);
                v.pop_back();
            }
        }
    }
}
int main() {
    int q;
    cin >> n >> m >> q;
    vector<vector<int>> abcd(q, vector<int>(4));
    for(int i = 0; i < q; i++) {
        for(int j = 0; j < 4; j++) {
            cin >> abcd[i][j];
        }
    }
    ll ans = 0;
    vector<int> v = {};
    dfs(v);
    for(int i = 0; i < rui.size(); i++) {
        ll tmp = 0;
        for(int x = 0; x < q; x++) {
            if(rui[i][abcd[x][1] - 1] - rui[i][abcd[x][0] - 1] == abcd[x][2]) {
                tmp += abcd[x][3];
            }

            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 9800
i = list(map(int,input().split()))
count = 0;

for num in range(2):
    if(i[0] < i[1]):
        count = count + i[1]
        i[1] = i[1] - 1
    else:
        count = count + i[0]
        i[0] = i[0] - 1

print(count)


Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 1005;
const int MOD = 1e9+7;
char c[N][N];
int dp[N][N];


signed main(){
	IOS
	int n,m;	cin >> n >> m;
	rep(i,n){
		rep(j,m)	cin >> c[i+1][j+1];
	}
	dp[1][1] = 1;
	rep(i,n){
		rep(j,m){
			if(i+j != 0 && c[i+1][j+1] == '.')	dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % MOD;
			// cout << dp[i+1][j+1] << ' ';
		}
		// cout << endl;
	}
	cout << dp[n][m] << endl;
}


Measured memory_bytes: 9088
#include<cstdio>
#include<iostream>
using namespace std;
int a[100010],n;
long long ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		if(!a[i])continue;
		ans+=a[i]/2;
		a[i]%=2;
		if(a[i])if(a[i+1])a[i]-=1,a[i+1]-=1,ans++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>

using namespace std;

int main(void)
{
    int a, b;
    int count = 0;
    int digit = 0;
    cin >> a;
    b = a;

    while (true)
    {
        digit++;
        if (b < 10)
        {
            break;
        }
        b /= 10;
    }
    for (size_t i = 1; i <= digit; i+=2)
    {   
        if (digit == i)
        {
            if (i == 1)
            {
                count += a;
            }
            else
            {
                count += a - pow(10, i - 1) + 1;
            }
        }
        else
        {
            if (i == 1)
            {
                count += 9;
            }
            else
            {
                count += pow(10, i) - pow(10, i - 1);
            }
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		boolean yes = false;
;
		if(cal(a,c) <= d){
			yes = true;
		}

		if(cal(b,c) <= d && cal(a,b) <=d){
			yes = true;
		}

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

	}

	public static int cal(int i, int n){
		int num = 0;
		if(i >= n){
			num = i - n;
		}else{
			num = n-i;
		}
		return num;
	}
}


Measured memory_bytes: 23508
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

long long mod = 1e9+7;

long long modpow(long long x, long long n) {
    x = x%mod;
    if(n == 0){
        return 1;
    }
    else if(n%2 == 1){
        return(x*modpow(x, n-1))%mod;
    }
    else{
        return modpow((x*x)%mod, n/2)%mod;
    }
}

long long comb(long long n, long long k){
    long long x = 1;

    for(long long i = n-k+1; i <= n; i++){
        x = x*i;
        x = x%mod;
    }
    long long y = 1;
    for(long long i = 1; i <= k; i++){
        y = y*i;
        y = y%mod;
    }

    y = modpow(y, mod-2);

    return x*y%mod;
}

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

    long long ans = modpow(2, n) - 1 - comb(n, a) - comb(n, b);

    while(ans < 0){
        ans += mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,x;
	scanf("%d %d %d",&a,&b,&x);
	while(1){
		if(a<=b){
			if(x%1000==0)	printf("%d\n",a*(x/1000));
			else	printf("%d\n",a*(x/1000+1));
			break;
		}
		if(a>=b*2){
			if(x%500==0)	printf("%d\n",b*(x/500));
			else	printf("%d\n",b*(x/500+1));
			break;
		}
		if(a<b*2){
			if(x%1000==0)	printf("%d\n",a*(x/1000));
			else{
				if(x%1000>500)	printf("%d\n",(a*(x/1000))+a);
				else	printf("%d\n",(a*(x/1000))+b);
			}
			break;
		}
	}
	return 0;
}



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

using namespace std;
#define X first
#define Y second
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl;
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
int n,x,a[20005],b[20005];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		a[i]=20001*i,b[i]=20001*(n-i)+1;
	for(int i=1;i<=n;i++)
		scanf("%d",&x),a[x]+=i;
	for(int i=1;i<=n;i++)
		printf("%d ",a[i]);puts("");
	for(int i=1;i<=n;i++)
		printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
long long a[200005],b[200005];
int main ()
{   int n; scanf("%d",&n);
      memset(b,0,sizeof(b));
    for(int i=1;i<=n;i++)
     {  scanf("%lld",&a[i]);
         b[a[i]]++;
         //printf("%d\n",b[a[i]]);
	 }
	 long long sum=0,ans=0;
	 for(int i=1;i<=n;i++)
	   {  if(b[i]>1) 
	       sum+=b[i]*(b[i]-1)/2;
	   }
	   //printf("sum:%lld\n",sum);
	for(int i=1;i<=n;i++)
	{    if(b[a[i]]>1)
	      ans=sum-b[a[i]]+1;
		  else
		  ans=sum;
		 printf("%lld\n",ans); 
	}
	return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back 
#define ll long long
using namespace std;
int main()
 {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n;
	cin>>n;
	ll a[n+1], b[n], count = 0;
	for(ll i=0;i<=n;i++){
	    cin>>a[i];
	}
	for(ll i=0;i<n;i++){
	    cin>>b[i];
	}
	for(ll i=0;i<n;i++){
	    if(b[i]>=a[i]){ count += a[i]; b[i] -= a[i]; 
	        if(a[i+1]>=b[i]){ a[i+1] -= b[i]; count += b[i]; }
	        else{ count += a[i+1]; a[i+1] = 0; }
	    }
	    else count += b[i];
	    if(a[i+1] < 0 ) a[i+1]=0;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 1792
n, m = map(int, input().split())
a = []
for i in range(n):
	b = input().split()
	b[0] = int(b[0])
	b[1] = int(b[1])
	a.append(b)
a = sorted(a)
counter = 0
for i in range(n):
	if m == 0:
		break
	if m > a[i][1]:
		counter += a[i][1] * a[i][0]
		m -= a[i][1]
	else:
		counter += a[i][0] * m
		m = 0
print(counter)

Measured memory_bytes: 28632
N, H = map(int, input().split())
L, used, S, ans = [], [False for _ in range(N)], 0, 0
for i in range(N):
    a, b = map(int, input().split())
    L.append([b, i])
    L.append([a, i])
for x in sorted(L, reverse = True):
    if used[x[1]]:
        c = (H - S) // x[0]
        if S + c * x[0] < H:
            c += 1
        ans += c
        break
    S += x[0]
    used[x[1]] = True
    ans += 1
    if S >= H:
        break
print(ans)


Measured memory_bytes: 82592
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int a,b,c,d;
  C4(a,b,c,d);
  
  int count = 0;
  rep(i,0,101){
    if(i >= a && i < b && i >= c && i < d)
      count++;
  }

  P(count);
  ret 0;

}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int q;
    cin >> q;
    multiset<int> mst;
    while (q--) {
        int com, x, l, r;
        cin >> com;
        if (com == 0) {
            cin >> x;
            mst.insert(x);
            cout << mst.size() << endl;
        } else if (com == 1) {
            cin >> x;
            cout << mst.count(x) << endl;
        } else if (com == 2) {
            cin >> x;
            mst.erase(x);
        } else {
            cin >> l >> r;
            auto litr = mst.lower_bound(l);
            auto ritr = mst.upper_bound(r);
            for (auto itr = litr; itr != ritr; ++itr) {
                cout << *itr << endl;
            }
        }
    }
}



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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0; i<n; ++i) cin >> p.at(i);

    int ans = 0;

    for(int i=0; i<(n-2); ++i){
        if((p.at(i) < p.at(i+1) && p.at(i+1) < p.at(i+2))
            || (p.at(i+2) < p.at(i+1) && p.at(i+1) < p.at(i))){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
if N % 2 == 1:
    print(0)
    exit()
ans = 0
"""tmp = 10
while tmp <= N:
    ans += N // tmp
    tmp *= 10"""
tmp = 50
while tmp <= N:
    ans += N // tmp
    tmp *= 5
ans += N // 10
print(ans)

Measured memory_bytes: 3060
#pragma GCC optimize(3)
#include<cstdio>
using namespace std;
int a[110],b,c,d,e;
main(){
scanf("%d",&b);
for(int i=0;i<b;i++){
scanf("%d",&a[i]);d+=a[i];}
scanf("%d",&c),e=d;
while(c--){
int p,x;scanf("%d%d",&p,&x);
if(x>=a[p-1])d+=x-a[p-1];
else d-=a[p-1]-x;
printf("%d\n",d);
d=e;}}

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

const ll MOD = 1000000007;
ll N, A, B, C, D;
ll dp[1010][1010];
ll inv[1010];
ll fac[1010], invFac[1010];

void init() {
  fac[0] = fac[1] = 1;
  invFac[0] = invFac[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 1010; i++) {
    inv[i] = MOD - (MOD / i) * inv[MOD % i] % MOD;
    fac[i] = i * fac[i-1] % MOD;
    invFac[i] = inv[i] * invFac[i-1] % MOD;
  }
}

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  init();
  cin >> N >> A >> B >> C >> D;
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= N; j++) {
      dp[i][j] = dp[i-1][j];
      if (A <= i && i <= B) {
        for (int k = C; k <= D && j-i*k >= 0; k++) {
          ll tmp = dp[i-1][j-i*k];
          (tmp *= fac[N-j+i*k]) %= MOD;
          (tmp *= invFac[N-j]) %= MOD;
          (tmp *= modPow(modPow(fac[i], k, MOD), MOD-2, MOD)) %= MOD;
          (tmp *= invFac[k]) %= MOD;
          (dp[i][j] += tmp) %= MOD;
        }
      }
    }
  }
  cout << dp[N][N] << endl;

  return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n;
int a[307][307];
long long ans=0;
int main()
{
	n=read();
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			a[i][j]=read();
	bool check=true;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			for (int k=1;k<=n;k++)
				if (a[i][j]>a[i][k]+a[k][j]) check=false;
	if (!check) printf("%d\n",-1); else
	{
		for (int i=1;i<=n;i++)
			for (int j=1;j<i;j++)
			{
				bool flag=true;
				for (int k=1;k<=n;k++)
					if (a[i][k]+a[k][j]==a[i][j]&&k!=i&&k!=j) flag=false;
				if (flag) ans+=a[i][j];
			}
		printf("%lld\n",ans);
	}
	return 0;
}


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

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;
#define mpr make_pair

lint dp[3005][3005][4];


int main()
{
    ios_base::sync_with_stdio(0);    cin.tie(NULL);    cout.tie(NULL);

    int r, c, k; cin>>r>>c>>k;

    vector<vl> mp(r, vl(c, 0));
    while(k--){
      lint r, c, v;
      cin>>r>>c>>v;
      r--, c--;
      mp[r][c] = v;
    }

    for (int i = 0; i<r; ++i)
      for (int j=0; j<c; ++j){
        memset(dp[i][j], -1, 4*sizeof(lint));
      }

    function<lint(int, int, int)> res = [&](int row, int col, int c)->lint{
      lint &ans = dp[row][col][c];
      if (ans != -1) return ans;
      ans = 0;
      if (c) ans = mp[row][col];
      if (col > 0){
        ans = max(ans, res(row, col-1, c));
        if (c > 0) ans = max(ans, res(row, col-1, c-1) + mp[row][col]);
      }
      if (row > 0){
        ans = max(ans, res(row-1, col, 3));
        if (c > 0) ans = max(ans, res(row-1, col, 3) + mp[row][col]);
      }
      return ans;
    };

    cout<<res(r-1, c-1, 3);
}


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

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}

int main(){
    int x,y; cin >> x >> y;
    if(y%2==1){
        cout << "No" << endl;
        return 0;
    }
    else {
        y/=2;
        if(x<=y && y<= 2*x){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
}

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

int main(){
#ifdef _DEBUG
	freopen("in" , "r", stdin );
	freopen("out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	map<int, int> m;
	for(int i = 0; i < 3; i++){
		int t; cin >> t;
		m[t]++;
	}
	if(m[5] == 2 && m[7] == 1) cout << "YES\n";
	else cout << "NO\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,cnt=0,a;
  map<ll,ll> mp;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    mp[a]++;
  }
  for(auto i:mp){
    if(i.first<i.second){
      cnt += i.second - i.first;
    }else if(i.first>i.second){
      cnt += i.second;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 6272
/*author:revolIA*/
/*明日を変えるなら今日変えなきゃ*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)if((int)(i*1.08) == n){
        return 0*printf("%d\n",i);
    }
    printf(":(\n");
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    def dfs(v, remove):
        for u in tree[v]:
            if [u, v] == remove or [v, u] == remove:
                continue
            elif visited[u]:
                continue
            else:
                visited[u] = True
                dfs(u, remove)

    n, m = map(int, input().split())
    edge = []
    tree = [[] for _ in range(n)]
    for _ in range(m):
        a, b = map(int, input().split())
        edge.append([a - 1, b - 1])
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

    res = 0
    for remove in edge:
        visited = [False for _ in range(n)]
        visited[0] = True
        dfs(0, remove)
        if not all(visited):
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9128
n=[input() for _ in range(int(input()))];m,a,r,c,h,count=0,0,0,0,0,0
for i in n:
  if i[0]=='M': m+=1
  elif i[0]=='A': a+=1
  elif i[0]=='R': r+=1
  elif i[0]=='C': c+=1
  elif i[0]=='H': h+=1
r=[m,a,r,c,h]
for i in range(5):
  for j in range(i+1,5):
    for k in range(j+1,5):
      count+=r[i]*r[j]*r[k]
print(count)

Measured memory_bytes: 16260
#include <stdio.h>

int S[100000],n;

int bs(int key){
  int L=0,R=n,mid;

  while(L<R){
    mid=(L+R)/2;
    if(key == S[mid]) return 1;
    if(key > S[mid]) L=mid+1;
    else if(key<S[mid]) R=mid;
  }

  return 0;
}

int main(){
  int i,q,t,cnt=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
    if(bs(t)) cnt++;
  }
  printf("%d\n",cnt);

  return 0;
}



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

const ll mod = 1000000007;
int digits(int i){
	int cnt = 1;
	while(i >= 10){
		i /= 10;
		cnt *= 10;
	}
	return cnt;
}

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n; cin >> n;
	int c[10][10] = {0,0}; 
	for(int i = 1; i <= n; i++){ //aが先頭,bが末尾
		int a, b; 
		a = i/digits(i);
		b = i % 10;	
		c[a][b]++;
	}
	ll ans = 0;
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			ans += c[i][j] * c[j][i];
		}
	}
	cout << ans << endl;
} 

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

const ll MOD = 1e9+7;

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

  ll N;
  cin >> N;
  ll K; cin >> K;
  ll ans = 0;
  for (ll k = K; k <= N+1; k++) {
    if (k == N+1) {
      ans++;
      ans %= MOD;
    } else {
      ans += ((2ll*N-k+1ll)*k/2ll - (k * (k-1))/2ll)+1ll;
      ans %= MOD;
    }
  }

  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 3636
program abc136b
   implicit none
   integer :: n
   integer :: digit, counter

   read(*,*) n

   digit = int(log10(real(n))) + 1


   if ( digit == 6 ) then
      write(*,*) 90909
      stop
   endif

   counter = 0
   if ( digit == 5 ) then
      counter =  (n - 9999)
      counter = counter + 909
   else if (digit == 4) then
      counter = 909
   else if ( digit == 3) then
      counter =  (n - 99) + 9
   else if ( digit == 2) then
      counter = 9
   else if (digit == 1 ) then
      counter = n
   end if

   write(*,*) counter

end program abc136b


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

int main() {
  int a, b, c, d = 0;
  cin >> a >> b >> c >> d;
  if (a + b > c + d)
    cout << "Left" << endl;
  else if (a + b < c + d)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}


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

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadInt();
            WriteLine(24 - x + 24);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> z(n);
  for(int i = 0;i < n;i++){
    cin >> z.at(i);
  }
  int y;
  vector<int> x;
  for(int i = 1;i < sqrt(z.at(0))+1;i++){
    if(z.at(0)%i==0){x.push_back(i);
    x.push_back(z.at(0)/i);}
  }
    sort(x.begin(),x.end());
    for(int i = 0;i < x.size();i++){
      int d = 0;
      for(int j = 0;j < n;j++){
        if(z.at(j)%x.at(i)!=0)d++;
      }
      if(d<2)y=x.at(i);
    }
    int f = z.at(1);
    for(int i = 2;i < n;i++){
    f=__gcd(f,z.at(i));
  }
  cout << max(f,y) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#define ll long long int
#define all(x) x.begin(),x.end()

 #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define  vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 100005LL
# define cout1(x) cout<<x<<"\n";
# define  deb(x) cout<<#x<<" "<<x<<"\n";
using namespace std; 
void print_vector(v arr){
    f(i,arr.size())cout<<arr[i]<<" ";
    cout<<endl;

}

void solve(){
    ll l,r,d;
    cin>>l>>r>>d;
    ll ans = r/d-l/d;
    if (l%d==0)ans++;
    cout<<ans<<endl;

}






int main(){
    fastio;
    ll t;
    // cin>>t;
    t=1;
    f(_,t){
        solve();
       
    }
    




}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    bool ok=1;
    for(int i=0;i<s.size();i++)if(s[i]!=t[i])ok=0;
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    // 整数の入力
	int n;
  	double a[1000];
	double sum=0;

    cin >> n;
  	for(int i=0;i<n;i++){
      cin >> a[i];
    }
  
  	for(int i=0;i<n;i++){
      sum += 1/a[i];
    }
	
  	cout << 1/sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

char ba[64][64];
char bb[64][64];

#define IN(x,s,g) ((x) >= (s) && (x) < (g))

bool memo[64][64][64][64];

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

int main(){
  int w,h;
  while(scanf("%d%d",&w,&h), w+h){
    int lsx, lsy, rsx, rsy;
    int lgx, lgy, rgx, rgy;
    memset(memo, 0, sizeof(memo));
    REP(i,h) scanf("%s %s",ba[i],bb[i]);
    REP(i,h) REP(j,w){
      if(ba[i][j] == 'L'){
        lsx = j; lsy = i;
        ba[i][j] = '.';
      }else if(ba[i][j] == '%'){
        lgx = j; lgy = i;
        ba[i][j] = '.';
      }
      if(bb[i][j] == 'R'){
        rsx = j; rsy = i;
        bb[i][j] = '.';
      }else if(bb[i][j] == '%'){
        rgx = j; rgy = i;
        bb[i][j] = '.';
      }
    }

    //REP(i,h) printf("%s %s\n",ba[i],bb[i]);

    typedef pair<pair<int,int>, pair<int,int> > P;
    queue<P> q;
    bool ans = false;
    q.push(mp(mp(lsx,lsy),mp(rsx,rsy)));
    while(!q.empty()){
      P p = q.front();
      int lx = p.f.f;
      int ly = p.f.s;
      int rx = p.s.f;
      int ry = p.s.s;

      //printf("(%d,%d) , (%d,%d)\n",lx,ly,rx,ry);
      q.pop();

      if(memo[lx][ly][rx][ry])
        continue;
      memo[lx][ly][rx][ry] = true;

      if(lx == lgx && ly == lgy){
        if(rx == rgx && ry == rgy){
          ans = true;
          break;
        }else{
          continue;
        }
      }
      if(rx == rgx && ry == rgy)
        continue;

      REP(i,4){
        int lxx = lx + dx[i];
        int lyy = ly + dy[i];
        int rxx = rx - dx[i];
        int ryy = ry + dy[i];

        if( ! (IN(lxx,0,w) && IN(lyy,0,h)) ){
          lxx = lx; lyy = ly;
        } else if(ba[lyy][lxx] == '#'){
          lxx = lx; lyy = ly;
        }

        if( ! (IN(rxx,0,w) && IN(ryy,0,h)) ){
          rxx = rx; ryy = ry;
        } else if(bb[ryy][rxx] == '#'){
          rxx = rx; ryy = ry;
        }

        if(!memo[lxx][lyy][rxx][ryy]){
          q.push(mp(mp(lxx,lyy),mp(rxx,ryy)));
        }
      }
    }
    puts(ans?"Yes":"No");
  }
  return 0;
}

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

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

    int B[K];
    for(int i=0; i<K; i++) B[i] = 0;

    int A=7;
    int ans=1;

    A=A%K;

    if(A==0){
        cout << 1 << endl;
        return 0;
    }

    B[A]++;

    while(1){

        ans++;
        A=10*A+7;

        A=A%K;
        if( A==0 ){
            break;
        }else if( B[A]>0 ){
            cout << -1 << endl;
            return 0;
        }

        B[A]++;
        //cout << "ans A " << ans << " " << A << endl;

    }

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

Measured memory_bytes: 7512
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll N;
vector<ll> H;

ll get_island_num(){
    ll num = 0;
    bool current_zero = true;

    for(ll h : H){
        if(current_zero){
            if(h!=0){
                // 島、上陸
                num++;
                current_zero = false;
            }else{
                // do nothing
            }   
        }
        // in island
        else{
            if(h!=0){
                // do nothing
            }else{
                current_zero = true;
            }
        }
    }
    return num;
}

void flood(){
    FOR(i, 0, N){
        if(H[i]!=0){
            H[i]--;
        }
    }
}

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

    // input
    cin >> N;

    H.resize(N);
    FOR(i, 0, N){
        cin >> H.at(i);
    }

    ll water_count = 0;

    ll island_num = get_island_num();
    while(island_num != 0){
        island_num = get_island_num();
        
        // 島を削る
        flood();
        water_count += island_num;
    }

    p(water_count);
    
    return 0;
}

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

int main(){
  std::ios::sync_with_stdio(false);
  list<unsigned long long> dat(0);
  list<unsigned long long>::iterator t=dat.begin();
  string com;
  int n,a;

  cin>>n;
  
  for(int i=0; i<n; i++){
    cin >> com;

    if(com=="insert"){
      cin >> a;
      dat.push_front(a);
    }
    else if(com=="delete"){
      cin >> a;
      t = dat.begin();
      while(t!=dat.end() && *t!=(unsigned long long)a){
	t++;
      }
      if(*t==(unsigned long long)a)
	dat.erase(t);
    }
    else if(com=="deleteFirst"){
      dat.pop_front();
    }
    else{
      dat.pop_back();
    }
  }
  
  t=dat.begin();
  printf("%Ld",*t++);
  while(t!=dat.end()){
    printf(" %Ld", *t++);
  }
  printf("\n");


  return 0;
}

Measured memory_bytes: 32504