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

using namespace std;
#define taskname "A"
#define pb	push_back
#define mp 	make_pair

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 2e5 + 5;

int n , m;
int dp[maxn][30];
ii a[maxn];
int T;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    int res = 0;
    cin >> n >> T;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i].first >> a[i].second;
    }
    sort(a+1,a+n+1,[&](const ii x , const ii y){
        if((ll)x.first * (y.second + 1) == (ll)y.first * (x.second + 1))return x.second < y.second;
        return (ll)x.first * (y.second + 1) > (ll)y.first * (x.second + 1);
         });
    memset(dp,123,sizeof dp);
    dp[0][0] = 0;
    for(int i = 1 ; i <= n + 1 ; ++i){
        if(a[i].first == 0){
            for(int j = 0 ; j < 30 && dp[i - 1][j] <= T ; ++j){
                ll cur = dp[i - 1][j];
                res = max(res , j);
                for(int t = i ; t <= n && cur + 1 + a[t].second <= T ; ++t){
                    cur = (cur + 1) + a[t].second;
                    res = max(res , j + t - i + 1);
                }
            }
            break;
        }
        for(int j = 0 ; j < 30 ; ++j){
            dp[i][j] = dp[i - 1][j];
            if(j > 0 && (ll)(dp[i - 1][j - 1] + 1) * (a[i].first + 1) + a[i].second <= T){
               dp[i][j] = min(dp[i][j] ,(dp[i - 1][j - 1] + 1) * (a[i].first + 1) + a[i].second);
            }
        }
    }
    cout << res;
}


Measured memory_bytes: 25216
S,K=input().split()
K=int(K)
K=min(K,300)
mod=998244353
a=[]
val=0
for i in range(len(S)):
    if S[i]=="0":
        a.append(val)
        val=0
    else:
        val+=1

if val!=0:
    a.append(val)
m=len(a)
K=min(sum(a),K)

dp=[[[0 for i in range(K+1)] for j in range(K+1)] for k in range(m+1)]

for j in range(K+1):
    dp[m][j][j]=1

b=[a[i] for i in range(m)]
c=[a[i] for i in range(m)]
for i in range(1,m):
    b[i]+=b[i-1]
b=[0]+b
for i in range(m-2,-1,-1):
    c[i]+=c[i+1]
for i in range(m-1,-1,-1):
    for k in range(min(b[i],K)+1):
        for j in range(min(K,k+c[i])+1):
            M=max(k-j,-a[i])
            dp[i][j][k]=sum(dp[i+1][j+l][k] for l in range(max(0,M),K-j+1))+sum(dp[i+1][j][k+l] for l in range(1,min(K-k,-M)+1))
            dp[i][j][k]%=mod

print(dp[0][0][0])

Measured memory_bytes: 108476
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let mut s = read::<String>().chars().collect::<Vec<_>>();
    s.reverse();
    let mut count = vec![0; 2019];
    let mut cur = 0i64;
    let mut ans = 0;
    let mut x = 1;

    for i in 0..s.len() {
        count[cur as usize] += 1;

        cur += s[i].to_digit(10).unwrap() as i64 * x;
        cur %= 2019;
        ans += count[cur as usize];

        x *= 10;
        x %= 2019;
        cur %= 2019;
    }

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

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
char dance[120];
int main(){
    cin >> dance;
    int state = 1;
    for(int i=0; i < strlen(dance); i++){
        if(i%2 == 0){
            if(dance[i] == 'L'){
                state = 0;
                break;
            }
        }
        if(i%2 == 1){
            if(dance[i] == 'R'){
                state = 0;
                break;
            }
        }
    }
    if(state == 1)  cout << "Yes" << endl;
    if(state == 0)  cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int num=3,fir=10000,sec=10000;
  for(int i=0;i<num;i++){
    int a;cin>>a;
    if(a<sec){
      if(a<fir){
        sec = fir;
        fir = a;
      }else{
        sec = a;
      }
    }
  }
  cout << fir+sec << endl;
}

Measured memory_bytes: 256
(let* ((n (read))
       (l (sort (loop repeat n collect (read)) #'<)))
  (loop with c = 0
        for i2 on l
        for i = (first i2)
        for l2 = (rest i2)
        while i
        do (loop while (eql (first l2) i)
                 do (setf l2 (rest l2)))

        do (loop for j2 on l2
                 for j = (first j2)
                 for l3 = (rest j2)
                 while j
                 do (loop while (eql (first l3) j)
                          do (setf l3 (rest l3))
                          )
                 do (loop for k2 on l3
                          for k = (first k2)
                          while k
                          unless (<= (+ i j) k)
                          do (progn
                               ;;(print (list i j k))
                               (incf c))))
        finally (format t "~A~%" c)))

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000000 + 7;
const static int INT_INF = 999999999;
const static llong INF = 1LL << 60;
const static double eps = 1e-6;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

int H, W;
char field[51][51];

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

    int cnt_white_tile = 0;
    cin >> H >> W;
    rep(i, H) {
        rep(j, W) {
            cin >> field[i][j];
            if (field[i][j] == '.') ++cnt_white_tile;
        }
    }

    int dist[51][51];
    rep(i, 51) {
        rep(j, 51) {
            dist[i][j] = INT_INF;
        }
    }

    queue<pair<int, int> > Q;
    Q.push({0, 0});
    dist[0][0] = 1;

    while (! Q.empty()) {
        pair<int, int> p = Q.front();
        int x = p.first, y = p.second;
        Q.pop();
        rep(i, 4) {
            if (0 <= x + dx[i] && x + dx[i] <= H - 1 && 0 <= y + dy[i] && y + dy[i] <= W - 1 && field[x + dx[i]][y + dy[i]] == '.' && dist[x][y] + 1 < dist[x + dx[i]][y + dy[i]]) {
                dist[x + dx[i]][y + dy[i]] = dist[x][y] + 1;
                Q.push({x + dx[i], y + dy[i]});
            }
        }
    }

    if (dist[H - 1][W - 1] == INT_INF) {
        cout << - 1 << endl;
    } else {
        cout << cnt_white_tile - dist[H - 1][W - 1] << endl;
    }
    
    return 0;
}

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

#define ll long long

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;

    for(int i=0; i<a; ++i){
        if(s[i]=='-'){
            cout << "No";
            return 0;
        }
    }

    if(s[a]!='-'){
        cout << "No";
        return 0;
    }

    for(int i=a+1; i<a+b+1; ++i){
        if(s[i]=='-'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
#define N 100010
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

ll T,n,m;

int main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n >> m;
    ll dp[4*100001],dp1[4*100001];

    dp[0] = 0;
    dp1[n] = n;
    for(ll i=1;i<=n;i++){
    	dp[i] = (dp[i-1] + i)%mod;
    }
    for(ll i=n-1;i>=0;i--){
    	dp1[i] = (dp1[i+1] + i)%mod;
    }
    
    ll ans = 1;
    for(ll i=m;i<=n;i++){
    	ans += (i*n - 2*dp[i-1] + 1 + mod)%mod;
    }

    cout << (ans%mod);
 
    return 0;
}


Measured memory_bytes: 5204
#include <iostream>

using namespace std;

int main()
{
  int a, b, i = 0, n;
  cin >> a >> b;
  while (true)
  {
    n = (i * (i - 1)) / 2;
    if (n > b && n - b == (((i - 1) * (i - 2)) / 2) - a)
      break;
    ++i;
  }
  cout << n - b  << endl;
  return 0;
}


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

using namespace std;
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
typedef vector<ll> vll;
typedef vector<int> vi;
const ll N = 2e6 + 10;
const int M = 1e9 + 7;
const double eps = 1e-9;

int main() {
    int x, n;
    cin >> x >> n;
    vll v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(all(v));
    ll ans = INT_MAX;
    for (int j = x; j <= x + 1000; ++j) {
        if (!binary_search(all(v), j)) {
            ans = j;
            break;
        }
    }
    for (int j = x - 1; j >= x - 1000; --j) {
        if (!binary_search(all(v), j)) {
            if (abs(x - ans) < abs(x - j))
                return cout << ans << endl, 0;
            else return cout << j << endl, 0;
        }
    }
}



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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 500005
#define all(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

int32_t main(){
	IOS;
	int tt = 1; 
	//cin >> tt;
	while(tt--){
		string a, b; cin >> a >> b;
      int cnt = 0;
      for(int i = 0; i < a.size(); i++) if(a[i] != b[i]) cnt++;
      cout << cnt ;
	
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
const int N = 100123;
vector <string> v;

int32_t main(){
	v.push_back("");
	for (int i = 1; i <= 10; i++){
		int siz = v.size();
		for (int j = 0; j < siz; j++){
			if (v[j].size() != i - 1)
				continue;
			if (i == 1){
				for (int j = 1; j < 10; j++){
					string f = "";
					f += char(j + '0');
					v.push_back(f);
				}
			}else{
				for (char k = max('0', char(v[j][v[j].size() - 1] - 1)); k <= min('9', char(v[j][v[j].size() - 1] + 1)); k++){
					string h = v[j];
					h += k;
					v.push_back(h);
				}
			}
		}
	}
	int k;
	cin >> k;
	cout << v[k] << endl;
}

Measured memory_bytes: 13936
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        int ans = 0;
        for (int i = 0; i < s.Length; i++)
        {
            string X = s.Substring(i);
            string Y = s.Substring(0, i);
            int xy = 0;
            for (char c = 'a'; c <= 'z'; c++)
            {
                if (X.Contains(c) && Y.Contains(c)) xy++;
            }
            ans = Math.Max(ans, xy);
        }
        Console.WriteLine(ans);
    }
}


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

int main(){
  int A, B, C;
  
  cin >> A >> B >> C;
  if (A == B && B == C) {
    cout << "No" << endl;
    return 0;
  } else if (A == B || A == C || B == C) {
    cout << "Yes" << endl;
    return 0;
  } 
  
  cout << "No" << endl;
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  int *a = new int[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int m = (1<<31);
  int minx=a[0];
  for(int i=1;i<n;i++){
    m = max(m,a[i]-minx);
    minx = min(minx,a[i]);

  }
  cout<<m<<endl;
  delete []a;
  return 0;
}

Measured memory_bytes: 1796
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 998244353
typedef long long ll;
using namespace std;

#define MOD 998244353
#define Nmax 300010
long long inv[Nmax],fact[Nmax],invfact[Nmax];
void PRE(){
    inv[1]=fact[0]=invfact[0]=1;
    for(int i=1;i<Nmax;i++){
        if(i>1)inv[i]=(MOD-(MOD/i)*inv[MOD%i]%MOD)%MOD;
        fact[i]=fact[i-1]*i%MOD;
        invfact[i]=invfact[i-1]*inv[i]%MOD;
    }
}
long long C(int n,int k){
    return fact[n]*invfact[k]%MOD*invfact[n-k]%MOD;
}

int main(){
    PRE();
    ll n,a,b,k;
    cin>>n>>a>>b>>k;
    ll ans=0;
    for(ll i=0;i<=n;i++){
	ll j=k-(a*i);
	if(j%b>0||j<0)continue;
	j/=b;
	if(j<0||n<j)continue;
	ans+=C(n,i)*C(n,j);
	//cout<<"#"<<i<<" "<<j<<endl;
	ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++){
  	cin >> a.at(i);
  	b.at(i) = a.at(i);
  }
  
  sort(b.begin(), b.end());
  int f = b.at(n-1), s = b.at(n-2);
  for(int i = 0; i < n; i++){
  
  	if(a.at(i) == f) cout << s << endl;
  
  	else cout << f << endl;
  
  }
}

Measured memory_bytes: 3200
// Problem : B - An Odd Problem
// Contest : AtCoder - AIsing Programming Contest 2020
// URL : https://atcoder.jp/contests/aising2020/tasks/aising2020_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
int n;cin>>n;
int a[n],ans=0;
fr(i,0,n)
{
	cin>>a[i];
	if(i%2==0 && a[i]%2) ans++;
}
cout<<ans;
return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define loop(i,a,b) for(int i = a; i < b; i++)
#define rep(i,a) loop(i,0,a)


int main()
{	
	int n,a,b;
	cin>>n>>a>>b;
	
	int na=0;
	int nb=0;
	
	string s;
	cin>>s;
	
	int i = 0;
	while(s[i]!='\0'){
		switch(s[i]){
			case 'a': if(na+nb<a+b){
									cout<<"Yes"<<endl;
									na++;
									break;
			}
			case 'b': if(na+nb<a+b&&nb<b){
									cout<<"Yes"<<endl;
									nb++;
									break;
			}
			default: cout<<"No"<<endl;
		}
		i++;
	}
			
	return 0;
}



Measured memory_bytes: 1276
#include<stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  while(a!=0&&c!=0){
    c-=b;
    if(c<=0){break;}
    a-=d;
    if(a<=0){break;}
  }
  if(a>0){printf("Yes\n");}
  else{printf("No\n");}
  return 0;
}


Measured memory_bytes: 1660
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

const int N=100005;

int n,a[N],b[N],c[N];
LL ans;

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f; 
}

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]),c[i]=a[i]+b[i],ans-=b[i];
	std::sort(c+1,c+n+1);
	for (int i=n;i>=1;i-=2) ans+=c[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1408
{-# LANGUAGE CPP #-}
module Main where

import qualified Data.Vector.Unboxed as V 
import qualified Data.Map.Strict as M
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Char
import qualified Data.List as L

dump :: (Show a) => a -> IO()
#if __GLASGOW_HASKELL__ >= 800
dump x = print x
#else
dump _ = pure ()
#endif

-- "101010" -> [1,0,1,0,1,0]
readToList :: String -> [Int]
readToList [] = []
readToList (x:xs) = read [x] : readToList xs

 
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

-- "10 10 10" -> [10, 10, 10]
getList :: IO [Int]
getList = (fmap (read . BS.unpack) . BS.words) <$> BS.getLine

-- "10 10 10" -> [10, 10, 10]
getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readmat :: Int -> IO [[Int]]
readmat rows = replicateM rows getList

newtype UF a = UF (M.Map a a) deriving (Show) -- Map node parent

makeuf :: Int -> UF Int
makeuf n = let m = M.fromList $ zip [0..n] [0..n]
                in UF m

unionUF :: (Eq a, Ord a) => a -> a -> UF a -> UF a
unionUF l r uf@(UF m) = let lp = findUF l uf
                            rp = findUF r uf
                        in if lp == rp
                           then uf
                           else if size l uf < size r uf
                                then UF $ M.update (const $ Just rp) lp m
                                else UF $ M.update (const $ Just lp) rp m

findUF :: (Eq a, Ord a) => a -> UF a -> a
findUF x uf@(UF m) = let px = m M.! x
                      in if px == x
                         then px
                         else findUF px uf -- TODO 貼り直し

size :: (Eq a, Ord a) => a -> UF a -> Int
size x (UF m) = M.size $ M.filter (\par -> par==x) m

genbit :: Int -> [[Int]]
genbit 0 = []
genbit 1 = [[0],[1]]
genbit len = do
  x <- [0,1]
  map (x:) $ genbit (len-1)

base :: Int
base = 10 ^ 9 + 7

forn :: (Num a, Enum a, Monad m) => a -> (a -> m b) -> m [b]
forn x = forM [0..(x-1)]

count :: (Eq a) => a -> [a] -> Int
count y = length . filter (== y)

main :: IO()
main = do
  [a,b] <- getList
  if a <= 8 && b <= 8
     then putStrLn "Yay!"
     else putStrLn ":("


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;




int main(int argc, char *argv[])
{
	int n;
	int h, w;
	int ans;
	

	//input
	cin >> n;
	cin >> h;
	cin >> w;


	//calc
	ans = (n - h + 1) * (n - w + 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
X,Y,A,B,C = map(int,input().split())
r_l = list(map(int,input().split()))
b_l = list(map(int,input().split()))
n_l = list(map(int,input().split()))

r_l.sort(reverse=True)
b_l.sort(reverse=True)

a_l = r_l[:X] + b_l[:Y] + n_l
a_l.sort(reverse=True)
print(sum(a_l[:X+Y]))

Measured memory_bytes: 23328
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, a, b, x[114514];
signed main() {
	cin >> n >> a >> b;
	rep(i, n)cin >> x[i];
	int ok = mod, ng = 0;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		int cnt = 0;
		rep(i, n) {
			int y = max(0LL, x[i] - mid * b);
			if (!y)continue;
			cnt += (y - 1) / (a - b) + 1;
		}
		if (cnt <= mid)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}


Measured memory_bytes: 1024
#include <iostream>

typedef long long ll;

using namespace std;

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll na = (k % 2 ? k * (a + b + c) - a : (k - 1) * (a + b + c) + a);
    ll nb = (k % 2 ? k * (a + b + c) - b : (k - 1) * (a + b + c) + b);
    cout << (na - nb) << endl;
    return 0;
}


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

int main() {
  ll N,ans(0);
  cin >> N;
  vector <ll> A(N);
  for (int i(0);i<N;i++) cin>>A[i];
  sort(A.begin(),A.end());
  ll cnt(1);
  for (int i(1);i<N;i++) {
    if (A[i]==A[i-1]){
      cnt+=1;
    }else{
      if (cnt%2==1) ans+=1;
      cnt=1;
    }
  }
  if (cnt%2==1) ans+=1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define M 100009
int a[M],b[M],n,m,ans,p,x;
main(){
	cin>>n>>m;
	r(i,n-1)cin>>a[i];
	r(i,n)b[i+1]+=b[i]+a[i];
	r(i,m){
		cin>>x;
		if(x>0){
			ans+=b[p+x]-b[p];
			p=p+x;
		}else{
			ans+=b[p]-b[p+x];
			p=p+x;
		}
		ans%=100000;
	}
	cout<<ans%100000<<endl;
}

Measured memory_bytes: 3832
public class Main {


		public static void main(String[] args) {
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int a;
		int b;
		double c;
		a = scan.nextInt();
		b = scan.nextInt();
		c = (double)a/b;
		
		if(1<=a && a <=Math.pow(10, 9) && 1<=b && b <=Math.pow(10, 9)){
			System.out.print(a/b+" ");
			System.out.print(a%b+" ");
			System.out.println(String.format("%.5f", c));
			
		}
		
			




		}
}

Measured memory_bytes: 26436
# -*- coding: utf-8 -*-

import collections
import math


class Vector2(collections.namedtuple("Vector2", ["x",  "y"])):

    def __add__(self, other):
        return Vector2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Vector2(self.x - other.x, self.y - other.y)

    def __mul__(self, scalar):
        return Vector2(self.x * scalar, self.y * scalar)

    def __neg__(self):
        return Vector2(-self.x, -self.y)

    def __pos__(self):
        return Vector2(+self.x, +self.y)

    def __abs__(self):  # norm
        return math.sqrt(float(self.x * self.x + self.y * self.y))

    def __truediv__(self, scalar):
        return Vector2(self.x/scalar, self.y/scalar)

    def abs2(self):
        return float(self.x * self.x + self.y * self.y)

    def dot(self, other):  # dot product
        return self.x * other.x + self.y * other.y

    def cross(self, other):  # cross product
        return self.x * other.y - self.y * other.x


def getDistanceSP(segment, point):
    p = point
    p1, p2 = segment
    if (p2 - p1).dot(p - p1) < 0:
        return abs(p - p1)
    if (p1 - p2).dot(p - p2) < 0:
        return abs(p - p2)
    return abs((p2 - p1).cross(p - p1)) / abs(p2 - p1)


def getDistance(s1, s2):
    a, b = s1
    c, d = s2
    if intersect(s1, s2):  # intersect
        return 0
    return min(getDistanceSP(s1, c), getDistanceSP(s1, d), getDistanceSP(s2, a), getDistanceSP(s2, b))


def ccw(p0, p1, p2):
    a = p1 - p0
    b = p2 - p0
    if a.cross(b) > 0:
        return 1  # COUNTER_CLOCKWISE
    elif a.cross(b) < 0:
        return -1  # CLOCKWISE
    elif a.dot(b) < 0:
        return 2  # ONLINE_BACK
    elif abs(a) < abs(b):
        return -2  # ONLINE_FRONT
    else:
        return 0  # ON_SEGMENT


def intersect(s1, s2):
    a, b = s1
    c, d = s2
    return ccw(a, b, c) * ccw(a, b, d) <= 0 and ccw(c, d, a) * ccw(c, d, b) <= 0


def project(l, p):
    p1, p2 = l
    base = p2 - p1
    hypo = p - p1
    return p1 + base * (hypo.dot(base) / abs(base)**2)


class Circle():
    def __init__(self, c, r):
        self.c = c
        self.r = r


def getCrossPoints(c, l):
    pr = project(l, c.c)
    p1, p2 = l
    e = (p2 - p1) / abs(p2 - p1)
    base = math.sqrt(c.r*c.r - (pr - c.c).abs2())
    return [pr + e * base, pr - e * base]

if __name__ == '__main__':

    a, b, r = map(int, input().split())
    c = Circle(Vector2(a, b), r)
    n = int(input())
    res = []
    for _ in range(n):
        ps = list(map(int, input().split()))
        l = [Vector2(ps[0], ps[1]), Vector2(ps[2], ps[3])]

        ans = getCrossPoints(c, l)
        ans = sorted(ans, key=lambda x: (x.x, x.y))
        res.append(ans)
        
    for ans in res:
        print("{:.8f} {:.8f} {:.8f} {:.8f}".format(ans[0].x, ans[0].y, ans[1].x, ans[1].y))



Measured memory_bytes: 6192
import java.util.Scanner;

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

			int H = scan.nextInt();
			int W = scan.nextInt();

			if(H == 0 && W == 0) {
				break;
			}

			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 34284
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
		
const double eps = 1e-9;																							   
const long long INF = 1e18;																					   
const float PI = 3.14;																								   
typedef long long LL;																								   
																												   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< pair<LL, LL> , vector< pair<LL, LL> >, greater< pair<LL, LL> > > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   																							   																				   

#define endl '\n'
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb push_back 																						   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////



///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	int x1, x2, x3, x4, x5;
	cin >> x1 >> x2 >> x3 >> x4 >> x5;
	if(x1 == 0){
		cout << 1 << '\n';
	}
	else if(x2 == 0){
		cout << 2 << endl;
	}
	else if(x3 == 0){
		cout << 3 << endl;
	}
	else if(x4 == 0){
		cout << 4 << endl;
	}
	else if(x5 == 0){
		cout << 5 << endl;
	}
	
	
	
	
	
	

	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s1, s2, s3, s1s2s3 ;
  cin >> s1s2s3 ;
  s1 = s1s2s3 / 100 ;
  s2 = (s1s2s3 - s1*100 )/10 ;
  s3 = s1s2s3 - s1*100-s2*10 ;
  cout << s1+s2+s3 << endl;
}

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

int main(){
	string s,t;
	cin>>s>>t;
	
	bool judd=false;
	for(int i=s.size()-t.size();i>=0;--i){
		bool jud=true;
		REP(j,t.size()){
			if(s[i+j]!=t[j]&&s[i+j]!='?'){
				jud=false;
				break;
			}
		}
		if(jud){
			REP(j,t.size()) s[i+j]=t[j];
			judd=true;
			break;
		}
	}
	
	if(!judd){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	
	REP(i,s.size()){
		if(s[i]=='?') s[i]='a';
	}
	
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	int n=s.size();
	int m=t.size();
	int cnt=0,ans=INT_MAX;
	for(int i=0;i<n-m+1;i++){
		for(int j=0;j<m;j++){
			if(s[i+j]!=t[j])
			cnt++;
		}
		ans=min(ans,cnt);
		cnt=0;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3612
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

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

  int64_t H, W;
  cin >> H >> W;
  int64_t start_r, start_c;
  cin >> start_r >> start_c;
  start_r--, start_c--;
  int64_t goal_r, goal_c;
  cin >> goal_r >> goal_c;
  goal_r--, goal_c--;

  vector<vector<bool>> is_open(H, vector<bool>(W, false));
  for (int64_t r = 0; r < H; ++r) {
    string s;
    cin >> s;
    for (int64_t c = 0; c < W; ++c) {
      if (s[c] == '.') {
        is_open[r][c] = true;
      }
    }
  }

  using QQ = pair<int64_t, Pair>;
  priority_queue<QQ> q;
  vector<vector<int64_t>> distances(H, vector<int64_t>(W, kInf));
  vector<vector<bool>> visited(H, vector<bool>(W, false));

  auto Update = [&](const Pair target) -> void {
    if (visited[target.first][target.second]) {
      return;
    }
    visited[target.first][target.second] = true;
    for (int64_t d_row = -2; d_row <= 2; ++d_row) {
      const int64_t n_row = target.first + d_row;
      for (int64_t d_col = -2; d_col <= 2; ++d_col) {
        const int64_t n_col = target.second + d_col;
        const int64_t step = std::abs(d_row) + std::abs(d_col);
        int64_t d;
        if (step == 0) {
          d = -1;
        } else if (step == 1) {
          d = 0;
        } else {
          d = 1;
        }
        if (d >= 0 && n_row >= 0 && n_row < H && n_col >= 0 && n_col < W &&
            is_open[n_row][n_col]) {
          const int64_t next_distance =
              distances[target.first][target.second] + d;
          if (next_distance < distances[n_row][n_col]) {
            distances[n_row][n_col] = next_distance;
            q.emplace(QQ(-next_distance, Pair(n_row, n_col)));
          }
        }
      }
    }
  };

  distances[start_r][start_c] = 0;
  q.emplace(QQ(0, Pair(start_r, start_c)));
  while (!q.empty()) {
    const Pair next = q.top().second;
    q.pop();
    Update(next);
  }

  if (distances[goal_r][goal_c] == kInf) {
    cout << -1 << endl;
  } else {
    cout << distances[goal_r][goal_c] << endl;
  }
  return 0;
}


Measured memory_bytes: 12092
#include <stdio.h>

int main(void) {
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if((a<b&&b<c)||(a<=b&&b<c)||(a<b&&b<=c)){
		printf("%d %d %d\n",a,b,c);
	}else if((a<c&&c<b)||(a<=c&&c<b)||(a<c&&c<=b)){
		printf("%d %d %d\n",a,c,b);
	}else if((b<a&&a<c)||(b<=a&&a<c)||(b<a&&a<=c)){
		printf("%d %d %d\n",b,a,c);
	}else if((b<c&&c<a)||(b<=c&&c<a)||(b<c&&c<=a)){
		printf("%d %d %d\n",b,c,a);
	}else if((c<a&&a<b)||(c<=a&&a<b)||(c<a&&a<=b)){
		printf("%d %d %d\n",c,a,b);
	}else if((c<b&&b<a)||(c<=b&&b<a)||(c<b&&b<=a)){
		printf("%d %d %d\n",c,b,a);
	}else if(a==b==c){
		printf("%d %d %d\n",a,b,c);
	}
	return 0;
}

Measured memory_bytes: 596
//インクルード
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>

//型宣言
typedef long long ll;
typedef unsigned long long ull;
typedef std::string string;
typedef string answerType;

//変数宣言
ll N;
ll M;
std::vector<string> Ai;
std::vector<string> Bi;
std::vector<string> Si;
answerType answer;

//関数のプロトタイプ宣言
//入力の取得
void getInput();
//答えを求める
answerType calcAnswer();

//メイン関数
int main() {
	//入力の取得
	getInput();

	//答え
	answerType answer = calcAnswer();

	//答えの出力
	std::cout << answer << std::endl;

	//正常終了
	return EXIT_SUCCESS;
}

//入力の取得
void getInput() {
	string temp;
	std::getline(std::cin, temp);

	string temp2;
	std::istringstream stream(temp);
	while(getline(stream, temp2, ' ')) {
		Si.push_back(temp2);
	}
}

//答えを求める
answerType calcAnswer() {
	string temp = "";
	for(ll i=0; i<Si.size(); ++i) {
		temp += toupper(Si[i].at(0));
	}
	return temp;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long int a,b,n;
    long long int t=0;
    vector < tuple<long long int,long int,long int> > dish;
    cin >> n;
    for(long int i=0;i<n;i++){
        cin >> a >> b;
        dish.push_back(make_tuple(a+b,a,b));
    }
    sort(dish.begin(),dish.end(),greater< tuple<long long int,long int, long int>>());
    for(long int i=0;i<n;i++){
        //cout << get<0>(dish[i]) << " "<<get<1>(dish[i]) <<" "<< get<2>(dish[i]) << endl;
        if(i%2==1){
            t-=get<2>(dish[i]);
        }else{
            t+=get<1>(dish[i]);
        }
    }
    cout << t << endl;

    return 0;
}

Measured memory_bytes: 4980
#include<stdio.h>
int k[100];
int main(void){
    int n,i;
    int num=0;
    scanf("%d",&n);
    while(n--){
        k[n]=1;
    }
    scanf("%d",&n);
    while(n--){
        scanf("%d",&i);
        k[i-1]=0;
    }
    scanf("%d",&n);
    while(n--){
        scanf("%d",&i);
        k[i-1]=1;
    }
    scanf("%d",&n);
    while(n--){
        scanf("%d",&i);
        if(k[i-1]){
            num++;
        }
    }
    printf("%d\n",num);
    return 0;
}


Measured memory_bytes: 2112
import java.util.*;

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

        if (n == 0) {
            System.out.println((m * m - m) / 2);
        }else if(m == 0){
            System.out.println((n * n - n) / 2);
        }else {
            int resultn = ((n * n - n) / 2);
            int resultm = ((m * m - m) / 2);
            System.out.println(resultm + resultn);
        }
    }
}

Measured memory_bytes: 23764
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(A*B);
    }

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


Measured memory_bytes: 35848
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;
 
 
int main()
{
  int s,w;
  scf(s),scf(w);
 
  if(s<=w)
  printf("unsafe\n");

  else
  printf("safe\n");



  
    
      
}

Measured memory_bytes: 3760
#include <iostream>
#include <iomanip>

using namespace std;

int main(){
    long long int w,h,x,y,ans = 0;
    long double area = 0.0;

    cin >> w >> h >> x >> y;

    if(w%2 == 0 && h%2 == 0 && w/2 == x && h/2 == y){
        ans = 1;
    }

    area = (w*h)/2.0;

    cout << fixed << setprecision(12) << area << " " << ans << endl;


    return 0;
}

Measured memory_bytes: 256
//#line 2 "SubstringQueries.cpp"

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N;
LL sum;
LL small = 123456789012LL;

int main() {
	cin >> N;

	for (int i = 0; i < N; i++) {
		LL tmp;
		cin >> tmp;
		sum += tmp;
		small = min(small, tmp);
	}
	if (N % 2) {
		cout << (sum % 2 ? "First" : "Second") << endl;
	}
	else {
		sum -= small * N;
		if (sum % 2 == 0 && small % 2 == 0) {
			cout << "Second" << endl;
		}
		else {
			cout << "First" << endl;
		}
	}
	return 0;
}


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

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    string s = sread();
    foreach (c; s)
        if (c == '1')
        {
            write('9');
        }
        else if (c == '9')
        {
            write('1');
        }
        else
        {
            write(c);
        }
    writeln();
}


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

int main()
{
	string A,B;
	int a,ans = 0;

	cin >> A >> B;

	A += B;
	
	a = stoi(A);

	for (int i = 1; i <= a / 2; i++) {
		if (i*i == a) {
			ans = 1;
			break;
		}
	}

	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    vector<int> broken(n+1);
    rep(i, m) {
        int a;
        cin >> a;
        broken[a] = 1;
    }

    vector<int> dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    if(broken[1]) {
        dp[1] = 0;
    }

    for(int i = 2; i <= n; i++) {
        if(broken[i]) {
            continue;
        }

        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= mod;
    }

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

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define INF 1000000007
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2)*pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
signed main() {
	int n, m, k;
	cin >> n >> m >> k;
	rep(i, n + 1) {
		rep(j, m + 1) {
			if ((n - i)*j + (m - j)*i == k){
			cout << "Yes" << endl; ggr;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
using namespace std;
 
typedef long long ll;

int main(){
	int a,b,c;
    cin >> a >> b >>c;
    if(a*c <=b){
    	cout << c<<endl; 
    }else{
    	cout << b/a <<endl;
    }
}

Measured memory_bytes: 256
#[allow(unused)]
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let mut nodes: Vec<(isize, isize)> = Vec::new();
    for _ in 0..n {
        let v_i = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_right().to_owned();
            let mut ws = s.split_whitespace();
            let a = ws.next().unwrap().parse().unwrap();
            let b = ws.next().unwrap().parse().unwrap();
            (a, b)
        };
        nodes.push(v_i)
    }

    let mut sum: f64 = 0f64;
    for i in (0..n) {
        for j in (0..n) {
            sum += distance(&nodes[i], &nodes[j]);
        }
    }

    println!("{}", sum / (n as f64));
}

fn distance(a: &(isize, isize), b: &(isize, isize)) -> f64 {
    (((a.0 - b.0).pow(2) + (a.1 - b.1).pow(2)) as f64).sqrt()
}


Measured memory_bytes: 4352
#include <stdio.h>
 
int main() 
{
	int num = 0;
	scanf("%d",&num);
	if ( num <= 111 )
	{
		printf("111");
	}
	else if ( num <= 222 )
	{
		printf("222");
	}
	else if ( num <= 333 )
	{
		printf("333");
	}
	else if ( num <= 444 )
	{
		printf("444");
	}
	else if ( num <= 555 )
	{
		printf("555");
	}
	else if ( num <= 666 )
	{
		printf("666");
	}
	else if ( num <= 777 )
	{
		printf("777");
	}
	else if ( num <= 888 )
	{
		printf("888");
	}
	else if ( num <= 999 )
	{
		printf("999");
	}
	
	return 0;
	 
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#define mod 998244353;
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    int size=*max_element(v.begin(),v.end());
    vector<int> index(size+1,0);
    for(int i=0;i<n;i++)
    {
        index[v[i]]++;
    }
    if(v[0]!=0||index[0]!=1)
    {
        cout<<"0";
        return 0;
    }
    long long int sum=1;
    for(int i=2;i<index.size();i++)
    {
        for(int j=0;j<index[i];j++)
        {
            sum*=index[i-1];
            sum%=mod;
        }
    }
    cout<<sum;
}

Measured memory_bytes: 1024
/*
[caddi2018] D - Harlequin
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 1e5;

int N;
int a[MAX_N];

bool solve() {
    int x = 0;
    for (int i = 0; i < N; i++) {
        x += a[i] % 2;
    }
    return x != 0;
}

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

    cout << (solve() ? "first" : "second") << endl;

    return 0;
}


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

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

unsigned long ans, H, W;

void solve(){
    if(H == 1 || W == 1){
        ans = 1;
    } else if (W % 2 == 0 || H % 2 == 0){
        ans = W * H / 2;
    } else {
        ans = W * (H-1) / 2;
        ans += (W+1) / 2;
    }

    cout << ans << endl;
}

int main(){
    cin >> H >> W;

    solve();
}


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

int main() {
	ll n;
	cin >> n;
	vector<ll> h(n);
	bool is_stair = true;
	rep(i,n) {
		cin >> h[i];
	}
	for (ll i=n-1;i>0;i--) {
		if (h[i] < h[i-1]) h[i-1]--;
		if (h[i] < h[i-1]) is_stair = false;
	}
	if (is_stair) cout << "Yes";
	else cout << "No";
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;
const ll MAX = 3030;

long long fac[MAX], finv[MAX], inv[MAX];

ll dp[MAX][MAX];

bool comp_p(const pll& l, const pll& r) {
	return l.first > r.first;
}

int main() {
	ll i, j;
	ll N, T;
	cin >> N >> T;
	vector<pll> AB;
	for (i = 0; i < N; i++) {
		ll a, b;
		cin >> a >> b;
		AB.push_back(pll(a, b));
	}
	sort(AB.begin(), AB.end(), comp_p);

	for (i = 0; i < MAX; i++) {
		dp[0][i] = 0;
	}
	for (i = 1; i < MAX; i++) {
		dp[i][0] = AB[0].second;
	}
	for (j = 1; j < N; j++) {
		for (i = 1; i <= T; i++) {
			dp[i][j] = max(dp[i][j - 1], dp[max(0LL, i - AB[j].first)][j - 1] + AB[j].second);
		}
	}
	cout << dp[T][N - 1] << endl;

	return 0;
}


Measured memory_bytes: 72064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		if(n == 0){
			System.out.println(0);
			return;
		}

		String result = "";


		int count = 0;
		while(n != 0){
			if(n % 2 != 0){
				result = "1" + result;

				if(count %2 == 0){
					n--;
				}
				else {
					n++;
				}
			}
			else {
				result = "0" + result;
			}

			count++;
			n /= 2;
		}

		System.out.println(result);
	}

}


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

int main() {
  int n,k;
  cin>>n>>k;
  int p[n];
  int64_t c[n];
  for(int i=0; i<n; i++) cin>>p[i];
  for(int i=0; i<n; i++) cin>>c[i];


  int64_t ans = 0;
  for(int i=0; i<n; i++) {
    int64_t tmpmax = 0;
    int64_t score = 0;
    int times = 0;
    int posi = i;
    bool ticket = true;
    while(ticket) {
      posi = p[posi]-1;
      score += c[posi];
      tmpmax = max(tmpmax, score);
      times++;

      if(times==k) {
        ans = max(tmpmax, ans);
        break;
      }

      if(i==posi) {
        if(score<=0) {
          ans = max(tmpmax, ans);
          break;
        }
        score = score*(k/times-1);
        times = (k/times-1)*times;
        tmpmax = score;
        while(true) {
          posi = p[posi]-1;
          score += c[posi];
          tmpmax = max(tmpmax, score);
          times++;
          if(times==k) {
            ans = max(tmpmax, ans);
            ticket = false;
            break;
          }
        }
      }
    }
  }

  if(ans==0) ans = (int64_t)(*max_element(c, c+n));

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3636