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


#define mod 1000000007
#define ull unsigned long long int
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<ll,ll>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return true; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

ll ncr(int n, int k)  
{  
	if(k>n)return 0;
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
} 
  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
#define  deb(x)       cout << '>' << #x << ':' << x << endl;

void  solve()
{
	int a,b;
	cin>>a>>b;
	string s1="",s2="";
	forn(i,b)s1+=to_string(a);
	forn(i,a)s2+=to_string(b);
	if(s1>s2)cout<<s2<<endl;
	else cout<<s1<<endl;
}


int main()
{

    FastIO;
    ll t=1;
   	//cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int p = 0;

    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                int n = 500 * i + 100 * j + 50 * k;
                if (n == x) ++p;
            }
        }
    }

    cout << p << endl;
}


Measured memory_bytes: 256
import math
a= input()
length=math.floor(len(a)/2)
def kaibun(p):
    length_p=math.floor(len(p)/2)
    total_p = 0
    for i in range(length_p):
        if p[i] is not p[-1*i -1]:
            return False
            break
        else:
            total_p += 1
        if total_p == length_p:
            return True
if kaibun(a):
    if kaibun(a[:length]):
        print('Yes')
    elif length==1:
        print('Yes')
    else:
        print('No')
else:
    print('No')

 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ll x,d,y,n,count=0;
    
    cin>>n>>d;
    
    while(n--){
        cin>>x>>y;
        if((x*x)+(y*y)<=d*d) count++;
    }
    cout<<count<<'\n';

    return 0;
}

Measured memory_bytes: 3616
import java.util.*;

public class Main {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> arr = new ArrayList<>();

        int max = Integer.MIN_VALUE, maxId = -1;
        int min = Integer.MAX_VALUE, minId = -1;
        for (int i = 0; i < n; i++) {
            int m = sc.nextInt();
            arr.add(m);

            if (m > max) {
                max = m;
                maxId = i;
            }
            if (m < min) {
                min = m;
                minId = i;
            }
        }

        int id = Math.abs(max) - Math.abs(min) > 0 ? maxId : minId;

        System.out.println(2 * n - 2);

        for (int i = 0; i < n; i++) {
            if (i != id) {
                System.out.println(String.format("%d %d", id + 1, i + 1));
            }
        }

        if(Math.abs(max) - Math.abs(min) > 0) {
            for (int i = 0; i < n - 1; i++) {
                System.out.println(String.format("%d %d", i + 1, i + 2));
            }
        } else {
            for (int i = n - 1; i > 0; i--) {
                System.out.println(String.format("%d %d", i + 1, i));
            }

        }
    }

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

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<long long> a(1000001,0);
  for(int i = 0; i < n; i++){
    int x; cin >> x;
    if(x>=1)a[x-1]++;
    a[x]++;
    a[x+1]++;
  }
  long long max_num = 0;
  for(int i = 0; i < a.size(); i++)
    max_num = max(max_num,a[i]);  
  
  cout << max_num << endl;
}

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


int main() {

  int64_t n;
  cin>>n;


  int cnt=0;
  for(int i=1;i<=n;i++){
    int a;
    cin>>a;

    if(a%2==1&&i%2==1)
      cnt++;
  }


  cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 3560
use std::collections::HashSet;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        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,
        d: [usize; n],
    }

    let available_mochi: HashSet<&usize> = d.iter().collect();

    println!("{}", available_mochi.len());
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int s = 0;
    cin >> s;

    map<int, bool> mp;

    mp[s] = true;

    int i = s;

    int res = 2;

    while (true)
    {
        int f;
        if (i % 2)
            f = 3 * i + 1;
        else
            f = i / 2;

        if (mp[f])
        {
            cout << res << endl;
            return 0;
        }

        mp[f] = true;
        res++;
        i = f;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define st first
#define sc second
#define arr array

using namespace std;
const ll mod = 1e9 + 7;
const int e = 2e5 + 79;
const int maxn = 2e6 + 69;

ll inv[maxn], maxx[maxn], dp[maxn];
int n, m;

ll Pow(ll a, ll b)
{
    if(b == 0) return 1;
    if(b == 1) return a%mod;
    ll t = Pow(a, b/2)%mod;
    if(b%2 == 0) return (t%mod*t%mod)%mod;
    else return ((t%mod*t%mod)%mod*a%mod)%mod;
}

ll calc(ll a, ll b)
{
    return ((dp[a]%mod*inv[b]%mod)%mod*inv[a-b]%mod)%mod;
}

int main()
{
    dp[0] = 1;
    dp[1] = 1;
    inv[0] = 1;
    for(int i=1; i<=maxn; i++){
        dp[i] = (dp[i-1]%mod*i)%mod;
        inv[i] = Pow(dp[i], mod - 2)%mod;
    }
    int k;
    cin >> k;
    string s;
    cin >> s;
    ll ans = 0;
    for(int i=0; i<=k; i++){
        ans = (ans + (Pow(25, k-i)%mod*Pow(26, i)%mod)%mod*calc(s.size()+k - 1 - i, s.size() -1)%mod)%mod;
    }
    cout << ans;

}
/*
8 1 2
-1 3 -2 5 3 -5 2 2
*/


Measured memory_bytes: 36592
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,x = 0,ma = 0;
	string s;
	cin >> n >> s;
	for(int i = 0;i < n;i++){
		if(s[i] == 'I') x++;
		else x--;
		ma = max(ma,x);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
T = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    if not a <= b:
        a, b = b, a
    T[a-1].append(b-1)

dp = [0]*(N+1)
for i in range(N):
    dp[i+1] = max(dp[i+1], dp[i])
    for j in T[i]:
        dp[j] = max(dp[i]+1, dp[j])
print(dp[N])


Measured memory_bytes: 18736
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pd(x) cerr<<"//"<<(x)<<endl;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,g,h,i,j,k,w,ok,ng,l,q;
ll x[500005],y[500005],z[500005];
char s[500005],t[500005];
bool flag,dame;

int main(){
    cin >> n;
	if(n % 2 == 1){
		num = (n - 1) / 2; 
		for(i=1;i<=n-1;i++){
			x[i] = i;
			if(i > num){
				x[i] = n - i;
			}
		}
		x[n] = num + 1;
		for(i=1;i<=n;i++){
			for(j=1;j<i;j++){
				if(abs(x[i] - x[j]) == 1 || abs(x[i] - x[j]) == num){
					y[ans] = i;
					z[ans] = j;
					ans++;
				}
			}
		}
	}else{
		num = n / 2;
		for(i=1;i<=n;i++){
			x[i] = i;
			if(i > num){
				x[i] = n + 1 - i;
			}
		}
		for(i=1;i<=n;i++){
			for(j=1;j<i;j++){
				if(abs(x[i] - x[j]) == 1 || abs(x[i] - x[j]) == num - 1){
					y[ans] = i;
					z[ans] = j;
					ans++;
				}
			}
		}
	}
	p(ans);
	for(i=0;i<ans;i++){
		pe(y[i]);p(z[i]);
	}



	//p(ans);
	return 0;
}

Measured memory_bytes: 28160
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    ll n,m,k;
    cin >> n>>m>>k;
    vector<ll> A(n+1);
    vector<ll> B(m+1);
    A[0]=0;
    B[0]=0;
    rep(i,1,n+1){
        ll a;
        cin >> a;
        A[i]=A[i-1]+a;

    }
    rep(i,1,m+1){
        ll b;
        cin >> b;
        B[i]=B[i-1]+b;
    }
    ll ans = 0;
    ll check = m;
    rep(i,0,n+1){
        if(A[i]>k){
            break;
        }else{
            ll max_i;
            
            while(A[i]+B[check]>k&&check>=0){
                    
                check--;
            }
                //assert(check>=0);
            max_i = i+check;

            
            ans = max(ans,max_i);
        }
    }
    cout<<ans<<endl;

  return 0;

}

Measured memory_bytes: 6440
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vl = vector<ll>; using vvl = vector<vl>;
using vc = vector<char>; using vvc = vector<vc>;
using vp = vector<pair<int,int>>;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
const ll INF = 9223372036854775807;

int main(){
  int n,x,t;cin >> n >> x >> t;
  int a = n/x;
  if(n%x) a++;
  cout << a*t << endl;
}

Measured memory_bytes: 3648
#読み込み部
N, u, v = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N-1)]

#グラフ作成部
graph = [[] for i in range(N+1)]
for i,j in AB:
    graph[i].append(j)
    graph[j].append(i)

#深さ優先探索
def dfs(v):
    dist = [-1] * (N+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist

DU,DV = dfs(u),dfs(v)
 
answer = 0
for u,v in zip(DU[1:],DV[1:]):
    if u < v:
        x = v - 1
        if answer < x:
            answer = x

print(answer)

Measured memory_bytes: 43500
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <cstring>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef long double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<LL> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))

const LD PI = acos(-1.0);
const LD EPS = 1e-9;
const LL INF = 1e9;
const LL mod = 1000000007;
const LL LINF = 1e18 + 10;
const LL MAX = 1e5 + 1;

int n;
int m;
VI g[MAX];
int ye = 0;
int path[MAX];
char used[MAX];

void dfs(int v)
{
	used[v] = 1;
	path[ye++] = v;
	for (auto i : g[v])
		if (used[i] == 0)
		{
			dfs(i);
			return;
		}
}

bool solve(int v)
{
	ye = 0;
	memset(used, 0, sizeof(used));
	used[v] = 1;
	if (SZ(g[v]) == 1)
	{
		path[ye++] = v;
		dfs(g[v][0]);
		return 1;
	}

	path[ye++] = v;
	dfs(g[v][0]);
	for (auto i : g[v])
		if (used[i] == 0)
			return 0;

	return 1;
}

int cmp(int x, int y)
{
	return SZ(g[x]) < SZ(g[y]);
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> n >> m;
	int u, v;
	FOR(i, 0, m)
	{
		cin >> u >> v;
		--u; --v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	if (n == 2)
	{
		cout << 2 << endl << 1 << " " << 2;
		return 0;
	}

	bool x;
	VI all;
	FOR(i, 0, n)
		all.push_back(i);

	sort(ALL(all), cmp);
	srand(time(NULL));
	int best = 0;
	while (best < 100)
	{
		x = solve(all[best]);
		if (x)
			break;

		best++;
	}

	cout << ye << endl;
	FOR(i, 0, ye)
		cout << path[i] + 1 << " ";
	cin >> n;
	return 0;
}

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

using namespace std;

int main()
{
    int n, k, cnt = 0, x;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        if (x >= k) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Atime = [0]
Btime = [0]

idxA = 0
for a in A:
    Atime.append(a+Atime[idxA])
    idxA += 1

idxB = 0
for b in B:
    Btime.append(b+Btime[idxB])
    idxB += 1

ans,j = 0,M
for i in range(N+1):
    if Atime[i] > K:
        break
    while Btime[j] > K - Atime[i]:
        j -= 1
    
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 134268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T> >;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

void pr(bool f){
    cout << (f ? "YES" : "NO") << endl;
    exit(0);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, a, b, c;
    cin >> n >> a >> b >> c;
    ll d;
    cin >> d;
    b -= a;
    a = 0;
    for(ll i = -d*(n-1); i <= c*(n-1); i += d+c){
        if(i <= b && b <= i + (d-c)*(n-1)) pr(1);
    }
    pr(0);
    return 0;
}

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

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

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

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  // 山1に降った雨量を0と仮定し、矛盾が起きた箇所との差分を補えば良い
  ll rain[N];
  rain[0] = 0;
  rain[1] = (a[0] - rain[0]) * 2;
  for (int i = 2; i < N; i++) {
    rain[i] = (a[i-1] - rain[i-1] / 2) * 2;
  }

  int diff = -1;
  for (int i = 1; i < N; i++) {
    if ((rain[i-1] + rain[i]) / 2 != a[i-1]) {
      diff = a[i-1] - (rain[i-1] + rain[i]) / 2;
      break;
    }
  }
  if ((rain[0] + rain[N-1]) / 2 != a[N-1]) {
    diff = a[N-1] - (rain[0] + rain[N-1]) / 2;
  }

  if (diff != -1) {
    for (int i = 0; i < N; i++) {
      if (i % 2 == 0) rain[i] += diff;
      else rain[i] -= diff;
    }
  }

  for (int i = 0; i < N; i++) {
    cout << rain[i] << " ";
  }
  cout << endl;
  return 0;
}


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

int main() {
long N;
long M;
long a = 0;

cin >> M >> N;

if(N/2 < M){
  a = N / 2;
}
else{
  if(N - M * 2 > 3){
    M = M + (N - M * 2) / 4;
  }
  a = M;
}
cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  double n, k;

  cin >> n >> k;

  double p = 0;
  for (int i = 1; i <= n; i++){
    if (k > i)
      p += 1.0 / n * pow(.5, ceil(log(k/i)/log(2)));
    else
      p += 1.0 / n;
  }


  printf("%.10lf\n", p);

  return 0;
}


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

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

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll h, w, k;
  cin >> h >> w >> k;

  vs c(h);
  rep(i, h) {
    cin >> c[i];
  }

  ll ans = 0;

  ll nptn_h = 1 << h;
  ll nptn_w = 1 << w;

  rep(ph, nptn_h) {
    rep(pw, nptn_w) {
      ll cnt = 0;
      rep(y, h) {
        if ((bit(y) & ph) == 0) {
          continue;
        }
        rep(x, w) {
          if ((bit(x) & pw) == 0) {
            continue;
          }
          if (c[y][x] == '#')
            cnt++;
        }
      }
      if (cnt == k) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int N, K;
    cin >> N >> K;

    int cnt = 0;
    rep(i, N)
    {
        int h;
        cin >> h;
        if (h >= K)
            cnt++;
    }

    cout << cnt << endl;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

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

    vector<i64> l(n), r(n);
    map<i64, i64> fvl, fvr;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        l[i] = i + a;
        r[i] = i - a;
        fvl[l[i]]++;
        fvr[r[i]]++;
    }

    i64 ct = 0LL;
    for (auto &&kv : fvl)
    {
        if (fvr.find(kv.first) != fvr.end())
        {
            ct += kv.second * fvr[kv.first];
        }
    }

    cout << ct << endl;

    return 0;
}

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

using namespace std;

int main(int argc, char const *argv[]) {
	int n,a,b;
	int ans = 0;
	std::cin >> n >> a >> b;

	for (size_t i = 1; i <= n; i++) {
		int keta = 0;
		int num = i;
		int dig;
		while (num != 0) {
			dig = num % 10;
			keta += dig;
			num /= 10;
		}
		if (a <= keta && keta <= b) {
			ans += i;
		}
	}

	std::cout << ans << '\n';
	return 0;
}


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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<int, int> P;

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

int h, w;

bool inside(int x, int y) {
    return (0 <= x) && (x <= w-1) && (0 <= y) && (y <= h-1);
}

int main(){
    cin >> h >> w;

    int ans = 0;
    string a[h];
    queue<P> que;

    REP(i, h) cin >> a[i];
    REP(i, h) REP(j, w) if(a[i][j] == '#') que.push(P(i, j));

    while(1){
        int s = que.size();

        REP(i, s) {
            P top = que.front();
            que.pop();

            REP(j, 4) {
                int x = top.second + dx[j];
                int y = top.first + dy[j];
                if(inside(x, y) && a[y][x] == '.') {
                    a[y][x] = '#';
                    que.push(P(y, x));
                }
            }
        }

        if(!que.size()) break;

        ans++;
    } 

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9488
#include <bits/stdc++.h>
#define int long long int
#define MAX 1000007
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve() {
	int a, b, k;
	cin >> a >> b >> k;
	int t = a;
	a = a - min(a, k);
	k = k - min(t, k);
	if(k > 0) {
		b = b - min(b, k);
	}
	cout << a << " " << b;
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

int main()
{

    int N;
    cin >> N;

    unsigned int a[N];
    map <int, int>  m;

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

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

    if ( m.size() == 1 ) {
        if ( m.begin()->first == 0 ) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if ( m.size() == 2 ) {
        if ( m.begin()->first == 0 && m.begin()->second == N/3 ) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if ( m.size() == 3 ) {
        int x = 0;
        for ( auto y : m ) {
            x ^= y.first;
            if ( y.second != N/3 ) {
                cout << "No" << endl;
                return 0;
            }
        }
        if ( x == 0 ) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 4224
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	long long int a[1000], b[1000], c[1000];
	for (int i = 0; i < x; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < y; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < z; i++) {
		cin >> c[i];
	}
	long long int ab[1000000];
	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			ab[i * y + j] = a[i] + b[j];
		}
	}
	sort(c, c + z);

	long long int l = 0, r = (long long int)pow(10, 10) * 3000 + 1;
	while (r - l > 1) {
		long long int mid = (l + r) / 2;
		int cnt = 0;
		for (int i = 0; i < x * y; i++) {
			cnt += z - (lower_bound(c, c + z, mid - ab[i]) - c);
		}
		if (cnt >= k)
			l = mid;
		else
			r = mid;
	}

	vector<long long int> ans;
	for (int i = 0; i < x * y; i++) {
		for (int j = z - 1; j >= 0; j--) {
			if (ab[i] + c[j] < l + 1) break;
			ans.push_back(ab[i] + c[j]);
		}
	}
	while (ans.size() < k) ans.push_back(l);
	sort(ans.begin(), ans.end());
	reverse(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 8192
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <assert.h>

#define LL long long int
#define MOD 1000000007
#define N 101
using namespace std;

void solve() {
	
	string s,t;
	cin >> s;
	int n,i,j,xchg=-1;
	n=s.length();
	if (n<26) {
		int occ[26]={0};
		for (i=0;i<n;i++) occ[s[i]-'a']++;
		for (i=0;i<26;i++) if (occ[i]==0) break;
		t=(char)('a'+i);
		s+=t;
		cout << s << '\n';
		return;
	}
	for (i=n-2;i>=0;i--) {
		if (s[i]<s[i+1]) break;
	}
	if (i<0) {
		cout << "-1\n";
		return;
	}
	for (j=i+1;j<n;j++) if (s[j]>s[i])
		if (xchg==-1||s[j]<s[xchg]) xchg=j;
	s[i]=s[xchg];
	cout << s.substr(0,i+1) << '\n';
}
int main() {
	int t=1;
	//cin >> t;
	while(t--) solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef pair <int,int> pii;
typedef vector <pii> vpii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef long long int lli;
typedef vector <lli> vlli;
typedef vector <vlli> vvlli;
typedef vector <string> vs;
typedef vector <bool> vb;

#define rep(i, n) for( i = 0; i < (n); ++i)
#define repA(i, a, n) for( i = a; i <= (n); ++i)
#define repD(i, a, n) for( i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sortr(x) sort(x.begin(),x.end(),greater <int> ())
#define mod 1000000007
#define ff first
#define ss second
#define fill(a,c)  memset(a, c, sizeof (a))
#define formap(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.first<<" , "<<it.second<<endl;} cerr<<endl
#define PI  3.14159265358979323846
#define pb push_back

int N=100001;



int main() {
	cin.sync_with_stdio(0);cin.tie(0);
    cin.exceptions(cin.failbit);
    
    int i,j,k,n,x=0;
    cin>>n;
    vi a(n),ans(n);
    rep(i,n){
        cin>>a[i];
        x=x^a[i];
    }
    rep(i,n){
        ans[i]=x^a[i];
    }
    rep(i,n)cout<<ans[i]<<" ";
    
    
    
    
   
   
    
    
   
   
   
   
   
   
	return 0;
}


Measured memory_bytes: 4776
import java.util.Scanner;

public class Main {

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

        String[] substr = str.split(" ", 0);

        //System.out.println(str);
        //System.out.println(substr[0]);
        //System.out.println(substr[1]);
        int a = Integer.parseInt(substr[0]);
        int b = Integer.parseInt(substr[1]);
        if (a == b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        scan.close();
    }

}

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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> testimony(n, vector<int>(n, -1));
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        for (int j = 0; j < a; j++) {
            int x, y;
            cin >> x >> y;
            x--;
            testimony[i][x] = y;
        }
    }
    int ans = 0;
    for (int i = 0; i < (1 << n); i++) {
        bitset<15> bit(i);
        bool flag = true;
        for (int j = 0; j < n && flag; j++) {
            if (!bit[j]) continue;
            for (int k = 0; k < n; k++) {
                if (testimony[j][k] == -1) continue;
                if (bit[k] != testimony[j][k]) {
                    flag = false;
                    break;
                }
            }
        }
        if (flag) ans = max(ans, (int)bit.count());
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
arrA = list(map(int,input().split()))

bunsi = 1
for i in arrA:
    bunsi *= i

bunbo = 0
for i in arrA:
    bunbo += bunsi/i

ans = bunsi/bunbo

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
import java.util.Scanner

/**
 * Created by sonetsuyoshi on 2015/12/16.
 */

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val m = sc.nextInt

  val connected = Array.ofDim[Boolean](n,n)
  val visited = Array.ofDim[Boolean](n)

  val ids = 0.until(n)

  for(i <- 0 until m) {
    val a = sc.nextInt - 1
    val b = sc.nextInt - 1
    connected(a)(b) = true
    connected(b)(a) = true
  }

  run()

  def run(): Unit = {
    visited(0) = true
    val ans = search(0)
    println(ans)
  }

  def search(id: Int): Int = {
    val adjs = ids.filter(i => connected(id)(i) && !visited(i))

    if(adjs.size == 0) {
      if(visited.forall(x => x)) 1
      else 0
    } else {
      adjs.foldLeft(0){(s, i) => {
        visited(i) = true
        val s1 = s + search(i)
        visited(i) = false
        s1
      }}
    }
  }
}


Measured memory_bytes: 28604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string color[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
    int colornum[8][3]={{0,0,0},{0,0,255},{0,255,0},{0,255,255},{255,0,0},{255,0,255},{255,255,0},{255,255,255}};
    int value[200]={};
    for(int i=0;i<10;i++)value['0'+i]=i;
    for(int i=0;i<6;i++)value['a'+i]=10+i;
    string str;
    while(cin>>str&&str!="0"){
        int num[3];
        for(int i=0;i<3;i++)num[i]=value[str[1+2*i]]*16+value[str[2+2*i]];
        int ans[8]={};
        for(int i=0;i<8;i++)
            for(int j=0;j<3;j++)
                ans[i]+=pow(colornum[i][j]-num[j],2);
        int co=0;
        for(int i=1;i<8;i++)if(ans[co]>ans[i])co=i;
        cout<<color[co]<<endl;
    }
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
//////////////////////////////////

int main() {
    long long n; cin >> n;
    long long ans = n * (n-1) / 2;
    cout << ans << endl;

    return 0;
}

// EOF


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

int main() {
    
    long long int n,req;
    cin>>n>>req;
    vector<int> v(n),w(n);
    for(int i=0;i<n;i++)
        cin>>w[i]>>v[i];
    
    vector<vector<long long int>> dp(2,vector<long long int>(1000007,INT_MAX));
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        
        for(int j=0;j<1000007;j++) dp[i%2][j]=INT_MAX;
        
        
        for(int j=0;j<1000007;j++){
            // dp[i%2][j]=min(dp[i%2][j]);
            if(j>=v[i-1])
                dp[i%2][j]=min({dp[!(i%2)][j-v[i-1]]+w[i-1],dp[!(i%2)][j]});
            else
                dp[i%2][j]=dp[!(i%2)][j];
            
        }
    }
    int ans;
    for(int j=0;j<1000007;j++){
        if(dp[n%2][j]<=req) ans=j;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 26756
/**
 * File    :  B2.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-8-12 14:15:13
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  int N;
  cin >> N;
  for (auto i = 0; i < 100; i++)
  {
    for (auto j = 0; j < 100; j++)
    {
      if (N == i * 4 + j * 7)
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

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



int main(){

	int W,H;

	for (;;){
		cin >> W >> H;
		if (W == 0 && H == 0)
			break;

		for (int i = 0; i < W; i++){
			for (int j = 0; j < H; j++){
				cout << "#";
			}
			cout << endl;
		}cout << endl;
	
	}





	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(), v.end(), greater<>());
    v[0]/=2;
    cout << accumulate(v.begin(), v.end(), 0) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	vector<int> p(N);
	rep(i, N) cin >> p[i];
	int cnt = 0;
	rep(i, N) {
		if((i+1)!=p[i]) cnt++;
	}

	if(cnt<=2) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	
  return 0;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
p_list = list(map(int, input().split()))
all_list = range(0, 151)

not_p_list = list(set(all_list)-set(p_list))
ans_list = []

if N == 0:
    print(X)
else:
    for i in not_p_list:
        j = abs(i - X)
        ans_list.append(j)

    # print(ans_list)

    ans = min(ans_list)
    minus_ans = -1 * ans

    #print(ans, minus_ans)

    if (minus_ans + X) in not_p_list:
        print(minus_ans + X)
    else:
        print(ans + X)


Measured memory_bytes: 61904
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;

int A,B,C;
int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B >> C;

    if(A*C <= B){
        cout << C << endl;
    }else{
        cout << int(B/A) << endl;
    }

    

    return 0;
}

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

vector<string> vec;
int num;

int calcu(){
	int a = vec[num].size()-1;
	int b;
	int result;
	bool flag;
	string s = vec[num];
	if(s[a] == '+'){
		result = 0;
		flag = true;
	}
	else if(s[a] == '*'){
		result = 1;
		flag = false;
	}
	else{
		stringstream ss;
		ss << s[a];
		ss >> b;
		return b;
	}
	num++;
	while(1){
		if(num >= vec.size())break;
		s = vec[num];
		if(s.size() == a+2){
			if(s[a+1] == '*' || s[a+1] == '+'){
				if(flag)result += calcu();
				else if(!flag)result *= calcu();
			}
			else{
				stringstream ss;
				ss << s[a+1];
				ss >> b;
				if(flag)result += b;
				else if(!flag)result *= b;
				num++;
			}
		}
		else break;
	}
	return result;
}

int main(){
	int n;
	string s;
	while(1){
		cin >> n;
		if(n == 0)break;
		vec.clear();
		num = 0;
		for(int i = 0;i < n;i++){
			cin >> s;
			vec.push_back(s);
		}
		cout << calcu() << endl;
	}
	return 0;
}

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

void solve() {
	int n, d;

	std::cin >> n >> d;

	long long ans = 0;
	for (int i = 0; i < n - 1; i++) {
		ans += 127;
		d = 127 - d;
	}

	std::cout << ans + d << std::endl;
}

int main() {
	int test_case;

	std::cin >> test_case;

	for (int i = 0; i < test_case; i++) {
		solve();
	}

	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main()
{
    int d[100][100];
    int N;
    cin>>N;
    rep(i,N){
        rep(j,N)d[i][j]=INF;
    }
    vector<int>edge(N);
    rep(i,N){
        int tmp;
        cin>>tmp;
        tmp--;
        int n;
        cin>>n;
        rep(j,n){
            int a;
            cin>>a;
            a--;
            d[tmp][a]=1;
        }
    }
    rep(i,N)d[i][i]=0;
    rep(k,N){
        rep(i,N){
            rep(j,N){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    rep(i,N){
        if(d[0][i]<INF){
            cout<<i+1<<" "<<d[0][i]<<endl;
        }else{
            cout<<i+1<<" "<<-1<<endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3108
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>

bool is_prime(long num) {
  if (num < 2) {
    return false;
  }
  
  if (num == 2) {
      return true;
  }

  for (long i = 2; i <= std::sqrt(num); ++i) {
    if (num % i == 0) {
      return false;
    }
  }

  return true;
}

int main() {
  std::istream_iterator<long> it = std::cin;
  std::cout << std::count_if(it, decltype(it){}, is_prime) << '\n';
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  int n=s.size();
  if(s=="1"||s=="0"){cout<<0<<endl;return 0;}
  
  int znum=0,onum=0;
  for(int i=0;i<n;i++){if(s[i]=='0'){znum++;}
                    if(s[i]=='1'){onum++;}}
  
  if(znum==onum){cout<<n<<endl;}
  else{cout<<min(znum,onum)*2<<endl;}
  

  
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
    map<string,int>mp;
    string s;
    mp["SUN"]=7;
    mp["MON"]=6;
    mp["TUE"]=5;
    mp["WED"]=4;
    mp["THU"]=3;
    mp["FRI"]=2;
    mp["SAT"]=1;
    cin>>s;
    cout<<mp[s]<<endl;   
    return 0;
}

Measured memory_bytes: 3636
import numpy as np
from functools import reduce
from math import sqrt

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

xnd = []
for _ in range(n):
    xi = list (map(int,input().split()))
    xnd.append(np.array( xi) )

#print(xnd)

#print(xnd[0] - xnd[1])


ans = 0
for i in range(n):
    for j in range(i+1,n):
        
        t = map(lambda x: x**2, xnd[i]-xnd[j])
        
        sum_sq = reduce( lambda x,y: x+y, t )
#        print(sum_sq)
        dist = float(np.sqrt(sum_sq))    
#        print(dist)
        ans += 1 if float.is_integer(dist) else 0

print(ans)

Measured memory_bytes: 21392
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <cstdlib>
using namespace std;
using ll = long long int;


int main()
{
    int N;
    cin >> N;
    vector<pair<int,int>> XY;
    for (int i = 0; i < N; i++) {
        int x;
        int y;
        cin >> x >> y;
        XY.push_back(make_pair(x,y));
    }
    int mod = abs((XY[0].first + XY[0].second) % 2);
    for (int i = 0; i < N; i++) {
        if (abs((XY[i].first + XY[i].second) % 2) != mod){
            cout << -1 << endl;
            return 0;
        }
    }

    vector<ll> Arm;
    ll p2 = 1;
    Arm.push_back(1);
    for (int i = 0; i < 32; i++) {
        p2*=2;
        Arm.push_back(p2);
    }
    int ans = 33;
    if (mod == 0){
        Arm.push_back(1);
        ans += 1;
    }
    reverse(Arm.begin(),Arm.end());

    cout << ans << endl;
    for (int i = 0; i < Arm.size(); i++) {
        cout << Arm[i] << ' ';
    }
    cout << endl;

    for (int i = 0; i < N; i++) {
        ll x = XY[i].first, y = XY[i].second;
        for (int j = 0; j < Arm.size(); j++) {
            if (x+y > 0 && x-y > 0) {
                cout << "R";
                x -= Arm[j];
            }
            else if(x+y > 0 && x-y <= 0) {
                cout << "U";
                y -= Arm[j];
            }
            else if(x+y <= 0 && x-y > 0) {
                cout << "D";
                y += Arm[j];
            }
            else  {
                cout << "L";
                x += Arm[j];
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
import sys
N, K = map(int, input().split())
if K > 42:
    print(" ".join(map(str, [N] * N)))
    sys.exit()
A = [int(i) for i in input().split()]
DP = [[0 for _ in range(N)] for _ in range(K+1)]
for i in range(N):
    DP[0][i] = A[i]

for i in range(1, K+1,1):
    B = [0] * N
    for j in range(N):
        pl, mi = min(j + DP[i-1][j], N-1), max(j - DP[i-1][j], 0)
        B[mi] += 1
        if pl + 1 < N:
            B[pl + 1] -= 1
    for j in range(1, N):
        B[j] += B[j-1]
    DP[i] = B
print(" ".join(map(str, DP[K])))


Measured memory_bytes: 217256
#include <algorithm>
#include <array>
#include <iostream>

int main()
{
    std::array<unsigned long long, 3> i;
    std::cin >> i[0] >> i[1] >> i[2];
    std::sort(i.begin(), i.end());
    std::cout << i[0] * i[1] * (i[2] % 2) << std::endl;
    return 0;
}


Measured memory_bytes: 256