akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int x=ir.nextInt();
		for(int i=1;;i++){
			int tot=(i+1)*i/2;
			if(tot>=x){
				out.println(i);
				return;
			}
		}
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

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

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


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

int main() {
  int N;
  cin >> N;
  double sum=0;
  for(int i=0;i<N;i++){
    double x;
    string u;
    cin >> x >> u;
    if(u=="JPY")sum+=x;
    else sum+=x*380000.0;
  }
  cout << sum;
}
       

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

int main() {
  int A,B,C,D;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
  int ans=0;
  while (ans==0) {
    C = C - B;
    if (C <= 0) {
      ans=1;
      break;
    }
    A = A - D;
    if (A <=0 ) {
      ans=2;
      break;
    }
  }  
  if (ans==1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int n,m,arr[100005],ans;
vector<int> v[100005];
long long x;
int main(){
    cin>>x;
    for(long long i =0;i<=200;i++){
        for(long long j =0;j<=i;j++){
            if(i*i*i*i*i+j*j*j*j*j==x){
                cout<<i<<' '<<-j<<endl;
                return 0;
            }
            else if(i*i*i*i*i-j*j*j*j*j==x){
                cout<<i<<' '<<j<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 5944
#include<iostream>
using namespace std;
int main()
{
 int a,b,c,d;
 cin >> a >> b;
 c=a+b;
 d=c/2;
 if(c%2!=0){
    cout << "IMPOSSIBLE";
 }
 else {
    cout << d;
 }
 return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b,c,k;
    scanf("%d %d %d",&a,&b,&c);
    if(b <= a && b <= c){ 
        k = a;
        a = b;
        b = k;
    }   
    if(c <= a && c <= b){ 
        k = a;
        a = c;
        c = k;
    }   

    if(c <= b){ 
        k = b;
        b = c;
        c = k;
    }   
    printf("%d %d %d\n",a,b,c);
}

Measured memory_bytes: 2664
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll mod_pow(ll x, ll n) {
    if (n == 0) return 1;
    ll res = mod_pow(x * x % mod, n / 2);
    if (n & 1) res = res * x % mod;
    return res;
}

ll com(ll a, ll b) {
    if (a < b) return 0;
    ll res = 1;
    for (ll i = 0; i < b; i++) {
        res *= (a - i);
        res %= mod;
        res *= mod_pow(b - i, mod - 2);
        res %= mod;
    }
    return res;
}

int main() {
    ll n,k; cin >> n >> k;
    vector<int> a(n),b(n),c;
    for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
    int cur = 0;
    int len = 0;
    int cycl = 0; 
    while (1) {
        if (b[cur]) {
            cycl = len + 1 - b[cur];
            break;
        }    
        len++;
        b[cur] = len;
        c.push_back(cur);
        cur = a[cur];
    }
    if (k < b[cur]) cout << c[k]+1 << "\n";
    else {
        ll tmp = k - b[cur] + 1;
        ll cnt = tmp % cycl;
        cnt += b[cur] - 1;
        cout << c[cnt]+1 << "\n";
    }   
}

Measured memory_bytes: 5828
s = gets.chomp.split("")
n = s.size
a = s[0..((n-1)/2-1)]
b = s[((n+3)/2-1)..(n-1)]
puts a.join("") == a.reverse.join("") && b.join("") == b.reverse.join("") && s.join("") == s.reverse.join("") ? "Yes" : "No"

Measured memory_bytes: 1788
#include <iostream>
#include <vector>


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

    std::vector<int> count(N, 1);

    for (int i = 0; i < K; i++) {
        int d;
        std::cin >> d;
        for (int j = 0; j < d; j++) {
            int idx;
            std::cin >> idx;
            count[idx - 1] = 0;
        }
    }

    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += count[i];
    }

    std::cout << sum << std::endl;
}


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

int main(){
	int n;
	int A[101];
	cin >> n;
	for(int i = 0; i < n; i++) cin >> A[i];
	for(int i = 0; i < n-1; i++) cout << A[i] << " ";
	cout << A[n-1] << endl;
	
	for(int i = 1; i < n; i++ ){
		int key = A[i];
		int j = i -1;
		while(j > -1 && A[j] > key){
			A[j+1] = A[j];
			j = j -1;
		}
		A[j+1] = key;
		for(int k = 0; k < n-1; k++) cout << A[k] << " ";
		cout << A[n-1] << endl;
	}
	
	return 0;
}

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

int main()
{
    int X,Y;
    cin >> X >> Y;
    if ((Y-2*X)%2==0 && Y-2*X>=0  && (4*X-Y)%2==0 && 4*X-Y>=0)
    {
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3568
N = int( input())
A = [ int( input()) for _ in range(N)]
now = 0
ans = 0
if A[0] != 0:
    ans = -1
else:
   for i in range(1,N):
       a = A[i]
       # if a > i:
       #     ans = -1
       #     break
       #el
       if now + 1 == a:
           ans += 1
           now += 1
       elif now >= a:
           ans += a
           now = a
       else:
           ans = -1
           break
print(ans)


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    vector<bool> x(n);
    bool broken = false;
    bool ok = true;
    bool upd = false;
    ll prev = 0;
    ll l = -1000000002, r = 1000000002;
    REP(i, n) {
      string tmp; cin >> tmp;
      if(tmp == "x") {
        if(upd) {
          if(i%2) l = max(l, prev+1);
          else r = min(r, prev-1); 
        }
        upd = false;
        x[i] = true;
        broken = true;
        continue;
      }
      ll j = stoi(tmp);
      if(i%2) {
        if(!upd && i != 0) r = min(r, j-1);
        if(upd && j <= prev) ok = false;
      } else {
        if(!upd && i != 0) l = max(l, j+1);
        if(upd && j >= prev) ok = false;
      }
      prev = j;
      upd = true;
    }
    bool seq = false;
    FOR(i, 1, n) {
      if(x[i] == true && x[i-1] == true) seq = true;
    }
    if(seq) {
      cout << "none" << endl;
      continue;
    }
    if(!ok) {
      cout << "none" << endl;
      continue;
    }
    if(!broken) {
      cout << "ambiguous" << endl;
      continue;
    }
    if(l == r) cout << l << endl;
    else if(l < r) cout << "ambiguous" << endl;
    else cout << "none" << endl;
  }
  
}



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

int n,t,c1[100005],c2[100005],son[100005],siz[100005],sum,hson,ans[100005];
int pa[200005],rnk[200005],edge[200005],ver[200005];
vector<int> e[100005];

int _find(int x){return pa[x]==x?x:pa[x]=_find(pa[x]);}
void _merge(int x,int y)
{
    x=_find(x),y=_find(y);
    sum-=min(ver[x],edge[x]);
    if(x!=y) sum-=min(ver[y],edge[y]);
    edge[x]++;
    if(x!=y) 
    {
        edge[x]+=edge[y],pa[y]=pa[x],ver[x]+=ver[y];
        if(rnk[x]==rnk[y]) rnk[x]++;
    }
    sum+=min(ver[x],edge[x]);
}

void dfs1(int now,int fa)
{
    son[now]=0,siz[now]=1;
    for(auto to:e[now])
    {
        if(to==fa) continue;
        dfs1(to,now);
        siz[now]+=siz[to];
        if(siz[to]>siz[son[now]]) son[now]=to;
    }
}

void cal(int now,int fa,int op)
{
    if(op==1) _merge(c1[now],c2[now]);
    else
    {
        rnk[c1[now]]=rnk[c2[now]]=0,ver[c1[now]]=ver[c2[now]]=1,edge[c1[now]]=edge[c2[now]]=0;
        pa[c1[now]]=c1[now],pa[c2[now]]=c2[now];
    }
    for(auto to:e[now])
        if(to!=fa&&to!=hson) cal(to,now,op);
}

void dfs2(int now,int fa,int keep)
{
    for(auto to:e[now])
    {
        if(to==fa||to==son[now]) continue;
        dfs2(to,now,0);
    }
    if(son[now]) dfs2(son[now],now,1);
    hson=son[now];
    cal(now,fa,1);
    hson=0;
    ans[now]=sum;
    if(!keep) cal(now,fa,-1),sum=0;
}

int main()
{
    scanf("%d%d",&n,&t);
    for(int i=1,x,y;i<n;i++)
    {
        scanf("%d%d",&x,&y);
        e[x].push_back(y),e[y].push_back(x);
    }
    for(int i=1;i<=n;i++) scanf("%d%d",c1+i,c2+i);
    for(int i=1;i<=t;i++) pa[i]=i,ver[i]=1;
    dfs1(1,1);
    dfs2(1,1,1);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}

/*
7 10000
1 2
1 3
2 4
2 5
3 6
3 7
1 1
1 2
1 3
1 3
2 3
1 1
1 1
 */


Measured memory_bytes: 19448
def main():
    N, A, B = (int(i) for i in input().split())
    X = [int(i) for i in input().split()]
    ans = 0
    for i in range(N-1):
        dist = X[i+1] - X[i]
        ans += min(A*dist,B)
    print(ans)

if __name__ == '__main__':
    main()

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

long long function(long long b, long long n) {
	long long ans = 0;
	while (n > 0) {
		ans += n % b;
		n /= b;
	}
	return ans;
}

int main() {
	long long n, s;
	cin >> n >> s;
	if (n == s) {
		cout << n + 1 << endl;
		return 0;
	}
	long long root_n = 0;
	for (long long b = 2; b*b <= n; b++) {
		root_n = b;
		if (function(b, n) == s) {
			cout << b << endl;
			return 0;
		}
	}
	if (n<=3) {
		for (int b = 2; b <= 4; b++) {
			if (function(b, n) == s) {
				cout << b << endl;
				return 0;
			}
		}
		cout << -1 << endl;
		return 0;
	}
	for (long long x = (n - s) / (root_n - 1) -1 +((n-s)%(root_n-1)==0) ; x >= 1; x--) {
		if ((n - s) % x != 0) {
			continue;
		}
		long long b = (n - s) / x + 1;
		if (b > root_n && b > x && s - x < b && 0 <= s-x) {
			cout << b << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

int main(){
  int A,B,C,K,ans;

  cin >> A >> B >> C >> K;

  if(A >= K){
    ans = K;
  }else if(A < K){
    ans = A;
    K -= A;
    if(B < K){
      K -= B;
      ans -= K;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3632
#include<stdio.h>

int bubbleSort(int A[],int N){
    int i,j;
    int sw=0;
    unsigned short flag=1;
    for(i=0;flag;i++){
        flag=0;
        for(j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                swap(&A[j],&A[j-1]);
                flag=1;
                sw++;
            }
        }
    }
    return sw;
}

void swap(int *a,int *b){
    int temp=*a;
    *a=*b;
    *b=temp;
}

int main(void){
    int i,A[100],N,sw;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    sw=bubbleSort(A,N);
    
    for(i=0;i<N;i++) {
        if (i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",sw);
    return 0;
}


Measured memory_bytes: 2116
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
using namespace std;
typedef long long ll;

int main() {
	int N; cin >> N;
	int a[N];
	bool b[8]; for (int i = 0; i < 8; i++) b[i] = false;
	int over = 0;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		int k = a[i] / 400;
		if (k <= 7) b[k] = true;
		else over++;
	}

	int max = 0;
	int min = 0;

	for (int i = 0; i < 8; i++) {
		max += b[i];
		min += b[i];
	}

	if(min > 0) cout << min << " ";
	else cout << 1 << " ";
	

	// 8種類以外の色もとれる
	max += over;
	cout << max << endl;

	
	

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int m, f, r, a[50], i,n,b[50];
  n = 0;
  for(i=0;i<50;i++){
    a[i]= 0;
    b[i] = 0;
  }
  for(i=0;i<50;i++){
    scanf("%d %d %d",&m, &f,&r);
    if(m==(-1)&&f==(-1)&&r==(-1))
    break;
    if(r>49){
    b[i]+=r;
  }
  if(m<0||f<0){
    a[i] = 1;
  }
else{
  a[i] += m + f;
}
  n++;
  }
  for(i=0;i<n;i++){
    if(a[i]>79)
      printf("A\n");
      else if(a[i]>64&&a[i]<80)
      printf("B\n");
      else if((a[i]>49&&a[i]<65)||b[i]>49)
      printf("C\n");
      else if((a[i]>29&&a[i]<50)&&b[i]<50)
      printf("D\n");
      else
      printf("F\n");
  }
  return 0;
}



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

#define endl '\n'

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

    int a,b,c,k; cin >> a >> b >> c >> k;
    int ans = min(a, k);
    k -= ans;
    int temp = min(b, k);
    k -= temp;
    temp = min(c, k);
    ans -= temp;
    cout << ans << endl;
}

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


#define ll long long
#define pb push_back

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

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const ll inf = 2e18+5;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    ll n,k;
    cin>>n>>k;
    vl a(n);
    loop(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    ll sum=0;
    loop(i,0,n-k)
        sum+=a[i];
    cout<<sum<<endl;    
   
    return 0;
}   

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

int main(){
  ll N;cin>>N;
  ll tmp_t=0,tmp_x=0,tmp_y=0;
  bool flag=true;
  rep(i,N){
    ll next_t,next_x,next_y;cin>>next_t>>next_x>>next_y;
    if((next_t-tmp_t)>=abs(next_x-tmp_x)+abs(next_y-tmp_y) && (next_t-tmp_t)%2==(abs(next_x-tmp_x)+abs(next_y-tmp_y))%2){
      tmp_t = next_t,tmp_x=next_x,tmp_y=next_y;
    }
    else{
      flag=false;
    }
  }
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int main(void){
    int N,M;cin>>N>>M;
    vector<int> A(N);
    int sum = 0;
    int res = 0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        sum += A[i];
    }
    for(int i=0;i<N;i++){
        if(sum%(4*M)==0&&A[i]>=sum/(4*M)){
            res++;
        }else if(sum%(4*M)!=0&&A[i]>=sum/(4*M)+1)
            res++;
    }
    if(res>=M) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 100010;

int n, m;
int c0;

int st[MN];
int bi_comp, bi_v;
int nbi_comp, nbi_v;
vi g[MN];

int sz;

bool dfs(int v, int c) {
	st[v] = c;
	++sz;

	bool flg = true;

	for (int to : g[v]) {
		if (st[to] == -1) {
			if (!dfs(to, c ^ 1)) {
				flg = false;
			}
		} else {
			if (st[to] == c) {
				flg = false;
			}
		}
	}

	return flg;
}

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

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].pb(b); g[b].pb(a);
	}

	memset(st, -1, sizeof(st));

	rep(i, n) {
		if (st[i] == -1) {
			if (g[i].size() == 0) {
				++c0;
			} else {
				sz = 0;
				bool res = dfs(i, 0);

				if (res) {
					++bi_comp;
					bi_v += sz;
				} else {
					++nbi_comp;
					nbi_v += sz;
				}
			}
		}
	}

	ll ret = (ll)n * n - (ll)(n - c0) * (n - c0) + (ll)bi_comp * bi_comp * 2 + 2LL * nbi_comp * bi_comp + (ll)nbi_comp * nbi_comp;

	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 9984
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in); 
		
		int N = sc.nextInt();
		int[] array1 = new int[N];
		int[] array2 = new int[N];
		for(int i=0; i<N; i++)
			array1[i] = sc.nextInt();
		for(int i=0; i<N; i++)
			array2[i] = sc.nextInt();
		
		int candies = 0;
		int total1 = 0;
		int total2 = 0;
		int total3 = 0;

		for(int i=0; i<N; i++) {
			total1 += array1[i];
			total2 = 0;
			for(int j=i; j<N; j++) {
				total2 += array2[j];
			}
			total3 = total1 + total2;
			if(candies < total3)
				candies = total3;
		}
		System.out.println(candies);
	}

} 
   

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            var h = int.Parse(Console.ReadLine());

            Console.WriteLine(((a + b) * h) / 2);
        }
    }
}

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

long double dist(int x, int y)
{
    return sqrt(pow(x,2) + pow(y,2));
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, d,cnt=0;
    cin >> n >> d;
    int x,y;

    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        if(dist(x, y) <= d)
            cnt++;
    }

    cout << cnt;
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int h, w, k;    cin >> h >> w >> k;
    int sup = h;
    vector<vector<int> > cnt(h);
    string *s = new string[h];
    int **ans = new int*[h];

    for (int i = 0; i < h; i++) {
        ans[i] = new int[w];
        cin >> s[i];
        int sz = 0;
        for (int j=0; j < w; j++) {
            if (s[i][j] == '#') {
                cnt[i].push_back(j);
                sz++;
            }
        }
        if (sz == 0 && sup == h)
            sup = i;
    }

    int l = 1;
    for (int i = 0; i < h; i++) {
        
        if (cnt[i].size() == 0)
            continue;

        else {
            int m = 0;
            int sz = cnt[i].size();
            while (sz > 1) {
                bool can = false;
                while (s[i][m] != '#' || !can) {
                    if (s[i][m] == '#')
                        can = true;
                    ans[i][m] = l;
                    m++;
                }
                l++;
                sz--;
            }
            for (int a = m; a < w; a++)
                ans[i][a] = l;
            l++;
        }
    }

    for (int i = 0; i < h; i++) {
        if (cnt[i].size() == 0 && i == 0) {
            int m = i+1;
            while (!cnt[m].size())
                m++;
            for (int j = 0; j < w; j++) {
                ans[i][j]  = ans[m][j];
            }
        }
        else if (cnt[i].size() == 0) {
            int m = i-1;
            while (!ans[m][0])
                m--;
            for (int j = 0; j < w; j++) {
                ans[i][j]  = ans[m][j];
            }
        } 

    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

int A[2000001]={0}, B[2000001];
int n;

void counting_sort(int k){
	int C[10001] = {0};
	rep(i, n){
		C[A[i]]++;
		
	}
	

	rep(i, k){
		C[i+1] = C[i] + C[i+1];
		
	}
	
	rrep(i, n-1, 0){
		B[C[A[i]]] = A[i];
		// rep(i, n) printf("C%d ", C[i]);
		// rep(i, n) printf("%d ", B[i]);
		// printf(" A[%d] %d\n", i, A[i]);
		
		C[A[i]]--;
	}
	// printf("\n");
	

}

int main(){

	scanf("%d", &n);
	rep(i, n) scanf("%d", &A[i]);
	counting_sort(10000);
	for(int i = 1; i <= n; i++){
		if(i > 1) printf(" ");

		printf("%d", B[i]);
	}
	printf("\n");
}


Measured memory_bytes: 18848
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;



int main(void){
    int a;
    cin >> a;
    cout << a+a*a+a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3628
import scala.io.Source

object Main extends App {
  val lines = Source.stdin.getLines.toList.init

  val count: List[List[String]] =
  for {
    line <- lines
  } yield { val Array(max, sum) = line.split(" ").map(_.toInt)
            val li = List.range(1, max+1)
            for {
              i <- li
              j <- li
              n <- li
              if (i+j+n == sum)
              if (i < j && j < n)
            } yield { s"$i + $j + $n" }
  }

  count.map(_.length).map(println)
}

Measured memory_bytes: 93956
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int a[2];
    for (int i = 0; i < 2; ++i){
        scanf("%d", &a[i]);
    }
    printf("%d", a[0] + a[1]/2);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    string a, b;
    cin >> a >> b;
    int n, m;
    string s = "", t = "";
    n = b[0] - '0';
    m = a[0] - '0';
    rep(i, n) s += a;
    rep(i, m) t += b;
    if(s > t) {
        cout << t << endl;
    } else {
        cout << s << endl;
    }

    return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n, m;
    cin >> n >> m;
    int t = (n - m) * 100;
    int res = 0;
    for(int i = 1; i <= (1 << m); ++i) {
        res += 1900 * m + t;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
def solve():
    MOD = 10**9 + 7

    N = int(input())
    Ass = [tuple(map(int, input().split())) for _ in range(N)]

    Sss = [[] for _ in range(N+1)]
    for S in range(1<<N):
        num1 = bin(S).count('1')
        Sss[num1].append(S)

    dp = [0] * (1<<N)
    dp[0] = 1
    for iM, Ss in enumerate(Sss[:-1]):
        for S in Ss:
            dp[S] %= MOD
            for iW in range(N):
                if S & (1<<iW) == 0 and Ass[iM][iW]:
                    S2 = S | (1<<iW)
                    dp[S2] += dp[S]

    print(dp[-1] % MOD)


solve()


Measured memory_bytes: 132036
#include <iostream>

using namespace std;

int main()
{
    int N, x, y, b, p;
    cin >> N;
    for (int d = 0; d < N; d++) {
        cin >> x >> y >> b >> p;
        int ans = min(b * x + p * y, (int)(max(b, 5) * x * 0.8) + (int)(max(p, 2) * y * 0.8));

        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0) cout << n / 2 << endl;
    else cout << n / 2 + 1 <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b; 
  cin >> a >> b;
 
  if (a%2 == 1 && b%2 == 1) {
    cout << "Odd" << endl;
  }
  
   else 
     cout << "Even" << endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
using ii = pair<int, int>;
using ll = long long int;


int a,b,c,d;

int main (){
	FASTIO;
	int T; cin >> T;
	while(T--) {
		string s; cin >> s;
		if(s == "AC") a++;
		else if(s=="WA") b++;
		else if(s == "TLE") c++;
		else d++;

		
	}

	cout << "AC x " << a << endl;
	cout << "WA x " << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x " << d << endl;
	return 0;
}


Measured memory_bytes: 3676
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
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; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  while (true) {
    int n = in();
    if (n == 0) break;
    vector<int> x(n), y(n), r(n), c(n);
    rep(i, n) cin >> x[i] >> y[i] >> r[i] >> c[i];
    auto intersectCC = [&](int i, int j) {
      int r2 = (r[i] + r[j]) * (r[i] + r[j]);
      int d = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
      return d < r2;
    };
    auto intersect = [&](int t, int used) {
      bool f = false;
      rep(i, t) f |= (~used >> i & 1) && intersectCC(t, i);
      return f;
    };
    vector<int32_t> dp(1 << n, -1);
    function<int(int)> dfs = [&](int used) {
      if (dp[used] != -1) return dp[used];
      cmax(dp[used], 0);
      rep(i, n) loop(j, i + 1, n) {
        if ((used >> i & 1) || (used >> j & 1) || c[i] != c[j]) continue;
        if (intersect(i, used) || intersect(j, used)) continue;
        cmax(dp[used], dfs(used | (1 << i) | (1 << j)) + 2);
      }
      return dp[used];
    };
    cout << dfs(0) << endl;
  }
}



Measured memory_bytes: 68460
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  int N,M; cin>>N;
  int max=0;
  vector<string> s(N);

  for(int i=0;i<N;i++) cin>>s[i];
  cin>>M;
  vector<string> t(M);
  for(int i=0;i<M;i++) cin>>t[i];

  for(int i=0;i<N;i++){
    string temp=s[i];
    int num=0;
    for(int j=0;j<N;j++){
      if(temp==s[j])num++;
    }
    for(int j=0;j<M;j++){
      if(temp==t[j])num--;
    }
    max=(num>max?num:max);
  }

  cout<<max<<endl;

  return 0;
}


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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

#define mygc(c) (c)=getchar()

int ri() {
	int c,s=0,r=0;
	for(;;){ mygc(c); if(c=='-'){s=1;break;} if(c<='9'&&c>='0'){r=c-'0';break;}}
	for(;;){ mygc(c); if(c>'9'||c<'0')break; r= r* 10 + c-'0';}
	if(s)r=-r;
	return r;
}

int main() {
    int n = ri();
	int a[n];
	FOR(i,n) a[i] = ri();
	
	// to +
	s64 cur = 0;
	s64 r0 = 0;
	FOR(i,n) {
		cur += a[i];
		if (i%2) { // -
			if (cur >= 0) {
				r0 += cur+1;
				cur = -1;
			}
		} else {
			if (cur <= 0) {
				r0 += 1-cur;
				cur = 1;
			}
		}
	}
	
	cur = 0;
	s64 r1 = 0;
	FOR(i,n) {
		cur += a[i];
		if (i%2) { // -
			if (cur <= 0) {
				r1 += 1-cur;
				cur = 1;
			}
		} else {
			if (cur >= 0) {
				r1 += cur+1;
				cur = -1;
			}
		}
	}
	
	cout << min(r0,r1) << endl;
	
    return 0;
}


Measured memory_bytes: 640
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())
T = list(input())

count = 0
for i in range(len(S)):
    if S[i] == T[i]:
        count += 1
# a, b = MAP()
# n = INT()
# a, b, c = MAP()

print(count)


Measured memory_bytes: 5704
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) {
		cout << (b - a) / 2 << endl;
	}
	else {
		ll ans = min({ b - 1ll, n - a, a + (b - a) / 2, n - b + 1 + (b - a) / 2 });
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include 	<ext/pb_ds/assoc_container.hpp> 
#include 	<ext/pb_ds/tree_policy.hpp> 
#include 	<iostream>
#include 	<queue>
#include 	<tuple>
#include 	<vector>
#include	<bits/stdc++.h>
#include	<algorithm>
#include 	<cmath>
#include 	<map>
#include 	<string>
#include 	<iomanip> 
#include 	<ctype.h>
#define 	ll  long long int
#define		read(a) long long int a; cin>>a;
#define 	readstr(s) string s; cin>>s;
#define 	readc(c) char c; cin>>c;
#define 	readarr(a,l) long long int a[l]={0}; for(ll i=0;i<l;i++) cin>>a[i];
#define 	loop(i,a,b) for(ll i=a;i<b;i++)
#define 	rloop(i,a,b) for(ll i=a;i>b;i--)
#define 	loopchar() for(char c='a';c<='z';c++)
#define 	printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define		printv(v) for (int i: v) cout << i << " "; cout << endl;
#define 	loopitr(vec) for(auto itr=vec.begin();itr!=vec.end();itr++)
#define 	ff first
#define 	ss second
#define 	readmtrx(i,j,a,b) ll arr[a][b]={0};for(ll i=0;i<a;i++)for(ll j=0;j<b;j++) cin>>arr[i][j];
#define 	all(a) a.begin(), a.end()
#define 	yes cout <<"YES"<<endl;
#define 	no cout <<"NO"<<endl;
#define 	sc(x) cout << (#x) << " is " << (x) << endl;
#define 	fast ios_base::sync_with_stdio(false);cin.tie(0);
#define 	pb(p) push_back(p)
#define 	mp make_pair
#define 	fsort(vec) sort(vec.begin(),vec.end())
#define 	rsort(vec) sort(vec.begin(),vec.end(),compare)
#define 	Endl endl
#define 	ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define 	roundoff std::cout << std::setprecision(15)
#define 	inf 9223372036854775807
#define 	infn -9223372036854775807
#define 	pi 3.14159265358979323846
const 		int mod = 1e9+7; 
#define 	intsize ll size = trunc(log10(num)) + 1
#define 	REVERSE(vec) reverse(vec.begin(),vec.end())
using 		namespace __gnu_pbds; 
using 		namespace std;

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

//code start from here 

int main() {
	fast;
	read(a)
	read(b)
	read(c)
	bool flag=false;
loop(j,b,c+1){

	if(j%a==0){
		flag=true;
		break;
	}
}
if(flag) cout<<"OK"<<endl;
else cout<<"NG"<<endl;
	return 0;
}

//ends here 

Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
using namespace std;
#define Maxn 100000
struct Node{
	int a;
	int id;
	friend bool operator <(Node p,Node q){
		if(p.a==q.a){
			return p.id<q.id;
		}
		return p.a<q.a;
	}
}a[Maxn+5],b[Maxn+5];
int n;
int p[Maxn+5];
bool vis[Maxn+5];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i].a);
		a[i].id=i;
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&b[i].a);
		b[i].id=i;
	}
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	bool found=0;
	for(int i=1;i<=n;i++){
		if(a[i].a>b[i].a){
			puts("No");
			return 0;
		}
		if(i>1&&a[i].a<=b[i-1].a){
			found=1;
		}
		p[a[i].id]=b[i].id;
	}
	if(found){
		puts("Yes");
		return 0;
	}
	for(int i=1,j=1;i<=n;i++,j=p[j]){
		if(vis[j]){
			found=1;
			break;
		}
		vis[j]=1;
	}
	if(found){
		puts("Yes");
	}
	else{
		puts("No");
	}
	return 0;
}


Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();
		int c = scan.nextInt();
		int[][] a = new int[r][c+1];
		int[] sum = new int[c+1];
		
		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				a[i][j] = scan.nextInt();
			}
		}

		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				a[i][c]= a[i][c]+a[i][j];
			}
		}
		
		for(int i=0;i<c+1;i++){
			for(int j=0;j<r;j++){
				sum[i]= sum[i]+a[j][i];
			}
		}

		for(int i=0;i<r;i++){
			for(int j=0;j<c+1;j++){
				if(j!=0)System.out.print(" ");
				System.out.print(a[i][j]);
			}
			    System.out.println();
		}
		for(int j=0;j<c+1;j++){
				if(j!=0)System.out.print(" ");
				System.out.print(sum[j]);
			}
			    System.out.println();
		}
}




//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Scanner;
//
//public class Main {
//	public static void main(String[] args) {
//		Scanner scan = new Scanner(System.in);
//		List<Integer> n = new ArrayList<Integer>();
//		List<Integer> x = new ArrayList<Integer>();
//		List<Integer> count = new ArrayList<Integer>();
//
//		 for(int i=0;;i++){
//			 n.add(i, scan.nextInt());
//			 x.add(i, scan.nextInt());
//			 count.add(i, 0);
//			 if(n.get(i)==0 && x.get(i)==0) break;
//		 }
//
//
//
//   for(int h=0;;h++){
//		 if(n.get(h)==0 && x.get(h)==0) break;
//		 for(int i=1;i<=n.get(h);i++){
//			 for(int j=i;j<=n.get(h);j++){
//				 if(i==j)continue;
//				 for(int k=j;k <= n.get(h);k++){
//					 if(i==k || j==k)continue;
//					 if(i+j+k == x.get(h)) count.set(h, count.get(h)+1 );
//				 }
//			 }
//		 }
//
//			System.out.println(count.get(h));
//   }
//	}
//
//}
//
//

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



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


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N, M = LI()
AB = [LI() for _ in range(M)]
path = [[] for _ in range(N+1)]
mp = []
ans = [0] * (N+1)

for ab in AB:
	a = ab[0]
	b = ab[1]
	path[a].append(b)
	path[b].append(a)
	#print(a,b)

def bfs(tree, st, endlist, endnum):
	queue = collections.deque()
	queue.append([-1,st])
	endlist[st] -= 1
	now = [-1,-1,-1]
	pre = []
	depth = 0
	histind = -1
	node = -1
	hist = []
	res = []
	allres = []
	while queue:
		pre = now[:]
		now = queue.popleft()
		histind = now[0]
		node = now[1]
		hist.append([histind,node])
		#来たときは絶対に初回
		res = [node,hist[histind][1]]
		allres.append(res[::])
		endnum -= 1
		if endnum == 0:
			return allres
		for v in path[node]:
			if endlist[v] > 0:
				queue.append([len(hist)-1,v])
				#endlist更新
				endlist[v] -= 1
		continue
	return None

#print_map(path)
result = bfs(path, 1, [1] * (N+1), N)
#print("[TO, FROM] = {0}".format(result))
if result is None:
	print("No")
	exit(0)
print("Yes")
execnum = N
maxlen = len(result[len(result)-1])
for i in result:
	#print(i)
	if ans[i[0]] == 0:
		ans[i[0]] = i[1]
		execnum-=1
		if execnum == 0:
			break

for i in ans[2:]:
	print(i)


Measured memory_bytes: 95952
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
bool same(Dice a,Dice b){
  for(int i=0;i<6;i++) if(a.s[i]!=b.s[i]) return false;
  return true;
}
int main(){
  Dice d[100];
  int n;cin >> n;
  for(int j=0;j<n;j++) 
    for(int i=0;i<6;i++)
      cin >> d[j].s[i];
  
  bool ff = true;
  for(int k=0;k<n-1;k++){
    for(int l=k+1;l<n;l++){
      bool f=false;
      for(int i=0;i<4;i++){
	d[l].roll('R');
	for(int j=0;j<4;j++){
	  d[l].roll('N');
	  if(same(d[k],d[l])) f=true;
	}
      }
      d[l].roll('E');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      
      d[l].roll('W');
      d[l].roll('W');
      for(int j=0;j<4;j++){
	d[l].roll('N');
	if(same(d[k],d[l])) f=true;
      }
      if(f) ff=false;
    }
  }
  
  cout << (ff?"Yes":"No") << endl;
  return 0;
}



Measured memory_bytes: 3120
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()

    D = [0] * (N+1)
    for i in range(1, N+1):
        for j in range(i, N+1, i):
            D[j] += 1

    ans = 0
    for i, d in enumerate(D):
        ans = ans + i * d
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 151436
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数
int d[100000];

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}
ll getPow(ll a, ll b){
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll d = getPow(a, b / 2);
		return (d*d) % MOD;
	}
	else {
		return (a*getPow(a, b - 1))%MOD;
	}
}


int main() {
	int n,k;
	scanf("%d%d", &n,&k);

	ll t[2001], tv[20001];
	t[0] = 1;
	REPS(i, n) {
		t[i] = (t[i-1] * i) % MOD;
		//PRINTL(t[i]);
	}
	tv[0] = 1;
	REPS(i, n) {
		tv[i] = getPow(t[i], MOD-2);
		//PRINTL(tv[i]);
	}

	REPS(i, k) {
		if (i > n - k + 1) {
			PRINTD(0);
			continue;
		}
		//printf("i:%d\n",i);
		//printf("%lld %lld\n", t[n - k + 1], tv[i]);
		ll ans1 = (t[n - k +1] * tv[i]) % MOD;
		//PRINTL(ans1);
		//printf("%lld\n", tv[n - k + 1 - i]);
		ans1 = (ans1*tv[n - k + 1 - i]) % MOD;
		//PRINTL(ans1);
		ll ans2 = (t[k - 1] * tv[i - 1]) % MOD;
		//PRINTL(ans2);
		ans2 = (ans2*tv[k -i]) % MOD;
		//PRINTL(tv[k]);
		PRINTL((ans1*ans2) % MOD);
	}
}


Measured memory_bytes: 256