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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int main() {

  Integer threshold = 1e9;

  Integer n, t; cin >> n >> t;
  string s; cin >> s;

  Integer time = 0;
  for (int i=2; i < s.size(); i += 4) {
    Integer dt;

    int k = s[i] - '0';
    Integer acc = 1;
    while (k > 0) {
      --k;
      if (acc * t > threshold) goto tle;
      acc *= n;
    }
    dt = acc * t;
    if (dt > threshold) goto tle;
    time += dt;
    if (time > threshold) goto tle;
  }

  if (time > threshold) goto tle;

  cout << time << endl;
  return 0;

tle:
  cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 1204
H, W, M = map(int, input().split())
h_list = [0] * H
w_list = [0] * W
target = []
for _ in range(M):
  h, w = map(int, input().split())
  h_list[h-1] += 1
  w_list[w-1] += 1
  target += [[h-1,w-1]]

h_max = max(h_list)
w_max = max(w_list)
h_max_list = set([i for i, v in enumerate(h_list) if v == h_max])
w_max_list = set([i for i, v in enumerate(w_list) if v == w_max])

place = len(h_max_list) * len(w_max_list)
candidate = 0
for h,w in target:
  if (h in h_max_list) and (w in w_max_list):
    candidate +=1

print(h_max+w_max-(place == candidate))

Measured memory_bytes: 217836
l=list(input())
s=set(l)
ans=1000000000
for i in s:
    k=l
    c=0
    while len(set(k))>1:
        tmp=['0']*(len(k)-1)
        for j in range(len(k)-1):
            if k[j]==i or k[j+1]==i:
                tmp[j]=i
        k=tmp
        c+=1
    ans=min(ans,c)
print(ans)

Measured memory_bytes: 40048
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))


//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    int N, T;
    int c, t;
    int min_c = 1e5;
    cin >> N >> T;
    REP(i, N) {
        cin >> c >> t;
        if(t <= T && c < min_c) min_c = c;
    }
    if(min_c == 1e5) cout << "TLE" << endl;
    else cout << min_c << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int unit(int p,int q,double a,int n,int l)
{
	int i,c=0;

	if(n>0 && p>0){
		for(i=l;i<=a;i++)
		{
			if(p*i==q)c++;
			c += unit(p*i-q,q*i,a/i,n-1,i);
		}
	}
	return(c);
}

int main(void)
{
	int p,q,a,n;
	
	while(1)
	{
		scanf("%d %d %d %d ",&p,&q,&a,&n);
		if(p==0 && q==0 && a==0 && n==0)break;
		printf("%d\n",unit(p,q,(double)a,n,1));
	}
	return 0;
}

Measured memory_bytes: 408
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(ll i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

const ll mod = 1e9 + 7;

int main(){
    ll n; cin >> n;
    vector<ll> lis(n);
    REP(i, 0, n){cin >> lis[i];}
    map<int, int> mp;
    vector<int> prev(n, -1);
    REP(i, 0, n){
        if(mp.count(lis[i])){
            prev[i] = mp[lis[i]];
            mp[lis[i]] = i;
        }else{
            mp[lis[i]] = i;
        }
    }
    vector<ll> dp(n+1, 0);
    dp[0] = dp[1] = 1;
    REP(i, 1, n){
        dp[i+1] = dp[i] % mod; //copy prev dp
        if(prev[i] == -1){
            continue;
        }
        if(i-prev[i] == 1){ //exclude
            continue;
        }
        dp[i+1] += dp[prev[i]+1]; //配列一個ずれてること忘れずに
        dp[i+1] %= mod;
    }
    cout << dp[n];
}

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

int findSumofDigits (int n) {
  int sum = 0;
  while (n>0) {
    sum += n % 10;
    n = n / 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  int sum = findSumofDigits(N);
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
  

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){

    int h,w;
    cin>>h>>w;

    char maze[h][w];
    int black=0;
    rep(i,h)rep(k,w){
        char c;
        cin>>c;
        maze[i][k]=c;
        if(c=='#')black++;

    }

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

    queue<int>q;
    q.push(0);
    q.push(0);
    int dist[h][w];
    rep(i,h)rep(k,w)dist[i][k]=1e5;
    dist[0][0]=1;

    while(!q.empty()){
    
    int nowx=q.front();q.pop();
    int nowy=q.front();q.pop();

        rep(i,4){
            int nx=nowx+dx[i];
            int ny=nowy+dy[i];
            if(dist[ny][nx]!=1e5)continue;
            if(nx<0 || nx>=w || ny<0 || ny >=h 
            || maze[ny][nx]=='#')continue;

            dist[ny][nx]=dist[nowy][nowx]+1;
            q.push(nx);
            q.push(ny);
        }

    }
    if(dist[h-1][w-1]==1e5){
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<h*w-(dist[h-1][w-1]+black)<<endl;


    return 0;

}
/*


*/


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

// 素因数分解
template <typename T>
map<T, T> prime_factor(T n) {
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret[i] = tmp;
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

/*  divisor_num(n)
    入力：整数 n
    出力：nの約数の個数
    計算量：O(√n)
*/
template <typename T>
T divisor_num(T N) {
    map<T, T> pf = prime_factor(N);
    T ret = 1;
    for (auto p : pf) {
        ret *= (p.second + 1);
    }
    return ret;
}

int ass(int a){
  if (a==2){
    return 1;
  }
  if (a==300000){
    return 3829761;
  }
  if (a==500000){
    return 6638407;
  }
  if (a==600000){
    return 8075420;
  }
  if (a==700000){
    return 9529244;
  }
  if (a==800000){
    return 10997400;
  }
  if (a==900000){
    return 12478098;
  }
  return ass(a-1)+divisor_num(a-1);
}

  int N;

int main() {
  cin >> N;
  cout << ass(N)<<endl;
}

Measured memory_bytes: 24156
#include<bits/stdc++.h>
    #define ll long long
    using namespace std;
     
    int main()
    {
      ll n,k;
      cin>>n>>k;
      int ans = k;
      for(int i = 1; i < n; i++)
        ans = (k-1)*ans;
      cout<<ans<<"\n";
      return 0;
    }

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,a,b,c,d = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
if "##" in s[a:c+1]:
    ans = "No"
elif "##" in s[b:d+1]:
    ans = "No"
elif c>d and "..." not in s[b-1:d+2]:
    ans = "No"
else:
    ans = "Yes"
print(ans)

Measured memory_bytes: 63388
n, a = gets.split.map(&:to_i)
cards = gets.split.map(&:to_i)
dp = Hash.new(0)
# dp開始前、平均と0枚差の組み合わせは1通り
# ただし1枚以上選ぶ必要があるため、最後にこの1通りは引く
dp[0] = 1

cards.each do |card|
  copy_dp = dp.dup
  copy_dp.each do |key, value|
    dp[key + card - a] += value
  end
end

puts dp[0] - 1


Measured memory_bytes: 3452
N = int(input())
H = [int(i) for i in input().split()]

for i in range(1, N - 1):
    if H[i + 1] >= max(1, H[i] - 1) >= H[i - 1]:
        H[i] = max(1, H[i] - 1)
        continue
    elif H[i + 1] >= H[i] >= H[i - 1]:
        continue
    else:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 14396
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [n, t] <- fmap read . words <$> getLine :: IO [Int]
    ts <- fmap read . words <$> getLine :: IO [Int]
    let as = zipWith (-) (tail ts) ts
    let bs = fmap (min t) as
    print $ sum bs + t

Measured memory_bytes: 70140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  string s; cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s.at(i);
  }
  cout << endl;
}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    map<string, int> rateN;
    rateN.insert(make_pair("grey", 0));
    rateN.insert(make_pair("brown", 0));
    rateN.insert(make_pair("green", 0));
    rateN.insert(make_pair("lightblue", 0));
    rateN.insert(make_pair("blue", 0));
    rateN.insert(make_pair("yellow", 0));
    rateN.insert(make_pair("orange", 0));
    rateN.insert(make_pair("red", 0));
    rateN.insert(make_pair("overred", 0));
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        if (a < 400) {
            ++rateN["grey"];
        }
        else if (a < 800) {
            ++rateN["brown"];
        }
        else if (a < 1200) {
            ++rateN["green"];
        }
        else if (a < 1600) {
            ++rateN["lightblue"];
        }
        else if (a < 2000) {
            ++rateN["blue"];
        }
        else if (a < 2400) {
            ++rateN["yellow"];
        }
        else if (a < 2800) {
            ++rateN["orange"];
        }
        else if (a < 3200) {
            ++rateN["red"];
        }
        else {
            ++rateN["overred"];
        }
    }

    int ansMin = 0;
    for (auto e : rateN) {
        if (e.first != "overred" && e.second > 0) {
            ++ansMin;
        }
    }
    int ansMax = ansMin + rateN["overred"];
    ansMin = max(1, ansMin);
    cout << ansMin << " " << ansMax << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>

int main(){
	int n, i, j, k, l, count;
	while(scanf("%d", &n) != EOF){
		count = 0;
		for(i = 0; i < 10; i++){
			for(j = 0; j < 10; j++){
				for(k = 0; k < 10; k++){
					for(l = 0; l < 10; l++){
						if(i+j+k+l == n){
							count++;
						}
					}
				}
			}
		}
		printf("%d\n", count);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef double d;

ll n,k;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>k;
	if(n>=k*2-1) cout<<"YES";
	else cout<<"NO";	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	vector<int> c = v;
	sort(rall(c));
	int max1 = c[0], max2 = c[1];
	for (int x : v) {
		if (x == max1)
			cout << max2 << endl;
		else
			cout << max1 << endl;
	}
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    int sum = 0, cnt = 0, cntr = 0, cntg = 0;
    vector<pair<int, int> > vec;
    for (int d = 0; d < a; d++) {
        int zn;
        cin >> zn;
        vec.pb({zn, 1});
    }
    for (int d = 0; d < b; d++) {
        int zn;
        cin >> zn;
        vec.pb({zn, 2});
    }
    for (int d = 0; d < c; d++) {
        int zn;
        cin >> zn;
        vec.pb({zn, 3});
    }
    sort(all(vec));
    reverse(all(vec));
    for (int d = 0; d < vec.size() && cnt < x + y; d++) {
        if (vec[d].sc == 1 && cntr < x) {
            cntr++; cnt++;
            sum += vec[d].ft;
        }
        if (vec[d].sc == 2 && cntg < y) {
            cntg++; cnt++;
            sum += vec[d].ft;
        }
        if (vec[d].sc == 3 && cnt < x + y) {
            cnt++;
            sum += vec[d].ft;
        }
    }
    cout << sum << "\n";
}


Measured memory_bytes: 10604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(x == 0 && y == 0) {
				break;
			}else if(x >= y) {
				System.out.println(y + " " + x);
			}else{
				System.out.println(x + " " + y);
			}
			
		}
	}
}


Measured memory_bytes: 36112
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		//waste of space, but I like arrays.
		int[][] myIndex = new int[5000][5000];

		//Get the number of time this needs to be done
		int q = sc.nextInt();

		for (int k = 0; k < q; k++) {
			//This for loop is just to get the values for the every comparison
			String a = sc.next();
			String b= sc.next();
			for (int i = 0; i < a.length(); ++i) { //First Position For Loop
				for (int j = 0; j < b.length(); ++j) { //Second Position For Loop

					//Checks if chars are the same
					if (a.charAt(i) == b.charAt(j)) {
						myIndex[i + 1][j + 1] = myIndex[i][j] + 1;
					}

					else {
						//checking which spot it needs to go in.
						if (myIndex[i + 1][j] > myIndex[i][j + 1]) {
							myIndex[i + 1][j + 1] = myIndex[i + 1][j];

						}

						else {

							myIndex[i + 1][j + 1] = myIndex[i][j + 1];
						}
					}
				}
			}
			//Prints out the entire array that is defined on new linges
			System.out.printf("%d\n", myIndex[a.length()][b.length()]);
		}
	}
}


Measured memory_bytes: 133872
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod  10000007
#define pii pair<int, int>
#define PI 2*acos(0.0)
#define forn(i, n) for(int i = 0; i < n; i++)


int main()
{
    io;
    int n, w;
    cin>>n>>w;
    vi wgt(1), val(1);
    for(int i= 0; i< n;i++)
    {
        int x, y;
        cin>>x>>y;
        wgt.pb(x);
        val.pb(y);
    }
    ll dp[n+1][w+1];
    for(int i = 0; i<= w; i++)
        dp[0][i] = 0;
    for(int i = 1; i<=n; i++)
    {
        for(int j = 0;j<= w; j++)
        {
            ll p1 = INT_MIN, p2  = INT_MIN;
            p1 = dp[i-1][j];
            if(j - wgt[i] >= 0)
                p2 = val[i] + dp[i-1][j-wgt[i]];
            dp[i][j] = max(p1, p2);
        }
    }
    cout<<dp[n][w];
    return 0;
}

Measured memory_bytes: 79232
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var chars [26]int
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.ToLower(sc.Text())
		if strings.TrimSpace(s) == "" {
			break
		}
		for i := 0; i < len(s); i++ {
			if 'a' <= s[i] && s[i] <= 'z' {
				chars[int(s[i]-'a')]++
			}
		}
	}
	// fmt.Println("debug - chars", chars)
	for i := 0; i < len(chars); i++ {
		fmt.Printf("%s : %d\n", string('a'+byte(i)), chars[i])
	}
}



Measured memory_bytes: 1116
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N;
    A.resize(N);
    rep(i,N){
        cin>>A[i];
    }
}
//=============================
void func(){}
//=============================
void solve()
{
    int ans = 0;
    int tmp = 0;
    for(auto x : A) {
        if (x % 2 == 0) {
            for (tmp = 0; x%2 == 0; tmp++) {
                x /= 2;
            }
            ans += tmp;
        }
    }
    cout<<ans<<endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 384
import sys

def merge(L,R):
    res = []
    
    l_L = len(L)
    l_R = len(R)
    i = 0
    j = 0
    while (i <= l_L) & (j <= l_R):
        if (i == l_L) & (j == l_R):
            return res
        elif i == l_L:
            res.append(R[j])
            j += 1
        elif j == l_R:
            res.append(L[i])
            i += 1
        elif L[i] <= R[j]:
            res.append(L[i])
            i += 1
        else:
            res.append(R[j])
            j += 1
    return res

def divide(A):
    l_A = len(A)
    l_L = int(l_A / 2)
    l_R = l_A - l_L
    L = A[:l_L]
    R = A[l_L:]
    return L,R

def my_sort(A):
    l_A = len(A)
    if l_A == 1:
        return A
    else:
        L,R = divide(A)
        L = my_sort(L)
        R = my_sort(R)
        return merge(L,R)
    
N , C, K = map(int,input().split())
T = []
for _ in range(0,N):
    T.append(int(input()))
T = my_sort(T)

bus = 0
t_0 = T[0]
t_B = T[0] + K
num = 0


i = 0
while i < len(T):
    t = T[i]
    dt = t - t_0
    if (dt <= K) & (float((num + 1)) / float(C) <= 1):
        num += 1
    else:
        if num != 0:
            #print(T[i-1])
            bus += 1
            t_0 = t
            num = 1
    i += 1
bus += 1
print(bus)

Measured memory_bytes: 9352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {

       


        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int n = int.Parse(line);
                if (n == 0) { break; }

                List<int> taroHand = new List<int>();
                for (int i = 0; i < n; i++) {
                    taroHand.Add(int.Parse(Console.ReadLine()));
                }
                List<int> hanaHand = new List<int>();
                for(int i = 1; i<= 2*n; i++){
                    if(taroHand.Contains(i)==false){hanaHand.Add(i);}
                }
                taroHand.Sort();
                //Store completed.

                int banokazu = 0;
                bool taroTurn = true;
                while(taroHand.Count>0&&hanaHand.Count>0){
                    if(taroTurn){
                        int dasukazu = 0;
                        foreach(int card in taroHand){
                            if(banokazu<card){dasukazu=card; break;}
                        }
                        if(dasukazu==0){banokazu=0;}
                        else{taroHand.Remove(dasukazu);banokazu=dasukazu;}
                    }else {
                        int dasukazu = 0;
                        foreach(int card in hanaHand){
                            if(banokazu<card){dasukazu=card; break;}
                        }
                        if(dasukazu==0){banokazu=0;}
                        else{hanaHand.Remove(dasukazu);banokazu=dasukazu;}
                    }
                    taroTurn = !taroTurn;
                }


                Console.WriteLine(hanaHand.Count);
                Console.WriteLine(taroHand.Count);
            }
        }

        
    }



    
}

Measured memory_bytes: 6168
#include<stdio.h>

int main(void)
{
    int a,b,c,d,z,g;

    scanf("%d%d%d%d",&a,&b,&c,&d);
    z=1;
    while(1){
        c-=b;
        if (c<=0) {printf("Yes\n"); break;}
        a-=d;
        if (a<=0) {printf("No\n"); break;}
    }
    return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, a[2020], x;
i64 dp[2020][2020];
void solve(){
	cin >> n >> x;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		dp[i][0] = a[i];
	}
	
	i64 ans = LINF;
	for(int i = 0; i < n; i++){
		i64 cnt = i*x;
		for(int j = 0; j < n; j++){
			cnt += dp[j][i];
			dp[j][i+1] = min(dp[j][i], a[mod(j-i-1,n)]);
		}
		chmin(ans,cnt);
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 31872
for e in iter(input, "0 0"):
    H, W = [int(x) for x in e.split()]
    [print("#", end="") for i in range(W)]
    print()

    for i in range(H - 2):
        for j in range(W):
            if j == 0 or j == (W - 1):
                print("#", end="")
            else:
                print(".", end="")
        print()

    [print("#", end="") for i in range(W)]
    print()
    print()



Measured memory_bytes: 7008
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
	typedef long long int lli;
	const int MaxN=55;
	#define fst first
	#define snd second
	
int main(){
	lli A,N,M,res;
	cin>>A>>N>>M;
	res=min(N-1,M);
	cout<<(A*res)/N-(A*(res/N));
}

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

int main() {
  int a,b,c,d;
  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: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i * i <= n - 1; i++) {
        if ((n - 1) % i == 0) {
            ll j = (n - 1) / i;
            ans++;
            if (i != j) ans++;
        }
    }
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ll t = n;
            while (t % i == 0) t /= i;
            if (t % i == 1) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
s = input()
count = 0
start = 0
goal = 0
for i in range(len(s)):
	if s[i] == "A":
		start = i
		break
for j in range(len(s)):
	if s[j] == "Z":
		goal = len(s) - j
print(len(s) - (start + goal) + 1)



Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main()
{
    ll n{};
    cin>>n;
    ll A[n]{},ans = INT_MAX;
    for(ll i=0;i<n;i++){
        cin>>A[i];
    }
    for(ll i=-100;i<=100;i++){
        ll sum{0};
        for(int j=0;j<n;j++){
            sum+=(A[j]-i)*(A[j]-i);
        }
        ans=min(sum,ans);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<climits>
#include<utility>
using namespace std;

int main(void)
{
	int N, M;
	cin >> N >> M;

	vector<int> a(M), b(M);
	vector<long long> c(M);
	for(int i=0; i<M; i++)
	{
		cin >> a[i] >> b[i] >> c[i];

		a[i]--;
		b[i]--;
		c[i] = -c[i];
	}

	vector<long long> dist(N, LLONG_MAX);
	dist[0] = 0;
	for(int i=0; i<N-1; i++)
	{
		for(int j=0; j<M; j++)
		{
			if(dist[a[j]] == LLONG_MAX)
				continue;

			long long cost = dist[a[j]] + c[j];
			if(cost < dist[b[j]])
				dist[b[j]] = cost;
		}
	}
	const long long d = dist[N-1];

	vector<bool> flag(N, false);
	for(int i=0; i<N; i++)
	{
		for(int j=0; j<M; j++)
		{
			if(dist[a[j]] == LLONG_MAX)
				continue;
			
			long long cost = dist[a[j]] + c[j];
			if(cost < dist[b[j]])
			{
				dist[b[j]] = cost;
				flag[b[j]] = true;
			}

			if(flag[a[j]] == true)
				flag[b[j]] = true;
		}
	}

	string ret;
	if(flag[N-1] == true)
		ret = "inf";
	else
		ret = to_string(-d);

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

ll a,b,c;

int main() {
    scanf("%lld%lld%lld",&a,&b,&c);
    if ((a%2!=0)||(b%2!=0)||(c%2!=0)) {
        printf("0\n");
        return 0;
    }
    if (a==b&&b==c) {
        printf("-1\n");
        return 0;
    }
    int cnt=0;
    while (a%2==0&&b%2==0&&c%2==0) {
        cnt++;
        ll aa=(b+c)/2;
        ll bb=(a+c)/2;
        ll cc=(a+b)/2;
        a=aa;
        b=bb;
        c=cc;
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 256
import sys

N,A,B,C,D=list(map(int,input().split()))
S=input()

for i in range(B,D-2):
	if S[i]=="#" and S[i+1]=="#":
		print("No")
		sys.exit()


for i in range(A,C-2):
	if S[i]=="#" and S[i+1]=="#":
		print("No")
		sys.exit()

if D<C:
	for i in range(B-1,D):
		if S[i-1]=="." and S[i+1]=="." and S[i]==".":
			print("Yes")
			sys.exit()
	print("No")
else:
	print("Yes")

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll 
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = -1;
#ifndef LOCAL
#define cerr if(0)cout
#endif

int dist(string a, string b) {
	int res = 0;
	FOR(i,0,a.size()-1) {
		if(a[i] != b[i]) ++res;
	}
	return res;
}

int32_t main() 
{
	IAMSPEED
	string s,t; cin >> s >> t;
	int n = s.size(), m = t.size();
	vector<string>pos;
	FOR(i,0,n-m) {
		pos.pb(s.substr(i,m));
	}
	//dbv(pos);
	int ans = inf;
	for(auto i:pos) {
		chmin(ans, dist(i,t));
	}
	cout << ans;

}



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

string s;
long long n, k;
vector<vector<vector<long long>>> dp;

long long solve();

int main() {
  cin >> s >> k;

  cout << solve() << endl;
  return 0;
}

long long solve() {
  n = s.size();
  dp.assign(n + 1, vector<vector<long long>>(
                       2, vector<long long>(k + 1, 0)));
  dp[0][0][0] = 1;
  for(int i = 0; i < n; ++i) {
    for(int j = 0; j < 10; ++j)
      for(int l = 0; l <= k; ++l) {
        long long now = l + (j != 0);
        if(now > k) continue;
        if(j == s[i] - '0') {
          dp[i + 1][1][now] += dp[i][1][l];
          dp[i + 1][0][now] += dp[i][0][l];
        }
        else if(j < s[i] - '0') {
          dp[i + 1][1][now] += dp[i][0][l] + dp[i][1][l];
        }
        else if(j > s[i] - '0') {
          dp[i + 1][1][now] += dp[i][1][l];
        }
        else
          assert(0);
      }
  }
  long long res = 0;
  for(int i = 0; i < 2; ++i) res += dp[n][i][k];
  return res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y){
  if (y == 0) return x;
  return gcd(y,x%y);
}
int main(){
  long long A,B;
  cin >> A >> B;
  long long G = gcd(A,B);
  int div,count;
  count = 1;
  long long U=ceil(sqrt((double)G));
  for (int div = 2; div<=U; div++){
    if (G%div==0){
      count++;
      while (G%div==0){
        G = G / div;
      }
    }
    if (div%2==1) div++;
    if (div%3==2 && div>3) div++;
  }
  if (G>1) count++;
  cout << count;
}


Measured memory_bytes: 256
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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
    input!{
        n: usize,
        v: [(usize1, usize1); n - 1]
    }
    let mut t = vec![vec![]; n];
    for &(a, b) in &v {
        t[a].push(b);
        t[b].push(a);
    }
    let mut map = HashMap::new();
    dfs(&t, 0, 0, 0, &mut map);
    println!("{}", map.values().cloned().max().unwrap());
    for &(a, b) in &v {
        println!("{}", map.get(&(a, b)).unwrap());
    }
}

fn dfs(t: &Vec<Vec<usize>>, v: usize, p: usize, pc: usize, map: &mut HashMap<(usize, usize), usize>) {
    let mut col = 0;
    for &c in &t[v] {
        if c == p {
            continue;
        }
        col += 1;
        if col == pc {
            col += 1;
        }
        map.insert((v, c), col);
        map.insert((c, v), col);
        dfs(t, c, v, col, map);
    }
}


Measured memory_bytes: 26920
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(C>=A&&C<=B){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  float sum = vec[0];
  for (int i = 1; i < N; i++){
    sum = (sum + vec[i]) / 2;
  }
  cout << sum;
 return 0; 
}

Measured memory_bytes: 256
import Data.Hashable (hash)
import Data.Map (Map, empty, member, insert)
import Data.List (partition)
import Control.Monad (foldM_)

main :: IO ()
main = do
    getLine
    inputs <- fmap lines getContents :: IO [String]
    foldM_ solve empty inputs

solve :: Map Int String -> String -> IO (Map Int String)
solve dictionary input =
    if ope == 'i' then
        return $ insert key val dictionary
    else do
        if member key dictionary then
            putStrLn "yes"
        else
            putStrLn "no"
        return dictionary
  where
    val = last . words $ input
    key = hash val
    ope = head input



Measured memory_bytes: 217152
# input
import math

a, b, x = map(int, input().split())

# 0,...,nの中でxで割り切れるのは
# 0, x, 2x,..., (n // x)* x の(n //x) + 1個

if a % x == 0:
    ans = ((b // x) + 1) - ((a // x) + 1) + 1
    print(ans)
else:
    ans = ((b // x) + 1) - ((a // x) + 1)
    print(ans)

Measured memory_bytes: 3064
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            int MIN = 0, MAX = 44;
            if (n < MIN || n > MAX) {
                System.out.println("Condition is invalid.");
                return;
            }
            int[] fs = new int[MAX + 1];
//            System.out.println(fibonacci(n, fs));
            fs = makeFibonacciNumbers(n, fs);
            System.out.println(fs[n]);
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static int fibonacci(int n, int[] fs) {
        if (n == 0 || n == 1) {
            return 1;
        }
        if (fs[n] != 0) {
            return fs[n];
        }
        fs[n] = fibonacci(n - 1, fs) + fibonacci(n - 2, fs);
        return fs[n];
    }

    private static int[] makeFibonacciNumbers(int n, int[] fs) {
        fs[0] = 1;
        fs[1] = 1;
        for (int i = 2; i <= n; i++) {
            fs[i] = fs[i - 1] + fs[i - 2];
        }
        return fs;
    }
}



Measured memory_bytes: 26320
from collections import defaultdict
from bisect import bisect_right

def main():
    S = input()
    T = input()
    d = defaultdict(list)
    for i, s in enumerate(S):
        d[s].append(i+1)
    pre = 0
    cnt = 0
    loop = 0
    len_S = len(S)
    for t in T:
        if not d[t]:
            print(-1)
            exit()
        index = bisect_right(d[t],pre)
        if index > len(d[t])-1:
            pre = 0
            loop += 1
            index = bisect_right(d[t],pre)
        pre = d[t][index]
        
    ans = loop * len_S + pre
    print(ans)






if __name__ == "__main__":
    main()

Measured memory_bytes: 45808
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,H,W,ans=0;
  cin>>H>>W;
  string s;
  vec v(4,0),alp(30,0);
  v[0]=LLONG_MAX;
  if(H%2)v[2]+=W/2;
  if(W%2)v[2]+=H/2;
  if(H%2&&W%2)v[1]++;
  while(H--){
    cin>>s;
    rep(i,W){
      alp[s[i]-'a']++;
    }
  }
  rep(i,30){
    v[alp[i]%4]--;
    if(v[alp[i]%4]<0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
def d_patisserie_abc(N, M, Cake):
    # 変数の意味は、左から順に、 綺麗さ, おいしさ, 人気度 をそれぞれ
    # 正の方向(p)に最大化する場合と負の方向(m)に最大化する場合である。
    # なお、mmm, mmp, mpm, mpp は、ppp, ppm, pmp, pmm を
    # 逆順ソートすることで得られる。
    ppp, ppm, pmp, pmm = [], [], [], []
    for x, y, z in Cake:
        ppp.append(x+y+z)
        ppm.append(x+y-z)
        pmp.append(x-y+z)
        pmm.append(x-y-z)

    pts = [
        abs(sum(sorted(ppp)[:M])),
        abs(sum(sorted(ppm)[:M])),
        abs(sum(sorted(pmp)[:M])),
        abs(sum(sorted(pmm)[:M])),
        abs(sum(sorted(ppp, reverse=True)[:M])),
        abs(sum(sorted(ppm, reverse=True)[:M])),
        abs(sum(sorted(pmp, reverse=True)[:M])),
        abs(sum(sorted(pmm, reverse=True)[:M]))
    ]
    ans = max(pts)
    return ans

N, M = [int(i) for i in input().split()]
Cake = [[int(i) for i in input().split()] for j in range(N)]
print(d_patisserie_abc(N, M, Cake))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  string s, t;
  cin >> s >> t;
  rep(i, s.size()+t.size()) {
    if (i%2 == 0) {
      cout << s.at(i/2);
    } else {
      cout << t.at(i/2);
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def comb(lst, x):
	from itertools import combination as c
	return list(comb(lst, x))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}
def smaller(lst, x): return bisect_left(lst, x) -1
def smallerEq(lst, x): return bisect_right(lst, x) -1

def solve(n, lst):
	cnt = 0
	for i in range(n):
		if i % 2 == 0 and lst[i] % 2:
			cnt += 1
	return cnt

n = int(input())
lst = list(map(int, input().split()))
print(solve(n, lst))

Measured memory_bytes: 9228
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

int main(void) {
    int N,A,T;

    cin>>N>>A>>T;
    if(N*A < T) {
        cout<<N*A<<endl;
    } else {
        cout<<T<<endl;
    }

    return 0;
}




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

using namespace std;

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

  int sum = 0;
  for(int i = 0; i < N; i++) {
    sum += a[i] - 1;
  }
  cout << sum << endl;
}

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;

int main()
{
  string s; cin >> s;
  int max=0;

  rep(i, s.size()) {
    int cnt = 0;
    for(int j = i; j < s.size(); j++) {
      if(s[j] == 'A' || s[j] == 'T' || s[j] == 'C' || s[j] == 'G'){
        cnt ++;
      } else{
        break;
      }
    }
    if (max < cnt) max = cnt;
  }

  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int h = int.Parse(str[0]);
            int a = int.Parse(str[1]);
            int ans = h / a;
            if (h % a != 0) ans++;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
 
int main(void)
{
    int a, b;
    int first;
    int leap, na;
     
    first = 0;
    while (1){
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }
        na = 0;
        if (first != 0){
            printf("\n");
        }
         
        for (leap = a; leap <= b; leap++){
            if (leap % 4 == 0 && leap % 100 != 0 || leap % 400 == 0){
                printf("%d\n", leap);
                na++;
                first++;
            }
        }
        if (na == 0){
            printf("NA\n");
            first++;
        }
    }
    return (0);
}

Measured memory_bytes: 616
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
int n, m;
int main(){
    int i, j, k;
    cin >> n;
    double x[100];
    for(i = 1; i <= n; ++i){
        scanf("%lf",&x[i]);
    }
    sort(x+1, x+1+n);
    double ans = x[1];
    for(i = 2; i <= n; ++i){
        ans = (x[i] + ans) * 0.5;
    }
    printf("%.6lf\n",ans);
    return 0;
}

Measured memory_bytes: 888
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD;
	auto B = RD;
	auto K = RD;
	auto x = min(A, K);
	A -= x;
	K -= x;
	auto y = min(B, K);
	B -= y;

	writeln(A, " ", B);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b)
{
	return a>b;
}
int main()
{
	int n, sum=0, s=0,  x=0, z=0;
	cin >> n;
	int a[n+1];
	if(n%2==0)
	{
		sum=n/2;
	}
	else
	{
		sum=(n/2)+1;
	}
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
	}
	sort(a+1, a+n+1, cmp);
	for(int i=1;i<=n;i+=2)
	{
		x+=a[i];
	}
	for(int i=2;i<=n;i+=2)
	{
		z+=a[i];
	}
	cout << x - z <<endl;
	return 0;
}


Measured memory_bytes: 256