akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

template<class T>
void outvo(vector<T> v) {
  cout << v[0];
  for (int i = 1; i < v.size(); i++)
    cout << " " << v[i];
  cout << endl;
}

void solve() {
  int n, k, s; cin >> n >> k >> s;
  vector<int> res;
  for (int i = 0; i < k; i++) res.push_back(s);

  const int MAX = 1000000000;
  int a = s < MAX ? MAX : 1;
  for (int i = 0; i < n - k; i++) res.push_back(a);

  outvo(res);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 2296
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int H, W;
	std::vector<std::string> C;
	std::cin >> H >> W;
	C.resize(H);
	for (auto& c : C)
		std::cin >> c;
	
	for (int i = 0; i < H; ++i) {
		std::cout << C[i] << "\n" << C[i] << "\n";
	}
}


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

int main(){

  int i,A[3];

  for(i=0;i<3;i++) cin >> A[i];
  sort(A,A+3);

  cout << A[0] << " " << A[1] << " " << A[2] << endl;
  return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

template<int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

const int mod = 1e9 + 7;
using modint = ModInt< mod >;

modint dp[1010][1010];
int main(){
    int h, w;
    cin >> h >> w;
    char a[1010][1010];
    rep(i, h)rep(j, w) cin >> a[i][j];

    dp[0][0] = 1;
    rep(i, h){
        rep(j, w){
            if(i+1 < h && a[i+1][j] == '.') dp[i+1][j] += dp[i][j];
            if(j+1 < w && a[i][j+1] == '.') dp[i][j+1] += dp[i][j];
        }
    }

    // rep(i,h){
    //     rep(j,w) cout << dp[i][j] << " "; cout << endl;
    // }
    cout << dp[h-1][w-1] << endl;


}


Measured memory_bytes: 5248
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0;i<n;i++) {
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		
		long w = 0, h = 0, num = a[n-1];
		for(int i=n-2;i>=0;i--) {
			if(a[i]==num) {
				if(w==0) {
					w = num;
					if(i-1>=0) {
						num = a[i-1];
						i--;
					}
				}
				else if(h==0)
					h = num;
			}
			else {
				num = a[i];
			}
			
			if(w!=0 && h!=0)
				break;
		}
		
		System.out.println(w*h);
	}
}

Measured memory_bytes: 48344
module ABC138

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public  :: task_B
  private :: calc_solution

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_B

    ! variables for this <subroutine>
    integer :: len_data

    ! arrays for this <subroutine>
    real(REAL64), dimension(:), allocatable :: val_data

    ! STEP.01
    ! read out the given data (length of the given data)
    read(unit=INPUT_UNIT, fmt=*) len_data

    ! STEP.02
    ! allocate the array to store the given data
    allocate( val_data(1:len_data) )

    ! STEP.03
    ! read out given data (value)
    read(unit=INPUT_UNIT, fmt=*) val_data(:)

    ! STEP.04
    ! calculate & output the answer of this task
    write(unit=OUTPUT_UNIT, fmt='(ES23.15e3)', advance='yes') calc_solution( val_data(:) )

    ! STEP.05
    ! deallocate the array to store the given data
    deallocate( val_data )

    ! STEP.END
    return

  end subroutine task_B

  pure function calc_solution (array) result(solution)

    ! arguments for this <function>
    real(REAL64), dimension(:), intent(in) :: array

    ! return value of this <function>
    real(REAL64) :: solution

    ! support variables for this <function>
    integer :: itr

    solution = 0.0_REAL64

    do itr = 1, size(array(:), dim=1), 1
      solution = solution + 1.0_REAL64 / array(itr)
    end do

    solution = 1.0_REAL64 / solution

  end function calc_solution

end module ABC138


program main

  ! <module>s to import
  use, non_intrinsic :: ABC138

  ! require all variables to be explicitly declared
  implicit none

  call task_B

end program main

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * f.cc: F - Xor Shift
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int BN = 30;
const int P = 4073;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int eps[MAX_N];
ll as[MAX_N], bs[MAX_N];
int a0hs[BN], a1hs[BN], bhs[BN];

/* subroutines */

inline int powmod(int a, int b) {
  int p = 1;
  while (b) {
    if (b & 1) p = (ll)p * a % MOD;
    a = (ll)a * a % MOD;
    b >>= 1;
  }
  return p;
}

void calcbhash(int n, ll as[], int hs[], int bit) {
  for (int k = 0; k < BN; k++) {
    hs[k] = 0;
    for (int i = 0; i < n; i++)
      if (((as[i] >> k) & 1) == bit)
	hs[k] = (hs[k] + eps[i]) % MOD;
  }
}

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) scanf("%lld", as + i);
  for (int i = 0; i < n; i++) scanf("%lld", bs + i);

  eps[0] = 1;
  for (int i = 1; i < n; i++) eps[i] = (ll)eps[i - 1] * P % MOD;

  int invp = powmod(P, MOD - 2);

  calcbhash(n, as, a0hs, 1);
  calcbhash(n, as, a1hs, 0);
  calcbhash(n, bs, bhs, 1);

  for (int k = 0; k < n; k++) {
    int m = 0;
    ll x = 0;

    for (ll bm = 1; m < BN; m++, bm <<= 1) {
      if (a1hs[m] == bhs[m]) x |= bm;
      else if (a0hs[m] != bhs[m]) break;
    }

    if (m == BN)
      printf("%d %lld\n", k, x);

    for (int i = 0; i < BN; i++) {
      int abk0 = ((as[k] >> i) & 1), abk1 = abk0 ^ 1;

      a0hs[i] =
	((ll)(a0hs[i] + (MOD - abk0)) % MOD * invp % MOD
	 + abk0 * eps[n - 1]) % MOD;
      a1hs[i] =
	((ll)(a1hs[i] + (MOD - abk1)) % MOD * invp % MOD
	 + abk1 * eps[n - 1]) % MOD;
    }
  }
  return 0;
}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    ll n,m,k;cin>>n>>m>>k;
    rep(i,0,n){
        rep(j,0,m){
            if((n-i)*j+(m-j)*i==k){
                cout<<"Yes";exit(0);
            }
        }
    }
    cout<<"No";
    
    return 0;
}


Measured memory_bytes: 256
module WeightedGraph
  (Vertex : sig
    type t
    val compare : t -> t -> int
  end)
  (Weight : sig
    type t
    val compare : t -> t -> int
  end) :
sig
  val prim :
    (* 頂点のリスト *)
    Vertex.t list ->
    (* 隣接リスト *)
    (Vertex.t -> (Vertex.t * Weight.t) list) ->
    (* 最小全域木に含まれる辺のリスト *)
    (Vertex.t * Vertex.t * Weight.t) list
end =
struct
  module VSet = Set.Make (Vertex)
  module WMap = Map.Make (Weight)
 
  (*
   * プリム法のメインループ
   * es : 隣接リスト
   * vs : 未だ訪れていない頂点の集合
   * q : 訪れた頂点から伸びる辺が重み順に入ったヒープ
   * acc : 最小全域木に使うのが確定した辺を入れるやつ
   *)
  let rec prim_aux es acc vs q =
    match WMap.min_binding q with
    | exception Not_found -> acc
    | (w, []) -> prim_aux es acc vs (WMap.remove w q)
    | (w, (u, v) :: rest) ->
        if not (VSet.mem v vs) then
          (* vは既に訪れていた *)
          prim_aux es acc vs (WMap.add w rest q)
        else
          (* vはまだ訪れていなかった *)
          prim_aux es ((u, v, w) :: acc) (VSet.remove v vs) @@
            (* vから伸びる辺をキューに追加 *)
            List.fold_left (fun q (u, w) ->
              WMap.add w ((v, u) :: try WMap.find w q with Not_found -> []) q) (WMap.add w rest q) (es v)
 
  let prim vs es =
    match vs with
    | [] -> [] (* 念のため *)
    | v :: vs ->
        prim_aux es [] (VSet.of_list vs) @@
          (* 始点から伸びる辺をキューに入れておく *)
          List.fold_left (fun q (u, w) ->
            WMap.add w ((v, u) :: try WMap.find w q with Not_found -> []) q) WMap.empty (es v)
end
 
module Int = struct
  type t = int
  let compare = compare
end
 
module G = WeightedGraph (Int) (Int)
 
let () = Scanf.scanf "%d\n" (fun n ->
  let xys = Array.to_list @@ Array.init n (fun i -> Scanf.scanf "%d %d\n" (fun x y -> x, y, i)) in
  let es = Array.make n [] in
  begin match List.sort (fun (x, _, _) (x', _, _) -> compare x x') xys with
  | [] -> ()
  | (x, y, i) :: rest ->
      ignore @@ List.fold_left (fun (x, y, i) (x', y', j) ->
        es.(i) <- (j, min (abs (x - x')) (abs (y - y'))) :: es.(i);
        es.(j) <- (i, min (abs (x - x')) (abs (y - y'))) :: es.(j);
        (x', y', j)) (x, y, i) rest
  end;
  begin match List.sort (fun (_, y, _) (_, y', _) -> compare y y') xys with
  | [] -> ()
  | (x, y, i) :: rest ->
      ignore @@ List.fold_left (fun (x, y, i) (x', y', j) ->
        es.(i) <- (j, min (abs (x - x')) (abs (y - y'))) :: es.(i);
        es.(j) <- (i, min (abs (x - x')) (abs (y - y'))) :: es.(j);
        (x', y', j)) (x, y, i) rest
  end;
  G.prim (Array.to_list @@ Array.init n (fun i -> i)) (fun i -> es.(i))
  |> List.map (fun (_, _, w) -> w)
  |> List.fold_left ( + ) 0
  |> Printf.printf "%d\n")

Measured memory_bytes: 66172
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

using P = pair<int, int>;

int main() {
	int n = in(), m = in();
	vector<P> s(n);
	for (P &x: s)
		x = {0, in()};
	while (m--) {
		int q = in();
		for (P &x: s)
			if (x.second <= q) {
				x.first++;
				break;
			}
	}
	outl(max_element(s.begin(), s.end()) - s.begin() + 1);
}


Measured memory_bytes: 2480
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		System.out.println(x+y/2);
	}
}


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

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long L, R;
    scan(L, R);
    long ans = long.max;
    foreach (i; L .. min(R + 1, L + 5000))
    {
        foreach (j; i + 1 .. min(R + 1, i + 5000))
        {
            ans = ans.min(i * j % 2019);
        }
    }
    writeln(ans);
}


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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define pli pair<long long,int>
#define pil pair<int,long long>
#define ll long long
#define el '\n'

using namespace std;

ll a, b, c;

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

    cin >> a >> b >> c;
    if (a + b >= c){
        cout << "No" << el;
        return 0;
    }
    c = c - a - b;
    if (c * c > 4 * a * b){
        cout << "Yes" << el;
    } else{
        cout << "No" << el;
    }

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]
INF = 10 ** 18
dist = [INF] * (N + 1)
dist[1] = 0
for _ in range(N):
    for a, b, c in edges:
        dist[b] = min(dist[b], dist[a] - c)

ans = dist[N]
for a, b, c in edges:
    dist[b] = min(dist[b], dist[a] - c)

if ans != dist[N]:
    print('inf')
else:
    print(-ans)

Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a[5] = {}, k, z = 1000;
    for (int i = 0; i < 5; i++) cin >> a[i];
    for (int i = 0; i < 120; i++) {
        int c = 0;
        for (int j = 0; j < 5; j++) {
            c += a[j];
            if (j != 4) while (c % 10) c++;
        }
        z = min(z, c);
        next_permutation(a, a + 5);
    }
    cout << z;
    int T;
    cin >> T;
    for (int U = 1; U <= T; U++) {
        cout << "Case #" << U << ": ";
        
    }
}


Measured memory_bytes: 256
//
//  main.cpp
//  A
//
//  Created by Hashizo on 2019/09/07.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;

#undef LONG_MAX
#undef LONG_MIN

#define LONG_MAX	9223372036854775807
#define LONG_MIN	(-LONG_MAX  -1)

#define ll long long

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

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


	cout << pow(n, 3.0) << endl;
	return 0;
}


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

struct rec {int position; long height;};

int main() {
    int n;
    cin >> n;
    stack<rec> s;
    long max_area = 0;
    rep(i, n+1) {
        long h;
        if (i == n) h = 0;
        else cin >> h;
        if (s.empty()) {
            if (h > 0) s.push({i, h});
        } else {
            if (s.top().height < h) {
                s.push({i, h});
            } else if (s.top().height > h) {
                int left;
                while (not s.empty() && s.top().height >= h) {
                    long area = (i - s.top().position) * s.top().height;
                    max_area = max(max_area, area);
                    left = s.top().position;
                    s.pop();
                }
                if (h > 0) s.push({left, h});
            }
        }
    }
    cout << max_area << endl;
}


Measured memory_bytes: 4660
def main():
    n,m=map(int,input().split())
    inf=10**6
    edges=[[inf]*n for i in range(n)]

    for i in range(m):
        a,b,c=map(int,input().split())
        a-=1
        b-=1
        edges[a][b]=c
    
    
    dp=[[inf]*n for i in range(1<<n)]
    dp[0][0]=0

    for s in range(1<<n):
        for v in range(n):
            for j in range(n):
                if (s>>j)&1 and v!=j and edges[j][v]<10**5:
                    dp[s][v]=min(dp[s][v],dp[s^(1<<j)][j]+edges[j][v])
                    
    if dp[-1][0]>10**5:
        print(-1)
    else:
        print(dp[-1][0])
    
if __name__=='__main__':
    main()


Measured memory_bytes: 19800
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner momoko= new Scanner(System.in);
        int num1 = momoko.nextInt();
        int num2 = momoko.nextInt();

        if(num1>num2)
            System.out.println("a > b");
        else if(num1<num2)
            System.out.println("a < b");
        else
            System.out.println("a == b");
    }
}


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

long double a, b, n;

void solver() {
  cin >> a >> b >> n;

  long double x;
  if (n < b - 1) {
    x = n;
  } else {
    x = b - 1;
  }

  long double ans = floor(a * x / b) - a * floor(x / b);
  cout << ans << "\n";
}

int main() {
  solver();
}


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

int main()
{
  int H, W, N;
  char c;
  int sum[1005][1005][3] = {0};
  cin >> H >> W >> N;
  for(int i = 1; i <= H; i++) {
    for(int j = 1; j <= W; j++) {
      scanf(" %c",&c);
      if(c == 'J') sum[i][j][0]++;
      else if(c == 'O') sum[i][j][1]++;
      else sum[i][j][2]++;
      Rep(k,3) {
	sum[i][j][k] += sum[i - 1][j][k] + sum[i][j - 1][k] - sum[i - 1][j - 1][k];
      }
    }
  }

  int A, B, C, D;
  while(N--) {
    cin >> A >> B >> C >> D;
    Rep(i,3) {
      cout << sum[C][D][i] - sum[A - 1][D][i] - sum[C][B - 1][i] + sum[A - 1][B - 1][i];
      if(i == 2)cout << endl;
      else cout << " ";
    }
  }
  return 0;
}

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

int Plus(int p){
    int sum = 0;
    rep(i, p){
        sum += i+1;
    }
    return sum;
}

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

    vector<int> p(n);
    rep(i, n){
        cin >> p.at(i);
    }

    vector<int> d(n+1);
    d.at(0) = 0;
    rep(i, n){
        d.at(i+1) += d.at(i)+p.at(i);
    }
    
    int p_max = 0, num;
    rep(i, n-k+1){
        if(max(d.at(i+k)-d.at(i), p_max) != p_max){
            p_max = d.at(i+k)-d.at(i);
            num = i;
        }
    }
    
    double ans = 0;
    for(int i = num; i < num+k; i++){
        ans += Plus(p.at(i))/(double)p.at(i);
    }

    printf("%.7lf", ans);
    return 0;
}

Measured memory_bytes: 1792
using System;
class main{
    static void Main(string[] args){
        int n = int.Parse(Console.ReadLine());
        int tpoint = 0;
        int hpoint = 0;
        for (int i = 0; i < n; i++)
        {
            string[] data = Console.ReadLine().Split(' ');
            if (data[0] == data[1])
            {
                tpoint++; hpoint++;
                continue;
            }
            char[] t = data[0].ToCharArray();
            char[] h = data[1].ToCharArray();
            int tlength = t.Length, hlength = h.Length;
            int charcount = tlength > hlength ? hlength:tlength;
            bool winner = tlength > hlength ? true : false;
 
            for (int j = 0 ; j < charcount; j++)
            {
                if (t[j] > h[j])
                {
                    winner = true;
                    break;
                }
                else if (t[j] < h[j])
                {
                    winner = false;
                    break;
                }
            }
 
            if(winner)
            {
                tpoint += 3;
            }else{
                hpoint += 3;
            }
        }
        Console.WriteLine("{0} {1}", tpoint, hpoint);
    }
}

Measured memory_bytes: 5664
//if acyclic graph try toposort
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
template <typename T>void umax(T &a, T b){
    a = max(a, b);
}
template <typename T>void umin(T &a, T b){
    a = min(a, b);
}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}

ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
const ll N = 1e3 + 5;
ll dp[N][N];
void solve(){
    ll n, m;
    cin >> n >> m;
    string s[n];
    fo(i, n){
        cin >> s[i];
    }
    dp[0][0] = 1;
    fo(i, n){
        fo(j, m){
            if(s[i][j] == '#')continue;
            if(i)dp[i][j] += dp[i - 1][j];
            if(j)dp[i][j] += dp[i][j - 1];
            dp[i][j]%=MOD;
        }
    }
    cout << dp[n - 1][m - 1]%MOD;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    while(TC--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 12672
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var nums = ReadInts();
        var k = nums[0];
        var s = nums[1];

        var res = Enumerable.Range(0, k + 1).Select(z =>
        Math.Max(k - Math.Abs(s - z - k) + 1, 0)
        ).Sum();


        Console.WriteLine(res);
    }


    #region Utils
    static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    #endregion
}



Measured memory_bytes: 13396
n = gets.chomp.to_i

def hantei(n)
  result = 'No'
  [1,2,3,4,5,6,7,8,9].each do |i|
    result = 'Yes' if ((n / i) < 10 && (n % i) == 0)
  end
  result
end

puts hantei(n)


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

using namespace std;

typedef long long ll;

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

	int s, w;
	cin >> s >> w;

	if(w >= s){
		cout << "unsafe" << endl;
	}else{
		cout << "safe" << endl;
	}

}


Measured memory_bytes: 3584
<?php

fscanf(STDIN, '%d %d %d', $n, $m, $l);

for ($i = 0; $i < ($n + $m); $i++) {
    if ($i < $n) {
        $A[] = explode(' ', trim(fgets(STDIN)));
    } else {
        $B[] = explode(' ', trim(fgets(STDIN)));
    }
}

for ($i = 0; $i < $n; $i++) {
    for ($j = 0; $j < $l; $j++) {
        $C[$i][$j] = 0;
        for ($k = 0; $k < $m; $k++) {
            $C[$i][$j] += $A[$i][$k] * $B[$k][$j];
        }
    }
    $result[] = implode(' ', $C[$i]);
}

echo implode(PHP_EOL, $result), PHP_EOL;

Measured memory_bytes: 11876
import bisect

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

asum = [0]
for i in range(len(a)):
	if asum[i]+a[i]<=k:
		asum.append(asum[i]+a[i])
	else:
		break

bsum = [0]
for i in range(len(b)):
	if bsum[i]+b[i]<=k:
		bsum.append(bsum[i]+b[i])
	else:
		break

ans = 0
for i in range(len(asum)):
	kb = k-asum[i]
	while len(bsum)>0 and bsum[-1]>kb:
		bsum.pop()
	ans = max(ans, len(bsum)+i-1)

print(ans)
	

Measured memory_bytes: 40492
#include <stdio.h>
#include <algorithm>
using namespace std;

int score[250];
int player[250][3];
int player_num;

int hantei(int a, int b){
	for (int c = 0; c < player_num; c++){
		if (b != c){
			if (player[c][a] == player[b][a]) return 0;
		}
		if (c == player_num - 1) return player[b][a];
	}
}

int main(){
	scanf("%d", &player_num);
	int flag = 0;

	// ??\???
	for (int a = 0; a < player_num; a++){
		for (int b = 0; b < 3; b++){
			scanf("%d", &player[a][b]);
		}
	}

	// ??????
	for (int a = 0; a < 3; a++){
		for (int b = 0; b < player_num; b++){
			score[b] += hantei(a, b);
		}
	}

	for (int a = 0; a < player_num; a++){
		printf("%d\n", score[a]);
	}
	return 0;
}

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

int main() {
    ll n;
    std::cin >> n;
    map<ll,ll> e;
    ll m = n;
    for (int i = 2; i <= sqrt(m); i++) {
        while(m%i==0){
            m/=i;
            e[i]++;
        }
    }
    if(m!=1){
        e[m]++;
    }
    ll cnt = 0;
    for (auto ee : e) {
        ll now = 1;
        while(ee.second>=now){
            ee.second-=now;
            now++;
            cnt++;
        }
    }
    std::cout << cnt << std::endl;
}


Measured memory_bytes: 3724
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int k = sc.nextInt();
		// スペース区切りの整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		// 出力

		boolean boo = false;
		for(int i =a; i<=b; i++){
			if(i % k == 0){
				boo = true;
			}
		}

		if(boo == true){
			System.out.println("OK");
		}
		else{
			System.out.println("NG");
		}

	}
}

Measured memory_bytes: 35776
#include<stdio.h>
int main(void)
{
	int n,a,x,b,y,sum=0,sum1=0;
	scanf("%d %d %d %d %d",&n,&a,&x,&b,&y);
	if(n%a==0){
		sum+=(n/a)*x;
	}
	else{
		sum+=((n/a)+1)*x;
	}
	if(n%b==0){
		sum1+=(n/b)*y;
	}
	else{
		sum1+=((n/b)+1)*y;
	
	}
	if(sum>sum1){
		printf("%d\n",sum1);
	}
	else{
		printf("%d\n",sum);
	}
	return 0;
}


Measured memory_bytes: 2752
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] a = new int[N];
		for( int i=0; i<N; i++ ){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		long ans = 0;      
		if( N%2==1 ){
			if( N==1 && a[0]==0 ){
				ans = 1;              
            }           
			for( int i=1; i<N; i+=2 ){
				if( a[i]!=a[i+1] && a[i]!=i+1 ){
					ans = 0;		
					break;
				}      
				if( i==N-2 && a[0]==0 ){
					ans = 2;
					for( int j=0; j<N/2-1; j++ ){
						ans = (2*ans)%1000000007L;
					}             
				}
			}  
		}
		if( N%2==0 ){
			for( int i=0; i<N; i+=2 ){
				if( !( a[i]==a[i+1] && a[i]==i+1 ) ){
					ans = 0;
					break;
				}
				if( i==N-2 ){
					ans = 2;
					for( int j=0; j<N/2-1; j++ ){
						ans = (2*ans)%1000000007L;
					}                 
				}
			}
		}  
		System.out.println(ans);
	}
}


Measured memory_bytes: 50400
#include <vector>
using namespace std;

class UnionFind
{
public:
    vector<int> parent;
    vector<int> sz;
    
    UnionFind(int n): parent(n), sz(n)
    {
        for(int i=0;i<n;i++)
        {
            parent[i] = i;
            sz[i] = 1;
        }
    }

    int root(int x)
    {
        return parent[x]==x ? x : parent[x] = root(parent[x]);
    }

    bool same(int x, int y)
    {
        return root(x)==root(y);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (sz[x] < sz[y])
            {
                parent[x] = y;
                sz[y] += sz[x];
            }
            else
            {
                parent[y] = x;
                sz[x] += sz[y];
            }
        }
    }

    int size(int x)
    {
        return sz[root(x)];
    }
};

#include <iostream>
#include <set>

int main()
{
    int N;
    cin>>N;
    vector<int> x(N), y(N);
    for (int i=0; i<N; i++)
    {
        cin>>x[i]>>y[i];
        x[i]--;
        y[i]--;
    }

    vector<vector<int>> vx(100000), vy(100000);
    for (int i=0; i<N; i++)
        vx[x[i]].push_back(i),
        vy[y[i]].push_back(i);

    UnionFind U(N);
    for (int i=0; i<100000; i++)
    {
        for (int v: vx[i])
            U.unite(vx[i][0], v);
        for (int v: vy[i])
            U.unite(vy[i][0], v);
    }

    vector<vector<int>> G(N);
    for (int i=0; i<N; i++)
        G[U.root(i)].push_back(i);

    long long ans = 0;
    for (int i=0; i<N; i++)
    {
        set<int> sx, sy;
        for (int g: G[i])
            sx.insert(x[g]),
            sy.insert(y[g]);
        ans += sx.size()*sy.size() - G[i].size();
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 17144
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli a;
	string s;
	cin>>a;
	cin>>s;

	if(a>=3200)cout<<s<<endl;
	else cout<<"red"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

struct E {
  int to;
  int cost;
};

vector<E> g[101010];
int c[101010];

void dfs(int v, int f, int cc) {
  c[v] = cc;
  for(auto e: g[v]) {
    if(e.to == f) continue;
    dfs(e.to, v, cc ^ e.cost);
  }
}

int main() {
  int n;
  cin >> n;
  for(int i = 0;i < n - 1;i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    g[a].push_back({b, c & 1});
    g[b].push_back({a, c & 1});
  }
  dfs(0, -1, 0);
  for(int i = 0;i < n;i++) {
    cout << c[i] << endl;
  }
}


Measured memory_bytes: 8448
# 整数列 A1,A2,...,AN が与えられます。 
# この整数列のどの 2 つの要素も互いに異なるならば YES を、そうでないなら NO を出力してください。

n = gets.to_i
a = gets.chomp.split
n.times do |i|
    a[i] = a[i].to_i
end

a.sort!

result = true
(n - 1).times do |i|
    if a[i] == a[i + 1]
        result = false
        break
    end
end

puts result ? "YES" : "NO"

Measured memory_bytes: 18560
def del_double(lst):
    bef = -1
    ret =[]
    for i in lst:
        if bef != i:
            ret.append(i)
            bef=i
    return ret

def f(lst):
    m_ = max(lst)
    idx = lst.index(m_)
    l_idx = idx-1
    if l_idx >=0:
        l = lst[l_idx]
    else:
        l = -1
    
    r_idx = idx+1
    if r_idx < len(lst):
        r = lst[r_idx]
    else:
        r =-1
        
    #print(idx,l_idx,r_idx,"l,r=",l,r,lst)
    # time.sleep(0.5)
    if r==-1 and l ==-1:
        return m_ 
    else:
        if r>l:
            lst[idx] = r
            #print("\t",m_ - r,m_,r)
            return m_ - r + f(del_double(lst))
        else:
            lst[idx] = l
            #print("\t",m_ - l,m_,l)
            return m_ - l + f(del_double(lst))
N = int(input())  
H = list(map(int,input().split()))

print (f(del_double(H)))

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

int main (int argc, char **argv) {
  int *a;
  int n;

  // data in
  cin >> n;
  a = new int[n];
  for (int i=0; i<n; i++) {
    cin >> a[i];
  }

  // find min/max/sum
  int min = 1000001;
  int max = -1000001;
  long sum = 0;
  for (int i=0; i<n; i++) {
    if (a[i] < min) min = a[i];
    if (a[i] > max) max = a[i];
    sum += a[i];
  }
  
  cout << min << " " << max << " " << sum << endl;
  delete [] a;
}

Measured memory_bytes: 1236
// ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
// ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
// ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
// ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
// ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
// ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
// ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
// █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
// █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
// ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
// ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
// ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
// ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
// █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
// ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
// ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
// ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
// ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
//#include "grader.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define For(i, a, b) for (int i = a; i < b; ++i)
#define Out(i, a, b) for (int i = a - 1; i >= b; --i)
#define pb push_back
#define x first
#define y second
#define files(FileName) read(FileName); write(FileName)
#define read(FileName) freopen((FileName + ".in").c_str(), "r", stdin)
#define write(FileName) freopen((FileName + ".out").c_str(), "w", stdout)
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }

using namespace std;

const string FILENAME = "input";
const int MAXN = 1e6;

typedef long long base;
typedef pair <base, base> point;

int n, cnt = 1;
int lst, tp = 0;

int main() {
	ios::sync_with_stdio(0);
	//read(FILENAME);
	cin >> n;
	cin >> lst;
	for (int i = 1; i < n; ++i) {
		//cout << tp << ' ' << lst << ' ' << cnt << endl;
		int a;
		cin >> a;
		if (tp == 0) {
			if (lst != a) {
				if (lst < a) {
					tp = 1;
				} else {
					tp = -1;
				}
			}
		} else {
			if (!((tp > 0 && lst <= a) || (tp < 0 && lst >= a))) {
				tp = 0, ++cnt;
			}
		}
		lst = a;
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
#define int long long
using namespace std;
const int N=300007;
int n,A[N],T[N];
bool ok(int t,int l,int r) {
	int n=r-l+1,h=A[l]*n-(T[l]-T[r+1]);
	return t>=h;
}
int cal(int t,int l,int r) {
	int n=r-l+1,h=A[l]*n-(T[l]-T[r+1]);
	if(!n) return 1000000000; 
	return A[l]+(t-h)/n;
}
signed main() {
	scanf("%lld",&n);
	For(i,1,n) {
		int x;
		scanf("%lld",&x);
		++A[x];
	}
	sort(A+1,A+1+n,greater<int>());
	Dor(i,n,1) T[i]=T[i+1]+A[i];
	For(i,1,n) {
		int l=1,r=i;
		while(l<=r) {
			int mi=(l+r)>>1;
			if(ok(T[i+1],mi,i)) r=mi-1;
			else l=mi+1;
		}
		printf("%lld\n",min(n/i,cal(T[i+1],l,i)));
	}
	return 0;
}

Measured memory_bytes: 5504
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include    <bits/stdc++.h>
#include    <ext/pb_ds/assoc_container.hpp>
#include    <ext/pb_ds/tree_policy.hpp>
using       namespace            std;
using       namespace            __gnu_pbds;
using       ll=                  int64_t ;
using       ull=                 unsigned long long ;
using       ld=                  long double;
#define     int                  int64_t
#define     mem(a,val)           memset( a,  val,  sizeof(a) )
#define     b_s                  binary_search
#define     u_b                  upper_bound
#define     l_b                  lower_bound
#define     nl                   cout<<endl
#define     pb                   push_back
#define     pf                   push_front
#define     ppb                  pop_back
#define     ppf                  pop_front
#define     in                   insert
#define     fi                   first
#define     se                   second
#define     pqueue               priority_queue
#define     rr                   return
typedef     tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;


/*#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;*/

const int   N=                   1e6+7;
const int   MOD=                 (int)1e9 + 7;
const int   MOD1=                (int)1e9 + 9;
const int   MOD2=                998244353;
const ld    pi=                  atan2(0, -1);
const ld    eps=                 1e-9;
int         tests=               1;

template<class x,class y>x max(x a,y b){return (a>b)?a:b;}
template<class x,class y>x min(x a,y b){return (a<b)?a:b;}
template<class x,class y>x log(x n,y r){return (n>r-1)?1+log(n/r,r):0;}

vector<int> adj[N],subset;
int vis[N]={0};
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.


int32_t main() 
{
	auto start = clock();
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);	

//	cout<<fixed;
//	cout<<scientific;
	cout<<fixed<<setprecision(1);
	// cin>>tests;
	for(int test=1;test<=tests;test++) 
	{
//		cout<<"Case #"<<test<<": ";
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.

		ld a,b;
		cin>>a>>b;
		cout<<(int)(a*b);
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
		
	}
	cerr<<endl<<endl<<endl<< "Time : " << double(clock() - start) / CLOCKS_PER_SEC <<endl;
	return 0;
}


Measured memory_bytes: 27252
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int a,b,d;
void update(P &ans,P p) {
    if(ans.fr+ans.sc > p.fr+p.sc) {
        ans=p;
        return;
    }
    if(ans.fr+ans.sc==p.fr+p.sc) {
        if(ans.fr*a+ans.sc*b > p.fr*a+p.sc*b)
           ans=p; 
    }
}
void solve() {
    P ans(INF,INF);
    int g = __gcd(__gcd(a,d),__gcd(b,d));
    a /= g;
    b /= g;
    d /= g;
    //cout<<a<<", "<<b<<", "<<d<<endl;

    rep(x, 50000) {
        int t=(a*x-d);
        if(t<0) continue;
        //if(x < 10) printf("%d %d\n",x, t);
        if(t%b==0) {
            update(ans,P(x,t/b));
        }
    }

    rep(y, 50000) {
        int t=b*y-d;
        if(t<0) continue;
        //if(y < 10) printf("%d %d\n",y,t);
        if(t%a==0) {
            update(ans,P(t/a,y));
        }
    }
    rep(x, 50000) {
        int t=(d-a*x);
        if(t<0) continue;
        //if(x < 10) printf("%d %d\n",x, t);
        if(t%b==0) {
            update(ans,P(x,t/b));
        }
    }
    cout<<ans.fr<<" "<<ans.sc<<endl;


}
int main() {
    while(cin>>a>>b>>d) {
        if(a==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1160