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

using namespace std;
using namespace std::chrono;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define print(x) cout << x << "\n";
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
int mod=1000000007;
const int MX=0x3f3f3f3f;

	
int main() {
	IOS;
	ll a,b,n;
	cin>>a>>b>>n;
	cout<<ll(floor(a*min(n,b-1))/b);
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

ll n,m;
vector<lvector> As;

void dfs(lvector v,ll pos) {
  if(v[n-1]>0) As.emplace_back(v);
  else {
    for(ll d=0;d+v[pos]<=m;++d) {
      v[pos+1]=v[pos]+d;
      dfs(v,pos+1);
    }
  }
  return;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll q,a,b,c,d,ans=0;cin>>n>>m>>q;
  vector<lvector> V(q);
  rep(i,q) {
    cin>>a>>b>>c>>d;a--,b--;
    V[i]=lvector{a,b,c,d};
  }
  sort(ALL(V));
  lvector tmp(n,0);tmp[0]++;
  dfs(tmp,0);
  for(lvector A:As) {
    ll ans_=0;
    for(auto v:V) {
      a=v[0],b=v[1],c=v[2],d=v[3];
      if(A[b]-A[a]==c) ans_+=d;
    }
    ans=max(ans,ans_);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 8980
n = int(input())
xs = list(map(int, input().split()))
m = min(xs)
M = max(xs)

ans = float('inf')
for i in range(m, M+1):
  result = 0
  for x in xs:
    result += (x-i) ** 2
  ans = min(ans, result)
print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;

public class Main{
	final static int MOD = 1000000007;
	final static int INF = 1000000000;

	
	
	static int n;
	static int[] a;
	public static void main(String[] args) throws IOException{
		NScanner sc = new NScanner(System.in);
		n = sc.nextInt(); 
		a = new int[n];
		for(int i = 0; i < n; ++i)
			a[i] = sc.nextInt();
		int q = sc.nextInt();
		for(int i = 0; i < q; ++i){
			int m = sc.nextInt();
			System.out.println((dfs(0, m) ? "yes" : "no"));
		}
	}
	
	static boolean dfs(int idx, int remain){
		if(remain == 0) return true;
		if(remain < 0) return false;
		if(idx >= n) return false;
		return dfs(idx+1, remain) || dfs(idx+1, remain-a[idx]);
	}

}


class NScanner{

	private BufferedReader br;
	private StringTokenizer tok;

	public NScanner(InputStream is) throws IOException{
		br = new BufferedReader(new InputStreamReader(is));
		getLine();
	}

	private void getLine() throws IOException{
		while(tok == null || !hasNext()){
			tok = new StringTokenizer(br.readLine());
		}
	}

	public boolean hasNext(){
		return tok.hasMoreTokens();
	}

	public String next() throws IOException{
		if(hasNext()){
			return tok.nextToken();
		}else{
			getLine();
			return tok.nextToken();
		}
	}

	public int nextInt() throws IOException{
		if(hasNext()){
			return Integer.parseInt(tok.nextToken());
		}else{
			getLine();
			return Integer.parseInt(tok.nextToken());
		}
	}

	public long nextLong() throws IOException{
		if(hasNext()){
			return Long.parseLong(tok.nextToken());
		}else{
			getLine();
			return Long.parseLong(tok.nextToken());
		}
	}

	public double nextDouble() throws IOException{
		if(hasNext()){
			return Double.parseDouble(tok.nextToken());
		}else{
			getLine();
			return Double.parseDouble(tok.nextToken());
		}
	}
}


Measured memory_bytes: 24956
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

#define MAX 24
int n;
int xs[MAX], ys[MAX], rs[MAX], cs[MAX];

char memo[1<<MAX];

#define DBL(x) ((x)*(x))

bool connect(int i, int j)
{
	double d = (DBL(xs[i]-xs[j]) + DBL(ys[i]-ys[j]));
	return d < DBL(rs[i]+rs[j]);
}

bool top(int bit, int i)
{
	for (int j = i-1; j >= 0; j--)
		if (!((bit>>j)&1))
			if (connect(i, j))
				return false;
	return true;
}

int solve(int bit)
{
	if (bit == (1<<n)-1) return 0;
	if (memo[bit] != -1) return memo[bit];

	memo[bit] = 0;
	rep(i, n) {
		if ((bit>>i)&1) continue;
		if (!top(bit, i)) continue;
		REP(j, i+1, n) {
			if (cs[i] != cs[j]) continue;
			if ((bit>>j)&1) continue;
			if (!top(bit, j)) continue;
			memo[bit] = max(memo[bit], (char)(solve(bit|(1<<i)|(1<<j))+2));
		}
	}
	return memo[bit];
}

int main(void)
{
	while (cin >> n, n) {
		memset(memo, -1, sizeof(memo));
		rep(i, n) cin >> xs[i] >> ys[i] >> rs[i] >> cs[i];

		cout << solve(0) << endl;
	}
	return 0;
}

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

ll p(ll x,int d){
    ll res = 1;
    for(int i = 1;i<=d;i++){
        res *= x;
    } 
    return res;
}

ll s(ll x){
    ll r = 0;
    while(x != 0){
        r += x % 10;
        x =  x/10;
    }
    return r;
}

int keta(ll x){
    int d = 0;
    while(1){
        if(x/(p(10,d))==0){
            return d;
            break;
        }
        d++;
    }
}


int keta_d(ll x,int d){
    return (x%p(10,d))/(p(10,d-1));
}


ll f(ll x){
    vector<ll> v;
    v.push_back(x);
    for(int d=1;d<=keta(x)+1;d++){
        for(int i = keta_d(x,d)+1;i<=9;i++){
            v.push_back((x/(p(10,d))*p(10,d))+(i+1)*p(10,d-1)-1);
        }
    }
    ll res = v[0];
    for (int i=0;i<v.size();i++){
        if (res * s(v[i]) - s(res) * v[i]>0){
            res = v[i];
        }
    }
    return res;
}


int main(){
    ll k; cin >> k;
    ll res = 1;
    for(ll i=1;i<=k;i++){
        cout << res << endl;
        res = f(res + 1);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define all(vec) vec.begin(), vec.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl
#define isEven(t) t % 2 == 0

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

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

	int N, M, X;
	int A[120] = {0};

	cin >> N >> M >> X;

	for (int i = 0; i < M; i++) {
		int tmp;
		cin>>tmp;
		A[tmp]++;
	}

	int p1=0, p2=0;
	for (int i = 0; i <= N; i++) {
		if(i<X){
			p1 += A[i];
		}
		if(i>X){
			p2 += A[i];
		}
	}

	cout << min(p1, p2) << endl;

	return 0;
}

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

int main() {

    int N;
    cin >> N;
    vector<int> B(N-1);
    
    for(int i = 0; i < N-1; i++){
        cin >> B.at(i);
    }

    long long score = B.at(0);

    for(int i = 0; i < N-2; i++){
        if(B.at(i) < B.at(i+1)){
            score += B.at(i);
        }else{
            score += B.at(i+1);
        }
    }

    score += B.at(N-2);

    cout << score << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a+b==15){
    cout<<"+"<<endl;
    return 0;
  }
  if(a*b==15){
    cout<<"*"<<endl;
    return 0;
  }
  cout<<"x"<<endl;
  return 0;
}


Measured memory_bytes: 256
n,s=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
ans=0
dp=[[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0]=1

for i in range(n):
    for c in range(s+1):
        if c>=A[i]:
            dp[i+1][c]=(2*dp[i][c]+dp[i][c-A[i]])%mod
        else:
            dp[i+1][c]=(2*dp[i][c])%mod

print(dp[n][s]%mod)


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

int main(){
  int n;
  cin >> n;
  string sn;
  sn = to_string(n);
  int m=0;
  for(int i=0; i<sn.size(); i++){
    m += (int)(sn.at(i))-48;
  }
  if(n%m==0)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}
  


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second
const lint MOD = (lint)1e9 + 7LL;

lint modpow(lint n, lint x){
    lint res = 1LL;
    while(x){
        if(x%2==1) res = (res * n) % MOD;
        n = (n*n)%MOD;
        x = x>>1;
    }
    return res;
}

signed main(){
    lint H, W, A, B;
    cin >> H >> W >> A >> B;
    vector<lint> factorial(H+W+1);
    vector<lint> invFactorial(H+W+1);
    factorial[0] = 1;
    invFactorial[0] = 1;
    lint res = 0;
    REP(i, H+W) factorial[i+1] = ((i+1) * factorial[i])%MOD;
    FOR(i, 1, H+W+1) invFactorial[i] = modpow(factorial[i], MOD-2);
    FOR(w, B, W){
        lint tmp;
        tmp = (((factorial[w+H-A-1]*invFactorial[w])%MOD)*invFactorial[H-A-1])%MOD; 
        lint comb = (((factorial[A-1+W-w-1]*invFactorial[A-1])%MOD)*invFactorial[W-w-1])%MOD;
        res = (res + (comb * tmp )%MOD)%MOD; 
    }
    cout << res << endl;
    return 0;
}

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

int main() {
    int N, K, S = 1;
    cin >> N >> K;

    for (int i = 0; i < N; i++) {
        if (S < K) {
            S *= 2;
        }
        else {
            S += K;
        }
    }
    cout << S << endl;
}


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

int main(){
	char c;
	int ans=0,n;

	cin>>ans;
	while(1){
		cin>>c;
		if(c=='='){
			printf("%d\n",ans);
			return 0;
		}
		cin>>n;
		if(c=='+') ans+=n;
		else if(c=='-') ans-=n;
		else if(c=='*') ans*=n;
		else ans/=n;
	}
	return 0;
}

Measured memory_bytes: 1144
#include<stdio.h>
int main(){
  int n,i,max=0,min=1000;
  scanf("%d",&n);
  int a[n+1];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(max<a[i])
      max=a[i];
    if(min>a[i])
      min=a[i];
  }
  printf("%d\n",max-min);
  return 0;
}


Measured memory_bytes: 1684
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }


    private void solve() {
        try {
            int r = sc.nextInt();
            int d = sc.nextInt();
            int x = sc.nextInt();

            for (int i = 0; i < 10; i++) {
                x = r * x - d;
                System.out.println(x);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21460
a, b, c, d = map(int, input().split())

if a>0 :
    if d<0 :
        print(a*d)
    else :
        print(b*d)
elif b<0 :
    if c>0 :
        print(b*c)
    else :
        print(a*c)
else :
    if c>0 :
        print(b*d)
    elif d<0 :
        print(a*c)
    else :
        if a*c<b*d :
            print(b*d)
        else :
            print(a*c)


Measured memory_bytes: 9156
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

const int M = 1000001;
int n,m,k,a[M],d[2][M],mr[M],tag[M],R[M],w[2][M];

void update(int now)
{
	if(d[0][now*2]>d[0][now*2+1])
	{
		d[0][now]=d[0][now*2+1];
		w[0][now]=w[0][now*2+1];
	}
	else 
	{
		d[0][now]=d[0][now*2];
		w[0][now]=w[0][now*2];
	}
	if(d[1][now*2]>d[1][now*2+1])
	{
		d[1][now]=d[1][now*2+1];
		w[1][now]=w[1][now*2+1];
	}
	else 
	{
		d[1][now]=d[1][now*2];
		w[1][now]=w[1][now*2];
	}
}

void built(int now,int l,int r)
{
	if(l==r)
	{
		int t=l&1;
		d[!t][now]=0x3f3f3f3f;
		d[t][now]=a[l];
		w[t][now]=l;
		mr[now]=n;
		return ;
	}
	int mid=(l+r)>>1,t=0;
	built(now*2,l,mid); built(now*2+1,mid+1,r);
	update(now);
	mr[now]=n;
}

void pd(int now)
{
	if(tag[now]) 
	{
		swap(d[0][now*2],d[1][now*2]);
		swap(d[0][now*2+1],d[1][now*2+1]);
		swap(w[0][now*2],w[1][now*2]);
		swap(w[0][now*2+1],w[1][now*2+1]);
		tag[now*2]^=1; tag[now*2+1]^=1;
		tag[now]=0;
	}
	mr[now*2]=min(mr[now*2],mr[now]);
	mr[now*2+1]=min(mr[now*2+1],mr[now]);
}

int ask1(int now,int l,int r)
{	
	if(l==r) {R[l]=mr[now]; d[1][now]=0x3f3f3f3f; return l;}
	int mid=(l+r)>>1,k; pd(now);
	if(d[1][now]==d[1][now*2]) k=ask1(now*2,l,mid);
	else k=ask1(now*2+1,mid+1,r);
	update(now);
	return k;
}

int ask2(int now,int l,int r,int L,int R)
{
	if(l>=L && r<=R) return w[0][now];
	
	int mid=(l+r)>>1,g,k=0; pd(now);
	if(L<=mid) k=ask2(now*2,l,mid,L,R);
	if(R>mid) 
	{
		g=ask2(now*2+1,mid+1,r,L,R);
		if(a[g]<a[k]) k=g;
	}
	return k;
}

void mody2(int now,int l,int r,int L,int R,int x)
{
	if(l>=L && r<=R)
	{
		if(x)
		{
			tag[now]^=1;
			swap(d[0][now],d[1][now]);
			swap(w[0][now],w[1][now]);
		}
		mr[now]=min(mr[now],R);
		return ;
	}
	int mid=(l+r)>>1; pd(now);
	if(L<=mid) mody2(now*2,l,mid,L,R,x);
	if(R>mid) mody2(now*2+1,mid+1,r,L,R,x);
	update(now);
}

void mody1(int now,int l,int r,int x)
{
	if(l==r)
	{
		d[0][now]=0x3f3f3f3f;
		w[0][now]=0;
		return ;
	}
	int mid=(l+r)>>1; pd(now);
	if(x<=mid) mody1(now*2,l,mid,x);
	else mody1(now*2+1,mid+1,r,x);
	update(now);
}

int main()
{
	scanf("%d",&n); a[0]=0x3f3f3f3f;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	built(1,1,n);
	for(int i=1;i<=n/2;i++)
	{
		int k=ask1(1,1,n);
		printf("%d ",a[k]);
		int g=ask2(1,1,n,k+1,R[k]);
		printf("%d ",a[g]);
		mody1(1,1,n,g);
		if(g-k>1)mody2(1,1,n,k+1,g-1,1);
		if(k!=1)mody2(1,1,n,1,k-1,0);
	}
}

Measured memory_bytes: 30208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
                     
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const ll mod = 1e9+7;
ll mult(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
ll add(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
ll sub(ll a,ll b){return ((a%mod)-(b%mod)+mod)%mod;} 
int n;
vector<vector<ll>> dp;
vector<int> v[100009];
void dfs(int cur, int par){
    dp[cur][0] = 1, dp[cur][1] = 1;
    for(auto &neigh: v[cur]){
        if(neigh == par) continue;
        dfs(neigh, cur);
        dp[cur][1] = mult(dp[cur][1], dp[neigh][0]);
        dp[cur][0] = mult(dp[cur][0], add(dp[neigh][0], dp[neigh][1]));
    }
}

int solve(){
    cin>>n;
    dp.resize(n+1, vector<ll>(2, 0));
    for(int i=0;i<n-1;++i){
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1, 0);
    cout<<add(dp[1][0] , dp[1][1]);
    return 0;
}
int main(){
    fast;
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 19768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int D = sc.nextInt();
		int n = 0;
		int count = 0;

		for (int i = 0; i < N; i++) {
			n += 2 * D + 1;
			count++;

			if (n >= N) {
				System.out.print(count);
				break;
			}
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	string s;
	bool b=0;
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++)
	{
		if(s[i]=='C')
		{
			int m=i;
			for(int j=m;j<=n;j++) 
			{
				if(s[j]=='F') b=1;
			}
		} 
	}
	if(b) cout<<"Yes";
	else cout<<"No";
	return 0;
 } 

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Pair = Tuple!(int, "a", int, "b");

void main() {
    int N, M, X, Y;
    scan(N, M, X, Y);

    auto xmax = readln.split.to!(int[]).reduce!max;
    auto ymin = readln.split.to!(int[]).reduce!min;

    auto ok = xmax < ymin && xmax < Y && X < ymin;

    writeln(ok ? "No War" : "War");
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

int main() {
  int n;
  cin >> n;
  int a[2][n];
  int i, j;
  for (i = 0; i < 2; i++) {
    for (j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  int sum[2][n + 10];
  for (i = 0; i < 2; i++) {
    for (j = 0; j < n + 10; j++) {
      sum[i][j] = 0;
    }
  }
  sum[0][0] = a[0][0];
  for (i = 1; i < n; i++) {
    sum[0][i] = sum[0][i - 1] + a[0][i];
  }
  sum[1][0] = sum[0][0];
  for (i = 0; i < n; i++) {
    sum[1][i] = max(sum[1][i - 1], sum[0][i]) + a[1][i];
  }
  cout << sum[1][n - 1] << endl;
  return 0;
}


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

typedef vector<int> vi;
typedef vector<vi> vvi;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
typedef unsigned long long ull;

string s;

bool solve(){
    stack<char> st;
    for (int i = 0; i < s.size(); i++){
        //cout << s[i];
        if (s[i] == '(' || s[i] == '['){
            st.push(s[i]);
        }
        else if (s[i] == ')' || s[i] == ']'){
            if (st.size() == 0){
                return false;
            }
            if (s[i] == ')'){
                if (st.top() != '(') return false;
            }
            if (s[i] == ']'){
                if (st.top() != '[') return false;
            }
            st.pop();
        }
    }
    //cout << endl;
    return st.size() == 0;
}

int main(){
    while (getline(cin, s) && s!="."){
        if (solve()){
            cout << "yes";
        }
        else {
            cout << "no";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1180
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


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

	sort(a.begin(), a.end());
	int cnt = 0;

	int x = 0;int y=0;

	for (int i = n - 1; i > 0; i--) {
		
		if (a[i] == a[i - 1]) {
			if (cnt == 0) {
				x = a[i];
				i--;
				cnt++;
			}
			else if(cnt==1){
				y = a[i];
				break;
			}
		}
	}

	cout << (LL)x*y << endl;

	
}

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

const ll MOD = 1000000007;
const ll MAX = 1001;

vector<ll> yak(MAX, 0);

int main(){
  ll n; cin >> n;
  for(ll i = 2; i <= n; i++){
    ll tmp = i;
    ll di = 2;
    while(tmp>1){
      if(tmp%di == 0){
        tmp /= di;
        yak[di]++;
      }else di++;
    }
  }
  ll ans = 1;
  for(ll i = 2; i <= n; i++){
    ans *= yak[i] + 1;
    ans %= MOD;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long int ll;

int sumOfDigit(int n) {
	if (n == 0) return 0;
	int num = n % 10;
	return num + sumOfDigit(n / 10);
}

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

Measured memory_bytes: 3072
#include <iostream>
#include <string>
int main() {
	std::string str;
	std::cin >> str;
	uint64_t ans = 0;
	int j=-1;
	for (size_t i = 0; i < str.size(); ++i) {
		if (j==-1&&str[i] == 'B')j = i;
		if (j!=-1&&str[i] == 'W')ans += i-j++;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
	char s1,s2,s3;
	int a=0;
	scanf("%c%c%c",&s1,&s2,&s3);
	if(s1=='1'){
		a=a+1;
	}
	if(s2=='1'){
		a=a+1;
	}
	if(s3=='1'){
		a=a+1;
	}
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char** argv)
{
	vector<int64_t> v;
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		int64_t a;
		cin >> a;
		v.push_back(a);
	}

	stable_sort(v.begin(),v.end(), greater<int64_t>());
	int64_t box[2]={};
	int boxPtr=0;
	int64_t lastVal = v[0];

	for(int i=1,iMax=v.size();i<iMax;i++)
	{
		if (lastVal==v[i]){
			// 同値連続
			box[boxPtr]=v[i];
			boxPtr++;
			if (2 <= boxPtr){break;}
			lastVal=-1;
		}else{
			lastVal=v[i];
		}
	}
	printf("%ld\n",box[0]*box[1]);

	return 0;
}


Measured memory_bytes: 1524
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    double r;
    cin >> r;
    double ans = r * 2 * acos(-1);
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
int main(){
  ll i,n,a[200010],sum=0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
  }
  mint ans=0;
  for(i=0;i<n;i++){
    ll x=(sum-a[i])%mod*a[i]%mod;
    ans+=x;
  }
  ans=ans/2;
  printf("%lld\n",ans);
}

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

int h, w, d;
char color[1024][1024];

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

    if (d == 1) {
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if ((i + j) % 2 == 0) {
                    cout << 'B';
                }
                else {
                    cout << 'R';
                }
            }
            cout << endl;
        }
    }
    else {
        for (int i = 0; i < 1024; i++) {
            for (int j = 0; j < 1024; j++) {
                int x = i + j + 3000;
                int y = i - j + 3000;
                y = y / d % 2; 
                x = x / d % 2; 
                color[i][j] = y * 2 + x; 
            }
        }


        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                switch (color[i][j]) {
                    case 0:
                    cout << 'R';
                    break;
                    case 1:
                    cout << 'G';
                    break;
                    case 2:
                    cout << 'B';
                    break;
                    case 3:
                    cout << 'Y';
                    break;
                }
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


ll bcnt[100010], acnt[100010];

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

    ll n, tmp;
    vector<ll> a, b, c;
    cin >> n;
    rep(i, 3*n){
        cin >> tmp;
        if(i < n) a.push_back(tmp);
        else if(i < 2*n) b.push_back(tmp);
        else c.push_back(tmp);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    rep(i, n){
        auto itr = upper_bound(c.begin(), c.end(), b[i]);
        int ind = distance(c.begin(), itr);
        if(ind != c.size()){
            bcnt[i] = c.size()-ind;
        }else{
            bcnt[i] = 0;
        }
    }

    repr(i, n-1, 1){
        bcnt[i-1] += bcnt[i];
    }

    rep(i, n){
        auto itr = upper_bound(b.begin(), b.end(), a[i]);
        int ind = distance(b.begin(), itr);
        if(ind != b.size()){
            acnt[i] = bcnt[ind];
        }else{
            acnt[i] = 0;
        }
    }

    ll res = 0;
    rep(i, n){
        res += acnt[i];
        //cout << acnt[i] << endl;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 4852
#include <cctype>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define pk putchar(' ')
#define ph puts("")
typedef long long ll;
using namespace std;
template <class T>
void rd(T &x)
{
    x = 0;
    int f = 1;
    char c = getchar();
    while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
    while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
    x *= f;
}
template <class T>
void pt(T x)
{
    if (x < 0)
        putchar('-'), x = (~x) + 1;
    if (x > 9)
        pt(x / 10);
    putchar(x % 10 ^ 48);
}
const int N = 1e5 + 5;
int n, m, h[N], ans;
vector<int> G[N];
int main() 
{
	rd(n), rd(m);
	ans = n;
	for (int i = 1; i <= n; i++)
		rd(h[i]);
	for (int i = 1, a, b; i <= m; i++)
		rd(a), rd(b), G[a].push_back(b), G[b].push_back(a);
    for (int i = 1; i <= n; i++)
    	for (int j = 0; j < G[i].size(); j++)
    		if (h[i] <= h[G[i][j]])
    		{
    			ans--;
    			break;
    		}
    pt(ans);
    return 0;
}

Measured memory_bytes: 8556
#include <iostream>]
#include <string>

int main(void) {
	int N = 0;
	int K = 0;
	std::string str;

	std::cin >> N;
	std::cin >> K;
	std::cin >> str;

	if (str[K - 1] == 'A') {
		str[K - 1] = 'a';
	}
	else if (str[K - 1] == 'B') {
		str[K - 1] = 'b';
	}
	else if (str[K - 1] == 'C') {
		str[K -1] = 'c';
	}

	std::cout << str;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,l;
string s[105];
int main()
{
	cin>>n>>l;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(s[i]>s[j])
			{
				swap(s[i],s[j]);
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		cout<<s[i];
	}
	
	return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    X = int(input())
    left = 0
    right = 10 ** 100
    while (right - left > 1):
        med = (right + left) // 2
        val = med * med + med - 2 * X
        if val >= 0:
            right = med
        else:
            left = med
    print (right)


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

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

int h,w;
int dist[30][30];
char field[30][30];
int bfs(int x,int y){
    queue<P> que;

    int res = 0;
    que.push({x,y});
    rep(i,30){
        rep(j,30){
            dist[i][j]=-1;
        }
    }
    dist[x][y] = 0;
    while(!que.empty()){
        int x=que.front().first;
        int y=que.front().second;
        res = max(res,dist[x][y]);//現在の最大値の更新
        que.pop();
        rep(dir,4){
            int nx = x + dx[dir];
            int ny = y + dy[dir];
            if(nx>=h || nx< 0 || ny >= w || ny < 0)continue;
            if(field[nx][ny]=='#')continue;
            if(dist[nx][ny]==-1){
                dist[nx][ny] = dist[x][y] + 1;
                que.push({nx,ny});
            }
        }
    }
    return res;
}

int main(){
    int ans = 0;
    cin >> h >> w;
    
    rep(i,h){
        rep(j,w){
            cin >> field[i][j]; 
        }
    }
    rep(i,h){
        rep(j,w){
            if(field[i][j]=='#')continue;
            ans = max(ans , bfs(i,j));
            
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

vector<int> H[100100];
vector<int> L[100100];
bool hisvisit[100100];
bool lisvisit[100100];
int N,M;
void dfs_h(int v);
void dfs_l(int v);

void dfs_h(int v){
    hisvisit[v] = true;
    for(int i = 0; i < H[v].size(); i++){
        int next = H[v][i];
        if(!lisvisit[next]) dfs_l(next);
    }
}

void dfs_l(int v){
    lisvisit[v] = true;
    for(int i = 0; i < L[v].size(); i++){
        int next = L[v][i];
        if(!hisvisit[next]) dfs_h(next);
    }
}

int main(){
    cin >> N >> M;
    REP(i,N){
        int k;
        cin >> k;
        REP(x,k){
            int l;
            cin >> l;
            H[i].push_back(l);
            L[l].push_back(i);
        }
    }

    dfs_h(0);
    bool ans = true;
    REP(i,N){
        if(!hisvisit[i]){
            ans = false;
            break;
        }
    }

    if(ans)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


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

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

  int l(0), r(0);
  while (r < n && s[r] == '1') r++;
  while (r < n && k > 0) {
    while (r < n && s[r] == '0') r++;
    while (r < n && s[r] == '1') r++;
    k--;
  }

  int ans = r - l;
  while (r < n) {
    while (r < n && s[r] == '0') r++;
    while (r < n && s[r] == '1') r++;
    while (l < n && s[l] == '1') l++;
    while (l < n && s[l] == '0') l++;
    ans = max(ans, r - l);
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
#include<cstring>
#include<string>
#include<vector>
using namespace std;

int main()
{
	int i, j, k, l,N, m, n, sum, flag,A,B,C,ans1,ans2;
	sum = 0;
	flag = 0;
	ans1 = ans2 = 0;
	long long int ans = 100000000000;
	cin >> N>>C;
	int D[31][31] ={};
	for (i = 0; i < C; i++) {
		for (j = 0; j < C; j++) {
			cin >> D[i][j];
		}
	}
	int c[501][501] = {};
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			cin >> c[i][j];
		}
	}
	int c1[31] = {};
	int c2[31] = {};
	int c3[31] = {};
	long long int sum1[31] = {};
	long long int sum2[31] = {};
	long long int sum3[31] = {};
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			if ((i + j + 2) % 3 == 0) {
				c3[c[i][j]]++;
			}
			else if ((i + j + 2) % 3 == 1) {
				c1[c[i][j]]++;
			}else if ((i + j + 2) % 3 == 2) {
				c2[c[i][j]]++;
			}
		}
	}
	for (i = 1; i <= C; i++) {
		for (j = 0; j < C; j++) {
			sum1[i] += D[j][i - 1] * c1[j + 1];
		}
		
	}
	for (i = 1; i <= C; i++) {
		for (j = 0; j < C; j++) {
			sum2[i] += D[j][i - 1] * c2[j + 1];
		}

	}
	for (i = 1; i <= C; i++) {
		for (j = 0; j < C; j++) {
			sum3[i] += D[j][i - 1] * c3[j + 1];
		}

	}
	for (i = 1; i <= C; i++) {
		for (j = 1; j <= C; j++) {
			for (k = 1; k <= C; k++) {
				if (i != j && j != k && k != i) {

					if (sum1[i] + sum2[j] + sum3[k] < ans) {
						ans = sum1[i] + sum2[j] + sum3[k];

					}
				}
			}

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



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

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

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

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

  ll n;
  cin >> n;
  vector<ll> v(n);
  ll num_max = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> v.at(i);
    num_max = max(num_max, v.at(i));
  }

  ll ans = num_max;
  for (int i = 0; i < n; i++)
  {
    if(ans % v.at(i) == 0) continue;
    ans = lcm(ans, v.at(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var A = sc.nextInt();
        var B = sc.nextInt();
        WriteLine(Math.Min(N * A, B));
    }


}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11092
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(fst) (int)(fst).size()
#define forn(i, n) for (ll i = 0; i < ll(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define all(fst) fst.begin(), fst.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 1e18;
    if ((b - a) % 2 == 0) ans = (b - a) / 2;
    ll x = a + (b - a - 1) / 2;
    ans = min(ans, x);
    ll y = n - b + 1 + (b - a - 1) / 2;
    ans = min(ans, y);
    cout << ans << "\n";
    return 0;
}

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

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


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
 
int main() {
  int n, x, S[13], H[13], C[13],  D[13];
  char T;
  for (int i = 0; i < 13 ; i++ ){
    S[i]=0; H[i]=0; C[i]=0; D[i]=0;
  }
 
  cin >> n;
  for (int i = 0; i < n ; i++) {
    cin >> T >> x;
    switch (T) {
      case 'S': S[x-1] = 1;break;
      case 'H': H[x-1] = 1;break;
      case 'C': C[x-1] = 1;break;
      case 'D': D[x-1] = 1;break;
    }
  }
  for (int i = 0; i < 13 ; i++ ){
    if (S[i]==0) {cout << "S " << i+1 << endl;}
  }
  for (int i = 0; i < 13 ; i++ ){
    if (H[i]==0) {cout << "H " << i+1 << endl;}
  }
  for (int i = 0; i < 13 ; i++ ){
    if (C[i]==0) {cout << "C " << i+1 << endl;}
  }
  for (int i = 0; i < 13 ; i++ ){
    if (D[i]==0) {cout << "D " << i+1 << endl;}
  }
  return 0;
}


Measured memory_bytes: 3116
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce, lru_cache
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

n = INT()
a = LIST()
m = max(a)

primes = [0]*(m+1)
primes[1] = 1
for i in range(2, m+1):
    if primes[i] == 0:
        for j in range(1, m//i+1):
            primes[i*j] = i

count = [0]*(m+1)
for x in a:
    y = x
    while primes[y] != y:
        count[primes[y]] += 1
        p = primes[y]
        while y % p == 0:
            y //= p
    if primes[y] >= 2:
        count[primes[y]] += 1

if max(count) <= 1:
    print("pairwise coprime")
else:
    g = 0
    for x in a:
        g = gcd(g, x)
    if g == 1:
        print("setwise coprime")
    else:
        print("not coprime")

Measured memory_bytes: 218600
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define whln(t) while(t--)
#define whlp(t) while(t++)
ll i=0,j=0;


int main(void){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
	 // int t ;
	 // cin>>t;
	 // whln(t){
  		string s,t,u;
  		ll a,b ;
  		cin>>s>>t>>a>>b>>u;

  		if(u==s)
  			a--;
  		else
  			b--;
  		cout<<a<<" "<<b;
  	
}
//   *****  *******   !
//   *		     *    !
//   ***       *      !
//   *       *        !
//   *****  *******   !

Measured memory_bytes: 3572
@L=1..($z=<>)+2;
@B=1e9;
$z-=!$B[$-=--$L[$_]]++for@A=glob<>;
map{
	$z+=!--$B[$-=$L[$A[$`-/ /]]++];
	$z-=!$B[$-=--$L[$A[$`-1]=$']]++;
	print$z,$/
}<>


Measured memory_bytes: 84964
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int n,k;
    cin>>n>>k;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    long double res=0;
    long double ans=0;
    for(int i=0;i<k;i++){
        long double ans1=v[i]*(v[i]+1);
        ans1/=2;
        ans+=((1/double(v[i]))*ans1);
    }
    res=max(res,ans);
    for(int i=0;i+k<n;i++){
        long double ans1=v[i]*(v[i]+1);
        ans1/=2;
        ans-=((1/double(v[i]))*ans1);
        ans1=v[i+k]*(v[i+k]+1);
        ans1/=2;
        ans+=((1/double(v[i+k]))*ans1);
        res=max(res,ans);
    }
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int N = int.Parse (str[0]);
            int[] A = new int[N];

            str = Console.ReadLine ().Split (' ');
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse (str[i]);
            }

            long ans = 0;
            for (int i = 1; i < N; i++)
            {
                if (A[i - 1] > A[i])
                {
                    ans += A[i - 1] - A[i];
                    A[i] = A[i - 1];
                }
            }

            Console.WriteLine (ans);

        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

Measured memory_bytes: 46204
import java.util.*;
import java.io.*;

class Main{
	public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
    	for(int i=0; i<9; i++){
         String team =sc.next();
         int am=sc.nextInt();
         int pm=sc.nextInt();
         System.out.println(team+" "+(am+pm)+" "+(am*200+pm*300));
    	}    	
	}
	}

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

int main(){
  int N,M;
  long long int price = 0;
  cin >> N >> M;
  vector<int> A(N);
  priority_queue<int> B;
  for(int i=0;i<N;i++){
    cin >> A[i];
    B.push(A[i]);
  }
  for(int j=0;j<M;j++){
    int a = B.top();
    B.pop();
    B.push(a/2);
  }
  for(int k=0;k<N;k++){
    price += B.top();
    B.pop();
  }
  cout << price << endl;
  return 0;
}

Measured memory_bytes: 1276
#include <stdio.h>

int main()
{
  int Number, Reminder, Reverse = 0,p;

  scanf("%d", &Number);
  p=Number;

  while (Number > 0)
   {
     Reminder = Number %10;
     Reverse = Reverse *10+ Reminder;
     Number = Number /10;
   }

  if(p==Reverse)
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}


Measured memory_bytes: 128