akhauriyash/Code-Regression huggingface dataset:
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
const long double eps = 1e-12;
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define REP(a,b) for(long long a = 0;a < b;++a)
long long dp[3001][3001] = {};
long long moved[3001][3001] = {};
int main() {
	string s, t;
	cin >> s >> t;
	REP(i, s.length() + 1) {
		REP(q, t.length() + 1) {
			if (i != s.length()) {
				if (dp[i + 1][q] < dp[i][q]) {
					dp[i + 1][q] = max(dp[i + 1][q], dp[i][q]);
					moved[i + 1][q] = 1;
				}
			}
			if (q != t.length()) {
				if (dp[i][q + 1] < dp[i][q]) {
					dp[i][q + 1] = max(dp[i][q + 1], dp[i][q]);
					moved[i][q + 1] = 2;
				}
			}
			if (i != s.length() && q != t.length()) {
				if (s[i] == t[q]) {
					if (dp[i + 1][q + 1] < dp[i][q] + 1) {
						dp[i + 1][q + 1] = max(dp[i + 1][q + 1], dp[i][q] + 1);
						moved[i + 1][q + 1] = 3;
					}
				}
			}
		}
	}
	int now_a = s.length();
	int now_b = t.length();
	string ans;
	while (moved[now_a][now_b] != 0) {
		int hoge = moved[now_a][now_b];
		if ((hoge & 1)) {
			now_a--;
		}
		if ((hoge & 2)) {
			now_b--;
		}
		if (hoge == 3) {
			ans.push_back(s[now_a]);
		}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 140928
//Never stop trying
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//s.order_of_key(), *s.find_by_order()

using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0}; //right left down up

int32_t main(){
   boost;
   char c; cin>>c;
   if(c>='a' && c<='z') cout << 'a' << endl;
   else cout << 'A' << endl;


   return 0;
}


Measured memory_bytes: 3644
# -*- coding: utf-8 -*-
from functools import reduce
from math import ceil
# GCD
def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

# lのGCD
def lcmlist(l):
    res = l[0]
    for i in range(1,len(l)):
        g = gcd(res, l[i])
        res = res*l[i]//g
    return res


n,m = map(int, input().split())
al = list(map(int, input().split()))

l = []
c = 0
for i in range(n):
    l.append(al[i]//2)
    cc = 0
    while al[i]%2==0:
        al[i] //= 2
        cc += 1

    if c==0:
        c = cc
    else:
        if c!=cc:
            print(0)
            exit()

g = lcmlist(l)
# if g%2==1:
#     print(0)
#     exit()

x = m//g
if x%2==1:
    print((x-1)//2+1)
else:
    print(x//2)

Measured memory_bytes: 14748
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# import sys

# sys.setrecursionlimit(10 ** 5 + 10)


# input = sys.stdin.readline

def resolve():
    n = int(input())
    S = list(map(int, input().split()))
    q = int(input())
    T = list(map(int, input().split()))

    ans = 0

    for i in T:
        pl = 0
        pr = n - 1

        while pl <= pr:
            pc = (pl + pr) // 2
            if S[pc] == i:
                ans += 1
                break
            elif i < S[pc]:
                pr = pc - 1
            else:
                pl = pc + 1

    print(ans)


resolve()


Measured memory_bytes: 16708
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll N;
int main() {
	cin >> N;
	cout << floor((ld)N / 3) << endl;
	return 0;
}

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 pii = pair<int,int>;
using pil = pair<pii,int>;

int s(int a){
    int r = 0;
    while(a/10 != 0){
        r += a%10;
        a /= 10;
    }
    r += a;
    return r;
}

int main(){
    int n;
    cin >> n;
    int t = s(n);
    if(n%t == 0)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

using namespace std;
int main(int argc, char *argv[])
{
	int n, m;
	map<string, int> dic;
	string str;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> str;
		if (dic.count(str) == 0){
			dic[str] = 1;
		}
		else{
			dic[str]++;
		}
	}

	cin >> m;
	string *t = new string[m];
	for (int i = 0; i < m; i++){
		cin >> str;
		if (dic.count(str) == 0){
			dic[str] = -1;
		}
		else{
			dic[str]--;
		}
	}

	int ans = 0;
	map<string, int>::iterator map_ite;
	for (map_ite = dic.begin(); map_ite != dic.end(); map_ite++){
		if (ans < map_ite->second){
			ans = map_ite->second;
		}
	}

	cout << ans << endl;

	return 0;
}



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

using namespace std;

int main()
{
    int n, h, w;
    cin >> n >> h >> w;
    int a, b;
    int ans = 0;
    for (int i=0; i<n; ++i){
        cin >> a >> b;
        if(a >= h && b >= w){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
        }
        long sum, min, max;
        sum = 0;
        max = -1000000;
        min = 1000000;
        for(int i = 0; i < n; i++){
            sum += a[i];
            if(max <= a[i]){
                max = a[i];
            }
            if(min >= a[i]){
                min = a[i];
            }
        }
        System.out.println(min + " " + max + " " + sum);
    }
}

Measured memory_bytes: 41128
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''
3 4 9 0
'''

def cosineRule(b,c,theta):
	a = b**2 + c**2 - 2*b*c*cos(theta)
	return sqrt(a)

def solve(l):
	b,c,h,m = l
	hh = h*30 + (m/60)*30
	mm = m*6
	theta = min(abs(hh-mm),360-abs(hh-mm))
	theta = pi*theta/180
	a = cosineRule(b,c,theta)
	return a
	
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)
print("%.20f" % ans)



Measured memory_bytes: 76592
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; } return x; }
long lcm(long x, long y) { return (x / gcd(x, y) * y); }

//using pll = pair<long, long>;
//using W_graph = vector<vector<pll>>;

int main() {

	long N, K; cin >> N >> K;
	vector<long> A(N); for (int i = 0; i < N; i++) cin >> A[i];
	vector<long> F(N); for (int j = 0; j < N; j++) cin >> F[j];
	sort(A.begin(), A.end());
	sort(F.begin(), F.end());
	vector<long> T(N); for (int k = 0; k < N; k++) T[k] = A[k] * F[N - k - 1];
	long tmax = INT_MIN;
	for (int i = 0; i < N; i++) tmax = max(tmax, T[i]);

	//答え決め打ち二部探索(0 , tmax]
	//vector<pair<long, long>> P(N); for (int i = 0; i < N; i++) P[i] = make_pair(F[i], A[i]);

	//long res = tmax;

	long max = tmax;
	long min = 0;
	long mid = (max + min) / 2;
	//midは試験する基準値のボーダー
	long cost = 0;
	vector<long> FF(N);
koko:;
	cost = 0;

	for (int i = 0; i < N; i++) FF[i] = mid / F[i];
    sort(FF.begin() , FF.end());
	for (int i = 0; i < N; i++) {

		if (A[i] - FF[i] > 0) cost += A[i] - FF[i];

	}
	if (cost > K) {//costが大きすぎ。res > mid.ボーダーを高くする
		max = max;
		min = mid + 1;
		mid = (max + min) / 2;
        if (max == min) cout << max << endl;
		else goto koko;
	}
	else {// res <= mid
		max = mid;
		min = min;
		mid = (max + min) / 2;
		if (max == min) cout << max << endl; else goto koko;
	}
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  int n; cin >> n;
  cout << (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#define MAX_STRING_SIZE 1999
using namespace std;

// lowecase/uppercase 変換
// 'A' + 'a' - 'A' => 'a'
// 'B' + 'a' - 'A' => 'A' + 1 + 'a' - 'A' => 'a' + 1

char reverse_case(char character) {
  if(character >= 'a' && character < 'z') {
    return character + ('A' - 'a');
  } else if (character >= 'A' && character <= 'Z') {
    return character + ('a' - 'A');
  }

  return character;
}

int main() {
  char str[MAX_STRING_SIZE];
  char conveted_str[MAX_STRING_SIZE];

  cin.getline(str, MAX_STRING_SIZE);
  int length = strlen(str);

  for(int i = 0; i < length; i++) {
    conveted_str[i] = reverse_case(str[i]);
  }
  conveted_str[length] = '\0';
  printf("%s\n", conveted_str);
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
#define ll long long
ll a[maxn],ans;
int main()
{
	int n;
	scanf("%d",&n);
	ans=1e18;
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]),a[i]+=a[i-1];
	for(int i=1;i<=n;++i) ans=min(ans,abs(a[n]-2*a[i]));
	printf("%lld\n",ans);
	return 0;
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

int K,N;
int A[100000];

int main(){
  cin>>N>>K;
  REP(N)cin>>A[i];
  cout<<(N-1)/(K-1)+((N-1)%(K-1)!=0?1:0)<<endl;
  return 0;
}


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

using namespace std;

int main()
{
    vector<int> nums;
    int res = 0;
    for(int i = 0; i < 3; ++i)
    {
        int a;
        cin >> a;
        nums.push_back(a);
    }

    sort(nums.begin(), nums.end(), greater<>());

    for(int i = 0 ; i < nums.size()-1; ++i)
    {
        res += abs(nums[i] - nums[i+1]);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m,s,t = LI()
    xy = [LI() for _ in range(m)]
    e = collections.defaultdict(list)
    for x,y in xy:
        e[x].append((y,1))
        e[y].append((x,1))

    def search(s):
        d = collections.defaultdict(lambda: inf)
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv, ud in e[u]:
                if v[uv]:
                    continue
                vd = k + ud
                if d[uv] > vd:
                    d[uv] = vd
                    heapq.heappush(q, (vd, uv))

        return d

    d1 = search(s)
    d2 = search(t)
    tt = d1[t]
    if tt == 1:
        return 0
    if tt == 2:
        return 1
    v1 = collections.defaultdict(int)
    v2 = collections.defaultdict(int)
    for k,v in d1.items():
        v1[v] += 1
    for k,v in d2.items():
        v2[v] += 1
    r = 0
    for i in range(tt-1):
        r += v1[i] * v2[tt-i-2]

    return r



print(main())



Measured memory_bytes: 109804
object Main {
  def main(args:Array[String]) = {
   // val seq = readLine.split("")
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).trim())
  }


def solve(aaa:String): String={
  val seq = aaa.split("").takeRight(4)
  val ret = if ( seq.toSet.size == 2 && seq.filter(_ == seq(0)).size == 2){
    "Yes"
  } else {
    "No"
  }
  ret
}

}


Measured memory_bytes: 25524
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	int x;cin>>x;
	if(x==0) cout<<1<<endl;
	if(x==1) cout<<0<<endl;	
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double n,res=0,piku=0,a;
    vector<double>v;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
   piku= v[0];
   for(int i=1;i<n;i++)
   {
       res=piku+v[i];
       piku=res/2;
   }
   cout<<piku<<endl;
   return 0;
}


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

int main() {
	int n;
	cin>>n;
	int l = n%10;
	if(l == 2 || l==4 || l==5 || l==7 || l==9)
	cout<<"hon";
	else if(l==0 || l==1 || l== 6 || l==8)
	cout<<"pon";
	else
	cout<<"bon";
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000000



int main(){

	int N;
	cin>>N;
	
	long long D;
	cin>>D;
	
	D*=D;
	
	int ans = 0;
	for(int i=0;i<N;i++){
		long long X,Y;
		cin>>X>>Y;
		
		if(X*X+Y*Y<=D)ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3632
n=int(input()) 
alist=list(map(int,input().split()))
a=1
if 0 in alist:
    print("0")
else:
    for i in alist:
        if a<=10**18:
            a=a*i
        else:
            break
    if a>10**18:
        print('-1')
    else:
        print(a)

Measured memory_bytes: 21616
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll k, a, b, ans;
    cin >> k >> a >> b;
    ans = max(k+1, ((k-a+1)/2)*(b-a)+a+(k-a+1)%2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////

void solve() {
	string S;
	cin >> S;
	for (int i = 0; i < 3; ++i) {
		if (S[i] == S[i + 1]) {
			cout << "Bad" << endl;
			return;
		}
	}
	cout << "Good" << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
import java.util.*;


public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int H = sc.nextInt();
		int W = sc.nextInt();
		int ans = 0;
		for(int i = 0; i < N; i++) {
			int A = sc.nextInt();
			int B = sc.nextInt();
			if(A >= H && B >= W)
				ans++;
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 25320
N=int(input())
S=[]
for i in range(N):
    S+=[input()]
    
S=sorted(S)

maxv=1
count=1
P=[]

for j in range(N-1):  
    if S[j]==S[j+1]:
        count+=1
    else:
        if count==maxv:
            P+=[S[j]]
        elif count>maxv:
            maxv=count
            P=[S[j]]  
        count=1
        
if count==maxv:
    P+=[S[N-1]]
elif count>maxv:
    maxv=count
    P=[S[N-1]]  

    

            
        
for k in range(len(P)):
    print(P[k])





Measured memory_bytes: 20136
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

vector<lint> divisor(lint n) {
	vector<lint> ret;
	for (lint i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.emplace_back(i);
			if (i * i != n) ret.emplace_back(n / i);
		}
	}
	sort(ret.begin(), ret.end(), greater<lint>());
	return ret;
}

lint gcd(lint a, lint b) { return b ? gcd(b, a%b) : a; }

int main() {

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

	int A, B, K;
	cin >> A >> B >> K;

	vector<lint> div;
	div = (divisor(gcd(A, B)));

	cout << div[K - 1] << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    cout << n * n * n << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e5+5;
int k;
string s;
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	cin >> k >> s;
	if(s.size() <= k)
		cout << s << endl;
	else
	{
		for(int i = 0; i < s.size(); i++)
			if(i == k - 1)
			{
				cout << s[i];
				break;
			}
			else
				cout << s[i];
		cout << "...";
	}
	return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    cout << (m1 != m2) << endl;
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 typedef long long ll;
 
int main() {
string s;
cin>>s;
int l=s.size();
string ans="NO";
for(int i=0;i<l;i++){
    for(int j=0;j<l-i;j++){
        string c=s;
        c.erase(i,j);
if(c=="keyence")ans="YES";
    }
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(){
    int D,N;
    long int out = 0;
    cin >> D >> N;
    if(N == 100){
            out = pow(100 , D)  * (N+1);
            cout << out << endl;
        
    }
    else{
            out = pow(100 , D)  * N;
            cout << out << endl;
    }
    return 0; 
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define N 102
#define W 350
ll n, w;
ll dp[N][N][W];
ll we[N], va[N];

int main() {
  cin >> n >> w;
  rep(i, n) cin >> we[i] >> va[i];
  rep(i, n+1) {
    rep(j, n+1) {
      rep(k, 3*n+20) {
        dp[i][j][k] = -INFLL;
      }
    }
  }
  dp[0][0][0] = 0;
  rep(i, n) {
    ll p = we[i] - we[0];
    rep(j, n) {
      rep(k, 3*n+20) {
        dp[i+1][j][k] = dp[i][j][k];
      }
    }
    rep(j, n) {
      rep(k, 3*n+20) {
        dp[i+1][j+1][k+p] = maxd(dp[i+1][j+1][k+p], dp[i][j][k] + va[i]);
      }
    }
  }
  ll ans = 0;
  rep(j, n+1) {
    rep(k, 3*n+20) {
      if(j*we[0]+k <= w) {
        ans = maxd(ans, dp[n][j][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 28416
/* ex 5_4
   terakura */

#include <stdio.h>
#define SIZE 100


int main(void){
    char name[SIZE], *ptr, count1 = 0, count2 = 0;

  	//入力
    scanf("%s", name);

    ptr = name;

    //*ptrがヌル文字になるまでポインターを動かす
    while(*ptr){

        //部分文字列の長さを数える
        while(*ptr == 'A'|| *ptr == 'C'|| *ptr =='G'|| *ptr =='T'){
            count1 += 1;
            ptr++;
        }

        //文字列の長さが大きい方を記憶させる
        if(count1 > count2){
            count2 = count1;
        }

        //カウンターをリセット
        count1 = 0;

        ptr++;
    }

    //出力
    printf("%d\n", count2);

    return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
void f(long &a, long &b) {
    if (a % 2 == 1) a--;
    long x = a / 2;
    a = x;
    b += x;
}
int main() {
    long a, b, k;
    cin >> a >> b >> k;
    rep(i, k) {
        (i % 2 == 0) ? f(a, b) : f(b, a);
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n,p;
    int count=0;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> p;
        if(p!=(i+1)){
            count++;
        }
    }
    if (count>2){
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int A, B, C, D, E, F;

signed main()
{
	cin >> A >> B >> C >> D >> E >> F;

	double max = 0;
	int max_w = 0;
	int max_s = 0;
	for (int a = 0; a <= 30; a++)
	{
		for (int b = 0; b <= 30; b++)
		{
			int water = 100 * A * a + 100 * B * b;
			if (water == 0) continue;

			int s_max = (water / 100 * E);
			s_max = MIN(s_max, (F - water));
			for (int c = 3000; c >= 0; c--)
			{
				int s1 = C * c;
				if (s1 > s_max) continue;
				int s2_cnt = (s_max - s1) / D;
				int s2 = s2_cnt * D;
				int s = s1 + s2;
				if (s > s_max) continue;

				if (water + s > F) continue;

				double x = s / (double)(s + water);
				if (x > max)
				{
					max = x;
					max_w = water;
					max_s = s;
				}
			}
		}
	}

	if (max_w == 0 || max_s == 0)
	{
		cout << (100 * A) << " 0" << endl;
	}
	else
	{
		cout << (max_w + max_s) << " " << max_s << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define FOR(i, a, b) for(int i = (a);i <= (b); i++)
#define ROF(i, a, b) for(int i = (a);i >= (b); i--)
const int N = 1111;
int n, m, K;
int a[12][N];
int cnt[12], add[12];
int cal(int s){
    memset(cnt, 0, sizeof cnt);
    int num = 0;
    FOR(i, 0, n - 1)num += s >> i & 1;
    s |= 1 << (n - 1);
    FOR(j, 1, m){
        int tot = 0, now = 0;
        memset(add, 0, sizeof add);
        FOR(i, 1, n){
            now += a[i][j];
            if(s >> (i - 1) & 1){
                add[++tot] += now;
                if(add[tot] > K)return 1e9;
                now = 0;
            }
        }
        FOR(i, 1, tot){
            cnt[i] += add[i];
            if(cnt[i] > K){
                num++;
                memset(cnt, 0, sizeof cnt);
                j--;
                break;
            }
        }
    }
    //printf("num=%d s=%d\n", num, s);
    return num;
}
int main(){
    cin>>n>>m>>K;
    FOR(i, 1, n){
        FOR(j, 1, m)scanf("%1d", &a[i][j]);
    }
    int ans = 1e9;
    FOR(i, 0, (1 << (n - 1)) - 1){
        ans = min(ans, cal(i));
    }   
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma GCC target ("avx,tune=native")
//Use above if bruteforcing with lots of small operations. Or just use it anytime, there's no downside.
//AVX is better slightly
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

ll inv(ll a, ll b){
    return (a > 1 ? b - inv(b%a, a)*b/a : 1);
}

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))
#define N 1010

const ld e = 2.71828182845904523536028747;
const ld PI = 3.14159265359;
const ll inf = (1LL<<62);
const int iinf = (1<<30);
//CLOCKS_PER_SEC

int n;
pii a[N], dp[N];
ld dist = -1;

bool cmp(pii unu, pii doi){
    return (atan2(unu.se, unu.fi) < atan2(doi.se, doi.fi));
}

ld get(int da, int db){
    return sqrt(1LL * da * da + 1LL * db * db);
}

int main(){
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //ios_base::sync_with_stdio(0); cin.tie(0);
    //ifstream cin ("test.in");
    cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i].fi >> a[i].se;
    sort(a+1, a+1+n, cmp);
    for (int i=n+1; i<=2*n; i++) a[i] = a[i-n];
    for (int i=1; i<=2*n; i++)
        dp[i] = {dp[i-1].fi + a[i].fi, dp[i-1].se + a[i].se};
    for (int i=1; i<=n; i++)
        for (int j=i; j<n+i; j++)
            dist = smax(dist, get(dp[j].fi - dp[i-1].fi, dp[j].se - dp[i-1].se));
    cout << fixed << setprecision(10) << dist;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<algorithm>
#include<functional>
#include<bitset>
#include<vector>
#include<set>
using  namespace std;
#define ll long long
#define pb push_back
#define sc second
#define fr first
#define mp make_pair
const int  MOD = 1e9 + 7, OO = 1e9;
const int M = 1e5 + 10 , N = 1e2 + 10;
ll dp[N][M], acc[N] ,  bucket[N][M];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, k;
	cin >> n >> k;
	int Sqrt;
	for (ll i = 1; i <= 100000; ++i) {
		if (i*i > n) {
			Sqrt = i;
			break;
		}
	}
	dp[0][1] = 1;
	for (int i = 0; i < k; ++i) {
		for (int j = 1; j < Sqrt; ++j)
			dp[i][j] += dp[i][j - 1];
		for (int j = Sqrt - 2; j >= 1; --j)
			bucket[i][j] += bucket[i][j + 1];
		for (int j = 1; j < Sqrt; ++j) {
			bucket[i + 1][j] = dp[i][j] * (n / j - n / (j + 1));
			bucket[i + 1][j] %= MOD;
			if (j == n / j) {
				bucket[i + 1][j] = 0;
				
			}
		}
		for (int j = 1; j < Sqrt; ++j) {
			dp[i + 1][j] = dp[i][Sqrt - 1] + bucket[i][j];
			dp[i + 1][j] %= MOD;
		}
	}
	ll ans = 0;
	for (int i = 1; i < M ; ++i) {
		ans += bucket[k][i];
		ans += dp[k][i];
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 160768
#include <stdio.h>

int main(void)
{

 int a,b,c,i,x;
 scanf("%d %d %d", &a, &b, &c);
 x = 0;

 for(i = a; i <= b; i++){
  if( c % i == 0){
    x++;
  }
 }

 printf("%d\n", x);
 
 return 0;
}  

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

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

    if(a >= 13){
        cout << b;
    }else if(a <= 12 && a >= 6){
        cout << b / 2;
    }else{
        cout << 0;
    }
}

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

using namespace std;

const int maxi = 1e6+10;
int a[maxi];
int n;
string s;

int main()
{
    cin>>s;

   if (s.size()%2) return !printf("No\n");
    for (int i = 0 ;i<s.size();i++)
        if (i%2==0 && s[i]!='h') return !printf("No\n"); else
        if (i%2==1 && s[i]!='i') return !printf("No\n");

    printf("Yes\n");
    return 0;
}
//Krajem maja samo uspomena osta
//nije bilo suza samo jedno zbogom


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	
	long long int n;
	long long int k;
	long long int total = 0;
	long long int count = 0;

	cin >> n >> k;
	vector<int>a(n + 1);
	vector<int>dp(n + 1,0);
	FOR(i, 1, n) {
		cin >> a[i];
		dp[a[i]]++;
	}
	FOR(i, 1, n) {
		if (dp[i] > 0) {
			total++;
		}
	}
	sort(dp.begin(), dp.end());
	if (total > k) {
		FOR(i, 1, n) {
			if (dp[i] > 0) {
				total--;
				count += dp[i];
			}
			if (total <= k) {
				break;
			}
		}
	}
	
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//#define pb(i) push_back(i) 
#define NIL -1
#define vll vector<ll> 
#define fatafat  {ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); }

int main()
{
    fatafat;
    ll n,w;
    cin>>n>>w;
    ll wt[n],va[n];
    ll t[w+1];
    for(int i=0;i<=w;i++)
    {
        t[i]=0;
    }    
    
    for(int i=0;i<n;i++)
    {
        cin>>wt[i]>>va[i];
    }
    
    for(int i=0;i<n;i++ )
    {
        for(int j=w;j>=wt[i];j--)
        {
           t[j]= max(t[j],va[i]+t[j - wt[i]]);
        }
    
    }
    
    cout<<t[w]<<"\n";
    
    return 0;
   
}

Measured memory_bytes: 1024
import sys

from operator import itemgetter

def main():
	lo=-1000000
	hi=1000000
	input = sys.stdin.readline
	k,x = [int(item) for item in input().split()]
	lst=[i for i in range(max(lo,x-k+1),min(hi,x+k-1)+1)]
	print(" ".join([str(n) for n in lst]))

main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    int x, y, z;
    R x >> y >> z;
    co((x - z) / (y + z));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  map<string, int> m;
  int maxc = -1;
  rep(i, n) {
    string s;
    cin >> s;
    m[s]++;
    maxc = max(m[s], maxc);
  }
  for(const auto& p : m ){
    if(p.second == maxc) cout << p.first << endl;
  }

  return 0;
}

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

using namespace std;
int main(void){
  int K, S;
  int x, y;
  int cnt = 0;//場合の数のカウント数
  cin >> K >> S;
  for(x = 0; x <= K; x++){
    for(y = 0; y <= K; y ++){
      if(S - x - y >= 0 && S - x - y <= K){++cnt;}
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

v = 0
t = (2*N) // K
s = N // K

if K % 2 == 0:
    if t % 2 == 0:
        v = 2*((t/2)**3)
    else:
        v = (((t+1)/2)**3) + (((t-1)/2)**3)
else:
    v = s**3

v = int(v)
print(v)

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


int main(){
    int N,L;
    cin >> N >> L;
    int A[200];
    for(int i=0; i<N; i++){
        A[i] = L + i;
    }

    int sum = 0;

    for(int j=0; j<N; j++){
        sum += A[j];
    }

    int answer;
    int dd = 1000000;
    int d;

    for(int k=0; k<N; k++){
        int tmpsum = 0;
        for(int l=0; l<N; l++){
            if(l != k){
                tmpsum += A[l];
            }
        }
        if(sum > tmpsum){
            d = sum - tmpsum;
        }
        else{
            d = tmpsum - sum;
        }

        if(d < dd){
            dd = d;
            answer = tmpsum;
        }
    }
    cout << answer;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define ov(a) for(ll i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
	fastio();
	ll N;
	cin>>N;
	dd ar[N];
	cn(ar,N);
	dd ans[N+1][N+1];
	ans[0][0]=1.0;
	for(ll i=1;i<=N;i++)
	{
		ans[i][0]=ans[i-1][0]*(1-ar[i-1]);
	}
	ans[1][1]=ar[0];
	for(ll i=2;i<=N;i++)
	{
		for(ll j=1;j<i;j++)
		{
			ans[i][j]=(ans[i-1][j-1]*ar[i-1]+ans[i-1][j]*(1-ar[i-1]));
		}
		ans[i][i]=ans[i-1][i-1]*ar[i-1];
	}
	dd sum=0.0;
	for(ll i=N/2+1;i<=N;i++)
		sum+=ans[N][i];
	cout<<fixed<<setprecision(12)<<sum<<endl;
}	


Measured memory_bytes: 70528
#include<stdio.h>
#include<stdlib.h>
int N,M,R[101],K[101][2],i,j,p,t,r;

int c(const void *a,const void *b)
{
	if(((int*)a)[0]==((int*)a)[0])
		return ((int*)a)[1]-((int*)b)[1];
	return ((int*)b)[0]-((int*)a)[0];
}

int main()
{
	scanf("%d%d",&N,&M);
	for(i=0;i<M;i++)
		scanf("%d%d",&K[i][0],&K[i][1]);
	qsort(K,M,sizeof(int[2]),c);
	for(i=r=0,p=1;i<M&&p<=N;)
	{
		for(j=i,t=-1;j<M;j++)
			if(K[j][0]<=p&&(t==-1||K[t][1]<=K[j][1]))
				t=j;
		if(t==-1)break;
		r++;
		p=K[t][1]+1;
		i=t+1;
	}
	if(p<=N)puts("Impossible");
	else printf("%d\n",r);
	return 0;
}

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

int main(){
  int D,N;
  cin >> D >> N;
  if (D == 0){
    if (N != 100) cout << N << endl;
    else cout << 101 << endl;
  }
  if (D == 1){
    if (N != 100) cout << N * 100 << endl;
    else cout << 10100 << endl;
  }
  if (D == 2){
    if(N != 100) cout << N * 10000 << endl;
    else cout << 1010000 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

//ll mod = 1000000007;
ll mod = 998244353;

signed main()
{
    string s;
    cin >> s;
    bool ans = true;
    vi dp(s.size() + 1);
    dp[0] = 1;
    if (s.size() < 5)
    {
        cout << "NO" << endl;
        return 0;
    }
    for (int i = 5; i <= s.size(); i++)
    {
        if (dp[i - 5] == 1 && s.substr(i - 5, 5) == "dream")
        {
            dp[i] = 1;
        }
        if (dp[i - 5] == 1 && s.substr(i - 5, 5) == "erase")
        {
            dp[i] = 1;
        }
        if (i >= 6)
        {
            if (dp[i - 6] == 1 && s.substr(i - 6, 6) == "eraser")
            {
                dp[i] = 1;
            }
        }
        if (i >= 7)
        {
            if (dp[i - 7] == 1 && s.substr(i - 7, 7) == "dreamer")
            {
                dp[i] = 1;
            }
        }
    }
    if (dp[s.size()] == 1)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
    return 0;
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
  int n, ans = 0;
  vector<int> v, c;
  cin >> n;

  REP(i, n){
    int vt;
    cin >> vt;
  v.pb(vt);
    }
    REP(i, n){
        int ct;
        cin >> ct;
        c.pb(ct);
      }

      REP(i,n){
          if(v[i] > c[i]) ans += (v[i] - c[i]);
        }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  int N; cin >> N;
  int a[10000] = {2};
  int b[N];
  int cnt = 1;

  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }

  int n = 3;
  while(n <= 10000) {
    bool f = true;
    for (int i = 0; i < cnt; i++) {
      if(n % a[i] == 0) {
        f = false;
        break;
      }
    }
    if(f) a[cnt++] = n;
    n += 2;
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    bool f = true;
    for (int j = 0; j < cnt; j++) {
      if(b[i] > a[j] && b[i] % a[j] == 0) {
        f = false;
        break;
      }
    }
    ans += int(f);
  }

  cout << ans << endl;
}



Measured memory_bytes: 3156
#include <stdio.h>
int min(int a,int b){
    return(a<b)?a:b;
}
int main(void){
    int n,K,cnt=0;
    scanf("%d%d",&n,&K);
    int a[n];
    char s[n];
    scanf("%s",s);
    for(int i=0;i<n;i++){
        a[i]=(s[i]=='L'?0:1);    //L:0 R:1
    }
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            cnt++;
        }
    }
    printf("%d\n",min(n-1,cnt+2*K));
    return 0;
}

Measured memory_bytes: 640
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	int N,K; cin>>N>>K;
	vector<ll> H(N); rp(i,N)cin>>H[i];
	sort(all(H));

	ll s = 0;
	rp(i,K-1) s+=H[i+1]-H[i];
	// ote(s);///
	ll mini = s;
	for(int pre=0, i=K; i<N; ++i, ++pre){
		// cout<<H[i]<<",";///
		s += (H[i]-H[i-1]) - (H[pre+1]-H[pre]);
		// cout<<H[i]<<","<<H[i-1]<<","<<H[pre+1]<<","<<H[pre]<<"\n";//
		// cout<<(H[i]-H[i-1])<<","<<(H[pre+1]-H[pre])<<"\n";//
		mini = min(mini,s);
		// ote(mini);///
	}
	ote(mini);
}


Measured memory_bytes: 1024
import heapq
import copy
def nint(x):
    return(int(x)*-1)
n, m = list(map(int, input().split()))
a = list(map(nint, input().split()))

b = copy.deepcopy(a)
heapq.heapify(b)

o = heapq.heappop(b)*-1
count = m
while o > 0 and count > 0:
    heapq.heappush(b, (o//2)*-1)
    count -= 1
    o = heapq.heappop(b)*-1

heapq.heappush(b, (o)*-1)

print(sum(b)*-1)

Measured memory_bytes: 104300
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007
INF = float("inf")


class FactInv:
    def __init__(self, N, MOD=1000000007):
        fact = [1]*(N+1)
        for i in range(1, N+1):
            fact[i] = fact[i - 1] * i % MOD

        inv = [None]*(N+1)
        inv[N] = pow(fact[N], MOD - 2, MOD)

        for i in range(N)[::-1]:
            inv[i] = inv[i + 1] * (i + 1) % MOD

        self.N = N
        self.MOD = MOD
        self.fact = fact
        self.inv = inv

    def perm(self, a, b):
        if a > self.N or b > self.N:
            raise ValueError(
                "\nPermutaion arguments are bigger than N\n N = {}, a = {}, b = {}".format(self.N, a, b))
        return self.fact[a] * self.inv[a-b] % self.MOD

    def comb(self, a, b):
        if a > self.N or b > self.N:
            raise ValueError(
                "\nCombination arguments are bigger than N\n N = {}, a = {}, b = {}".format(self.N, a, b))
        return self.fact[a] * self.inv[b] * self.inv[a-b] % self.MOD



def main():
    N, K = LI()
    A = sorted(LI())
    factinv = FactInv(N+1)
    ans = 0

    ans = 0
    for i, x in enumerate(A):
        maxc = factinv.comb(i, K - 1) if i >= K - 1 else 0
        minc = factinv.comb(len(A) - i - 1, K - 1) if len(A) - i - 1 >= K - 1 else 0
        ans = (ans + x * (maxc - minc)) % MOD

    print(ans % MOD)

if __name__ == '__main__':
    main()

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

struct UnionFind {
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    bool same(int x, int y) { 
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
 
 
int main() {
    int N,M;
    int ans = -1;
    int sum = 0;
    cin >> N >> M;
    vector<int> vec(N);
    UnionFind UF(N);
    for(int i=0;i<N;++i){
      cin >> vec.at(i);
    }

    for(int i=0;i<M;++i){
      int x,y; cin >> x >> y;
      x--; y--;
      UF.unite(x,y);
    }
while(sum > ans){
    ans = sum;
    sum = 0;
    for(int i=0;i<N;++i){
      if(UF.same(vec.at(i)-1,i)){
        swap(vec.at(vec.at(i)-1),vec.at(i));
      }
    }
    for(int i=0;i<N;++i){
      if(vec.at(i) == i+1) sum++;
    }
  }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3992