akhauriyash/Code-Regression huggingface dataset:
using static System.Console;

namespace AOJ
{
    public class ALDS1_1_B
    {
        public static void Main(string[] args)
        {
            string[] input = ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            WriteLine(GreatestCommonDivisor(a,b));
        }

        /// <summary>
        /// The prerequisite: x > 0 , y > 0 
        /// Output: 0 ~ Min(x, y)
        /// </summary>
        public static int GreatestCommonDivisor(int x, int y)
        {
            if (x <= 1 || y <= 1) return 0;
            
            int divisor= x > y ? y : x;

            for (int i = divisor; i > 0; i--)
            {
                if (x % i == 0 && y % i == 0)
                {
                    return i;
                }
            }

            return 1;
        }
    }
}


Measured memory_bytes: 15952
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{
// ユークリッドの互除法により |a| と |b| の最大公約数を求める。
// (a == 0)なら b, (b == 0)なら a を返す。
i64 GCD(i64 a, i64 b)
{
    a = abs(a); b = abs(b);
    if (a > b) swap(a, b);
    while(b > 0) {
        i64 r = a % b;
        a = b;
        b = r;
    }
    return a;
}
// |a| と |b| の最小公倍数を求める。
i64 LCM(i64 a, i64 b)
{
    return abs(a) / GCD(a,b) * abs(b);
}
// }}}

i64 f(i64 n, i64 c, i64 d)
{
    return n - (n/c) - (n/d) + (n / LCM(c,d));
}

signed main()
{
    i64 a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << f(b,c,d) - f(a-1,c,d) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc=new Scanner(System.in);
        char x=sc.next().charAt(0);
        char y=sc.next().charAt(0);
         if(x>y)System.out.println(">");
         else if(x<y)System.out.println("<");
         else System.out.println("=");
        
	
	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a[n];
    vector<ll> b;
    rep(i,0,n-1){
        cin>>a[i];
        b.pb(a[i]);
    }
    sort(b.begin(),b.end(),greater<ll>());
    ll m1=-1,m2=-1;
    vector<ll> v;
    ll c;
    bool bb;
    rep(i,0,n-2){
        c=1;
        bb=true;
        while(bb){
            if(i<=n-2){
                if(b[i]==b[i+1]){
                    c++;
                    i++;
                }else{
                    bb=false;
                }
            }else{
                bb=false;
            }
        }
        v.pb(c);
    }
    ll cc=-1;
    rep(i,0,v.size()-1){
        cc+=v[i];
        //cout<<v[i]<<' '<<cc<<' '<<b[cc]<<endl;
        if(v[i]>=2){
            if(m1==-1){
                if(v[i]>=4){
                    m1=b[cc];
                    m2=b[cc];
                    break;
                }else{
                    m1=b[cc];
                }
            }else{
                m2=b[cc];
                break;
            }
        }
    }
    if(m1>=0 && m2>=0){
        cout<<m1*m2<<endl;
    }else{
        cout<<0<<endl;
    }
    
    return 0;
}







Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;

const long long MOD = 1000000007;

void solve(long long N, long long K, std::vector<long long> A){
  vector<long long> count(2001, 0);
  vector<long long> cumcount(2001, 0);
  vector<long long> ivn(N, 0);
  long long ans = 0;

  for (int i = 0; i < N; i++) {
    count[A[i]]++;
    for (int j = i+1; j < N; j++) {
      if (A[i] > A[j]) {
        ivn[i]++;
      }
    }
  }

  cumcount[0] = count[0];
  for (int i = 1; i < 2001; i++) {
    cumcount[i] = cumcount[i-1] + count[i];
  }

  for (int i = 0; i < N; i++) {
    ans += ivn[i] * K % MOD;
    ans %= MOD;
  }

  long long t;
  t = ((K * (K-1)) / 2) % MOD;
  for (int i = 0; i < N; i++) {
    ans += t * cumcount[A[i]-1] % MOD;
    ans %= MOD;
  }
  std::cout << ans << std::endl;

}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> A(N-1-0+1);
  for(int i = 0 ; i < N-1-0+1 ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in); 
		
		int a = in.nextInt(); 
		int b = in.nextInt(); 
		
		System.out.println(gcd(a, b)); 
		
		

	}

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

}


Measured memory_bytes: 26324
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   


    ll n , m;
    cin >> n >> m;

    ll sum=0;

    for(ll i=0;i<m;i++) {
        ll x;
        cin >> x;
        sum+=x;
    }

    if(sum > n) {
        cout << "-1";
    }
    else {
        cout << n - sum;
    }
    
    return 0;
}

Measured memory_bytes: 3624
var
  i,j,c,f:longint;
  s:string;
begin
  c:=101;
  f:=0;
  readln(s);
  for i:=1 to length(s) do
  begin
    j:=length(s) - i;
    if s[j]='C' then c:=j;
    if s[i]='F' then f:=i;
  end;
  if c<f then write('Yes') else write('No');
end.

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;
using pii=pair<int,int>;


vector<int> Dijkstra(vector<vector<pii>> adj_list,int start){/*adj_listはs番目に「「tとsからtへの距離dのpair」を並べたベクトル」が入っているベクトル */
  int n=adj_list.size();
  /*初期化*/
  vector<int> distance(n,INF);
  vector<int> pre(n);
  distance.at(start)=0;
  priority_queue<pii,vector<pii>,greater<pii>> unsettled;/*未確定の頂点*/
  REP(u,n){
    unsettled.push(make_pair(distance.at(u),u));
  }

  /*本計算*/
  while(!unsettled.empty()){
    int u;
    tie(ignore,u)=unsettled.top();
    unsettled.pop();/*uを確定*/
    /*uから伸びている辺の先へ書き込み*/

    for(auto vpair : adj_list.at(u)){
      int weight_u_to_v,v;
      tie(v,weight_u_to_v)=vpair;
      int alt=distance.at(u)+weight_u_to_v;
      /*更新*/
      if(distance.at(v)>alt){
        distance.at(v)=alt;
        pre.at(v)=u;
        unsettled.push(make_pair(alt,v));

      }
    }

  }
  return pre;

}

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<pair<int,int>>> adj_list(n);
    vector<vector<bool>> is_unused(n,vector<bool>(n,false));/*(i,j)を結ぶ辺が使われたかどうか判定*/
    REP(i,m){
        int s,t,d;
        cin>>s>>t>>d;
        s--;
        t--;
        adj_list.at(s).push_back(make_pair(t,d));
        adj_list.at(t).push_back(make_pair(s,d));
        is_unused.at(s).at(t)=true;/*辺が存在*/
        is_unused.at(t).at(s)=true;
    }
    
    

    REP(i,n){
        REP(j,n){
            if(i<j){
                vector<int> pre;
                pre=Dijkstra(adj_list,i);
                is_unused.at(pre.at(j)).at(j)=false;
                is_unused.at(j).at(pre.at(j))=false;
            }
        }
    }
    int ans=0;
    REP(i,n){
        REP(j,n){
            if(i<j&&is_unused.at(i).at(j)){
                ans++;

            }
        }
    }
    cout<<ans<<endl;

}
  

Measured memory_bytes: 3228
s = str(input()).upper()
if 4 == len(s):
    if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
        print('Yes')
    elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
        print('Yes')
    elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
        print('Yes')
    else:
        print('No')
else:
    print('Please input type length 4')

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

const int MAX = 100000;
int main() {
	int K;
	int64_t A[MAX];
	cin >> K;
	for (int i = 0;i < K;i ++)cin >> A[i];
	
	int64_t mi = 2, ma = 2;
	for (int i = K - 1;i >= 0;i --) {
		mi += (A[i] - mi % A[i]) % A[i];
		ma += A[i] - (ma + A[i]) % A[i] - 1;
		if (mi > ma) {
			cout << -1;
			return 0;
		}
	}
	cout << mi << " " << ma;
	return 0;
}
/*
ある試合ではN人がAiグループを作ると残るのはN-N%Aiであることを利用する
まず、データ数の有効範囲を考えて逆から考える
つまり、最終試合から考えていく
最後は二人なので、Akは必ず2である それ以外なら-1でおｋ
よってkの試合前は2~3人である
このように考えると、ある試合のグループの指定がAi人で、試合後の人数が最小x,最大y人の時、
試合前の最小はx+(Ai-x%Ai)%Aiであり、最大はy+Ai-(y+Ai)%Ai-1である
また、可能人数が離散的になることはあり得ない
何故ならば試合前人数がa~b人の時、a<=c<=bを満たすcはa/Ai<=c/Ai]<=b/Ai (mod Ai)も満たすから。
*/

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define INF (1<<25)
int N;
double dp[2][21][21];
double X[20] , Y[20];
bool g[20][20][20];
double dist[20][20];

double PI = asin(0.5)*6;
double EPS = 1e-7;
int main(){
	cin >> N;
	double r , theta;
	cin >> r >> theta;
	
	theta *= PI / 180;
	rep(i,N) cin >> X[i] >> Y[i];
	rep(i,N){
		rep(j,N){
			int x1 = X[j] - X[i];
			int y1 = Y[j] - Y[i];
			dist[i][j] = sqrt(x1*x1+y1*y1);
		}
	}
	rep(i,N){
		rep(j,N){
			if( i != j ){
				rep(k,N){
					if(j != k && i != k ){
						long long x1 = X[j] - X[i];
						long long y1 = Y[j] - Y[i];
						long long x2 = X[k] - X[j];
						long long y2 = Y[k] - Y[j];
						double t = acos( 1.0 * (x1*x2 + y1*y2) / ( sqrt(x1*x1+y1*y1) * sqrt(x2*x2+y2*y2) ) );
						//cout << i << "-" << j << "-" << k << " : " << " (" << x1 << "," << y1 << ")  " << " (" << x2 << "," << y2 << ")  " << t/PI*180 << " " << endl;
						if(y1*x2 == x1*y2){
								double A =  x1 / sqrt(x1*x1+y1*y1) , B = y1 / sqrt(x1*x1+y1*y1);
								double C =  x2 / sqrt(x2*x2+y2*y2) , D = y2 / sqrt(x2*x2+y2*y2);
								//cout << A << " " << B << " {} " << C << " " << D << endl;
								if( fabs(A-C) < EPS && fabs(B-D) < EPS)g[i][j][k] = true ;//, cout << i << "-" << j << "-" << k << endl;
						}else if(t < theta){
							
							g[i][j][k] = true;
						}
					}
				}
			}
		}
	}
	/*
	rep(i,N){
		rep(j,N){
			rep(k,N){
				if(g[i][j][k])cout << i << "-" << j << "-" << k << " : " << g[i][j][k] << " " << endl;
			}
		}
		cout << endl;
	}*/
	rep(i,2)rep(j,N)rep(k,N) dp[i][j][k] = INF;
	rep(i,N) if( i != 0 ) dp[0][0][i] = dist[0][i];

	int c = 0;
	for(int i = 0 ; ; i++){
		//cout << "[" << i << "]" << endl;
		//rep(j,N)rep(k,N) if(dp[c][j][k] != INF) cout << j << "-" << k << " : " << dp[c][j][k] << endl;;
		rep(j,N)rep(k,N) if(dp[c][j][k] < r + EPS){ goto allowed; }
		// end 
		cout << i << endl;
		return 0;
		
		allowed:;
		
		rep(j,N)rep(k,N) dp[!c][j][k] = INF;
		rep(j,N){
			rep(k,N){
				if(dp[c][j][k] != INF){
					rep(l,N){
						if(g[j][k][l]){
							dp[!c][k][l] = min( dp[c][j][k]+dist[k][l] , dp[!c][k][l] );
						}
					}
				}
			}
		}
		c ^= 1;
	}
	
	
	
}

Measured memory_bytes: 964
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

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

void solve() {
    int n;
    cin >> n;
    cout << (n-1) / 2 << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
if (N-1)*(N-2)//2 < K:
    print(-1)
    exit()
M = (N-1) + ((N-1)*(N-2)//2-K)
c = 0
print(M)
#Start from tree with depth = 1
for i in range(2,N+1):
    print(1,i)
    c += 1
    if c >= M:
        exit()
for i in range(2,N):
    for j in range(i+1,N+1):
        print(i,j)
        c += 1
        if c >= M:
            exit()




Measured memory_bytes: 3608
import java.util.Arrays;
import java.util.Scanner;


public class Main {

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

		int N = sc.nextInt();
		int K = sc.nextInt();

		int[] B = new int[N+1];

		for(int i = 1 ; i <= N ; i++){
			int tmp = sc.nextInt();
			B[tmp]++;
		}
		sc.close();
		int count = 0;
		for(int i = 1 ; i <= N ; i++){
			if(B[i] != 0){
				count++;
			}
		}
		Arrays.sort(B);
/*
		for(int i = 1 ; i <= N ; i++){
			System.out.println(B[i]);
		}
*/
		int[] C = new int[count+1];

		for(int i = count ; i >= 1 ; i--){
			C[i] =B[i + (N-count)];
			//System.out.println(C[i]);
		}
		/*
		for(int i = 1 ; i <= count ; i++){
			System.out.println(C[i]);
		}
	*/

		if(count <= K){
			System.out.println("0");
		}
		else{
			int ans = 0;
			for(int i = 1 ; i <= count-K ; i++){
				ans += C[i];
			}
			System.out.println(ans);
		}



	}
}

Measured memory_bytes: 81176
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
      int N = scanner.nextInt();
       
      ArrayList <Integer> a = new ArrayList <Integer>();
 int n[] = new int[N];
      for(int i=0; i<N; i++){
         n[i] =scanner.nextInt();
      	 a.add(n[i]);
      }
  
      Collections.sort(a);
  
  	  for(int i=0; i<N; i++){
         int max = a.get(a.size()-1);
         int max2 = a.get(a.size()-2);
        if(max==n[i]){
        System.out.println(max2);
        }
        else{
        System.out.println(max);
        }
      }
}
}

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

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

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

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

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

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

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

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

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

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

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

#[allow(dead_code)]
fn chmin<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x > y && {
        *x = y;
        true
    }
}

#[allow(dead_code)]
fn chmax<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x < y && {
        *x = y;
        true
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input!(q: usize, lr: [(usize, usize); q]);

    let lim = 1e5 as usize + 1;
    let mut vs = vec![0; lim + 1];
    for i in 0..lim {
        if i % 2 == 0 {
            continue;
        }
        let a = (i + 1) / 2;
        if is_prime(i as i64) && is_prime(a as i64) {
            vs[i] = 1;
        }
    }
    for i in 0..lim {
        vs[i + 1] += vs[i];
    }

    for &(l, r) in lr.iter() {
        let ans = vs[r] - vs[l - 1];
        println!("{}", ans);
    }
}

pub fn is_prime(n: i64) -> bool {
    if n <= 1 {
        return false;
    }
    for prime in 2.. {
        if prime * prime > n {
            break;
        }
        if n % prime == 0 {
            return false;
        }
    }
    return true;
}


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

int main()
{
	string a[2];
	cin >> a[0] >> a[1];

	if (a[0][0] == a[1][2] && a[0][1] == a[1][1] && a[0][2] == a[1][0]) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a >= b)
            for (int i = 0; i < a; i++)
                System.out.print(b);
        else
            for (int i = 0; i < b; i++)
                System.out.print(a);

    }
}


Measured memory_bytes: 21844
#!/usr/bin/env python3

K, A, B = map(int, input().split())

tataku = A - 1
if (A > B) or (A >= K) or (A + 1 == B): #  or (tataku + 1 >= K):
    print(K+1)
else:
    c = B
    nokori = K - tataku - 2
    if nokori % 2 == 1:
        c += (B-A) * (nokori//2) + 1
    else:
        c += (B-A) * (nokori//2)

    print(c)



Measured memory_bytes: 3060
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int ans = 0;
    rep(i, n){
        ans += a[i] - 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	// AtCoder Beginner Contest 007
	// https://atcoder.jp/contests/abc007/tasks
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int light = h * w;
		char[][] room = new char[h][w];
		int[][] dirs = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
		Queue<Point> q = new LinkedList<>();
		int res = 0;
		
		for (int i = 0; i < h; i++) {
			String str = sc.next();
			for (int j = 0; j < str.length(); j++) {
				char c = str.charAt(j);
				room[i][j] = c;
				if (c == '#') {
					light--;
					q.offer(new Point(i, j));
				}
			}
		}
		
		while (!q.isEmpty()) {
			int size = q.size();
			res++;
			
			for (int i = 0; i < size; i++) {
				Point p = q.poll();
				for (int[] dir: dirs) {
					int dx = p.x + dir[0];
					int dy = p.y + dir[1];
					if ((0 <= dx) && (dx < h) && (0 <= dy) && (dy < w)) {
						if (room[dx][dy] != '#') {
							room[dx][dy] = '#';
							light--;
							q.offer(new Point(dx, dy));
						}
					}
				}
			}
		}
		
		System.out.println(res-1);
	}
	
	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine()); 
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try{ 
                str = br.readLine(); 
            } catch (IOException e) { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}

class Point {
	int x;
	int y;
	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
}

Measured memory_bytes: 90856
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try{
	    while(true){
		int n = Integer.valueOf(sc.readLine());
		if(n==0)
		    break;
		int[][] dp = new int[n][n];
		int max = 0;
		for(int j=0; j<n; j++){
		    String sp = sc.readLine();
		    for(int i=0; i<n; i++)
			if(sp.charAt(i)=='*')
			    dp[j][i] = 0;
			else
			    if(j==0||i==0)
				dp[j][i]=1;
			    else{
				dp[j][i]= Math.min(Math.min(dp[j][i-1], dp[j-1][i]), dp[j-1][i-1])+1;
				max = Math.max(max, dp[j][i]);
			    }
		}
		System.out.println(max);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 15000
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,y,mul,cnt=0,ans;
    cin>>x>>y;
    if(x%y==0)
    {
        cout<<"-1\n";
        return 0;
    }
    for(int i=1;; i++)
    {
        if(x%y!=0)
        {
            cout<<x*i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

n = ni()
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

lis = make_divisors(n)
ans = 0
for i in lis:
    if i - 1 == 0:
        continue
    if i - 1 > n // (i - 1):
        ans += i - 1
print(ans)


Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll M, K;
    cin >> M >> K;

    if (M == 0) {
        if (K == 0) {
            cout << "0 0\n";
        } else {
            cout << "-1\n";
        }
        return 0;
    } else if (M == 1) {
        if (K == 0) {
            cout << "0 0 1 1\n";
        } else {
            cout << "-1\n";
        }
        return 0;
    }

    if (K >= 1<<M) {
        cout << "-1\n";
        return 0;
    }

    vec ans;
    Rep (i, 1<<M) {
        if (i == K) continue;
        ans.push_back(i);
    }
    ans.push_back(K);
    for (ll i = (1<<M) - 1; i >= 0; i--) {
        if (i == K) continue;
        ans.push_back(i);
    }
    ans.push_back(K);

    Rep (i, 1<<(M+1)) {
        cout << ans[i] << " \n"[i==(1<<(M+1))-1];
    }
}

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

int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if (a+b==c || a+c==b || b+c==a) {
    printf("Yes\n");
  }
  else {
    printf("No\n");
  }
}


Measured memory_bytes: 256
import math

while True:
    n = int(input())
    if 0 == n:
        break

    ss  = list(map(int, input().split()))
    ave = sum(ss[:]) / n

    sig = 0
    for s in ss:
        sig += (s - ave)**2
    sig = math.sqrt(sig/n)

    print(sig)



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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

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

  vi a(n - 1), b(n - 1), c(n - 1);
  for (ll i = 0; i < n - 1; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i] -= 1;
    b[i] -= 1;
  }

  ll q, k;
  cin >> q >> k;
  k -= 1;

  vi x(q), y(q);
  for (ll i = 0; i < q; i++) {
    cin >> x[i] >> y[i];
    x[i] -= 1;
    y[i] -= 1;
  }

  vector<vpii> g(n);
  for (ll i = 0; i < n - 1; i++) {
    g[a[i]].push_back(make_pair(b[i], c[i]));
    g[b[i]].push_back(make_pair(a[i], c[i]));
  }

  vi dist(n, (1ll << 32));
  queue<ll> qu;
  unordered_set<ll> visited;
  qu.push(k);
  visited.insert(k);
  dist[k] = 0;
  while(qu.size()) {
    ll fr = qu.front();
    qu.pop();
    for (pii i: g[fr]) {
      ll to = i.first;
      ll cost = i.second;
      if (visited.find(to) == visited.end()) {
        qu.push(to);
        visited.insert(to);
        dist[to] = dist[fr] + cost;
      }
    }
  }

  for (ll i = 0; i < q; i++) {
    cout << dist[x[i]] + dist[y[i]] << endl;
  }
}

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

int main() {
    int n, x, i, j, k, cnt = 0, total = 0;
    while (1) {
        cin >> n >> x;
        if (n == 0 && x == 0) {
            break;
        }

        for (i = 1; i <= n; i++) {
            for (j = 1; j <= n && j != i; j++) {
                for (k = 1; k <= n && k != i && k != j; k++) {
                    total = i + j + k;
                    if (total > x) {
                        break;
                    }

                    if (total == x) {
                        cnt++;
                    }
                }
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
    return 0;
}


Measured memory_bytes: 3076
n = int(input())
h = list(map(int, input().split()))
dp = [float('inf')] * (n + 10)
dp[0] = 0
def chmin(a, b):
    if a < b:
        return a
    else:
        return b

for i in range(n):
    if i == 0:
        dp[i + 1] = dp[i] + abs(h[i + 1] - h[i])
    if i < n - 2:
        dp[i + 2] = chmin(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]))

print(dp[n - 1])

Measured memory_bytes: 13928
n,k,q = map(int,input().split())

a = [int(input()) for _ in range(q)]
dict = {i:k for i in range(1,n+1)}

for i in range(len(a)):
  dict[a[i]] += 1

for i in range(1,n+1):
  if dict[i]-q > 0:
    print('Yes')
  else:
    print('No')


Measured memory_bytes: 19088
import math
N,D=map(int,input().split())
cord=[list(map(int,input().split())) for i in range(N)]
ans=0
for i in range(N-1):
    for j in range(i+1,N):
        distance=math.sqrt(sum((cord[i][s]-cord[j][s])**2 for s in range(D)))
        if distance-int(distance)<=0.0001:
            ans+=1

print(ans)

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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;

int main(){
  ll N,A,B,L,ans;
  cin>>N;
  cin>>A>>B;
  L=A+B;
  ans = A*(N/L)+min(A,N%L);

  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0010
public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int num = 0;
		int[] hist = new int[101];
		fill(hist, 0);
		while (sc.hasNextInt()) {
			hist[sc.nextInt()]++;
		}
		
		C[] cs = new C[100];
		for (int i = 1; i <= 100; i++) 
			cs[i - 1] = new C(i, hist[i]);
		
		sort(cs);
		System.out.println(cs[99].k);
		for (int i = 98; i >= 0 && cs[i].v == cs[99].v; i--) System.out.println(cs[i].k);
	}
}

class C implements Comparable<C> {
	int k, v;
	C (int k, int v) {
		this.k = k;
		this.v = v;
	}
	
	public int compareTo(C c) {
		if (this.v == c.v) {
			return c.k - this.k;
		} else {
			return this.v - c.v;			
		}

	}
}

Measured memory_bytes: 12000
# -*- coding: utf-8 -*-
import numpy as np

n, k = map(int, input().split())

if n > k:
    tmp = n % k
    if tmp >= k - tmp:
        ans = k - tmp
    else:
        ans = tmp
elif n < k:
    if n >= k - n:
        ans = k - n
    else:
        ans = n
else:
    ans = 0

print(ans)

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

int main()
{
	ll N, P, sum = 0, tmp = 0;
	cin >> N >> P;
	vector<pii> wb(N);
	for (int i = 0; i < N; i++) {
		cin >> wb[i].first >> wb[i].second;
		sum += wb[i].second;
	}
	sort(wb.begin(), wb.end(), [&](const pii& l, const pii& r) {
		return (l.first * 100 - (l.first - l.second) * P) > (r.first * 100 - (r.first - r.second) * P);
	});
	for (int i = 0; i < N; i++) {
		sum += wb[i].first - wb[i].second;
		tmp += wb[i].first;
		if (tmp * 100 >= sum * P) {
			cout << i + 1 << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var l = cin.nextInt();

            var san = l / 3.0;
                                 
            Console.WriteLine(Math.Pow(san,3));
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define end "\n"
#define inp(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define soa(arr,n) sort(arr,arr+n)
#define sov(arr) sort(arr.begin(),arr.end())
#define fr(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (b == 0){
        *x = 1, *y = 0;
        return a;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b, a%b , &x1, &y1);
    *x = y1;
    *y = x1-(a/b)*y1;
    return gcd;
}
ll modInverse(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}
int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t=1;
    while(t--){
        int n,k;
        cin>>n>>k;
        int arr[n]; inp(arr,n);
        ll l=0,h=1000000000;
        ll ans=-1;
        while(l+1<h){
            ll v1=(l+h)/2;
            ll v2=v1+1;
            ll c1=0,c2=0;
            fr(i,0,n-1){
                c1+=arr[i]/v1;
                c2+=arr[i]/v2;
                if(arr[i]%v1==0) c1--;
                if(arr[i]%v2==0) c2--;
            }
            if(c1>k && c2<=k){
                ans=v2;
                break;
            }
            else if(c1<=k) h=v1;
            else l=v2;
        }
        if(ans==-1) cout<<h<<end;
        else cout<<ans<<end;
    }
    return 0;
}

Measured memory_bytes: 4380
import collections as c

n = int(input())

a = list(map(int,input().split()))

x = c.Counter(a)

cnt = {}

for k,v in x.items():
    cnt[k] = v*(v-1)//2
    
s = sum(cnt.values())
    
mcnt = {}

for k,v in x.items():
    mcnt[k] = cnt[k]-(v-2)*(v-1)//2
    
for i in a:
    print(s-mcnt[i])

Measured memory_bytes: 39656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
#define PI 3.14159
#define Mod 998244353
#define pi acos(-1)


int main()
{
    string st;
    cin >> st;
    int n = st.size();
    string testr = st;
    if(n % 2 == 0)
    {
        cout << "No" << endl;
        return 0;
    }
    //reverse(testr.begin(), testr.end());

    string one = "";
    int j = n-1;
    for(int i = 0; i < (n-1)/2; i++)
    {
        if(st[i] != st[j])
        {
            cout << "No" << endl;
            return 0;
        }
        j--;
    }
    for(int i = 0; i < (n-1)/2; i++)
    {
        one += st[i];
    }
    string two = "";
    for(int j = ((n-1)/2)+1; j < n; j++)
    {
        two += st[j];
    }
    //cout << one << " " << two << endl;
    int nn = one.size();
    j = nn-1;
    for(int i = 0; i < nn; i++)
    {
        if(i > j)
        {
            break;
        }
        if(one[i] != one[j])
        {
            cout << "No" << endl;
            return 0;
        }
        j--;
    }
    j = nn-1;
     for(int i = 0; i < nn; i++)
    {
        if(i > j)
        {
            break;
        }
        if(two[i] != two[j])
        {
            cout << "No" << endl;
            return 0;
        }
        j--;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;  
using namespace std;

typedef long long ll;

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
os;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

const int N = 55;

int g[N][N];
int dp[N][N][2];
int n, m;

int get(int x, int y) {
  return x == 0 and y == 1;
}

int go(int x, int y, int last) {
  if(x == n - 1 and y == m - 1) {
    return get(last, g[x][y]);
  }
  if(dp[x][y][last] != -1) return dp[x][y][last];
  int gettis = get(last, g[x][y]);
  int cur = 1e9;
  if(x + 1 < n) cur = min(cur, gettis + go(x + 1, y, g[x][y]));
  if(y + 1 < m) cur = min(cur, gettis + go(x, y + 1, g[x][y]));
  return dp[x][y][last] = cur;
}

int main() {
  int n; cin >> n;
  vector <pair <int, int>> red(n), blue(n);
  vector <int> used(n, 0);
  for(int i = 0; i < n; i++) {
    cin >> red[i].second >> red[i].first;
  }
  sort(red.rbegin(), red.rend());
  for(int i = 0; i < n; i++) {
    cin >> blue[i].first >> blue[i].second;
  }
  sort(blue.begin(), blue.end());
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int x = red[i].first;
    int y = red[i].second;
    for(int j = 0; j < n; j++) {
      int p = blue[j].first;
      int q = blue[j].second;
      if(y >= p or x >= q or used[j]) continue;
      used[j] = 1;
      ans++;
      break;
    }
  }
  print(ans);
}

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

int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i=0; i<N; i++) cin >> L[i];
    
    //累積和
    vector<int> s(N+1, 0);
    for(int i=0; i<N; ++i) s[i+1] = s[i] + L[i];

    int ans = 0;
    for(int i=0; i<N+1; i++){
        if(s[i] > X) break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
struct node
{
    int x,y;
}a[100005];
bool cmp(node p1,node p2)
{
    return p1.x<p2.x;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+1+n,cmp);
    long long ans=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i].y>=m)
        {
            ans+=(long long)m*a[i].x;
            a[i].y-=m;
            m=0;
        }
        else
        {
            ans+=(long long)a[i].x*a[i].y;
            m-=a[i].y;
        }
        if(m==0) break;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
N,M = map(int,input().split())
S = list(input())
#print(S)
S.reverse()

if S[0] == 1 or S[-1] == 1:
    det = -1
else:
    det = 0
    count = 0
    data = []
    for i in range(N+1):
        if S[i] == "0":
            data.append(count+1)
            count = 0
        else:
            count += 1
        if count == M:
            det = -1
            break
    #print(data)
    
if det != -1:
    ans = []
    count = 0
    for i in range(1,len(data)):
        if count + data[i] > M:
            ans.append(count)
            count = data[i]
        else:
            count += data[i]
    ans.append(count)
    ans.reverse()
    print(" ".join(map(str,ans)))

else:
    print(-1)

Measured memory_bytes: 11944
s = int(input())

def f(n):
    if (n % 2) != 0:
        return 3*n + 1
    else:
        return n // 2

numbers = [s]
old_num = s
while True:
    new_num = f(old_num)
    old_num = new_num
    if new_num in numbers:
        numbers.append(new_num)
        break
    numbers.append(new_num)

min_m = max(numbers)
for n in range(len(numbers)):
    for m in range(n+1, len(numbers)):
        if numbers[m] == numbers[n]:
            min_m = min(min_m, m)

#print(numbers)
print(min_m+1)

Measured memory_bytes: 3064
r = input()
s = [i for i in r]
cnt = 0
if len(s)>=2:
    for i in range(1,len(s)):
        if s[i] == s[i-1]:
            cnt += 1
            s[i] = '1'
            if s[i] == s[i-1]:
                s[i] = '0'
    print(cnt)
else:
    print(0)

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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int h , w , n;
	cin >> h >> w >> n;
	int m = max(h,w);
	int ans = (n + m - 1 ) / m; 
	cout << ans << endl;

	
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int N, K;

    void input() {
        cin >> N >> K;

    }

    double kaku(int s) {
        int cnt = 0;
        while (s < K) {
            s <<= 1;
            cnt++;
        }
        double ret = 1.0 * pow(0.5, cnt);
        return ret;
    }

    void solve() {
        input();
        double ans = 0.0;
        for (int i = 1; i <= N; ++i) {
            double tmp = kaku(i);
            ans += tmp;
        }

        ans /= N;
        cout << ans << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;
const long double pi = 3.14159265;
const long long mod =1e9+7;


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

    return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long ll;
using namespace std;
int n;
int main(void){
    int n;
    string s;cin>>n>>s;
    int dp[n+1][n+1];//sの
    rep(i,n+1){
        rep(j,n+1){
            dp[i][j]=0;
        }
    }
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            int ni=i+1,nj=j+1;
            if(s[i]==s[j]){
                dp[ni][nj]=dp[i][j]+1;
            }else{
                dp[ni][nj]=0;
            }
        }
    }
    int res=0;
    rep(i,n+1){
        rep(j,n+1){
            if(i==j)continue;
            if(i-dp[i][j]<j)continue;
            res=max(res,dp[i][j]);
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 97920
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int,int>
#define pl pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
struct edge {ll to,cost;};
ll V,E,r,s,t,d;
ll dist[500050],dist2[500050];
vector<edge> G[500050];

void dijkstra(ll s){
    priority_queue<pl, vector<pl>, greater<pl> > que;
    fill(dist,dist+V,MM);
    dist[s] = 0;
    que.push(pl(0,s)); //first = distance, second = index

    while(que.size()){
        pl p = que.top();
        que.pop();
        ll pos = p.second;
        if(dist[pos] < p.first) continue;

        for(int i = 0; i < G[pos].size(); i++){
            edge e = G[pos][i];
            if(dist[e.to] > dist[pos] + e.cost){
                dist[e.to] = dist[pos]+e.cost;
                que.push(pl(dist[e.to],e.to));
            }
        }
    }
}

int main(){
    cin >> V >> E >> r;
    for(int i = 0; i < E; i++){
        cin >> s >> t >> d;
        G[s].push_back({t,d});
    }
    dijkstra(r);
    for(int i = 0; i < V; i++){
        if(dist[i] == MM) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
}





Measured memory_bytes: 28840
A,B,K = [int(i) for i in input().split()]
if (A>B):
    A,B=B,A
k=0
for i in reversed(range(1,A+1)):
    if (A % i == 0 and B % i == 0):
        k+=1
    if (k==K):
        print(i)
        break


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int n,o;
bool c[8];
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		int r = a/400;
		if(r<8){
			c[r] = true;
		}else o++;
	}
	int ct=0;
	for(int i=0;i<8;i++)if(c[i])ct++;
	//min
	printf("%d ",max(ct,o ? 1:0));
	//max
	printf("%d\n",ct+o);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
	using namespace std;
	#define ll       long long
	#define ull       unsigned long long
	#define  sci(x)   scanf("%d", &x)
	#define  scl(x)   scanf("%lld", &x)
	#define  scd(x)   scanf("%lf", &x)
	#define l0(i,n)   for(ll i=0; i<n; i++)
	#define MAX                 100000


	int main ()
	{
		ios::sync_with_stdio(0);
		cin.tie(0);
		//CODE TONOY
		for (int i=1 ; i<=5  ; i++)
		{
			int a;
			cin >> a;
			if (a==0) cout << i << endl;
		}
		return 0;
	}


Measured memory_bytes: 3584