akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

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

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

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

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

fn main() {
  input! {
    n: usize,
    x: i64,
    ll: [i64; n],
  }
  let mut d = 0;
  let mut count = 1;
  for &l in &ll {
    d += l;
    if d <= x {
      count += 1;
    }
  }

  println!("{}", count);
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll,pair<ll,ll>> pii;
typedef pair<ll,ll> pi;
typedef vector<ll> vl;

#define matrix vector<vector<ll>>
#define llmax LLONG_MAX
#define llmin LLONG_MIN
#define rep(i,n) for(ll (i)=0;(i)<n;++(i))
#define crep(i,m,n) for(ll (i)=m;(i)<n;++(i))
#define zero(a) memset((a),0,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)));
#define sq(a) ((a)*(a))
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define ff first
#define ss second

ll global=0;

// return nCr value
long long C(int n, int r) {
	if(r>n) return 0;
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;
    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
    return ans;
}

// return whether number is prime or not
vector<ll> sieve(ll n){
    vector<ll> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return is_prime;
}


void test_case();
int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    for(ll T=0;T<t;T++){
        test_case();
    }
    //**************************************************************************//
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

void test_case(){
    ll n,k;cin>>n>>k;
    std::vector<ll> dp(n+1,llmax), v(n);
    rep(i,n)cin>>v[i];
    k = min(k, n);
    dp[0] = 0;
    dp[1] = 0;
    for(ll i=2;i<=k;++i){
        for(ll j=i-1;j>=1;--j){
            dp[i] = min(dp[i],dp[j]+abs(v[i-1]-v[j-1]));
        }
    }

    for(ll i = k+1;i<=n;++i){
        for(ll j=1;j<=k;++j){
            dp[i] = min(dp[i-j]+abs(v[i-1]-v[i-j-1]), dp[i]);
        }
    }
    cout<<dp[n];
}


Measured memory_bytes: 4720
import sys
import heapq
from collections import deque

input = sys.stdin.readline

N = int(input())

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

A = [-i for i in A]
B = [-i for i in B]
C = [-i for i in C]
BD = [i for i in B]

heapq.heapify(A)
heapq.heapify(B)
heapq.heapify(C)
heapq.heapify(BD)

ai = [0]*N
bi = [0]*N
ci = [1]*N

def compete_cal(N, B, C, bi, ci):
    ciq = deque(ci)
    for i in range(N):
        b=-heapq.heappop(B)
        while len(C)>0:
          c=-heapq.heappop(C)
          if c>b:
              bi[i]+=ciq.popleft()
          else:
              heapq.heappush(C, -c)
              break

    for i in range(1,N):
        bi[i]+=bi[i-1]

    return bi   

bi = compete_cal(N, B, C, bi, ci)

ai = compete_cal(N, A, BD, ai, bi)
    
print(sum(ai))


Measured memory_bytes: 22976
#include <cstdio>
#include <algorithm>
int N, W;
const int MAX_N = 110;
long long w[MAX_N], v[MAX_N];
long long dp[MAX_N][100100];
long long ans = 0;

void solve() {
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j < 100001; j++) {
            dp[i][j] = 1000000001;
        }
    }
    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 100001; j++) {
            dp[i+1][j] = dp[i][j];
        }
        for (int j = 0; j < 100001; j++) {
            if (dp[i][j] + w[i] > W)
                continue;
            dp[i+1][j+v[i]]=std::min(dp[i+1][j+v[i]],dp[i][j]+w[i]);
            ans = std::max(ans, j+v[i]);
        }
    }
    printf("%d\n", ans);
}

int main() {
    scanf("%d %d", &N, &W);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &w[i], &v[i]);
    }
    solve();
    return 0;
}

Measured memory_bytes: 80000
import java.util.*;
import java.io.*;
//実行部分///////////////////////////////////////////////////////////////////////
public class Main{
  public static void main(String[] args) throws Exception{
    //入力のバッファリーダオブジェクトを生成
    BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
    String text=br.readLine();//入力した言葉
    int number=Integer.parseInt(br.readLine());//入力した命令数(string→int)
    String[] data=new String[number];//入力した命令の配列

    for (int i=0;i<number; i++){
      data[i]=br.readLine();
    }
    processing(text,data);//処理/出力
  }
///////////////////////////////////////////////////////////////////////////////
  public static void processing(String text,String[] in_data){
    String[] temp_array=new String[4];
    String[] temp_array2=new String[4];
    for (String str : in_data){
      temp_array=str.split(" ");
      Factory factory =new Factory();
      Imethodable products_obj=factory.create(temp_array[0]);
      text=products_obj.order(text,temp_array);
    }
  }
}
//インターフェイス(クラスの抽象修飾子)
interface Imethodable{
 String order(String word, String[] array);
}
//factoryクラス
class Factory{
  public Imethodable create(String type){
    if(type.equals("replace")){
      return new Replace();
    }else if(type.equals("print")){
      return new Print();
    }else if(type.equals("reverse")){
      return new Reverse();
    }
    return null;
  }
}

class Replace implements Imethodable{

  public String order(String word,String[] array){
    String temp2="";
    int a=Integer.parseInt(array[1]);
    int b=Integer.parseInt(array[2]);
    String re=array[3];
    for (int y=0;y<a;y++){
      temp2=temp2+word.charAt(y);
    }
      temp2=temp2+re;
    for (int z=b+1;z<word.length();z++){
      temp2=temp2+word.charAt(z);
    }
    word=temp2;
    return word;
  }
}

class Print implements Imethodable{
  public String order(String word,String[] array){
    String temp="";
    int a=Integer.parseInt(array[1]);
    int b=Integer.parseInt(array[2]);

    for(int x=a;x<=b; x++){
      temp=temp+word.charAt(x);
    }
    System.out.println(temp);
    return word;
  }
}

class Reverse implements Imethodable{
  public String order(String word,String[] array){
    String temp2="";
    int a=Integer.parseInt(array[1]);
    int b=Integer.parseInt(array[2]);

    for (int y=0;y<a;y++){
      temp2=temp2+word.charAt(y);
    }

    for (int x=b;x>=a; x--){
      temp2=temp2+word.charAt(x);
    }

    for (int z=b+1;z<word.length();z++){
      temp2=temp2+word.charAt(z);
    }
    word=temp2;
    return word;
  }
}



Measured memory_bytes: 90136
//--- pA ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		int n = reader.ni();
		n %= 10;
		if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
			out.println("hon");
		} else if (n == 0 || n == 1 || n == 6 || n == 8) {
			out.println("pon");
		} else {
			out.println("bon");
		}
		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 32852
#include <stdio.h>
#include <string.h>

int main()
{
  int	n;
  char	str[100000];
  char	tmp[100000];

  while(1){
    scanf("%d",&n);
    if (n == 0){ break; }
    scanf("%s",str);
 	
    while( n>0 ){
      int i,j,len;

      len = strlen(str);
      memset(tmp, '\0', sizeof(tmp));
      char c = '\0';
      char	countbuf[10],valuebuf[10];
      int count;

      for(i = 0;i < len;i++){
	if (c != str[i]){
	  count = 0;
	  for (j = i; j < len; j++){
	    if( str[i]==str[j]){
	      count++;
	    }else{
	      break;
	    }    
	  }
	  memset(valuebuf,'\0',sizeof(valuebuf));
	  valuebuf[0] = str[i];
	  sprintf(countbuf,"%d", count);
	  strcat(tmp,countbuf);
	  strcat(tmp,valuebuf);
	  memset(countbuf, '\0', sizeof(countbuf));
	  c = str[i];
	}
      }
      memcpy(str,tmp,sizeof(tmp));   
      n--;
    }
  
    printf("%s\n", tmp);	
  }
  return 0;
}

Measured memory_bytes: 2864
from collections import deque

N, K = map(int, input().split())
inputs = [int(i) for i in input().split()]

R = min(N, K)
ans = 0
for left in range(R+1):
    #print('left', left)
    for right in range(R+1-left):
        if left + right > K:
            continue
        stay = K - left - right
        # print(right, left, stay)
        tmp = inputs[:left] + inputs[::-1][:right]
        tmp.sort()
        total = sum(tmp)
        if stay <= len(tmp):
            tmp = tmp[:stay]
        for item in tmp:
            if item < 0:
                total -= item
            else:
                break
        ans = max(ans, total)

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	ll n; cin>>n;
	ll a=0,b=0,c=0,d=0;
	rep(i,0,n){
		string s; cin>>s;
		if(s == "AC") a++;
		if(s == "WA") b++;
		if(s == "TLE") c++;
		if(s == "RE") d++;
	}
	cout<< "AC x "<<a<<endl;
	cout<< "WA x "<<b<<endl;
	cout<< "TLE x "<<c<<endl;
	cout<< "RE x "<<d<<endl;

}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

vvi G;
int N;
vvi dp;

int tsp(int pos, int visited) {
	if (visited == (1 << N) - 1) {
		return 0;
	}
	if (dp[visited][pos] != -1) {
		return dp[visited][pos];
	}
	int ans = INF;
	rep(i, N) {
		if ((visited & (1 << i)) != 0)continue;
		ans = min(ans, G[pos][i] + tsp(i, visited | (1 << i)));
	}
	return dp[visited][pos] = ans;
}

int main() {
	while (true) {
		cin >> N;
		if (N == 0)break;
		vs name(N);
		rep(i, N)cin >> name[i];
		vb del(N, false);
		// ???????????¨????????????????????????????????´???????¶????
		rep(i, N) {
			rep(j, N) {
				// i???j??????????????????
				if (i == j || name[i].size() > name[j].size())continue;
				// i?????????????????????????£????0???J-I
				bool flag2 = false;
				rep(k, name[j].size() - name[i].size() + 1) {
					bool flag = true;
					rep(l, name[i].size()) {
						if (name[j][k + l] != name[i][l]) {
							flag = false;
							break;
						}
					}
					if (flag) {
						// ????????????
						flag2 = true;
						break;
					}
				}
				if (flag2) {
					// ?????????????????§i?????????
					del[i] = true;
					break;
				}
			}
		}

		vs tmp;
		rep(i, N) {
			if (!del[i]) {
				tmp.push_back(name[i]);
			}
		}
		name = tmp;
		N = name.size();

		G = vvi(N, vi(N, 0));
		dp = vvi(1 << N, vi(N, -1));
		rep(i, N) {
			rep(j, N) {
				if (i == j)continue;
				int maxk = 0;
				repl(k, 1, min(name[i].size(), name[j].size())){
					// name[i]?????????k????????¨name[j]?????????k???????????????
					bool flag = true;
					rep(l, k) {
						if (name[i][name[i].size() - k + l] != name[j][l]) {
							flag = false;
							break;
						}
					}
					if (flag)maxk = k;
				}
				G[i][j] = name[j].size() - maxk;
			}
		}
		int ans = INF;
		rep(i, N) {
			ans = min(ans, tsp(i, 1 << i) + (int)name[i].size());
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 5628
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int n,l;
    cin>>n>>l;

    i64 minaji = INF;
    i64 sum = 0;
    
    REP(i,n){
        sum += l+i;
        if( abs(l+i) < abs(minaji) ){
            minaji = l+i;
        }
    }cout<<sum-minaji<<endl;


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

Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		
		int n = scan.nextInt();
		for(int i = 0; i < n; i++){
			BigDecimal x1 = scan.nextBigDecimal();
			BigDecimal y1 = scan.nextBigDecimal();
			BigDecimal ax = scan.nextBigDecimal().subtract(x1);
			BigDecimal ay = scan.nextBigDecimal().subtract(y1);
			BigDecimal x3 = scan.nextBigDecimal();
			BigDecimal y3 = scan.nextBigDecimal();
			BigDecimal bx = scan.nextBigDecimal().subtract(x3);
			BigDecimal by = scan.nextBigDecimal().subtract(y3);
			boolean flag = false;
			flag = ax.multiply(by).compareTo(ay.multiply(bx)) == 0;
			System.out.printf("%s\n", flag? "YES" : "NO");
		}
	}
}

Measured memory_bytes: 30372
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MOD 1000000007
#define rep(i,x,y) for(int i=(x);i<=(y);++i)
#define drep(i,x,y) for(int i=(x);i>=(y);--i)
inline int read(){
	char ch=getchar();int x=0,f=1;
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while('0'<=ch&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int cnt[200010];
int mn[200010];
int c[200010],w[200010];
int fac[200010],inv[200010];
inline int C(int x,int y){
	return 1ll*fac[x]*inv[y]%MOD*inv[x-y]%MOD;
} 
int main(){
	int n=read(),X=read(),Y=read();
	fac[0]=1;inv[0]=inv[1]=1;
	rep(i,1,n){
		fac[i]=1ll*fac[i-1]*i%MOD;
		if(i>1){
			inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
		}
	}
	rep(i,2,n){
		inv[i]=1ll*inv[i-1]*inv[i]%MOD;
	}
	rep(i,1,n)mn[i]=1e9;
	rep(i,1,n){
		c[i]=read(),w[i]=read();
		mn[c[i]]=min(mn[c[i]],w[i]);
		++cnt[c[i]];
	}
	int m=1;
	rep(i,1,n){
		if(mn[i]<mn[m])m=i;
	}
	int t=1;
	rep(i,1,n){
		if(mn[i]!=1e9&&i!=m){
			if(t==-1)t=i;
			else if(mn[i]<mn[t]){
				t=i;
			}
		}
	}
	//printf("%d %d\n",mn[m],mn[t]);
	rep(i,1,n){
		if(w[i]!=mn[c[i]]&&w[i]+mn[c[i]]<=X)continue;
		if(c[i]==m&&w[i]+mn[t]<=Y)continue;
		if(c[i]!=m&&w[i]+mn[m]<=Y)continue;
		--cnt[c[i]];
	}
	//rep(i,1,n)printf("%d\n",cnt[i]);
	int sum=0;
	rep(i,1,n){
		if(mn[i]!=1e9&&(i==m||mn[i]+mn[m]<=Y)){
			sum+=cnt[i];
		}
	}
	int ans=1;
	rep(i,1,n){
		if(mn[i]!=1e9&&(i==m||mn[i]+mn[m]<=Y)){
			ans=1ll*ans*C(sum,cnt[i])%MOD;
			sum-=cnt[i];
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 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};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */

int a, b, k;
void in(){
    cin >> a >> b >> k;
}

void solve(){

    int cnt = 0;
    revrep(i,100,0){
        if(a % i == 0 && b % i == 0) cnt++;
        if(cnt == k){
            print(i);
            return;
        }
        
    }


}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,tmp=0,tmp2=0;
  int a[LIMIT2]={0};
  char s[LIMIT2];
  
  scanf("%lld",&n);
  scanf("%s",s);
  rep(i,n){
    if(s[i]=='E') tmp2++;
  }
  rep(i,n){
    if(s[i]=='E') tmp2--;
    if(i==0) result = tmp+tmp2;
    else result = min(result,tmp+tmp2);
    if(s[i]=='W') tmp++;
  }
  printf("%lld",result);
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
set<int> si;

int main() {
	cin >> n;
	rep(i, n) {
		int a;
		cin >> a;
		if (si.find(a) == si.end())si.insert(a);
		else si.erase(a);
	}
	cout << si.size() << endl;
}

Measured memory_bytes: 4864
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

string s, t;

int main() {
	int n;
	cin >> n;
	while (n--) {
		//dp[i][j] := s???i??????????????§???t???j??????????????§?????£?????¨??????LCS
		vector<vector<int>> dp(2000, vector<int>(2000));
		cin >> s >> t;
		dp[0][0] = (s[0] == t[0]);
		for (int i = 1; i < s.size(); i++)dp[i][0] = (bool)(dp[i-1][0] + (s[i] == t[0]));
		for (int j = 1; j < t.size(); j++)dp[0][j] = (bool)(dp[0][j-1] + (s[0] == t[j]));
		
		for (int i = 1; i < s.size(); i++) {
			for (int j = 1; j < t.size(); j++) {
				if (s[i] == t[j])dp[i][j] = dp[i-1][j-1]+1;
				else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
		cout << dp[s.size() - 1][t.size() - 1] << endl;
	}
}

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

int main(){
	int n;
	string s[1002];
	int t[1002];
	string X;
	cin >> n;
	for(int i = 0 ; i < n ; i ++){
		cin >> s[i] >> t[i];
	}
	cin >> X;
	
	for(int i = 0 ; i < n ; i ++){
		if(s[i] == X){
			int ret = 0;
			for(int j = i+1 ; j < n ; j ++){
				ret += t[j];
			}
			cout << ret << endl;
			return 0;
		}
	}
}


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

typedef long long ll;
const int NMAX = 1e6 + 10;
const int MOD = 1e9 + 7;

int r[NMAX];

void init(int n)
{
	for(register int i = 1;i <= n;i++)
		for(register int j = i;j <= n;j += i)
			r[j]++;
}
int main(int argc, char const *argv[])
{
	int n;
	scanf("%d",&n);
	init(n);
	ll ans = 0;
	for(register int i = 1;i < n;i++)
		ans += r[i];
	printf("%lld\n",ans );
	return 0;
}

Measured memory_bytes: 7656
#include <cstdio>
#include <numeric>

using namespace std;

int main() {
  int n, m, p, x;
  int t[105];
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &t[i]);
  }
  scanf("%d", &m);
  int sum = accumulate(t + 1, t + 1 + n, 0);
  while (m--) {
    scanf("%d %d", &p, &x);
    int ans = sum - t[p] + x;
    printf("%d\n", ans);
  }
  return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> L(N);
    rep(i, 0, N) cin >> L[i];

    sort(L.begin(), L.end());
    ll ans = 0;
    rep(i, 0, N){
        rep(j, i + 1, N){
            auto pre = upper_bound(L.begin() + j, L.end(), L[j] - L[i]);
            auto suf = lower_bound(L.begin() + j, L.end(), L[j] + L[i]);
            ans += suf - pre - 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
#define sqr(int) (int * int)
#define sqr3(int) (int * int * int)
#define pi M_PI
#define nl "\n"



  int a,b;
  int main(){
	ios::sync_with_stdio(true);
	cin.tie(0);
	cin >> a >> b;
	if(a > 9 || b > 9){
		cout << -1;
	}
	else{
		cout << a*b;
	}
	
	}

	
	


	



Measured memory_bytes: 3580
N, K = map(int, input().split())
A = list(map(int, input().split()))
# Nの中からK個中最大でK-1個だけ変えることができるので
# N >= T*(K-1) + 1となり、この式をTを求めるように式変形する（Tは試行回数）
T = (N-2) // (K-1)+1
print(T)


Measured memory_bytes: 14008
n = input()
hs = map(int, raw_input().split())
hs.append(10**9+1) #sentinel

c = 0
mc = 0
for p, n in zip(hs, hs[1:]):
	if p >= n:
		c += 1
	else:
		if c > mc:
			mc = c
		c = 0

print mc


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

using namespace std;

int main(){
	
	int n, q;
	cin >> n;
	vector<int> s(n);

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

	cin >> q;
	int t;
	int counter = 0;
	for (int i = 0; i < q; i++) {
		cin >> t;
		counter += binary_search(s.begin(), s.end(), t);
	}

	cout << counter << endl;


	return 0;
}


Measured memory_bytes: 3116
package main

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

func main() {
	_, A, B := ReadInt(), ReadInt(), ReadInt()
	S := ReadString()

	var a, b int
	for i := 0; i < len(S); i++ {
		if S[i] == 'c' {
			fmt.Println("No")
			continue
		}
		if S[i] == 'a' {
			if a+b < A+B {
				fmt.Println("Yes")
				a++
			} else {
				fmt.Println("No")
			}
			continue
		} else {
			if a+b < A+B && b+1 <= B {
				fmt.Println("Yes")
				b++
			} else {
				fmt.Println("No")
			}
		}
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 2584
#include<stdio.h>

int main(){
  int i,j,k;
  int N,K;
  
  scanf("%d %d",&N,&K);
  char S[N];
  scanf("%s",S);
  for(i=0;i<N;i++){
    if(i == K-1){
      if(S[i]=='A'){
        printf("a");
      }
      else if(S[i]=='B')
        printf("b");
      else
        printf("c");
    }
    else
      printf("%c",S[i]);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

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

		int ans = 0;
		for(int i = 0 ; i < n ; i++){
			for(int j = i+1 ; j < n ; j++){
				ans += d[i]*d[j];
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
N = int(input())

lst = [['a']]
for i in range(N - 1):
    n = len(lst)
    tmp_lst = []
    tmp_append = tmp_lst.append
    for j in range(n):
        tmp = lst[j]
        count = len(set(tmp))
        for k in range(count + 1):
            tmp_append(tmp + [chr(k + 97)])
    lst = tmp_lst
lst.sort()

for tmp in lst:
    print (*tmp, sep = '')

Measured memory_bytes: 25420
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s0,s1;
	cin>>s0>>s1;
	if(s0[0]==s1[2] && s0[1]==s1[1] && s0[2]==s1[0])cout<<"YES";
	else cout<<"NO";
    return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(200001,0);
    for(int i=0;i<n;++i){
        int temp;
        cin>>temp;
        ++a[temp];
    }
    
    sort(a.begin(),a.end(),greater<int>());
    int ans=0;
    for(int i=k;i<n;++i){
        if(a[i]!=0) ans+=a[i];
        else break;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>

using namespace std;

map<string, int> dict;


int main(){
  int n, m;
  cin >> n >> m;
  
  int ans = (n*(n-1)+m*(m-1))/2;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
s = [ord(alph)-97 for alph in input()]
K = int(input())
i = 0
while K > 0 and i < len(s)-1:
    if s[i] != 0 and 26-s[i] <= K:
        K -= 26-s[i]
        s[i] = 0
    else:
        i += 1
s[-1] = (s[-1]+K)%26 
print(*[chr(x+97) for x in s], sep = '')

Measured memory_bytes: 56500
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    
    static List<Long> list;

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int k = Integer.parseInt(sc.next());
        list = new ArrayList<>();
        
        for(int i = 1; i <= 9; i++){
            dfs(Integer.toString(i));
        }
        
        Collections.sort(list);
        System.out.println(list.get(k-1));
    }
    
    static void dfs(String s){
        
        list.add(Long.parseLong(s));
        
        if(s.length() == 10) return;
        
        int a = Integer.parseInt(s.substring(s.length()-1, s.length()));
        if(1 <= a) dfs(s + (a-1));
        dfs(s + a);
        if(a <= 8) dfs(s + (a+1));
    }
}

Measured memory_bytes: 55092
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
int ceil(int a,int b){// a以上でbの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){//stoi関数の代用 文字列を数値として読み取りint型に変換//
    return atoi(s.c_str());
}
int dp[110][10010];
int main (){
    int n,m,x;
    cin>>n>>m>>x;
    int a[m];
    rep(i,m){
        cin>>a[i];
    }
    int r=0,l=0;
    rep(i,m){
        if(a[i]<x) l++;
        else r++;
    }
    cout<<min(l,r)<<endl;
    return 0;
}

Measured memory_bytes: 256
<?php
define('MOD', pow(10, 9) + 7);

fscanf(STDIN, "%d %d", $N, $M);
$s = [];
for ($i = 0; $i < $M; $i++) {
    fscanf(STDIN, "%d", $a);
    $s[$a] = 1;
}
$pos = 0;
$array[-1] = 0;
$array[0] = 1;
for ($i = 1; $i <= $N; $i++) {
    if (isset($s[$i])) {
        $array[$i] = 0;
    } else {
        $array[$i] = $array[$i - 2] + $array[$i - 1];
    }
    $array[$i] %= MOD;
}
printf("%d", $array[$N]);


Measured memory_bytes: 26048
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    ll n;
    cin>>n;
    vector<ll> a(n+1);
    vector<ll> b(n);
    rep(i,n+1){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }

    ll ans=0;
    ll k;
    rep(i,n){
        k = min(a[i],b[i]);
        b[i]-=k;
        ans+=k;
        ans+=min(a[i+1],b[i]);
        a[i+1] = max(0ll,a[i+1]-b[i]);

    }
   // ans+=min(a[n],b[n-1]);


    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1792
import sys
from collections import deque
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [D, n] = string_to_int(inputs[0])
    N = n + 1 if n == 100 else n
    adder = reduce(lambda acc, _: acc * 100, range(D), 1)
    count = 0
    for _ in range(N):
        count += adder
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    string s;
    cin>>s;
    vector<int> data(27,0);
    for(int i=0;i<4;i++){
        data[tolower(s[i])-'a']++;
    }
    int cnt=0;
    for(int i=0;i<27;i++){
        if(data[i]==2) cnt++;
    }
    cout<<(cnt==2?"Yes":"No")<<endl;
    return 0;
}


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

int main () {
    ll n,a1,a2,k;
    cin>>n>>k;
    vector<ll> h(n);
    vector<ll> dp(n,1e10);
    for(a1=0;a1<n;++a1) cin>>h[a1];
    dp[0]=0;
    for(a1=0;a1<n;++a1){
        for(a2=1;a2<=k;++a2){
            if(a1+a2>=n) break;
            dp[a1+a2]=min(dp[a1+a2], dp[a1]+abs(h[a1]-h[a1+a2]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

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

int cub[26];
int main(){
    string x;
    cin>>x;
    bool can=true;
    for(int i=0; i<x.length(); i++){
        if(x[i]>=97 && x[i]<=122)
            cub[x[i]-97]++;
    }
    for(int i=0; i<26; i++){
        if(cub[i]%2!=0 && cub[i]!=0){
            can=false;
            break;
        }
    }
    if(can)
        printf("Yes");
    else
        printf("No");
return 0;
}


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

#define ll long long
#define ld long long
#define M 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {
    fast;
	char b;
    cin >> b;
    char a;
    if (b == 'A')
        a = 'T';
    else if (b == 'T')
        a = 'A';
    else if (b == 'G')
        a = 'C';
    else 
        a = 'G';
    cout << a << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{  
      IOS;
      int n=0,W=0;
      cin>>n>>W;

      ll wt[n],cost[n];
      ll dp[n+1][W+1];

       f(i,0,n+1)
       {
          f(j,0,W+1)
            { 
              dp[i][j] = 0;
            }
       }

      f(i,0,n)
       cin>>wt[i]>>cost[i];

      f(i,1,n+1)
       {
          f(j,0,W+1)
            {
              if(wt[i-1]>j)
                {
                  dp[i][j] = dp[i-1][j];
                }
              else 
                {
                  dp[i][j] = max((cost[i-1] + dp[i-1][j-wt[i-1]]),dp[i-1][j]);
                }
            }
       }

      cout<<dp[n][W]<<endl;
  return 0;
}


Measured memory_bytes: 82360
from collections import defaultdict
n = int(input())
s = [list(map(int,input().split())) for i in range(n)]
s.sort()
c = []
if n == 1:
    print(1)
else:
    for i in range(n):
        for j in range(i+1,n):
            x = s[j][0] - s[i][0]
            y = s[j][1] - s[i][1]
            c.append(str(x) + " " + str(y))
    r = defaultdict(int)
    for g in c:
        r[g] += 1
    q = list(r.values())
    q1 = max(q)
    print(n-q1)

Measured memory_bytes: 3444
#include<stdio.h>
int main(){
  int i,j,c,y[144],x[144],k,ny,nx,t,r;
  int X[]={0,1,0,-1};
  int Y[]={1,0,-1,0};
  char m[14][14]={0};
  while(scanf("%s",m[1]+1)!=EOF){
    for(i=1;i<12;i++)scanf("%s",m[i+1]+1);
    for(i=c=0;i<12;i++){
      for(j=0;j<12;j++){
	if(m[i+1][j+1]-'1')continue;
	y[  0]=i+1;
	x[t=0]=j+1;
	m[i+1][j+1]=0;
	c++;
	for(r=1;r-t;t++){
	  for(k=0;k<4;k++){
	    nx=x[t]+X[k];
	    ny=y[t]+Y[k];
	    if(m[ny][nx]-'1')continue;
	    m[ny][nx]=0;
	    y[r  ]=ny;
	    x[r++]=nx;
	  }
	}
      }
    }
    printf("%d\n",c);
  }
  return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> vec(N,0);
  for(int i=0;i<K;i++){
    int d,a;
    cin >> d;
    for(int j=0;j<d;j++){
      cin >> a;
      vec.at(a-1)++;
    }
  }
  int count=0;
  for(int i=0;i<N;i++){
    if(vec.at(i)==0)count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	a, b, c := readInt(), readInt(), readInt()

	if b >= a * c {
		fmt.Println(c)
	} else {
		fmt.Println(b/a)
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i< (n);i++)
#define rep1(i,n) for(int i=1;i<= (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const static ll MOD = (1e+9)+7;

int main(){
    int h,w;cin>>h>>w;
    vector<vector<int>> mp(h,vector<int>(w,0));
    rep(i,h){
        string s;cin>>s;
        rep(j,w){
            if(s[j] == '#'){
                mp[i][j] = 1;
            }
        }
    }
    vector<vector<int>> dp(h,vector<int>(w,0));
    if(mp[0][0]==1)dp[0][0]=2;
    rep1(i,h-1){
        //まずは行方向に
        if(mp[i-1][0] == 0 && mp[i][0] == 1){
            dp[i][0] = dp[i-1][0]+2;
        }else{
            dp[i][0] = dp[i-1][0];
        }
    }
    rep1(i,w-1){
        //まずは行方向に
        if(mp[0][i-1] == 0 && mp[0][i] == 1){
            dp[0][i] = dp[0][i-1]+2;
        }else{
            dp[0][i] = dp[0][i-1];
        }
    }
    rep1(i,h-1){
        rep1(j,w-1){
            int root_r,root_d;
            if(mp[i][j-1] == 0 && mp[i][j] == 1){
                root_r = dp[i][j-1] + 2;
            }else{
                root_r = dp[i][j-1];
            }
            if(mp[i-1][j] == 0 && mp[i][j] == 1){
                root_d = dp[i-1][j] + 2;
            }else{
                root_d = dp[i-1][j];
            }
            dp[i][j] = min(root_r,root_d);
        }
    }
    cout<<dp[h-1][w-1]/2<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int k,n,i,num;
  scanf("%d%d",&n,&k);
  int a[n+1];
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
    if(a[i]==1)
      num=i;
  }
  int left,right;
  left=(num-1)/(k-1);
  right=(n-num)/(k-1);
  if((num-1)%(k-1)+(n-num)%(k-1)>=k)
    printf("%d\n",left+right+2);
  else if((num-1)%(k-1)==0 && (n-num)%(k-1)==0)
    printf("%d\n",left+right);
  else
    printf("%d\n",left+right+1);
  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N, K; cin >> N >> K;
  vector<int> p(N);
  rep(i, N) {
    cin >> p[i];
  }
  double curr = 0.0;
  double ans = 0.0;
  rep(i, K) {
    curr += (double)(p[i] * (p[i] + 1)) / 2.0 / p[i];
  }
  ans = curr;
  REP(i, K, N) {
    curr -= (double)(p[i - K] * (p[i - K] + 1)) / 2.0 / p[i - K];
    curr += (double)(p[i] * (p[i] + 1)) / 2.0 / p[i];
    ans = max(ans, max(ans, curr));
  }
  printf("%.10f\n", ans);
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M;
	vector<vector<int>> S;
	
	cin >> N >> M;
	S.resize(N);

	for(int i=1; i<=M; i++){
		int p;
		string s;
		cin >> p >> s;
		char *c = (char*)s.c_str();
		if(strcmp(c, "AC") == 0){
			S[p-1].push_back(1);
		}
		else{
			S[p-1].push_back(0);
		}
	}
	int ac = 0, wa = 0; 
	for(int i=0; i<N; i++){
		int u = 0;
		int v = 0;
		for(int j=0; j<S[i].size(); j++){
			if(S[i][j]==1){
				u = 1;
				break;
			}
			else{
				v++;
			}
		}
		if(u == 1){
			ac++;
			wa += v;
		}
	}
	printf("%d %d\n", ac, wa);
	return 0;
}

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

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int main() {
	int a, b;

	while (cin >> a >> b, b) {
		int d = b - a;

		vi a;
		a.pb(d / 1000);
		d %= 1000;

		a.pb(d / 500);
		d %= 500;
		
		a.pb(d / 100);

		reverse(all(a));

		print(a);
	}
}

Measured memory_bytes: 3156