akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {
	int a, b, c, d;
	int ab, bc, ac;
	cin >> a >> b >> c >> d;
	ab = a - b;
	if (ab < 0) ab *= -1;
	bc = b - c;
	if (bc < 0) bc *= -1;
	ac = a - c;
	if (ac < 0) ac *= -1;

	if (ac <= d || (ab <= d && bc <= d)) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    string s;
    cin >> s;
    int sc = 0, b = 0;
    for (char c: s) {
        if (c == 'p') {
            if (b > 0) --b;
            else ++b, --sc;
        } else {
            if (b > 0) --b, ++sc;
            else ++b;
        }
    }
    cout << sc << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  cout << (1 << (int)log2(N)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,x,y;
	long long res=0,temp=0;
	cin>>a>>b>>c>>x>>y;
	res=a*x+b*y;
	if(x>y){
		temp=c*2*x;
		if(temp<res)res=temp;
	}else{
		temp=c*2*y;
		if(temp<res)res=temp;
	}
	if(x>y){
		temp=c*2*y;		
		x-=y;
		y=0;
		temp+=x*a;
		if(temp<res)res=temp;
	}else{
		temp=c*2*x;
		y-=x;
		x=0;
		temp+=y*b;
		if(temp<res)res=temp;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;

/// bが真なら"Yes"を返す。そうでなければ"No"を返す。
string get_yes_or_no(bool b) {
  return b ? "Yes" : "No";
}

/// xsがかわいそうなら真を返す。
bool get_is_poor(vector<int> xs) {
  /// 要素数が3でない場合については、かわいそうかどうかが定義されていない。
  assert(xs.size() == 3);
  set<int> xs1 = set<int>(xs.begin(), xs.end());
  return xs1.size() == 2;
}

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> xs = vector<int>({A, B, C});
  bool is_poor = get_is_poor(xs);
  string s = get_yes_or_no(is_poor);
  cout << s << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        if(A==7 & B==5 & C==5){
            System.out.print("YES");
        }else if (A==5 & B==7 & C==5){
            System.out.print("YES");
        }else if (A==5 & B==5 & C==7) {
            System.out.print("YES");
        }else{
            System.out.print("NO");
        }

    }
    }



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

#define rep_0(i, end) for(int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for(int i = (fr); i <= (ba); ++i)
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__)
#define overload_rep(arg_0, arg_1, arg_2, name, ...) name
#define all(box) box.begin(), box.end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {

    string S;
    cin >> S;
    int N = S.size(), ans = 0;
    rep(i, N / 2) if(S[i] != S[N - i - 1])ans++;
    cout << ans << '\n';

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

template<class T> void swap(T &a, T &b ){
    T temp;
    temp = a;
    a = b;
    b = temp;   
}

int main(){
    int N,K,Q;
    int *A;
    int i;
    int a;
    int count;

    cin >> N >> K >> Q;
    A = new int[N];
    for(i=0;i<N;i++){
        A[i] = 0;
    }
    for(i=0;i<Q;i++){
        cin >> a;
        A[a-1]++;
    }
    
    for(i=0;i<N;i++){
        if( Q - A[i] < K){
            cout << "Yes" << endl;
        }else{
            cout <<  "No" << endl;
        }
    }

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


Measured memory_bytes: 1024
#include <iostream>
#include <stdlib.h>
#include <algorithm>
 
 
using namespace std;
 
int main(void){
    long long N;
    long long M;
    cin >> N >> M;

    long long ans=1;

    if(abs(N - M) >= 2){
        cout << 0 << endl;
        return 0;
    }


    for(long long i=1;i<=N;i++){
        ans = i * ans;
        ans = ans % (1000000000 + 7);
    }
    for(long long i=1;i<=M;i++){
        ans = i * ans;
        ans = ans % (1000000000 + 7);
    }   
    if(N - M == 0){
        ans = ans * 2;
    }
    ans = ans % (1000000000 + 7);
    cout << ans << endl;
    return 0;

    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) \
  for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

map<char, int> c;

int main() {
  string s;
  cin >> s;
  int x = 0;
  int y = 0;
  for (int n = 0; n < s.sz; ++n) {
    ++c[s[n]];
  }
  bool f = true;
  if (c['N'] > 0 && c['S'] == 0) f = false;
  if (c['S'] > 0 && c['N'] == 0) f = false;
  if (c['E'] > 0 && c['W'] == 0) f = false;
  if (c['W'] > 0 && c['E'] == 0) f = false;

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

// Built using Sublime-CHelper plug-in (beta)


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	p := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
	}

	swapCount := 0
	isYes := true
	for i, num := range p {
		if p[i] != i+1 {
			swapCount++
			// 並び替えて昇順になるかどうか
			if p[num-1] != i+1 {
				isYes = false
				break
			}
			// 何回並び替えが必要か求める
			if swapCount == 3 {
				isYes = false
				break
			}
		}
	}

	// 2回以上並び替えが必要な場合No
	if isYes {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  while(a!=0&&b!=0){
    for(int i=0;i<a;i++){
      for(int j=0;j<b;j++){
	if((i%2==0&&j%2==0)||(i%2==1&&j%2==1)){
	  cout<<"#";
	}
	else cout<<".";
      }
      cout<<endl;
    }
    cout<<endl;
    cin>>a>>b;
  }
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

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

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

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////


int main() {
	ll H, W, M;
	cin >> H >> W >> M;

	vll h(M + 1), w(M + 1);
	set<pair<ll, ll>> st;
	repn(i, M)cin >> h[i] >> w[i];

	vll hcnt(H + 1), wcnt(W + 1);
	repn(i, M) {
		hcnt[h[i]]++;
		wcnt[w[i]]++;
		st.insert({ h[i],w[i] });
	}

	ll hmx = 0;
	ll wmx = 0;
	repn(i, H) {
		hmx = max(hcnt[i], hmx);
	}
	repn(i, W) {
		wmx = max(wcnt[i], wmx);
	}

	vll hlis, wlis;
	repn(i, H)if (hcnt[i] == hmx) { hlis.push_back(i); }
	repn(i, W)if (wcnt[i] == wmx) { wlis.push_back(i); }

	bool b = 0;
	for (ll x: hlis) {
		for (ll y : wlis) {
			if (!st.count({ x,y })) { b = 1; break; }
		}
		if (b) { break; }
	}

	ll ans = hmx + wmx;
	if (!b) { ans--; }
	cout << ans << endl;
}


Measured memory_bytes: 39760
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;


void solve(){
    int n;
    cin >> n;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            if(i + j == n){
                if((i % 4 == 0 && j % 7 == 0) || (i % 7 == 0 && j % 4 == 0)){
                    cout << "Yes";
                    return;
                }
            }
        }
    }
    cout << "No";
                
}


int main(){
    
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
x3 = y3 = x4 = y4 =0
if x1 <= x2 and y1 <= y2:
    x3 = x2-(y2-y1)
    y3 = y2+(x2-x1)
    x4 = x1-(y2-y1)
    y4 = y1+(x2-x1)
elif x2 <= x1 and y1 <= y2:
    x3 = x2-(y2-y1)
    y3 = y2-(x1-x2)
    x4 = x1-(y2-y1)
    y4 = y1-(x1-x2)
elif x2 <= x1 and y2 <= y1:
    x3 = x2+(y1-y2)
    y3 = y2-(x1-x2)
    x4 = x1+(y1-y2)
    y4 = y1-(x1-x2)
elif x1 <= x2 and y2 <= y1:
    x3 = x2+(y1-y2)
    y3 = y2+(x2-x1)
    x4 = x1+(y1-y2)
    y4 = y1+(x2-x1)
print(x3, y3, x4, y4)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,k;
  cin>>n>>k;
  ll a[n];
  rep(i,0,n) cin>>a[i];
  rep(i,0,min(k,100)){
    ll b[n+1];
    rep(i,0,n+1){
      b[i]=0;
    }
    rep(i,0,n){
      if(i-a[i]<0){
        b[0]++;
      }
      else{
        b[i-a[i]]++;
      }
      if(i+a[i]+1>n){
        b[n]--;
      }
      else{
        b[i+a[i]+1]--;
      }
    }
    rep(i,0,n){
      b[i+1]+=b[i];
    }
    rep(i,0,n){
      a[i]=b[i];
    }
  }
  rep(i,0,n){
    cout<<a[i];
    if(i==n-1) cout<<endl;
    else cout<<' ';
  }
}

Measured memory_bytes: 6712
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

using namespace std;
using P = pair<long long, long long>;
using T = tuple<long, long, long>;

long long MOD = 1000000007;
long long dp[100005][4];

int main() {
	long long N, M;
	cin >> N >> M;

	if (M == 0) {
		cout << "Yes" << endl;
		return 0;
	}

	vector<long long>L(M);
	vector<long long>R(M);
	vector<long long>D(M);
	vector<vector<P>>info(N + 1);
	for (int i = 0; i < M; ++i) {
		cin >> L[i] >> R[i] >> D[i];
		info[L[i]].push_back(make_pair(R[i], D[i]));
		info[R[i]].push_back(make_pair(L[i], -D[i]));
	}
	sort(L.begin(), L.end());
	sort(R.begin(), R.end());

	long long small = 1000000005;
	long long big = -1000000005;
	string ans = "Yes";
	long long m = max(L[M - 1], R[M - 1]);
	vector<long long>distance(m + 1, 1000000005);
	vector<bool>dist(m + 1, false);
	queue<long long>qu;
	for (int i : L) {
		if (dist[i])continue;
		distance[i] = 0;
		qu.push(i);
		while (!qu.empty()) {
			int target = qu.front(); qu.pop();
			if (dist[target])continue;
			dist[target] = true;
			long long currentPos = distance[target];
			for (P i : info[target]) {
				long long d = currentPos + i.second;
				if (distance[i.first] == 1000000005) {
					small = min(small, d);
					big = max(big, d);
					if (1000000000 < big - small) {
						ans = "No";
						cout << ans << endl;
						return 0;
					}
					distance[i.first] = d;
					qu.push(i.first);
				}
				else {
					if (distance[i.first] != d) {
						ans = "No";
						cout << ans << endl;
						return 0;
					}
				}
			}
		}
	}

	cout << ans << endl;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    auto sorted = a;
    sort(sorted.begin(), sorted.end());
    int c = 0;
    for(int i = 0; i < n; ++i){
        int j = distance(sorted.begin(), lower_bound(sorted.begin(), sorted.end(), a[i]));
        if((i & 1) ^ (j & 1)){
           c++;
        }
    }
    cout << c / 2 << endl;
}


Measured memory_bytes: 1024
from heapq import heappush,heappop
from collections import deque
h,w=map(int,input().split())
sx,sy=map(int,input().split())
sx-=1
sy-=1
gx,gy=map(int,input().split())
gx-=1
gy-=1
g=[list(input()) for _ in range(h)]
v=[[0 for j in range(w)] for i in range(h)]
v2=[[0 for j in range(w)] for i in range(h)]
q=deque([])
q.append([0,sx+h*sy])
while q:
    c,xy=q.popleft()
    x=xy%h
    y=xy//h
    if x==gx and y==gy:
        print(c)
        exit()
    if v[x][y]==1:
        continue
    v[x][y]=1
    for a in range(-2,3):
        for b in range(-2,3):
            if a==b==0:
                continue
            if a*b==0 and abs(a+b)==1:
                nx=x+a
                ny=y+b
                if 0<=nx<h and 0<=ny<w and g[nx][ny]=='.' and v[nx][ny]==0:
                    q.appendleft([c,nx+h*ny])
                continue
            nx=x+a
            ny=y+b
            if 0<=nx<h and 0<=ny<w and g[nx][ny]=='.' and v[nx][ny]==0 and v2[nx][ny]==0:
                q.append([c+1,nx+h*ny])
                v2[nx][ny]=1
print(-1)


Measured memory_bytes: 145024
import math
a,b,C = map(int, input().split())
c = C/180 * math.pi
S = (1/2)*a*b*math.sin(c)
x = math.sqrt(a**2+b**2-2*a*b*math.cos(c))
print(S)       #面積1/2*absinC
print(a+b+x)  #辺の長さa^2=b^2+c^2-2bccosA→周の長さa+b+c
print(2*S/a)     #高さh 面積S=1/2*a*h→h=2*S/a


Measured memory_bytes: 5704
#pragma GCC optimize("Ofast")
#include<stdio.h>
int x;
char c;
inline int read()
{
	x=0; c=getchar();
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return x;
}
int main(void)
{
	long n = read() + 1, ans = n - 1;
	for (int i = 2; i < n; ++i)
	{
        int u = read(), v = read();
        switch(u > v)
        {
            case true: ans += i * (n - i) - v * (n - u); break;
            default: ans += i * (n - i) - u * (n - v);
        }
        
	}
	printf("%ld", ans);
  
    return 0;
}


Measured memory_bytes: 1604
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) ll((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
const ll MOD = 1E9+7;
const ll INF = 1E18;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	double n,k;
	cin>>n>>k;
	double res=0;
	FOR(i,1,n){
		double t=1.0/double(n);
		if(i<k){
			double p=1.0;
			int j=i;
			while(j<k) j*=2,p/=2.0;
			t*=p;
		}
		res+=t;
	}
	cout<<fixed<<setprecision(13)<<res<<'\n';
}



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

using namespace std;

int n,meeting,c;
vector<vector<int> > g(100002);
int visited[100002];
vector<int> path;
vector<int> rpath;

void findpath(int s)
{
    visited[s]=1;
    path.push_back(s);
    if(s==n)
    {
        for(int i=0;i<path.size();i++) rpath.push_back(path[i]);
        return ;
    }
    for(int i=0;i<g[s].size();i++)
    {
        int v=g[s][i];
        if(!visited[v]) findpath(v),path.pop_back();
    }
}

void dfs(int s)
{
    visited[s]=1;
    for(int i=0;i<g[s].size();i++)
    {
        int v=g[s][i];
        if(!visited[v] && v!=meeting) c++,dfs(v);
    }
}

int main()
{
    cin >> n;
    for(int i=0;i<n-1;i++)
    {
        int x,y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    memset(visited,0,sizeof(visited));
    findpath(1);

    if(rpath.size()%2==0) meeting = ((rpath.size())/2)-1;
    else meeting = (rpath.size())/2;
    meeting = rpath[meeting];
    memset(visited,0,sizeof(visited));
    c=0;
    dfs(n);
    int cw=c;
    c=0;

    meeting = -100;
    dfs(1);
    int cb=c;
    if(cb>cw) cout << "Fennec";
    else cout << "Snuke";
    return 0;
}



Measured memory_bytes: 10360
#include<iostream>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
//#include "convinienceBox.h"
using namespace std;


int main(){
    int t;
    cin>>t;
    if(t>=30){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int X, Y;
  cin >> X >> Y;
  REP(i, X + 1) {
    int a = i * 2, b = (X-i) * 4;
    if (a + b == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

using namespace std;
int main(){
    string in;
    
    cin>>in;

    
    if(in[2]==in[3] && in[4]==in[5]){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
string s;
int c, cnt[30];
int main(){
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        cnt[s[i] - 'A']++;
    }
    for(int i = 0; i < 26; i++){
        if(cnt[i] == 2){
            c++;
        }
    }
    if(c == 2){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


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

using namespace std;
typedef long long LL;
const int Max_Num=100010;

class UnionFind {
public:
    vector <LL> par;
    vector <LL> siz;

    UnionFind(LL sz_): par(sz_), siz(sz_, 1LL) {
        for (LL i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(LL sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (LL i = 0; i < sz_; ++i) par[i] = i;
    }

    LL root(LL x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool unite(LL x, LL y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

    LL size(LL x) {
        return siz[root(x)];
    }
};

int main(){
  int N, M;
  cin >> N >> M;
  int X[Max_Num], Y[Max_Num], Z[Max_Num];
  UnionFind tree(N);
  rep(i,M){
    int x, y, z;
    cin >> x >> y >> z;
    tree.unite(x,y);
  }
  int ans=0;
  rep(i,N) if(tree.root(i)==i) ans++;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)
#define per(i, n) for(int i=n-1; i>=0; i--)
#define reps(i, n) for(int i=1; i<n; i++)
#define pers(i, n)  for(int i=n-1; i>=1; i--)

const int INF = 1001001001;

void solve(){
  int x,y,z;  cin >>x>>y>>z;
  cout << z << " " << x << " " << y << endl;
}

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


Measured memory_bytes: 256
# C
a, b, c, x, y = map(int, input().split())

ans = 0
while min(x,y) != 0:
    if min(x, y) == x:
        ans += x*min(a+b, 2*c)
        y -= x
        x = 0
    elif min(x, y) == y:
        ans += y*min(a+b, 2*c)
        x = x - y
        y = 0
        
if x == 0:
    ans += y*min(b, 2*c)
elif y == 0:
    ans += x*min(a, 2*c)
    
print(ans)

Measured memory_bytes: 3064
S = input().strip()
T = input().strip()

ls = len(S)
lt = len(T)

if ls < lt:
    print('UNRESTORABLE')
    exit()

for i in reversed(range(ls - lt + 1)):
    match = True
    for s, t in zip(S[i:lt + i], T):
        if s != t and s != '?':
            match = False
            break
    if match:
        ans = ''
        ans += S[:i]
        ans += T
        ans += S[i+lt:]
        print(ans.replace('?', 'a'))
        exit()
print('UNRESTORABLE')


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

int main()
{
    int a,b,c,x;
    while(scanf("%d%d%d%d",&a,&b,&c,&x)==4)
    {
        int maxa = min(x / 500 + 1,a);
        int maxb = min(x / 100 + 1,b);
        int cnt=0;
        for(int i = 0 ; i <= maxa; i++)
        {
            for(int j = 0; j <= maxb; j++)
            {
                if((x-i*500-j*100)%50==0)
                {
                    int k=(x-i*500-j*100)/50;
                    if(k>=0&&k<=c)
                    {
                        //printf("%d %d %d\n",i,j,(x-i*500-j*100)/50);
                        cnt++;
                    }
                }

            }
        }
        printf("%d\n",cnt);
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;

int main() {
  int l,r,d; cin>>l>>r>>d;
  int ans = 0;
  for(int i = l; i <= r; i++) {
    if (i % d == 0) ans++;
  }
  cout << ans;
}


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

int main()
{
    int n, counts = 0;

    cin >> n;

    for (int i = 1; i < n; i++)
    {
        for (int j = 1; j < n; j++)
        {
           
            if((n - i*j) > 0) counts++;
            if (i*j > n) j = n;
        }
    }
    cout << counts << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
using ll = long long;
int main(void){
    int s,w;
    cin>>s>>w;
    if(s>w)cout<<"safe"<<endl;
    else cout<<"unsafe"<<endl;
}


Measured memory_bytes: 3632
# ABC77 C - Snuke Festival
from bisect import bisect_left
from bisect import bisect_right
from bisect import bisect

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

ans = 0
for i in range(N):
    ans += bisect_left(A, B[i]) * (N - bisect_right(C, B[i]))

print(ans)

Measured memory_bytes: 22720
#include<stdio.h>

int main(){
  int n,i,a,maxn = -1000000,minn = 1000000;
  long sum = 0;

  scanf("%d",&n);

  for(i=0;i<n;++i){
    scanf("%d",&a);

    if(a < minn) minn = a;
    if(a > maxn) maxn = a;

    sum += a;
  }

  printf("%d %d %ld\n", minn, maxn, sum);
  
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>
#include <cassert>

using namespace std;

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

const ll MOD = 1000000000 + 7;
const ll INF = 99999999;
const ll MAX_V = 105;
const double EPS = 10e-8;
const double PI = 3.14159265359;

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

int main() {
    int h, w;
    string s[51], ans = "Yes";
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> s[i];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                int cnt = 0;
                for (int k = 0; k < 4; k++) {
                    int ni = i + dy[k], nj = j + dx[k];
                    if(ni<0||ni>=h || nj<0 || nj >= w)continue;
                    if(s[ni][nj]=='#')cnt++;
                }
                if(cnt==0)ans ="No";
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  if(N<=K)cout<<X*N<<endl;
  else cout<<X*K+Y*(N-K)<<endl;
  return 0;
}


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

#define int long long
#define ld long double

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>b;i--)

#define pb push_back
#define mp make_pair
#define all(A) A.begin(),A.end()
#define allr(A) A.rbegin(),A.rend()
#define precise(i) fixed << setprecision(i)
#define fi first
#define se second

#define err() cout<<"\n==================================\n";
#define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n";
#define err1(a) cout<<#a<<" "<<a<<"\n";
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n";
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n";

const int logN = 20;
const int M = 1000000007;
const int INF = 1e12;
#define PI 3.14159265;
const int N = 200005;

#define Pii pair<int,int>
#define Vi vector<int>
#define Vpii vector<Pii>

void solve()
{
       int k;
       cin>>k;
       rep(c,0,k)
       {
              cout<<"ACL";
       }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)
    {
           solve();
    }
    return 0;
}

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

#define MAX 101

void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top = 0;
int S[MAX];

int main(){
  int x,a,b;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a = pop();
      b = pop();
      push(a+b);
    } else if ( s[0] == '-' ){
      a = pop();
      b = pop();
      push(b-a);
    } else if ( s[0] == '*' ){
      a = pop();
      b = pop();
      push(a*b);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[top]);
  return 0;
}

void initialize(void){
  top = 0;
}

int isEmpty(void){
  if(top == 0) return 1;
  else return 0;
}

int isFull(void){
  if(top >= MAX - 1) return 1;
  else return 0;
}

void push(int x){
  if(isFull() == 1) fprintf(stderr,"Error(overflow)\n");
  else{
    top++;
    S[top] = x;
  }
}

int pop(void){
  if(isEmpty() == 1) fprintf(stderr,"Error(underflow)\n");
  else{
    top--;
  return S[top+1];
  }
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
template <long long mod>
class Combination
{
    std::vector<long long> fact, finv, inv;
public:
    Combination() {}
    Combination(int sz)
    {
        fact.resize(sz);
        finv.resize(sz);
        inv.resize(sz);
        fact[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
        }
        inv[0] = 0;
        inv[1] = 1;
        for (int i = 2; i < sz; ++i)
        {
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        }
        finv[0] = 1;
        for (int i = 1; i < sz; ++i)
        {
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    long long C(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return (fact[n] * finv[k] % mod) * finv[n - k] % mod;
    }
    long long P(long long n, long long k)
    {
        if (n < k)
            return 0;
        if (n < 0 || k < 0)
            return 0;
        return fact[n] * finv[n - k] % mod;
    }
    long long H(long long n, long long k)
    {
        return this->C(n + k - 1, k);
    }
    long long getfact(int i)
    {
        return fact[i];
    }
    long long getinv(int i)
    {
        return inv[i];
    }
    long long getfinv(int i)
    {
        return finv[i];
    }
};
template< typename T >
T mod_pow(T x, T n, const T &p) {
  if(x < 0) return 0;
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 998244353;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(int i=0;i<((int)(v.size()));++i) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n, s; cin >> n >> s;
  vi a(n);
  for(int i=0;i<(n);++i) {
    cin >> a[i];
  }
  Combination<MOD> comb(1000000);
  vvll dp(n+1, vll(s+1, 0));
  dp[0][0] = mod_pow<ll>(2, n, MOD);
  for(int i=0;i<(n);++i) {
    for(int j=0;j<(s+1);++j) {
      dp[i+1][j] += dp[i][j];
      dp[i+1][j] %= MOD;
      if(j+a[i] <= s) {
        dp[i+1][j+a[i]] += dp[i][j] * comb.getinv(2);
        dp[i+1][j+a[i]] %= MOD;
      }
    }
  }
  cout << dp[n][s] << endl;
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=3e5+5;
int n,a[N],b[N],w[N];

bool ok(int X)
{
	int mx=0;
	for(int i=1;i<=n;i+=2)
	if(b[i]-w[i]+mx>=X)
	{
		if(i==n)return 1;
		mx=max(mx,-b[i]+w[i+1]);
	}
	return 0;
}

int main()
{
#ifdef kcz
	freopen("1.in","r",stdin);
#endif
	cin>>n;
	rep(i,1,n)
	{
		scanf("%d",a+i);
		b[i]=b[i-1]+a[i]*(i%2);
		w[i]=w[i-1]+a[i]*(i%2==0);
	}
	if(n%2==0)
	{
		printf("%d %d\n",max(b[n],w[n]),b[n]+w[n]-max(b[n],w[n]));
		exit(0);
	}
	int l=max(0,b[n]-w[n]),r=b[n]+1;
	while(l+1!=r)
	{
		int mid=(l+r)/2;
		if(ok(mid))l=mid;
		else r=mid;
	}
	printf("%d %d\n",w[n]+l,b[n]+w[n]-(w[n]+l));
}

Measured memory_bytes: 3712
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

check = max(a,b,c,d,e) - min(a,b,c,d,e)

if check <= k:
    print('Yay!')
else:
    print(':(')


Measured memory_bytes: 3060
//#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>
#include<ctime>

#include <cstring>

#define pub push_back


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e5+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;








typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph;

vector<ll> fact;
vector<ll> fact2;
void finit(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll comb(ll a, ll b);


void finit(int n){
	fact.resize(n + 5);
	fact2.resize(n + 5);
	fact[0] = fact2[0] = 1;
	for (int i = 1; i <= n; i++){
		fact[i] = (fact[i - 1] * i) % MOD;
		fact2[i] = exp(fact[i], MOD - 2, MOD);
	}
}
ll exp(ll taban, ll us, ll md) {
	ll carpan = taban % md;
	if (carpan == 0) return 0;
	ll temp = us;
	ll ans = 1;
	while (temp){
		if (temp % 2) ans = (ans*carpan) % md;
		temp /= 2;
		carpan = (carpan*carpan) % md;
	}
	return ans;
}

ll ebob(ll a, ll b){
	if (!a)return b;
	return ebob(b%a, a);
}

ll ekok(ll x, ll y){
	return (x*y) / ebob(x, y);
}

ll comb(ll x, ll y){
	if (x < y) return 0;
	return fact[x] * ((fact2[x - y] * fact2[y]) % MOD) % MOD;
}
















ll n, k;
ll res;
double dd;
ll t = 1, x, y, p, q;
signed main(){
	IOS;
	//cin >> t;
	while (t--){
		cin >> n >> dd;
		ll temp     = dd * 100.0 + 0.01;
		res = (temp* n)/100;
		
		cout << res;

		
	}


	getchar(); getchar();

	return 0;

}

Measured memory_bytes: 3704
#include<stdio.h>
int main(void){
  	int i=0;
 	char S[3]; 
  	
  	scanf("%s",S);
  	if(S[1]=='B')	S[1]='R';
  	else if(S[1]=='R') S[1]='B';
  	while(i<3){
      printf("%c",S[i]);
      i++;
    }
}


Measured memory_bytes: 1648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define MAXC 100000
ll dp[3005][3005];
int main()
{
	int n;cin>>n;
	int a[n];
	for(int i=0;i<n;i++) {
		cin>>a[i];
	}
	
	for(int l = n-1;l>=0;l--){
		for(int r = l;r<n;r++){
			if(l==r) dp[l][r] = a[l];
			else dp[l][r] = max(a[l]-dp[l+1][r], a[r]-dp[l][r-1]);
		}
	}
	cout<<dp[0][n-1];
}

Measured memory_bytes: 70016
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i = 0; i < n; ++i)
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
    ll n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    vector<ll> saba(61,0);
    // bit毎に見る
    rep(i,60){
        ll saba0 = 0LL, saba1 = 0LL;
        rep(j,n){
            if(a[j]&(1LL<<i)) saba1++;    
            else saba0++;
        }
        saba[i] = saba0*saba1%MOD;
    }

    // bitごとに足し合わせる
    ll yumiko = 0LL; // 由美子とは僕の元カノの名前です……
    rep(i,60) yumiko = (yumiko+(saba[i]*((1LL<<i)%MOD))%MOD)%MOD;

    // 出力
    cout << yumiko << "\n";
}

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

int main() {
  
  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  
  if (S.at(K-1)=='A') {
    S.at(K-1)='a';
  }
  else if (S.at(K-1)=='B') {
    S.at(K-1)='b';
  }
  else if (S.at(K-1)=='C') {
    S.at(K-1)='c';
  }
  
  for (int i=0;i<N;i++) {
    cout<<S.at(i);
  }
  cout << endl;
}
    

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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 200001

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll n, a, b;
    cin >> n >> a >> b;
    cout << min(n*a, b) << endl;
    return 0;
}


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

int main()
{
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = A; i <= B; i++)
    {
        if ((i - A) < K || (B - i) < K)
        {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String remove = s.replaceAll("o", "");
		if(remove.length() < 8) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
		sc.close();	
	}

}


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

typedef int keytype;

//quicksort(<#keytype *a#>, <#int first#>, <#int last#>);
//long long ;
void quicksort(keytype a[], int first, int last){
    int i, j;
    keytype x, t;
    
    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int gcd(int x, int y){
    if (y == 0) return x;
    else        return gcd(y, x % y);
}

int main() {
    int m,n,k,ans,a[1000],i,sum=0;
    scanf("%d %d",&n,&m);
    for (i=0; i<n; i++) {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    quicksort(a, 0, n-1);
    double hikaku = (double)sum/(4*(double)m);
    double hikaku_2 = (double)a[n-m];
    if( hikaku_2 >= hikaku ){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
char t[200100], d[200100];
string s;
int n, q;

char sim(int p) {
    for (int i = 0; i < q; i++) {
        if (s[p] == t[i]) p += (d[i] == 'L' ? -1 : 1);
        if (p < 0) return 'L';
        if (p >= n) return 'R';
    }
    return 0;
}

int main() {
    cin >> n >> q;
    cin >> s;
    for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
    int ok, ng;
    for (ok = -1, ng = n; ng - ok > 1; ) {
        int m = (ok + ng) / 2;
        char r = sim(m);
        if (r == 'L') ok = m;
        else ng = m;
    }
    int L = ok;
    for (ok = n, ng = -1; ok - ng > 1; ) {
        int m = (ok + ng) / 2;
        char r = sim(m);
        if (r == 'R') ok = m;
        else ng = m;
    }
    int R = ok;
    cout << R - L - 1 << endl;
}


Measured memory_bytes: 900
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <iomanip>
#include <cassert>
#include <string.h>
#include <cstdio>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next

#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-8;
const LL INF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9 + 7;
const LL MAX = 1 << 20;

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

	LL a, b, c, k;
	cin >> a >> b >> c >> k;
	LL ans = a - b;
	if (k & 1)
		ans *= -1;
	cout << ans << endl;
	return 0;
}

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

typedef long long int ll;

int main()
{
	ll n;
	scanf("%lld",&n);
	ll arr[n+1];
	for(ll i=0;i<=n;i++)
		arr[i]=0;
	for(ll i=1;i<n;i++)
	{
		ll x;
		scanf("%lld",&x);
		arr[x]++;
	}
	for(ll i=1;i<=n;i++)
		printf("%lld\n",arr[i]);
}



Measured memory_bytes: 5320
N, A, B, C, D = map( int, input().split())
b = [ string for string in input()]

Z = True

for i in range ( A, C-3):
  if (b[i] is "#") and (b[i+1] is "#"):
    Z = False
    break

if Z:    
  for i in range ( B, D-3):
    if (b[i] is "#") and (b[i+1] is "#"):
      Z = False
      break
    
if Z and ( C > D):
  for i in range ( B-1, D):
    if (b[i-1] is ".") and (b[i] is ".") and (b[i+1] is "."):
      Z = True
      break
    else :
      Z = False
      
if Z:
  print("Yes")
  
if not Z:
  print("No")
    

Measured memory_bytes: 4916
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int t, d, l,result,condition;
    vector<int> v;
    while(cin>>t>>d>>l,(t!=0||d!=0||l!=0)){
        v.resize(t);
        result = 0;
        condition = 0;

        REP(i,t){
            cin >> v[i];
        }
        REP(i,t){
            if(v[i]>=l){
                condition = d;
            }else{
                condition--;
            }
            if(condition>0){
                result++;
            }
        }
        cout << max(result-1,0) << endl;
    }

    return 0;
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll	long long 
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
int gcd(int a, int b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
int invertBits(int num) 
{  
    int x = log2(num) + 1; 
    for (int i = 0; i < x; i++)  
       num = (num ^ (1 << i));  
   
    return num; 
} 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int main()
{
	int i;
	int n,k;
	cin>>n>>k;
	if(k>(((n-1)*(n-2))/2))
	{
		cout<<"-1";
		return 0;
	}
	int ma=((n-1)*(n-2))/2;
	int count=n-1;
	count+=ma-k;
	cout<<count<<endl;
	for(i=2;i<=n;i++)
	{
		cout<<1<<" "<<i<<endl;
		count--;
	}
	if(count==0)
	return 0;
	int j;
	for(i=2;i<n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			cout<<i<<" "<<j<<endl;
			count--;
			if(count==0)
			return 0;
		}
	}
	return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  ll A;
  scanf("%lld",&A);
  cout << max(0ll, N*N-A) << endl;
}

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

class Main{

	public static void main(String[] args){

		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";
		StringTokenizer stk;
		try{
			str=bfr.readLine();

			if(str==null) {
				System.exit(0);
			}
			int suuji=Integer.parseInt(str);

			str=bfr.readLine();

			if(str==null) {
				System.exit(0);
			}

			stk=new StringTokenizer(str , " ");
			int[] moto=new int[suuji];
			int minimum=99999999;

			int aa=0;
			while(stk.hasMoreTokens()) {
				moto[aa]=Integer.parseInt(stk.nextToken());
				aa++;
			}

			List<Integer> yakusu=new ArrayList<>();

			for(int i=0; i<suuji; i++) {
				if(minimum>moto[i]) {
					minimum=moto[i];
				}
			}

			int[] amari=new int[suuji];
			int amariwa=0;

			for(int i=1; i<=minimum; i++) {
				for(int j=0; j<suuji; j++) {
					amari[j]=moto[j]%i;
					amariwa+=amari[j];
				}
				if(amariwa==0) {
					yakusu.add(i);
				}
				amariwa=0;
			}

			for(Integer s : yakusu) {
				System.out.println(s);
			}
		}catch(IOException e) {

		}
		catch(NumberFormatException er) {

		}

	}
}


Measured memory_bytes: 26040