akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;

signed main(){
    int A,B,C,D,E;
    cin>>A>>B>>C>>D>>E;
    int AA = 10-A%10; int BB = 10-B%10; int CC = 10-C%10; int DD = 10-D%10; int EE = 10-E%10;
    if(AA==10) AA=0; if(BB==10 )BB=0; if(CC==10) CC=0; if(DD==10) DD=0; if(EE==10) EE=0;
    cout<<(A+B+C+D+E)+(AA+BB+CC+DD+EE)-max(AA,max(BB,max(CC,max(DD,EE))))<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <deque>
#include <utility>
#include <algorithm>
using namespace std;

int main(void){

    string a, b;
    cin>>a>>b;
    string s=a+b;
    
    int t=stoi(s);
    int tt=sqrt(t);
    
    if(t==tt*tt){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


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

void input_vector(vector<int>& v) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
}

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

    cout << n-k+1 << endl;
    return 0;

}


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

const int MOD=1000000007;
const int INF=1001001001;


int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> to(n);
  rep(i,m){
    int u,v;

    cin>>u>>v;
    u--;v--;
    to[u].push_back(v);
  }
  int s,t;
  cin>>s>>t;
  s--;t--;
  int dist[n][3];
  rep(i,n)rep(j,3)dist[i][j]=INF;
  dist[s][0]=0;
  queue<P> q;
  q.push(P(s,0));
  while (!q.empty()){
    int t1,t2;
    t1=q.front().first;
    t2=q.front().second;
    q.pop();
    for(int t3:to[t1]){
      int nl=(t2+1)%3;
      if (dist[t3][nl]!=INF)continue;
      dist[t3][nl]=dist[t1][t2]+1;
      q.push(P(t3,nl));
    }
  }
  int ans=dist[t][0];
  if (ans==INF)ans=-1;
  else(ans=ans/3);
  cout<<ans;
}


Measured memory_bytes: 6912
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, M: int, V: int, P: int, A: "List[int]"):

    # 降順
    A.sort(reverse=True)
    acc = [0]+list(accumulate(A))

    left = P-1
    right = len(A)
    L = M*(V-N)-acc[P-1]
    K = A[P-1]-M
    while right - left > 1:
        mid = (right + left)//2
        cap = (mid-P+1)*A[mid] - acc[mid]
        if A[mid] < K or cap < L:
            right = mid
        else:
            left = mid
    print(right)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, V, P, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64672
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    cin >> a >> b >> s;

    bool f = true;

    for (int i = 0; i < a + b + 1; i++) {
        if (i == a and s[i] != '-') f = false;
        if (i != a and (s[i] < '0' or s[i] > '9')) f = false;
    }

    cout << ( f ? "Yes" : "No" ) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int MAX_N = 100010;
long long int n;
int par[MAX_N];    //親
int deapth[MAX_N]; //木の深さ
long long int cnt[MAX_N];
long long int num;

struct edge
{
    int from;
    int to;
    int cost;
    bool operator<(const edge &another) const
    {
        return cost < another.cost;
    }
    bool operator>(const edge &another) const
    {
        return cost > another.cost;
    }
};

//n要素で初期化
void init(int n)
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
        deapth[i] = 0;
        cnt[i] = 1;
    }
}
//木の根を求める
int find(int x)
{
    if (par[x] == x)
    {
        return x;
    }
    else
    {
        return par[x] = find(par[x]);
    }
}

//xとyの属する集合を併合
void unite(int x, int y)
{
    x = find(x);
    y = find(y);
    if (x == y)
        return;
    if (deapth[x] < deapth[y])
    {
        par[x] = y;
        cnt[y] += cnt[x];
    }
    else
    {
        par[y] = x;
        cnt[x] += cnt[y];
        if (deapth[x] == deapth[y])
            deapth[x]++;
    }
}

bool same(int x, int y)
{
    return find(x) == find(y);
}

int main()
{
    cin >> n;
    vector<P> x(n);
    vector<P> y(n);
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        x[i] = P(a, i + 1);
        y[i] = P(b, i + 1);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    vector<edge> v;
    for (int i = 0; i < n - 1; i++)
    {
        /* code */
        edge e;
        e.from = x[i].second;
        e.to = x[i + 1].second;
        e.cost = x[i + 1].first - x[i].first;
        v.push_back(e);
        e.from = y[i].second;
        e.to = y[i + 1].second;
        e.cost = y[i + 1].first - y[i].first;
        v.push_back(e);
    }
    sort(v.begin(), v.end());
    init(n);
    long long int ans = 0;
    for (int i = 0; i < v.size(); i++)
    {
        edge e = v[i];
        if (same(e.from, e.to))
        {
            continue;
        }
        else
        {
            unite(e.from, e.to);
            ans += e.cost;
        }
    }
    cout << ans << endl;
}

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

int h, w;
vector<string> grid;
int dir[4] = {-1, 1, 0, 0};

int bfs(int si, int sj, int gi, int gj) {
    vector<vector<int>> dist(h, vector<int>(w, -1));
    dist[si][sj] = 0;
    queue<pair<int, int>> q;
    q.push({si, sj});
    while (!q.empty()) {
        auto p = q.front();
        q.pop();
        for (int i = 0; i < 4; i++) {
            int nx = p.first + dir[i];
            int ny = p.second + dir[3 - i];
            if (0 > nx || nx >= h || 0 > ny || ny >= w) continue;
            if (grid[nx][ny] == '#') continue;
            if (dist[nx][ny] == -1) {
                if (nx == gi && ny == gj) {
                    return dist[p.first][p.second] + 1;
                }
                dist[nx][ny] = dist[p.first][p.second] + 1;
                q.push({nx, ny});
            }
        }
    }
    return dist[gi][gj];
}

int main() {
    cin >> h >> w;
    grid.resize(h);
    rep(i, h) cin >> grid[i];
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            for (int p = 0; p < h; p++) {
                for (int q = 0; q < w; q++) {
                    if (grid[i][j] == '#' || grid[p][q] == '#') continue;
                    if (i == p && j == q) continue;
                    ans = max(ans, bfs(i, j, p, q));
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  int h,w;
  cin>>h>>w;
  char a;
  int ans=0;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
      cin>>a;
      if(a=='#')
        ans++;
    }
  if(ans==h+w-1)
    cout<<"Possible";
  else cout<<"Impossible";
  
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<int,int> P;
#include <boost/multiprecision/cpp_int.hpp>
 
using bint = boost::multiprecision::cpp_int;

int main(){
    bint n;
    cin >> n;
    
    if (n==0) {cout << 0;rn 0;}
    string ans;
    bint ind = 1;
    bint base = -2;
    bint p = 1;
    while(n != 0){
        p *= base;
        if(n%p != 0){
            ans = "1" + ans;
            n -= p/base;
        }
        else{
            ans = "0" + ans;
        }
        ind ++;
    }
    cout << ans;
}

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

int a[200010];
int ans[200010];
int main(){
	int n; cin >> n;
	for(int i=2;i<=n;i++) {
		cin >> a[i];
		ans[a[i]]++;
	}
	for(int i=1;i<=n;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 5112
#include <stdio.h>
#include <stdlib.h>
#define M 1000000

void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;
int left[M/2+2],right[M/2+2];

int main(){
  int i,n,arr[M];
  
  scanf("%d",&n);
  if(n>500000) exit(2);
  for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }
  mergeSort(arr,0,n);
  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",arr[i]);
  }
  printf("\n%d\n",count);
  
  return 0;
}

void mergeSort(int arr[],int le,int ri){
  int mid;
  if(le+1<ri){
    mid = (le+ri)/2;
    mergeSort(arr,le,mid);
    mergeSort(arr,mid,ri);
    merge(arr,le,mid,ri);
  }
}

void merge(int arr[],int le,int mid,int ri){
  int i,j,k; 

  for(k=0;k<mid-le;k++){
    left[k]=arr[le+k];
  }
  for(k=0;k<ri-mid;k++){
    right[k]=arr[mid+k];
  }
  left[mid-le] = right[ri-mid] = 9999999999999;
  i=0;
  j=0;
  for(k=le;k<ri;k++){
  count++;
    if(left[i]<=right[j]){
      arr[k] = left[i];
      i++;
    }else{
      arr[k] = right[j];
      j++;
    }
  }
}



Measured memory_bytes: 5604
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
d = [0] * 4

for i in range(n):
	d[0] += abs(x[i] - y[i])
	d[1] += abs(x[i] - y[i])**2
	d[2] += abs(x[i] - y[i])**3
	d[3] = max(d[3], abs(x[i] - y[i]))
	
d[1] = d[1]**(1/2)
d[2] = d[2]**(1/3)

for i in range(4):
	print('%f' % d[i])


Measured memory_bytes: 5648
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    ll n; cin >> n;
    vector<ll> s(n);
    ll sum = 0;
    ll ans = 1002003004;
    rep(i,n){
        cin >> s[i];
        sum += s[i];
    }

    if(n ==2){
        cout << abs(s[0] - s[1]) << endl;
        return 0;
    }

    ans = 1000000000000000000LL;

    rep(i,n-1){
        sum -= s[i]*2;
        ans = min(ans,abs(sum));
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val (a, b, x) = readLine()!!.split(' ').map { it.toDouble() }
    val rad = if (a * a * b / 2 <= x) {
        Math.atan(2 * (a * a * b - x) / (a * a * a))
    } else {
        Math.PI / 2 - Math.atan(2 * x / (a * b * b))
    }
    println(rad / Math.PI / 2 * 360)
}


Measured memory_bytes: 37920
import java.util.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = Integer.parseInt(sc.next());
		int[] A = new int[N];
		Arrays.setAll(A, $ -> Integer.parseInt(sc.next()));
		Arrays.sort(A);

		int target = A[0];
		int streak = 0;
		long sum = 0;
		for (int i : A) {
			if (i == target) {
				streak++;
				continue;
			}
			sum += target > streak ? streak : streak - target;
			target = i;
			streak = 1;
		}
		System.out.println(sum + (target > streak ? streak : streak - target));
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 49560
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	//ll t,n; 
	vector<int> arr(5);
	cin>>arr[0]>>arr[1]>>arr[2]>>arr[3]>>arr[4];
	for(auto i=0;i<5;++i){
		if(arr[i]==0){
			cout<<i+1<<'\n';
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3556
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int n = Integer.valueOf(s.split(" ")[0]);
		int m = Integer.valueOf(s.split(" ")[1]);
		
		if(n > m) {
			System.out.println("safe");
		}
		else
			System.out.println("unsafe");
	}

}

class FastReader {
	BufferedReader bf;
	StringTokenizer st;

	public FastReader() {
		bf = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(bf.readLine());
			} catch (Exception e) {
				System.out.println(e);
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			str = bf.readLine();
		} catch (Exception e) {
			System.out.println(e);
		}
		return str;
	}
}



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

int main() {
  int N, M;
  cin >> N >> M;
  int sum = 0, a;
  rep(i, M){
   cin >> a;
    sum += a;
  }
  if(N >= sum) cout << N-sum << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<utility>//swapでaとbの値を入れ替える
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whie(a) vector<vector<int>>

int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

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


int main() {
	ll a,b;
	ll ans = 0;
	cin >> a >> b;
	for (int i = 0;; i++) {
		ans++;
		if (a < b)break;
		a /= b;

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


Measured memory_bytes: 256
use proconio::input;

macro_rules! chmax {
    ($max_v: expr, $v: expr) => {
        if $v > $max_v {
            $max_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        k: i64,
        a: [i64; n],
        b: [i64; m],
    };
    let ca = std::iter::once(0)
        .chain(a.iter().scan(0, |acc, a_i| {
            *acc += a_i;
            Some(*acc)
        }))
        .collect::<Vec<_>>();
    let cb = std::iter::once(0)
        .chain(b.iter().scan(0, |acc, b_i| {
            *acc += b_i;
            Some(*acc)
        }))
        .collect::<Vec<_>>();

    let mut ans = 0;
    let mut max_j = cb.len() - 1;
    for (i, &ca_i) in ca.iter().enumerate() {
        for (j, &cb_i) in cb[0..=max_j].iter().enumerate().rev() {
            if ca_i + cb_i <= k {
                chmax!(ans, i + j);
                max_j = j;
                break;
            }
        }
    }

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


Measured memory_bytes: 12576
import heapq

def main():

    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    hq = []
    for a in A:
        heapq.heappush(hq, -a)
    for _ in range(M):
        a = heapq.heappop(hq)
        a = -a/2
        heapq.heappush(hq, -a)
    ans = 0
    for a in hq:
        ans += int(-a)
    return ans

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 87320
A,B,C = list(map(int,input().split()))
K = int(input())

while K > 0:
    if A >= B:
        B = B * 2
    else:
        if B >= C:
            C = C * 2
    K -= 1
    
if A < B and B < C:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9172
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]

sum_before = sum(T)
for i in range(M):
    sum_after = sum_before - T[PX[i][0]-1] + PX[i][1]
    print(sum_after)

Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int main(){
double x1,x2,x3,y1,y2,y3;
double a,b,c,d;
double r,i,j;
int k;
int n;
scanf("%d",&n);
for(k=0;k<n;k++){
scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
i=(double)1/2*(double)((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));
j=(double)1/2*(double)((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2));
a=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
a=sqrt(a);
b=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);
b=sqrt(b);
c=(x3-x1)*(x3-x1)+(y3-y1)*(y3-y1);
c=sqrt(c);
d=1-((double)(b*b+c*c-a*a)/(double)(2*b*c))*((b*b+c*c-a*a)/(2*b*c));
d=sqrt(d);
r=a/(double)(2*d);
printf("%.3f %.3f %.3f\n",i,j,r);
}
return 0;
}

Measured memory_bytes: 664
package main

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

func main() {
	v := ReadString()
	var s, e, n, w int
	for _, c := range []byte(v) {
		switch c {
		case 'S':
			s++
		case 'E':
			e++
		case 'N':
			n++
		case 'W':
			w++
		}
	}

	if s == 0 && n > 0 || s > 0 && n == 0 {
		fmt.Println("No")
		return
	}
	if e == 0 && w > 0 || e > 0 && w == 0 {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}

var reader = bufio.NewReader(os.Stdin)

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


Measured memory_bytes: 1856
# -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
# スペース区切りの整数の入力
# b, c = map(int, input().split())
# 文字列の入力
# s = input()
# 出力
# print("{} {}".format(a+b+c, s))
n,m = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in a:
    if (i >= sum(a)/(4*m)):
        cnt += 1
if (cnt >= m):
    print("Yes")
else:
    print("No")

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

int main() {
    long long A, B, V, M, T;
    cin >> A >> V;
    cin >> B >> M;
    cin >> T;

    long long kyori = abs(A - B);
    long long sokudo_sa = (V - M) * T;

    if(kyori > sokudo_sa){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

}

Measured memory_bytes: 3632
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    h=II()
    w=II()
    print((n-h+1)*(n-w+1))

main()

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

#define fi first
#define se second

using namespace std;

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        string s;
        cin >> s;
        for(char c: s){
                if(c == '?'){
                        cout << 'D';
                } else{
                        cout << c;
                }
        }
}


Measured memory_bytes: 3744
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s; cin >> s;

    bool a = true;
    for (uint32_t i = 0; i < s.size(); i++) {
        if ((i + 1) % 2 != 0) {
            if (s[i] == 'L') a = false;
        } else {
            if (s[i] == 'R') a = false;
        }
    }

    cout << (a ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, K;
long long dp[51][51][2501];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> K;
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			for (int k = 0; k <= 2500; k++) {
				if (k - 2 * j >= 0 && j <= i - 1)
					dp[i][j][k] += dp[i - 1][j][k - 2 * j];
				dp[i][j][k] = dp[i][j][k] % MOD;
				if (k - 2 * j >= 0 && j - 1 >= 0)
					dp[i][j][k] += dp[i - 1][j - 1][k - 2 * j];
				dp[i][j][k] = dp[i][j][k] % MOD;
				if (k - 2 * j >= 0 && j <= i - 1) {
					long long tmp = dp[i - 1][j][k - 2 * j] * j;
					tmp = tmp % MOD;
					tmp = tmp * 2;
					tmp = tmp % MOD;
					dp[i][j][k] += tmp;
				}
				dp[i][j][k] = dp[i][j][k] % MOD;
				if (k - 2 * j >= 0 && j + 1 <= i - 1) {
					long long tmp = dp[i - 1][j + 1][k - 2 * j] * (j + 1);
					tmp = tmp % MOD;
					tmp = tmp * (j + 1);
					tmp = tmp % MOD;
					dp[i][j][k] += tmp;
				}
				dp[i][j][k] = dp[i][j][k] % MOD;
			}
		}
	}
	cout << dp[n][0][K] << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 49152
N, x = map(int,input().split())
A = list(map(int,input().split()))
T = [A[k] for k in range(N)]

ans = sum(A)
A = A+A

for k in range(1,N):
    for l in range(N):
        T[l] = min(T[l],A[N+l-k])
    ans = min(ans,sum(T)+k*x)

print(ans)


Measured memory_bytes: 42476
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;

void main(){
	auto Q=readln.split.to!(int[]),r=Q[0],g=Q[1],b=Q[2];
    if((100*r+10*g+b)%4==0)writeln("YES");
    else writeln("NO");
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

#define MAX_V 100010
#define MAX_LOG_V 20

vector<int> edge[MAX_V];
int parent[MAX_LOG_V][MAX_V];
int depth[MAX_V];

struct LCA{
  int root;

  LCA(int r): root(r){}

  void add_edge(int a, int b) {
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  
  void dfs(int v, int par, int dep) {
    parent[0][v] = par;
    depth[v] = dep;
    for (auto child : edge[v]) {
      if (child != par) dfs(child, v, dep + 1);
    }
  }

  void init(int V) {
    dfs(root, -1, 0);
    for (int k = 0; k + 1 < MAX_LOG_V; k++) {
      for (int v = 0; v < V; v++) {
	if (parent[k][v] < 0) {
	  parent[k+1][v] = -1;
	} else {
	  parent[k+1][v] = parent[k][parent[k][v]];
	}
      }
    }
  }

  int lca(int u, int v) {
    if (depth[u] > depth[v]) swap(u, v);
    for (int k = 0; k < MAX_LOG_V; k++) {
      if ((depth[v] - depth[u]) >> k & 1) {
	v = parent[k][v];
      }
    }
    if (u == v) return u;
    for (int k = MAX_LOG_V - 1; k >= 0; k--) {
      if (parent[k][u] != parent[k][v]) {
	u = parent[k][u];
	v = parent[k][v];
      }
    }
    return parent[0][u];
  }
};

int main() {
  int N;
  LCA lca(0);
  
  scanf("%d", &N);
  REP(i, N) {
    int k;
    scanf("%d", &k);
    REP(j, k) {
      int c;
      scanf("%d", &c);
      lca.add_edge(i, c);
    }
  }
  lca.init(N);
  int Q;
  scanf("%d", &Q);
  REP(i, Q) {
    int u, v;
    scanf("%d %d", &u, &v);
    printf("%d\n", lca.lca(u, v));
  }
  return 0;
}

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

int main()
{
  string S;
  cin>>S;
  S.erase(S.end()-1);
  if(S.size()%2!=0){
    S.erase(S.end()-1);
  }
  int ans;
  bool flag=true;
  while(flag){
    vector<char> tmp;
    for(int i=0;i<S.size()/2;i++){
      tmp.push_back(S[i]);
    }
    
    bool can=true;
    for(int i=0;i<tmp.size();i++){
      if(tmp[i]!=S[i+S.size()/2]){
        can=false;
        break;
      }
    }
    if(can){
      ans=S.size();
      break;
    }
    S.erase(S.end()-2,S.end());
    
  }
  cout<<ans;
}

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

using namespace std;

const int N = 1e7;
long long divisors[N + 5];

void countDivisors(int n) {
    for (int i = 1; i <= n; ++i)
        for (int j = i; j <= n; j += i)
            ++divisors[j];
}


int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    countDivisors(N);
    int n;
    cin >> n;
    long long ans = 0;
    for (long long i = 1; i <= n; i++) {
        ans += (divisors[i] * i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 81776
//   ┏━━┓┏━━┓┏┓┏┓┏┳━┳┓┏━━┓┏━┳┓┏━━┓     ┏┳┓┏┳┓┏━┳━┓┏━━┓┏━┓
//   ┃┏┓┃┃━━┫┃┗┛┃┃┃┃┃┃┃┏┓┃┃┃┃┃┗┃┃┛     ┃┏┛┃┃┃┃┃┃┃┃┃┏┓┃┃╋┃
//   ┃┣┫┃┣━━┃┃┏┓┃┃┃┃┃┃┃┣┫┃┃┃┃┃┏┃┃┓     ┃┗┓┃┃┃┃┃┃┃┃┃┣┫┃┃┓┫
//   ┗┛┗┛┗━━┛┗┛┗┛┗━┻━┛┗┛┗┛┗┻━┛┗━━┛     ┗┻┛┗━┛┗┻━┻┛┗┛┗┛┗┻┛
#include "bits/stdc++.h" 
using namespace std; 
#define mod 1e9 + 7 
#define FOR(a, c)  for(int a = 0; a < c; a++) 
#define FORL(a, b, c) for(int a = b; a < c; a++) 
#define FORR(a, b, c) for(int a = b ; a > c; a--) 
typedef long long int ll; 
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define PB push_back 
#define POB pop_back 
#define MP make_pair 
int minimumChar(string S1, string S2) 
{ 
    // Get the sizes of both strings 
    int n = S1.size(), m = S2.size(); 
  
    int ans = INT_MAX; 
  
    // Traverse the string S2 
    for (int i = 0; i < m - n + 1; i++) { 
        int minRemovedChar = 0; 
  
        // From every index in S2, check the number of 
        // mis-matching characters in substring of 
        // length of S1 
        for (int j = 0; j < n; j++) { 
            if (S1[j] != S2[i + j]) { 
                minRemovedChar++; 
            } 
        } 
  
        // Take minimum of prev and current mis-match 
        ans = min(minRemovedChar, ans); 
    } 
  
    // return answer 
    return ans; 
} 

int main() 
{ 
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  string s1,s2;
  cin>>s1>>s2;
  cout << minimumChar(s2, s1); 
  return 0;
}
// By Ashwani Kumar, Indian Institute Of Technology(IIT), Guwahati.
//   ╔══╗╔══╗╔══╗     ╔══╗╔╦╗╔╦═╦╗╔══╗╔╗╔╗╔══╗╔══╗╔══╗
//   ╚║║╝╚║║╝╚╗╔╝     ║╔═╣║║║║║║║║║╔╗║║╚╝║║╔╗║╚╗╔╝╚║║╝
//   ╔║║╗╔║║╗─║║─     ║╚╗║║║║║║║║║║╠╣║║╔╗║║╠╣║─║║─╔║║╗
//   ╚══╝╚══╝─╚╝─     ╚══╝╚═╝╚═╩═╝╚╝╚╝╚╝╚╝╚╝╚╝─╚╝─╚══╝

Measured memory_bytes: 3660
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
typedef long long ll;
const ll MOD = 1'000'000'007;
ll mod_powe(ll x, ll n, ll mod)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
int main(void)
{
    ll n;
    ll rem[2];
    cin >> n >> rem[0] >> rem[1];

    ll comb[200100];
    ll combr[200100];

    comb[0] = combr[0] = 1;

    rep(i, 1, 200100)
    {
        comb[i] = comb[i - 1] * i % MOD;
        combr[i] = combr[i - 1] * mod_powe(i, MOD - 2, MOD) % MOD;
    }

    // nHr = n+r-1Cr
    // n+r-1Cr = (n+r-1)!/(n-1)!(r!)
    // nCr = (n)! / (n-r!)(r!) ->

    ll ans;
    ans = mod_powe(2, n, MOD) - 1;
    //cout << ans << endl;

    REP(num, 2)
    {
        ll ansa = 1;
        for (ll i = n; i >= n - rem[num] + 1; i--)
        {
            ansa = (ansa * i) % MOD;
        }
        ansa = (ansa * combr[rem[num]]) % MOD;
        //ll t1 = (comb[n + rem[num]] * combr[n]) % MOD;
        //t1 = (t1 * combr[rem[num]]) % MOD;
        ans = (ans - ansa + MOD) % MOD;
    }
    cout << ans << endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int A[80][80];
int B[80][80];
int C[80][80];
bitset<12800> Set[80][80];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin>>h>>w;

    rep(i,h)rep(j,w){
        cin>>A[i][j];
    }
    rep(i,h)rep(j,w){
        cin>>B[i][j];
    }
    rep(i,h)rep(j,w){
        C[i][j] = abs(A[i][j]-B[i][j]);
    }
    Set[0][0][C[0][0]] = true;
    rep(i,h)rep(j,w){
        if (i>0){
            rep(k,12800){
                if (!Set[i-1][j][k]) continue;
                Set[i][j][k+C[i][j]] = true;
                Set[i][j][abs(k-C[i][j])] = true;
            }
        }
        if (j>0){
            rep(k,12800){
                if (!Set[i][j-1][k]) continue;
                Set[i][j][k+C[i][j]] = true;
                Set[i][j][abs(k-C[i][j])] = true;
            }
        }
    }
    int ans;
    rep(i,12800){
        if (Set[h-1][w-1][i]){
            ans = i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 10368
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
  s.append("."+input()+".")
s.append("."*(w+2))
ans="Yes"
for i in range(1,h+1):
   for j in range(1,w+1):
      if s[i][j]=="#" and s[i-1][j]=="." and s[i][j+1]=="." and s[i+1][j]=="." and s[i][j-1]==".":
        ans="No"
        break
print(ans)

Measured memory_bytes: 64972
/*  In the name of ALLAH */

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif



int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
  

    int a[3],k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    int num[]={1,0,-1};
    int sum = 0;
    int i =0;
    while(k){
        int temp ;
        temp = min(a[i],k);
        sum+=temp*num[i++];
        // see(temp,sum);
        k-=temp;  

    }

    cout<<sum<<endl;

 
    
 
    return 0;
}


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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    S = sorted(set(list(input())))
    alphabets = [chr(ord('a') + i) for i in range(26)]

    if len(S) == 26:
        print('None')
    else:
        for alphabet in alphabets:
            if alphabet not in S:
                print(alphabet)
                break


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

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  if ((c-b) % 2 == 0) {
    cout << (c-b)/2;
    return 0;
  }
  cout << min(b+(c-b-1)/2,a-c+1+(c-b-1)/2);
  
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
rep(i,N) {
  cin >> list[i];
}
//配列(スタックとしても使える)
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
//ソート クイックだからO(NlogN)
sort(all(list));
sort(all(list), greater<int>());

//配列の最小最大(Nは要素数)
*min_element(all(c))
*max_element(all(c))

//a[0]からa[N]を逆順にする(計算量はO(N))
reverse(all(a));
//listの末尾に要素を追加
list.push_back(10);
//listの末尾から要素を削除
list.pop_back();
//空ですか？
list.empty()



//キュー(待ち行列)
//定義
queue<int> a;
//追加
a.push(x);
//取る
a.pop();
//チェック
a.front()
//サイズ
a.size()
//空ですか
a.empty()



//優先度付きキュー※全部計算量がO(NlogN)あるので注意
// int 型の要素を持ち、最も小さい値を取り出す形の priority_queue を定義
priority_queue<int, vector<int>, greater<int>> Q1;
// double 型の要素を持ち、最も大きい値を取り出す形の priority_queueを定義
priority_queue<double, vector<double>, less<double>> Q2;
//追加
a.push(x);
//取る
a.pop();
//一番小さいの教えて下さい
a.top()
//サイズ
a.size()
//空ですか
a.empty()



//配列の内容表示
dout << "====listの内容====\n";
for (int edp = 0; edp < N; edp++) dout << list[edp] << endl;
dout << "====ここまで====\n";



//部分文字列
//添字3から5文字
s.substr(3,5)
//添字3から全部
s.substr(3)

//入れ替え
swap(a,b);


*/



Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
x=int(input())
t = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            y = 500*a + 100*b + 50*c
            if x == y:
                t+=1
                
print(t)

Measured memory_bytes: 3060
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==b && b==c) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21716
// abc133_a
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n*a, b) << endl;

  return 0;
}


Measured memory_bytes: 256
import itertools

H, W, K = map(int, input().split())


def countBlack(c):
    count = 0
    for i in range(H):
        for j in range(W):
            if c[i][j] == "#":
                count += 1
    return count


def makeRededList(c, h_list, w_list):
    new_c = []
    for i in range(H):
        new_c.append([])
        if i in h_list:
            new_c[i] = ["."] * W
        else:
            for j in range(W):
                if (j in w_list):
                    new_c[i].append(".")
                else:
                    new_c[i].append(c[i][j])
    return new_c


c = []


for i in range(H):
    c.append([])
    txt = input()
    for j in txt:
        c[i].append(j)

ans_count = 0

a = []
for i in range(H):
    a.append(f"h{i}")
for i in range(W):
    a.append(f"w{i}")


for i in range(W+H):
    for v in itertools.combinations(a, i):
        h_list = []
        w_list = []
        for string in v:
            if string[0] == "h":
                h_list.append(int(string[1]))
            else:
                w_list.append(int(string[1]))
        if countBlack(makeRededList(c, h_list, w_list)) == K:
            ans_count += 1

print(ans_count)


Measured memory_bytes: 9292
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
    long N,M,u,v,S,T;
    cin>>N>>M;
    vector<long>g[3*N],d(3*N);
    for(long i=0;i<M;i++){
        cin>>u>>v;
        u--,v--;
        g[3*u+0].push_back(3*v+1);
        g[3*u+1].push_back(3*v+2);
        g[3*u+2].push_back(3*v+0);
    }
    cin>>S>>T;
    S--,T--;
    for(long i=0;i<3*N;i++)d[i]=100000000000000L;
    d[0]=0L;
    queue<pair<long,long>>q;
    q.push(make_pair(3*S,0L));
    while(!q.empty()){
        auto c=q.front();q.pop();
        if(c.first==3L*T){cout<<c.second/3L<<endl;return 0;}
        for(auto x:g[c.first])if(d[x]==100000000000000L)d[x]=c.second+1L,q.push(make_pair(x,c.second+1L));
    }
    cout<<-1<<endl;
    return 0;
}

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

// dp[i][j]: 左にi個、右にj個詰めた時の最大値
ll dp[2020][2020];

int main() {
  int N;
  cin >> N;
  vector< pair<ll, ll> > A(N);
  REP(i,N) {
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(A.begin(), A.end(), greater<pair<ll,ll> >());
  REP(i,N) {
    for( ll j=0; i+j<N; j++ ) {
      // left
      dp[i+1][j] = max(dp[i+1][j], dp[i][j] + A[i+j].first * (A[i+j].second - i));
      // right
      dp[i][j+1] = max(dp[i][j+1], dp[i][j] + A[i+j].first * (N-1-j - A[i+j].second));
    }
  }
  ll ans = 0;
  REP(i,N+1) {
    ans = max( ans, dp[i][N-i] );
  }
  cout << ans << endl;
}



Measured memory_bytes: 26320
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, ans; cin >> a >> b; ans = 0;
    for(int i=1;i<b-a;i++) ans += i;
    cout << ans - a;
    cout << endl;
    return 0;
}




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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (size_t NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (size_t NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

// 二分探索をする
// { TTTTTFF } => output: 5
// { FFFFFFF } => output: 0
// { TTTTTTT } => ooutput: 7
// funcを満たさない最小のIndexを返す
template<typename T>
T binarySearchFunction( int begin, int end, function<bool(T index)> func )
{
	T lb = begin-1, ub = end-1;
	while( lb < ub - 1 )
	{
		T mid = ( lb + ub ) / 2;
		if( func( mid ) ) lb = mid;
		else ub = mid;
	}
	if( ub == end - 1 && func( ub ) ) return end;
	return ub;
}
template<typename T>
T BSF( int begin, int end, function<int(T index)> func )
{
	T lb = begin-1, ub = end-1;
	while( lb < ub - 1 )
	{
		T mid = ( lb + ub ) / 2;
		T f = func(mid);
		if( f < begin ) lb = mid;
		else if( f >= end ) ub = mid;
		else return mid;
	}
	T f = func(ub);
	if( f < begin || end <= f ) return -1;
	return ub;
}

int main()
{
	ll n, q;
	string s;
	cin >> n >> q >> s;
	vector<pair<char, bool>> v(q);
	REP(i,q)
	{
		char a,b;
		cin >> a >> b;
		v[i] = pair<char,bool>( a, b == 'R' );
	}

	auto last = [n, q, v, s] ( int idx ) -> int
	{
		REP( i, q )
		{
			if( s[idx] == v[i].first )
			{
				idx += v[i].second ? 1 : -1;
				if( idx == -1 || idx == n )
					return idx;
			}
		}
		return idx;
	};
	auto is = [n, last]( int idx )
	{
		ll f = last(idx);
		return 0 <= f && f < n;
	};
	auto isn = [is]( int idx ) 
	{
		return !is(idx);
	};

	ll mid = BSF<ll>( 0, n, last );
	if( mid == -1 )
		cout << 0 << endl;
	else
	{
		ll ans = 0;
		ans += binarySearchFunction<ll>( 0, mid + 1, isn );
		ans += n - binarySearchFunction<ll>( mid, n, is );
		cout << n - ans << endl;
	}
		
	return 0;
}

Measured memory_bytes: 2564
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "algorithm"
#include "functional"
#include "set"
#include "numeric"
#include "unordered_map"

using namespace std;

const long long int MOD = 1000000007;

int N, M, K, H, W, L, R;

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

	cin >> N >> K;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	int fin = -1;
	for (int i = 0; i < N - 1; i++) {
		if (v[i] + v[i + 1] >= K)fin = i + 1;
	}
	if (fin == -1) {
		cout << "Impossible\n";
		return 0;
	}
	cout << "Possible\n";
	for (int i = 1; i < fin; i++)cout << i << endl;
	for (int i = N - 1; i > fin; i--)cout << i << endl;
	cout << fin << endl;
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
const int MOD = 1e9+7;
const int INF = 1e9;
const int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
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;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
  void debug() {cerr << "\n";}
  template<class First> void debug(const First& first) {cerr<<first<<"\n";}
  template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
#else
  #define debug(...) 42
#endif


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

  if (M == 1 && K == 1) {
    cout << "-1\n";
    return 0;
  }
  if (K == 0) {
    rep(i, 1 << M) {
      cout << (i?" ":"")<< i << " " << i;
    }
    cout << endl;
  } else {
    if (K > (1 << M) - 1) {
      cout << "-1\n";
    } else {
      // 構築できる
      cout << K;
      rep(i, 1 << M) {
        if (i == K)
          continue;
        cout << " " << i;
      }
      cout << " " << K;
      rrep(i, (1 << M)-1) {
        if (i == K)
          continue;
        cout << " " << i;
      }
      cout << "\n";
    }
  }

  return 0;
}


Measured memory_bytes: 1792