akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<sstream>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<climits>
#include<functional>

#include<memory.h>

#define ll long long

using namespace std;

const int MAXN(1e5 + 5);
vector<vector<int> > dp(MAXN, vector<int>(3));


int main()
{
	vector<int> v(3);
	int N(0);
	while (cin >> N) {
		fill(dp.begin(), dp.end(), vector<int>(3));

		for (int i = 1; i <= N; ++i) {
			cin >> v[0] >> v[1] >> v[2];
			dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + v[0];
			dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + v[1];
			dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + v[2];
		}

		cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;
	}
	return 0;
}

Measured memory_bytes: 5760
let solve h w c =
  let rec duduwa ans i j k = function
    | [] -> (ans, [(c.(i).(j), k)])
    | (ch, cj) :: y' when ch >= c.(i).(j) -> duduwa (if ch * (j - cj) > ans then ch * (j - cj) else ans) i j cj y'
    | ys -> (ans, (c.(i).(j), k) :: ys) in
  let rec doit ans = function
    | (i, _, xs) when i = h -> ans
    | (i, j, xs) when j = w -> doit (List.fold_left (fun acc (ch, cj) -> if ch * (w - cj) > acc then ch * (w - cj) else acc) ans xs) (i + 1, 0, [])
    | (i, j, []) -> doit ans (i, j + 1, [(c.(i).(j), j)])
    | (i, j, ((ch, _) :: _ as xs)) when ch < c.(i).(j) -> doit ans (i, j + 1, (c.(i).(j), j) :: xs)
    | (i, j, ((ch, _) :: _ as xs)) when ch > c.(i).(j) ->
      let (ans, ys) = duduwa ans i j j xs in
      doit ans (i, j + 1, ys)
    | (i, j, xs) -> doit ans (i, j + 1, xs) in
  doit 0 (0, 0, [])

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let read () = List.map int_of_string (split_on_char ' ' (read_line ()))

let () =
  match read () with
  | [h; w] ->
    let c = Array.make_matrix h w 0 in
    for i = 0 to h - 1 do
      let rec doit j = function
        | [] -> ()
        | x::xs ->
          c.(i).(j) <- x;
          doit (j + 1) xs in
      doit 0 (read ())
    done;
    for j = 0 to w - 1 do
      c.(0).(j) <- 1 - c.(0).(j);
      for i = 1 to h - 1 do
        c.(i).(j) <- if c.(i).(j) = 1 then 0 else c.(i-1).(j) + 1
      done
    done;
    Printf.printf "%d\n" (solve h w c)
  | _ -> ()

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

int main() {
  int a,b;
  cin>>a>>b;
  if ((a+b)%2==1) {
    cout<< (a+b+1)/2 << endl;
  }
  else{
    cout<< (a+b)/2 <<endl;
  }
}


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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> abc(N, vector<int>(3));
    for (int i = 0; i < N; i++) {
        cin >> abc.at(i).at(0) >> abc.at(i).at(1) >> abc.at(i).at(2);
    }

    vector<vector<int>> dp(N, vector<int>(3, 0));
    dp.at(0) = abc.at(0);
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            int keep = 0;
            for (int k = 0; k < 3; k++) {
                if (j != k) {
                    if (keep < dp.at(i - 1).at(k) + abc.at(i).at(j)) {
                        keep = dp.at(i - 1).at(k) + abc.at(i).at(j);
                    }
                }
            }
            dp.at(i).at(j) = keep;
        }
    }

    cout << max({dp.at(N - 1).at(0), dp.at(N - 1).at(1), dp.at(N - 1).at(2)}) << endl;
}

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

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> g(N);
    for(int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<pii> que;
    que.push(make_pair(0, 0));
    bool ok = false;
    while(!que.empty()) {
        pii p = que.front();
        que.pop();
        if(p.second == N-1) {
            ok = true;
        }
        if(p.first >= 2) {
            continue;
        }
        for(auto to : g[p.second]) {
            que.push(make_pair(p.first + 1, to));
        }
    }
    if(ok) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 12784
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define fi first
#define se second
#define sqrt(x) sqrt(abs(x))
#define sqr(x) ((x) * (x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define fill(x, y) memset(x, y, sizeof(x))
#define mp make_pair
#define pb emplace_back
#define popcnt __builtin_popcount
#define ctz __builtin_ctz

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
template <class T> using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;
    return in;
}

template <class T>
ostream& operator << (ostream &out, vector <T> &a) {
    for (T &i: a) out << i << ' ';
    return out;
}

template <class T>
ostream& operator << (ostream &out, set <T> &a) {
    for (auto &i: a) out << i << ' ';
    return out;
}

template <class T, class U>
istream& operator >> (istream &in, pair <T, U> &p) {
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator << (ostream &out, pair <T, U> &p) {
    out << p.first << ' ' << p.second;
    return out;
}

void fastIO() {
    ios_base:: sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
}

ll n, m;

signed main() {
    fastIO();

    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2;

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ:
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll X;
	cin>>X;
	ll t = 1;
	ll val = 100 + 100*0.01;
	while(val<X)
	{
		val = val + val*0.01;
		t++;
	}
	cout<<t;	
}

Measured memory_bytes: 3636
# 問題C
import numpy as np
import warnings
warnings.filterwarnings('ignore')

N = int(input())
h = np.array([list(map(int, input().split())) for _ in range(N)])

h = h.reshape(N, 3)

dp = np.array([[0] * h.shape[1]] * h.shape[0])
dp[0, :] = h[0, :]
for i in range(1, N):
    dp[i, 0] = max(dp[i-1, 1], dp[i-1, 2])+h[i, 0]
    dp[i, 1] = max(dp[i-1, 0], dp[i-1, 2])+h[i, 1]
    dp[i, 2] = max(dp[i-1, 0], dp[i-1, 1])+h[i, 2]

print(max(dp[-1, ]))


Measured memory_bytes: 50772
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=2e5+10;
	
	int a[N];
	void main()
	{
		int h=qread(),a=qread();write( ceil(1.0*h/a) );
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"Time: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}

Measured memory_bytes: 764
object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val n = readLine.trim.toInt
  val Array(a, d) = readLine.trim.split(' ').map(_.toInt)
  val m = readLine.trim.toInt
  val orders = Array.tabulate(m){_⇒
    val Array(x, y, z) = readLine.trim.split(' ').map(_.toInt)
    (x, y, z)
  }
  var k = readLine.trim.toInt
  for ((_, y, z) ← orders.filter(_._1 == 0).reverse) {
    k = reverse(y to z, k)
  }
  var value = a + d * (k - 1)
  for ((x, y, z) ← orders){
    if ((y to z).contains(k)) {
      x match {
        case 0 ⇒ k = reverse(y to z, k)
        case 1 ⇒ value += 1
        case 2 ⇒ value /= 2
        case _ ⇒ ???
      }
    }
  }
  println(value)
  def reverse(range: Range, k: Int): Int = {
    if (range.contains(k)){
      range.last - (k - range.head)
    }else k
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 255260
#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define foreach(i, vec) for(auto &&i : vec)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x) cerr << #x << ": " << (x) << endl
using namespace std;
typedef long long LL;
typedef long long int64;
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
typedef std::vector<LL> VL;
typedef std::vector<VL> VVL;
typedef std::vector<string> VS;
typedef std::pair<int, int> PII;
typedef std::pair<int64, int64> PLL;
typedef std::queue<int> QI;
typedef std::priority_queue<int> PQI;
template<class T,class U>inline bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>inline bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>inline void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}

const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;
// M_PI 3.1415...

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cill(n);
    LL ans = 0;
    REP(i, 1, n+1){
        if(to_string(i).length() % 2 == 1)
            ans++;
    }
    co(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int r, c, k;
int grid[3005][3005];
int dp[3005][3005][4]; //row col left
int32_t main() {

    fast
    cin >> r >> c >> k;
    int x, y, value;

    for(int i = 0; i < k; i++) {
        cin >> x >> y >> value;
        grid[x][y] = value;
    }
    for(int i = 1; i <= r; i++) {
        for(int j = 1; j <= c; j++) {
            for(int k=0;k<=3;k++){
                dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k]);
                dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+grid[i][j]);
                dp[i][j][2]=max(dp[i][j][2],dp[i-1][j][k]+grid[i][j]);
                dp[i][j][3]=max(dp[i][j][3],dp[i-1][j][k]+grid[i][j]);

                if(k>0){
                    dp[i][j][k]=max({dp[i][j][k],dp[i][j-1][k-1]+grid[i][j],dp[i-1][j][k],dp[i][j-1][k]});
                }
            }
        }
    }

    int ans=0;
    for(int i=0;i<4;i++)ans=max(ans,dp[r][c][i]);
    cout << ans<< endl;




    return 0;
}



Measured memory_bytes: 355728
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, n, s) for (int i = s; i < n; i++)
using namespace std;
const double PI = acos(-1);
int main()
{
    int n;
    cin>>n;
    map<string,int>card;
    string key;
    string num;
    rep(i,n){
        cin>>key>>num;
        card[key+" "+num]=1;
    }
    string types[4]{"S","H","C","D"};
    for(auto t:types){
        reps(i,14,1){
            string q=t+" "+to_string(i);
            if(!card.count(q)){
                cout<<q<<endl;
            }
        }
    }
   // system("pause");
    return 0;
}


Measured memory_bytes: 3288
import java.util.*;

/**
 * A
 */
public class Main {

    void run() {
        
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[] array = new int[n];

        for(int i=0; i<n; i++) {
            array[i] = sc.nextInt();
        }

        sc.close();

        int cnt = partition(array, 0, n-1);

        System.out.print(array[0]);

        for(int i=1; i<n; i++) {

            if( i == cnt) {
                System.out.print(" ["+array[i]+"]");
            } else {
                System.out.print(" "+array[i]);
            }

            if(i == n-1) {
                System.out.println();
            }
        }

    }

    int partition(int[] A, int p, int r) {

        int x = A[r];
        int i = p-1;
        int tmp;

        for(int j=p; j<r; j++) {
            
            if(A[j]<=x) {
                i = i+1;
                tmp = A[i];
                A[i] = A[j];
                A[j] = tmp;
            }

        }

        tmp = A[i+1];
        A[i+1] = A[r];
        A[r] = tmp;

        return i+1;
        
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


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

int int_cmp(const int *a, const int *b){
	if(*a<*b) return 1;
	else if(*a<*b) return -1;
	return 0;
}

int main(void){
	while(1){
		int n, m, i;
		int p[1000];
		long ans=0;
	
		scanf(" %d %d", &n, &m);
		if(n==0) break;
		
		for(i=0; i<n; i++) scanf(" %d", &p[i]);
		qsort(p, n, sizeof(int), (int(*)(const void*, const void*))int_cmp);
		
		for(i=0; i<n; i++)
			if((i+1)%m!=0) ans+=p[i];
			
		printf("%ld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 652
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = Long.parseLong(sc.next());
        }

        // 主処理
        long[] array = new long[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += a[i];
            array[i] = sum;
        }

        long[] diff = new long[n - 1];
        for (int i = 0; i < n - 1; i++) {
            diff[i] = Math.abs(array[i] - (array[n - 1] - array[i]));
        }
        long result = Arrays.stream(diff).min().getAsLong();

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 62448
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();

		if (b == 0) {
			System.out.println(1);
			sc.close();
			return;
		}

		System.out.println(b / x - (a == 0 ? -1 : ((a - 1) / x)));

		sc.close();
	}
}



Measured memory_bytes: 23764
#include <iostream>

using namespace std;

int main(){
    int N, X;
    cin >> N >> X;
    int m[N];
    for(int i=0; i < N; i++){
        cin >> m[i];
    }

    int count=0, sum;

    for(int i=0; i < N; i++){
        sum += m[i];
    }
    X -= sum;
    count += N;

    int min = 100001;
    for(int i=0; i < N; i++){
        if(min > m[i]) min = m[i];
    }

    int plus;
    plus = X/min;

    cout << count + plus << endl;

    
}

Measured memory_bytes: 256
using System;
using static System.Console;



class Program
{
    enum Mode { Init, Vertical, Horizontal };
    
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	string s1 = ReadLine();
	string s2 = ReadLine();

	long ans = 1, M = 1000000007;

	Mode m = Mode.Init;
	int i = 0;
	while (i < n)
	{
	    if (s1[i] == s2[i]) // Vertical
	    {
		switch(m)
		{
		    case Mode.Init:
			ans = ans * 3 % M; break;
		    case Mode.Vertical:
			ans = ans * 2 % M; break;
		    case Mode.Horizontal:
			ans = ans * 1; break;
		}
		m = Mode.Vertical;
		i++;
	    }
	    else // Horizontal
	    {
		switch(m)
		{
		    case Mode.Init:
			ans = ans * 6 % M; break;
		    case Mode.Vertical:
			ans = ans * 2 % M; break;
		    case Mode.Horizontal:
			ans = ans * 3 % M; break;
		}
		m = Mode.Horizontal;
		i += 2;
	    }
	}
	
	WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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){return c-'0';}

// TODO: write
int main() {
  int d,t,s;cin>>d>>t>>s;
  if(t*s>=d)print("Yes");
  else print("No");
  return 0;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
#include <random>
#include <cassert>
#include <sstream>
using namespace std;
#define F first
#define S second
#define pb push_back
#define MP make_pair
#define ALL(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ln(i, n) " \n"[i == n]
typedef long long LL;
typedef long double LDB;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
//////////////////////
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const LL  INFF = (LL)1e15;
const int mod = 998244353;
const int MXN = (int)1e6 + 7;
int main(){
	LL k, a, b; cin >> k >> a >> b;
	LL ans = 0;
	if (k <= a) ans = 1 + a;
	else {
		k -= (a - 1);
		ans = a;
		if (b >= a + 2) {
			ans += (b - a) * (k / 2);
			k %= 2;
			if (k) ans++;
		} else {
			ans += k;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int x, y, tmp;
  while(1){
    scanf("%d%d",&x, &y);
    if(x == 0 && y == 0){
      break;
    }else if(x > y){
     tmp = x; x = y; y = tmp;
    }
    printf("%d %d\n",x,y);
  }
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#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++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;
ll inf = pow(2,62);
int main()
{
    ll x;cin >> x;
    if(x >= 30){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long

int main(void)
{
    ll n,m; cin>>n>>m;
    ll sum=0;
    rep(i,m){
        ll a; cin>>a;
        sum+=a;
    }
    if(sum<=n) cout<<n-sum<<endl;
    else cout<<"-1"<<endl;
    return 0;
} 

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    string s;
    while (n > 0)
    {
        if (n == 1)
        {
            s.push_back('a');
        }
        else
        {
            n--;
            s.push_back('a' + n % 26);
        }

        n /= 26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;
typedef long long ll;
using Graph =vector<int>;
typedef pair<int,int> P;
int ans;
int main(){
  int dp[110][10100];
  //dp[i][w] i個メまでで価値vの最大
  //ans=sigma_w(dp[N][w])
  int N,W;cin>>N>>W;
  rep(i,N+1){
    rep(j,W+1) dp[i][j]=0;
  }
  rep(i,N){
    int v,w;cin>>v>>w;
    for(int j=1;j<=W;++j){
      dp[i+1][j]=dp[i][j];
      if (j-w<0) continue;
      dp[i+1][j]=max(dp[i+1][j],dp[i][j-w]+v);
    }
  }
  rep(i,W+1) ans=max(dp[N][i],ans);
  cout<<ans<<endl;
}



Measured memory_bytes: 7100
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int a,b;
	cin >> a >> b;
	for (int i =0 ; i <10000; i++) {
		if (int (i * 0.08) == a && int (i * 0.1) == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
write = sys.stdout.write

from collections import deque
class HopcroftKarp:
    def __init__(self, N0, N1):
        self.N0 = N0
        self.N1 = N1
        self.N = N = 2+N0+N1
        self.G = [[] for i in range(N)]
        for i in range(N0):
            forward = [2+i, 1, None]
            forward[2] = backward = [0, 0, forward]
            self.G[0].append(forward)
            self.G[2+i].append(backward)
        self.backwards = bs = []
        for i in range(N1):
            forward = [1, 1, None]
            forward[2] = backward = [2+N0+i, 0, forward]
            bs.append(backward)
            self.G[2+N0+i].append(forward)
            self.G[1].append(backward)

    def add_edge(self, fr, to):
        #assert 0 <= fr < self.N0
        #assert 0 <= to < self.N1
        v0 = 2 + fr
        v1 = 2 + self.N0 + to
        forward = [v1, 1, None]
        forward[2] = backward = [v0, 0, forward]
        self.G[v0].append(forward)
        self.G[v1].append(backward)

    def bfs(self):
        G = self.G
        level = [None]*self.N
        deq = deque([0])
        level[0] = 0
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        self.level = level
        return level[1] is not None

    def dfs(self, v, t):
        if v == t:
            return 1
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w] and self.dfs(w, t):
                e[1] = 0
                rev[1] = 1
                return 1
        return 0

    def flow(self):
        flow = 0
        G = self.G
        bfs = self.bfs; dfs = self.dfs
        while bfs():
            *self.it, = map(iter, G)
            while dfs(0, 1):
                flow += 1
        return flow

    def matching(self):
        return [cap for _, cap, _ in self.backwards]

def solve():
    N, M, L = map(int, readline().split())
    if N == 0:
        return False
    INF = 10**9
    E = [[INF]*N for i in range(N)]
    for i in range(M):
        u, v, d = map(int, readline().split())
        E[u][v] = E[v][u] = d
    for i in range(N):
        E[i][i] = 0
    for k in range(N):
        for i in range(N):
            Ei = E[i]
            for j in range(N):
                Ei[j] = min(Ei[j], Ei[k] + E[k][j])
    g = HopcroftKarp(L, L)

    P = [list(map(int, readline().split())) for i in range(L)]
    P.sort(key = lambda x: x[1])
    for i in range(L):
        pi, ti = P[i]
        for j in range(i+1, L):
            pj, tj = P[j]
            if ti + E[pi][pj] <= tj:
                g.add_edge(i, j)
    write("%d\n" % (L - g.flow()))
    return True
while solve():
    ...


Measured memory_bytes: 141328
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>

using namespace std;

namespace mod {

template <class T, int M>
class MInt;

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);

template <class T, int M>
class MInt {
  T n_;

 public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}

  MInt &operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }

  MInt &operator/=(const MInt &rhs) { return (*this) *= Inv(rhs); }

  T Get() { return n_; }
};

template <class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}

template <class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}

template <class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}

template <class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }

  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }

  return a;
}

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}  // namespace mod

const int md = 1e9 + 7;
using MInt = mod::MInt<long long, md>;
using ll = long long;

// Sのi番目以降，Tのj番目以降から作れる共通する部分列の数
int solve(vector<int> &vs, vector<int> &vt, ll i, ll j,
          vector<vector<int>> &memo) {
  if (i == vs.size() || j == vt.size()) {
    return 1;
  }

  if (memo[i][j] < 0) {
    MInt ans1 = solve(vs, vt, i + 1, j, memo);
    MInt ans2 = solve(vs, vt, i, j + 1, memo);
    MInt ans3 = solve(vs, vt, i + 1, j + 1, memo);

    MInt ans(0);
    if (vs[i] == vt[j]) {
      ans += ans3;
    }

    ans += ans1 + ans2;

    ans -= ans3;
    memo[i][j] = ans.Get();
  }

  return memo[i][j];
}

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<int> vs(n), vt(m);
  for (int i = 0; i < n; ++i) {
    cin >> vs[i];
  }

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

  vector<vector<int>> memo(n + 1, vector<int>(m + 1, -1));
  cout << solve(vs, vt, 0, 0, memo) << '\n';
}

Measured memory_bytes: 16384
#include <iostream>

int main()
{
    std::string s;
    std::cin >> s;

    int month_1 = (s[0] - '0') * 10 + s[1] - '0';
    int month_2 = (s[2] - '0') * 10 + s[3] - '0';

    if (month_1 < 1 || month_1 > 12) {
        if (month_2 < 1 || month_2 > 12) {
            std::cout << "NA" << std::endl;
            return 0;
        }

        std::cout << "YYMM" << std::endl;
        return 0;
    }

    if (month_2 < 1 || month_2 > 12) {
        std::cout << "MMYY" << std::endl;
        return 0;
    }

    std::cout << "AMBIGUOUS" << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#define maxn 55
using namespace std;
typedef long long ll;

inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = getchar();c < '0' || c > '9';c = getchar()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return res * sig;
}
int n,par[maxn],x[maxn],y[maxn],ans;
void ini(int n){
  for(int i = 1;i <= n;i++){
    par[i] = i;
  }
}
int fin(int u){
  return par[u] == u ? par[u] : par[u] = fin(par[u]);
}
void uni(int u,int v){
  u = fin(u), v = fin(v);
  if(u ^ v) par[u] = v;
}
int check(int p,int q){
  ini(n);
  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= n;j++){
      if(x[i] + p == x[j] && y[i] + q == y[j]) uni(i,j);
    }
  }
  int res = 0;
  for(int i = 1;i <= n;i++) res += (par[i] == i);
  return res;
}
int main(){
  ans = n = getint();
  for(int i = 1;i <= n;i++) x[i] = getint(), y[i] = getint();
  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= n;j++){
      ans = min(ans,check(x[j] - x[i],y[j] - y[i]));
    }
  }
  printf("%d\n",ans);
  return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> A(n, vector<int>(m));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      cin >> A.at(i).at(j);
    }
  }
  vector<int> B(m);
  for(int i = 0; i < m; i++){
    cin >> B.at(i);
  }
  vector<int> C(n, 0);
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      C.at(i) += A.at(i).at(j) * B.at(j);
    }
  }
  for(int i = 0; i < n; i++) cout << C.at(i) << endl;
}



Measured memory_bytes: 3216
/*
AtCoder Beginner Contest 176 - E - Bomber
https://atcoder.jp/contests/abc176/tasks/abc176_e
*/

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

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

double EPS=1e-9; 
int INF=1000000005; 
long long INFF=1000000000000000005ll; 
double PI=acos(-1); 
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 }; 
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define OUT(x) cout << x << endl 
#define OUTH(x) cout << x << " " 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a)) 
#define EACH(a, b) for (auto&(a) : (b)) 
#define REP(i, n) FOR(i, 0, n) 
#define REPN(i, n) FORN(i, 1, n) 
#define MAX(a, b) a=max(a, b) 
#define MIN(a, b) a=min(a, b) 
#define SQR(x) ((ll)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define TC(t) while (t--) 
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)

int main()  
{ 
    FAST_INP;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt","w", stdout);
    #endif
    
    ll H,W,M,mxR,mxC,cnt=0,cntR=0,cntC=0,ans=0;
    cin >> H >> W >> M;
    vi row(H, 0), col(W, 0), h(M), w(M);
    REP(i,M){
        cin >> h[i] >> w[i];
        --h[i], --w[i];
        // store the frequency of row and col
        row[h[i]]++, col[w[i]]++;
    }
    // find the max frequency of row and col
    mxR=*max_element(ALL(row)), mxC=*max_element(ALL(col));
    // count how many elements have such frequency for row and col
    cntR=count(ALL(row),mxR), cntC=count(ALL(col),mxC);
    // number of intersections
    cnt=cntR*cntC;
    // add mxR and mxC to ans 
    ans=mxR+mxC;
    // as stated in the question, it is possible to place the bomb at a square with a target
    // which means ans may not be the final answer as we need to substract 1 if a bomb is located in the intersection of mxR and mxC
    REP(i,M){
        if(row[h[i]]+col[w[i]]==ans){
            cnt--;
        }
    }
    OUT(ans-(cnt==0));
    return 0; 
} 

// o b o
// x o x 

Measured memory_bytes: 7924
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
char ch[100010];
int n,x,pos,cnt=0;
int lian[100010],head[100010];
struct node{
	int to,nxt,cap;
}e[200010];
void add(int u,int v){
	e[++cnt].to=v;e[cnt].nxt=head[u];head[u]=cnt;
}
int main(){
	scanf("%s",ch+1);
	n=strlen(ch+1);
	int i,j;
	for(i=1;i<=n;++i)  lian[i]=ch[i]-48;
	if(lian[n]!=0 || lian[1]==0){printf("-1\n");return 0;}
	for(i=1;i<=n;++i){
		if(lian[i]^lian[n-i]){printf("-1\n");return 0;}
	}
	x=(n+1)/2;pos=x+1;
	for(i=pos+1;i<=n;++i)  add(pos,i);
	for(i=x;i>=1;--i){
		add(pos,i);
		if(lian[i])  pos=i;
	}
	for(j=1;j<=n;++j){
		for(i=head[j];i;i=e[i].nxt){
			printf("%d %d\n",j,e[i].to);
		}
	}
	return 0;
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  int n,l;
  cin >> n;
  
  int saidai = 0,goukei = 0;
  
  for ( int i = 0; i < n; i++){
    cin >> l;
    goukei += l;
    if ( saidai < l ){
      saidai = l;
    }
  }
  
  if ( saidai < goukei - saidai ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N,M;
int n[100000],isRed[100000];

int main(void){
    cin>>N>>M;
    fill(n,n+N,1);
    isRed[0]=1;
    REP(i,M){
        int x,y;
        cin>>x>>y;
        x--;y--;
        n[x]--;n[y]++;
        if(isRed[x])
            isRed[y]=1;
        if(n[x]==0)
            isRed[x]=0;
    }
    int ans=0;
    REP(i,N)
        if(isRed[i])
            ans++;
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>

#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())

using namespace std;
using ll = int64_t;

constexpr int N = 200;
constexpr int X = 1e5;
constexpr int MOD = 1e9 + 7;

int ways[N + 1][X + 1];
bool ready[N + 1][X + 1];

int n, x;
vector<int> s;

int rec(int i, int m) {
  if (i == n)
    return m;
  if (ready[i][m])
    return ways[i][m];
  ll ans = rec(i + 1, m % s[i]);
  ans += ll(n - i - 1) * rec(i + 1, m);
  ans %= MOD;

  ways[i][m] = ans;
  ready[i][m] = true;
  return ans;
}

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

  cin >> n >> x;
  s.resize(n);
  for (int& i : s)
    cin >> i;
  sort(all(s));
  reverse(all(s));

  int ans = rec(0, x);
  cout << ans << endl;


  return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define mod 1000000007

int main()
{

    ll w,a,b;
    cin >> w >> a >> b;
    ll l1=a, l2=b, r1=a+w,r2=b+w;
    if((l2 >= l1 && l2 <= r1) || (r2 >= l1 && r2 <= r1)) cout << 0;
    else
    {

        if(r2 < l1) cout << abs(l1-r2);
        else cout << abs(l2-r1);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(int32_t argc, char const *argv[])
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int low = 1, high = a[n - 1], ans = a[n - 1];
	while (low <= high)
	{
		int mid = (low + high) / 2;
		int x = 0;
		for (int i = 0; i < n; ++i)
		{
			int prts = a[i] / mid;
			if (a[i] % mid)
				prts ++;
			x += prts - 1;
		}
		
		if (x <= k)
		{
			ans = mid;
			high = mid - 1;
		}
		else
			low = mid + 1;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 4716
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,cnt,a[202020],now[202020];
vector<int>ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=n;i>=1;i--)
	{
		if(i>(n/2+n%2))
		{
			if(a[i]==1)
			{
				ans.push_back(i);
				for(int j=1;j<=sqrt(i);j++)
				{
					if(i%j==0)
					{
						now[j]++;
						if((j*j)!=i)
						{
							now[i/j]++;
						}
					}
				}
			}
		}
		else
		{
			if((now[i]%2)!=a[i])
			{
				ans.push_back(i);
				for(int j=1;j<=sqrt(i);j++)
				{
					if(i%j==0)
					{
						now[j]++;
						if((j*j)!=i)
						{
							now[i/j]++;
						}
					}
				}
			}
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i]<<' ';
	}
	cout<<endl;
	return 0;
}

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

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

    int ans = (n - 2) * 180;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N,R,ans;
    cin >> N >> R;

    if(N >= 10)
        cout << R << endl;
    else{
        ans = 100 * (10 - N) + R;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    int a,b; cin >> a >> b;
    cout << (a+b==15 ? '+' : (a*b==15 ? '*' : 'x')) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){ int sz = a.size();
for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////
int n,m,q,ans;
int a[55],b[55],c[55],d[55];

int arr[11];

void calc(){
	int cur = 0;
	rep(i,q){
		if(arr[b[i]] - arr[a[i]] == c[i])cur += d[i];
	}
	chmax(ans,cur);
}

void dfs(int i = -1,int x = 1){
	if(i >= 0)arr[i] = x;
	if(i == n-1){
		calc();
		return;
	}else{
		for(int next = x;next <= m;next++){
			dfs(i + 1,next);	
		}
	}	
}

int main(int argc, char const *argv[])
{
	ioboost();

	cin >> n >> m >> q;
	rep(i,q){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--,b[i]--;
	}

	dfs();

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 3664
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VB vector<bool>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVL vector<VL>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

lint gcd(lint x, lint y){
    lint r = x % y;
    while(r != 0){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

int main(){
    int t;
    cin >> t;
    rep(i, t){
        lint a, b, c, d;
        cin >> a >> b >> c >> d;
        bool ans = (a >= b && d >= b);
        if(ans){
            lint tmp = gcd(b, d);
            if(b - tmp + (a % tmp) > c){
                ans = false;
            }
        }
        if(ans){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
s = input()
S = len(s)

for i in range(S-1) :
    if s[i] == s[i+1] :
        print(i+1, i+2)
        break
    elif i + 2 < S and s[i] == s[i+2] :
        print(i+1, i+3)
        break
else :
    print(-1, -1)

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

int main(){
  int log,sum=0,minnum=10;
  vector<int> time(5);
  for(int i=0;i<5;i++){
    cin>>time[i];
    if(time[i]%10==0){
      sum+=time[i];
      time[i]=0;
    }else{
      int a=time[i]%10;
      if(a<minnum){
        minnum=a;
        log=i;
      }
    }
  }for(int i=0;i<5;i++){
    if(i==log){
      sum+=time[i];
    }else{
      if(time[i]==0) continue;
      sum+=time[i]+(10-time[i]%10);
    }
  }
  cout<<sum<<endl;
}

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

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<ll> h(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> h[i];
  }

  sort(h.begin(), h.end());
  ll ans = 1e9 + 7;
  for (ll i = 0; i < N - K + 1; i++)
  {
    ans = min(ans, abs(h[i] - h[i + K - 1]));
  }
  cout << ans << endl;
}


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

using namespace std;

//#define MD 10

int main(){
    long long int a,b,c;
    cin>>a>>b>>c;
    long long int k;
    cin>>k;
    for(long long int i=0;i<k;i++){
        long long int tmp=max(max(a,b),c);
        if(tmp==a){
            a*=2;
        }else if(tmp==b){
            b*=2;
        }else if(tmp==c){
            c*=2;
        }
    }
    long long int ans=a+b+c;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N1, M1, N2, M2;
  cin >> N1 >> M1 >> N2 >> M2;

  if (N1 + 1 == N2){
    cout << 1 <<endl; 
  }
    else{
      cout << 0 <<endl;
    }
  
}

Measured memory_bytes: 256