akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

#define rep(i, n) for(int i=0; i<n; i++)

const int mod=1e9+7;
inline int add(int x,int y){
  x+=y;
  if (x>=mod) return x-mod;
  return x;
}
inline int sub(int x,int y){
  x-=y;
  if (x<0) return x+mod;
  return x;
}
inline int mul(int x,int y){
  return (x*1ll*y)%mod;
}
inline int power(int x,int y){
  int ans=1;
  while(y){
    if (y&1) ans=mul(ans,x);
    x=mul(x,x);
    y>>=1;
  }
  return ans;
}
inline int inv(int x){
  return power(x,mod-2);
}

int main()
{
  IOS;
  int n;
  cin  >> n;
  ll ans=0;
  ans+=(n/500)*1000;
  n%=500;
  ans+=(n/5)*5;
  cout << ans << endl;
  
  return 0;
}


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

const int inf=2000000000;
const long long llinf=9000000000000000000;

void dfs(int u,vector<vector<long long> > &e,vector<long long> &p,vector<long long> &sz){
	sz[u]=1;
	for(int j=0;j<e[u].size();j++){
		int v=e[u][j];
		if(p[u]!=v){
			p[v]=u;
			dfs(v,e,p,sz);
			sz[u]+=sz[v];
		}
	}
}

int main(){
	int n;
	cin>>n;
	vector<vector<long long> > e(n,vector<long long>());
	for(int i=0;i+1<n;i++){
		int a,b;
		cin>>a>>b;a--;b--;
		e[a].push_back(b);
		e[b].push_back(a);
	}
	vector<long long> p(n,-1),sz(n,0);
	dfs(0,e,p,sz);
	vector<long long> path;
	int c=n-1,psz=0;
	while(c>=0){
		path.push_back(sz[c]-psz);
		psz=sz[c];
		c=p[c];
	}
	reverse(path.begin(),path.end());
	long long ls=0,rs=0;
	int i=0,j=(int)path.size()-1;
	while(i<=j){
		ls+=path[i++];
		if(i<=j) rs+=path[j--];
	}
	cout<<(ls>rs?"Fennec":"Snuke")<<endl;
	return 0;
}

Measured memory_bytes: 16248
N, M = map(int, input().split())
l = [10]*N

f = True
for _ in range(M):
    a, b = map(int, input().split())
    a-=1
    if l[a]==b:
        continue
    elif l[a]==10:
        l[a]=b
    else:
        print(-1)
        exit()

if l[0]==0:
    print(0) if N==1 else print (-1)
else:
    if l[0]==10:
        if N==1:
            l[0]=0
        else:l[0]=1
    for i in range(0,N):
        if l[i]==10:l[i]=0
        print(str(l[i]),end="")









Measured memory_bytes: 3064
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	int K;
	cin>>K;
	int x,y;
	cin>>x>>y;
	int ans = 0;
	rep(i,n){
		if(i>=K) ans+=y;
		else ans+=x;
	}
	cout<<ans<<endl;
}


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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main()
{
    int n, a, b;
    char str[1001], q[1001], temp[1001], cmd[10];
    scanf("%s", str);
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%s %d %d", cmd, &a, &b);
        if (strcmp(cmd, "print") == 0)
        {
            for (int j = a; j <= b; j++)
            {
                printf("%c", str[j]);
            }
            printf("\n");
        }
        else if (strcmp(cmd, "reverse") == 0)
        {
            strcpy(temp, str);
            for (int j = 0; j < b - a + 1; j++)
            {
                str[a + j] = temp[b - j];
            }
        }
        else
        {
            scanf("%s", q);
            for (int j = 0; j < strlen(q); j++)
            {
                str[a + j] = q[j];
            }
        }
    }
    return 0;
}


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


#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  int K,S;
  cin  >> K >> S;
  int ans = 0;
  
  for(int x = 0;x<=K;x++){
    for(int y = 0;y<=K;y++){
      int z = S - x - y;
      if(z >= 0 && z <= K) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,p;
  cin>>n>>p;
  int odd=0,even=0;
  rep(i,n){
    int num;
    cin>>num;
    if(num%2==0) even++;
    else odd++;
  }
  int ans=1;
  if(odd==0){
    if(p==0){
      rep(i,n) ans*=2;
    }
  }
  else{
    rep(i,n-1) ans*=2;
  }
  if(ans==1) ans--;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
ans = 0
dic = {}
dic[1 + A[0]] = 1
for i in range(2, N+1):
    if i - A[i-1] in dic:
        ans += dic[i - A[i-1]]
    if i + A[i-1] in dic:
        dic[i + A[i-1]] = dic[i + A[i-1]] + 1
    else:
        dic[i + A[i-1]] = 1
print(ans)

Measured memory_bytes: 40644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

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;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	char c;
	cin>>c;
	char ans=c+1;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#define ll long long
using namespace std;
const ll mod=1e9+7;
int a[2010]; 
ll n,k;
ll qpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b%2) res=res*a%mod;
		a=a*a%mod;
		b=b/2;
	}
	return res;
}
int main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	ll cnt=0;
	ll inv=qpow(2,mod-2);
	for(int i=0;i<n-1;i++)
	{
		ll temp=a[i];
		for(int j=i+1;j<n;j++)
		{
			if(a[j]<temp) cnt++;
		}
	}
	sort(a,a+n);
	ll count=0;
	for(int i=1;i<n;i++)
	{
		ll ccnt=0;
		if(a[i]!=a[i-1])
		{
			for(int j=i;j<n;j++)
			{
				if(a[j]==a[i]) ccnt++;
				else break;
			}
		}
		count+=ccnt*i;	
	}
	ll res=((k*(k-1)%mod*inv)%mod*count)%mod+(cnt*k%mod)%mod;
	res%=mod;
	cout<<res<<endl;
 } 


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

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto K = RD;
	auto Q = RD;
	auto cnt = new long[](N);
	foreach (i; 0..Q)
	{
		auto A = RD-1;
		++cnt[A];
	}

	foreach (i; 0..N)
	{
		if (K - Q + cnt[i] > 0)
			writeln("Yes");
		else
			writeln("No");
	}

	stdout.flush();
	debug readln();
}

Measured memory_bytes: 4348
fun main(args: Array<String>) {
    val (X, Y) = readLine()!!.split(" ").map { it.toInt() }
    if((2 * X - Y) % 3 != 0 || (2 * Y - X) % 3 != 0){
        println(0)
    }else{
        val x = (2 * X - Y) / 3
        val y = (2 * Y - X) / 3
        if(x >= 0 && y >= 0){
            val c = COM(1000000007, x + y + 1)
            println(c.com(x + y, x))
        }else{
            println(0)
        }
    }
}

class COM(
    val mod: Int,
    val max: Int
) {
    val fac = LongArray(max)
    val finv = LongArray(max)
    val inv = LongArray(max)

    init {
        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1

        for(i in 2 until max){
            fac[i] = fac[i - 1] * i % mod
            inv[i] = mod - (inv[mod % i] * (mod / i)) % mod
            finv[i] = finv[i - 1] * inv[i] % mod
        }
    }

    fun com(n: Int, k: Int): Long {
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod
    }
}

Measured memory_bytes: 54308
#include<iostream>
using namespace std;
int main(){
    int x,i=1;
    while(true){
        cin >> x;
        if(x==0){
            break;
        }
        else{
                    cout << "Case" << " " << i << ":" << " " << x << endl;
                    i++;
        }

    }
    return 0;
}


Measured memory_bytes: 3004
n = int(input())
testimony = []  # 各iの証言
for i in range(n):
    t = []
    for _ in range(int(input())):
        x, y = map(int, input().split())
        t.append((x - 1, y))
    testimony.append(t)
best = 0  # 正直者の最大人数
for honest in range(1 << n):  # 正直者をあらかじめ仮定して破綻を確認する
    for i in range(n):  # 証言者i
        if not (honest >> i) & 1:  # iが不親切な人なら証言を聞かない
            continue
        for j, t in testimony[i]:  # iによるjに対する証言t
            if (honest >> j) & 1 != t:  # jに対する仮定とtが食い違えば破綻
                break
        else:
            continue
        break
    else:  # 全ての正直者に話を聞いて破綻が無ければ更新
        best = max(best, bin(honest).count('1'))
print(best)


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


using namespace std;


const int N = 1e5 + 10;
struct node{
    int t, x, y;
}A[N];

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

    A[0].t = A[0].x =  A[0].y = 0;

    for(int i = 1; i <= n; i ++)
        cin >> A[i].t >> A[i].x >> A[i].y;

    auto cmp = [](node & x, node & y) -> bool {
        return x.t < y.t;
    };

    sort(A + 1, A + n + 1, cmp);

    bool is = true;
    for(int i = 1; i <= n; i++){
        int sum = abs(A[i].x - A[i-1].x) + abs(A[i].y - A[i-1].y);
        if(sum + A[i-1].t > A[i].t) is = false;

        if(((A[i].x + A[i].y)%2) != (A[i].t % 2)) is = false;
    }

    if(is) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
    int n,k;
    string s;
    cin>>n>>k>>s;
    int ans=0;
    int c=0;
    for (int i=1;i<n;i++) {
        if (s[i-1]==s[i])
            ans++;
        else
            c++;
    }
    cout<<ans+min(c,k*2)<<endl;
    return 0;
}

Measured memory_bytes: 512
import sys

#---------------- Paste code from here!--------------------
import sys
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10 ** 9 + 7
def LI(): return map(int, sys.stdin.readline().split())

def main():
    r = lambda: sys.stdin.readline().strip()
    R = lambda: list(map(int, r().split()))
    N, K = R()
    dp = [0]*2610*51*51
    ip = 2610*51
    restp = 2610
    dp[0] = 1
    for i in range(N):
        for rest in range(N):
            if rest > N //2:
                break
            for k in range(0, K+1, 2):                
                # for i, rest, k in product(range(N), range(N), range(0,K+1,2)):
                dp[(i+1)*ip+(rest+1)*restp+(k+2*rest+2)] += dp[i*ip+rest*restp+k]
                dp[(i+1)*ip+(rest+1)*restp+(k+2*rest+2)] %= MOD
                dp[(i+1)*ip+rest*restp+(k+2*rest)] += dp[i*ip+rest*restp+k] * (2*rest+1)
                dp[(i+1)*ip+rest*restp+(k+2*rest)] %= MOD
                if rest:
                    dp[(i+1)*ip+(rest-1)*restp+(k+2*rest-2)] += dp[i*ip+rest*restp+k] * rest * rest
                    dp[(i+1)*ip+(rest-1)*restp+(k+2*rest-2)] %= MOD
    print(dp[N*ip+K])

if __name__ == "__main__":
    main()


Measured memory_bytes: 94300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 
const int maxN = 1e5+10;
vector<int> g[maxN];
vector<char> used(maxN, false);
vector<pii> res;
int cnt = 0;

void bfs(int v) {
	cnt++;
	queue<int> q;
	q.push(v);
	used[v] = true;
	
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for(int x : g[u]) {
			if(!used[x]) {
				cnt++;
				res.pb({x, u+1});
				used[x] = true;
				q.push(x);
			}
		}
	}
}

int main() {
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	bfs(0);
	
	if(cnt < 0)
		cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		sort(all(res));
		for(auto i : res) {
			cout << i.se << endl;
		}
	}
	return 0;
}



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	ll n;
	cin >> n;
	ll loop_cnt = 0;
	ll log = 1;
	while(n >= log)
	{
		n -= log;
		log *= 26;
		loop_cnt++;
	}

	for(int i = 0; i < loop_cnt; ++i)
	{
		log /= 26;
		cout << (char)(((n / log) % 26) + 'a');
	}
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3648
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  int n, k;
  cin >> n >> k;

  vector<int> h(n);
  rep(i,n) cin >> h[i];

  sort(h.begin(), h.end());
  int res = inf;
  rep(i,n-k+1) {
    res = min(res, h[i+k-1]-h[i]);
  }

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 640
N=int(input())
A=list(map(int,input().split()))
import bisect
A.sort()
B=[abs(i) for i in A]
l=min(B)
count=0
for i in range(N):
  if A[i]<0:
    count+=1
  else:
    break
if count%2==1:
  for i in range(count-1):
    A[i]=-A[i]

  print(sum(A)-2*l-2*A[count-1])

if count%2==0:
  for i in range(count):
    A[i]=-A[i]
  print(sum(A))

Measured memory_bytes: 19956
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;

 int main()
 {
   int n,a,b;
   while(cin>>n>>a>>b)
   {
     int cnt1=n*a;
     int cnt2=b;
     if(cnt1<cnt2) cout<<cnt1<<endl;
     else cout<<cnt2<<endl;  
   }
   return 0;
 }
 


Measured memory_bytes: 256
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);


void solve() {
    double r;
    cin >> r;
    double pi = 3.1415926536;
    double ans = 2 * pi * r;
    cout << fixed << setprecision(15) << ans << endl;
}
int32_t main() {
    IOS;
    int test = 1;
//    cin >> test;
    for(int i=1;i<=test;i++){
//        cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 3820
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .map(|x| x.parse::<u32>().unwrap())
        .collect::<Vec<_>>();
    let n = list[0];
    let m = list[1];
    ((1900 * m + 100 * (n - m)) * 2u32.pow(m)).to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "1 1" => "3800",
    test2: "10 2" => "18400",
    test3: "100 5" => "608000",
}


Measured memory_bytes: 4352
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def main():
    X,Y,Z=mis()
    print(Z,X,Y)


main()







Measured memory_bytes: 5676
#include<stdio.h>

int main(){
 int a,b,c,d,e,f;
 double x,y,det;

 while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
  det=1/(double)(a*e-b*d);
  x=det*(double)(e*c-b*f);
  y=det*(double)(-d*c+a*f);
  printf("%.3f %.3f\n",x==0?0.0:x,y==0?0.0:y);
 }
 return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
int g[12];
int main()
{
    std::ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;

    for(int i=1; i<=k; i++)
    {
        int x;
        cin>>x;
        g[x]=1;
    }
    for(n;; n++)
    {
        int t=n,flag=0;
        while(t)
        {
            int c=t%10;
            if(g[c])
            {
                flag=1;
                break;
            }
            t/=10;
        }
        if(!flag)
            break;
    }
    cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
#define LP(i, a, b) for (int i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (int i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-13

#define INF 1e9
const int MaxSize = 1050 + 10;
//const LL MOD = 1e9 + 7;
const LL MOD = 99999;
const int AS = 26;

string s;

/*
 https://atcoder.jp/contests/abc142/tasks/abc142_e
 E - Get Everything
 */
int N;

LL const BASE = 256;

//don't forget to lower case if you are doing string matching
LL sHash(string s) {
	LL h = 0;
	LP(i, 0, s.size())
	{
		h = (h * BASE) + (LL) s[i] - 'a'; //very similar idea to base number calculation
		h %= MOD;
	}

	return h;
}

bool good(int winL) {

	LL hash = 0;
	LL topBase = 1;
	SAL list(MOD);
	LP(i, 0, winL)
	{
		if (i > 0) {
			topBase *= BASE;
			topBase %= MOD;
		}

		hash *= BASE;
		hash %= MOD;
		hash += (LL) (s[i] - 'a');
		hash %= MOD;
	}
	list.at(hash).push_back(0);

	LP(i, winL, N)
	{
		//slide the hash
		hash -= topBase * (LL) (s[i - winL] - 'a');
		hash %= MOD; //watch out for the negative case!
		hash += MOD;
		hash %= MOD;

		hash *= BASE;
		hash %= MOD;
		hash += (LL) (s[i] - 'a');
		hash %= MOD;
		list.at(hash).push_back(i - winL + 1);
	}

	LP(slot, 0, MOD)
	{
		int ls = list.at(slot).size();
		if (ls < 2)
			continue;

		LP(i, 0, ls)
		{
			LP(j, i+1, ls)
			{
				int asi = list.at(slot)[i];
				int bsi = list.at(slot)[j];
				//cout << asi << " " << bsi << " " << winL << endl;
				if ((bsi - asi) < winL)
					continue;

				bool match = true;
				LP (k, 0, winL)
				{
					if (s[asi + k] != s[bsi + k]) {
						match = false;
						break;
					}
				}

				if (match) {
					return true;
				}
			}
		}
	}

	return false;
}

int main() {

	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/pycp/A_1.in", "r", stdin);
	cin >> N >> s;
	//check 1 case

	int low = 0;
	int high = N;

	while (low < high) {
		int mid = (low + high) / 2;
		if (good(mid)) {
			if (mid == low) {
				if (good(mid + 1)) {
					low = mid + 1;
				} else {
					low = mid;
				}
				break;
			} else {
				low = mid;
			}
		} else {
			high = mid - 1;
		}
	}

	cout << low;

	return 0;
}



Measured memory_bytes: 2776
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<ll >    vecll;
typedef vector<string > vecstr;
int main()
{
  int a, b, m;
  cin >> a >> b >> m;
  vecint veca(a,0), vecb(b,0);
  REP(i,a)cin >> veca[i];
  REP(i,b)cin >> vecb[i];
  vecint x(m,0), y(m,0), c(m,0);
  REP(i,m){
    cin >> x[i] >> y[i] >> c[i];
    x[i] --;
    y[i] --;
  }
  int ans = 1e9;
  REP(i,m){
    ans = min(ans, veca[x[i]] + vecb[y[i]] - c[i]);
  }
  sort(all(veca));
  sort(all(vecb));
  ans = min(ans, veca[0] + vecb[0]);
  cout << ans << endl;
}


Measured memory_bytes: 2176
#include<stdio.h>

int main()
{
	char str[102];
	int ans,i,minus;

	while(fgets(str,102,stdin)!=NULL)
	{
		i=0;ans=0;minus=0;
		while(*(str+i)!='\n')
		{
			switch(*(str+i))
			{
				case 'M':
					ans+=1000;
					if(1000>minus)ans-=minus*2;
					minus=1000;
					break;
				case 'D':
					ans+=500;
					if(500>minus)ans-=minus*2;
					minus=500;
					break;
				case 'C':
					ans+=100;
					if(100>minus)ans-=minus*2;
					minus=100;
					break;
				case 'L':
					ans+=50;
					if(50>minus)ans-=minus*2;
					minus=50;
					break;
				case 'X':
					ans+=10;
					if(10>minus)ans-=minus*2;
					minus=10;
					break;
				case 'V':
					ans+=5;
					if(5>minus)ans-=minus*2;
					minus=5;
					break;
				case 'I':
					ans+=1;
					minus=1;
					break;
			}
			i++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	if a == b && b == c {
		fmt.Println("No")
	} else if a == b || b == c || c == a {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

int freq[100001];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    int n; cin >> n;

    long long tot = 0, cur = 0;

    for(int i = 0; i < n; ++i){
        cin >> freq[i];
        if(freq[i] > 2){
            tot += (freq[i] - 1) >> 1;
            freq[i] = 1 + (freq[i] % 2 == 0 ? 1 : 0);
        }
        if(freq[i] == 0){
            tot += cur >> 1;
            cur = 0;
        }
        cur += freq[i];
    }

    cout << tot + (cur >> 1) << "\n";

    return 0;

}


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

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int l = -1;
    int r = -1;
    ll x = 0;
    ll s = 0;
    while (l + 1 < n) {
        ++l;
        if (r < l) {
            x = s = 0;
            r = l - 1;
        }
        while (r + 1 < n && (x ^ a[r + 1]) == (s + a[r + 1])) {
            x ^= a[r + 1];
            s += a[r + 1];
            ++r;
        }
        ans += r - l + 1;
        x ^= a[l];
        s -= a[l];
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i <b; i++)
using pii = pair<int,int>;
#define all(a) a.begin(), a.end()

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

int main(){
    int N; cin >> N;
    vector<int> P(N);
    rep(i, 0, N) cin >> P[i];
    
    int ans = 0, M = 1e9;
    rep(i, 0, N){
        if(M >= P[i]){
            M = P[i];
            ans++;
        }
    }
    cout << ans << endl;
}

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

bool binarySearch(vector<int> a, int n, int key)
{
	int low = 0, high = a.size(), mid;
	while(low <= high)
	{
		mid = (low + high) / 2;
		if(a[mid] == key)
			return true;
		else if(a[mid] > key)
			high = mid - 1;
		else
			low = mid + 1;
	}
	return false;
}

int main()
{
	int n, q, tmp, count = 0;
	vector<int> a;
	cin>>n;
	for(int i = 0; i < n; i++)
	{
		cin>>tmp;
		a.push_back(tmp);
	}
	cin>>q;
	for(int i = 0; i < q; i++)
	{
		cin>>tmp;
		if(binarySearch(a, n, tmp) ) count++;
	}
	cout<<count<<endl;
}


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

int main() {
    string s;
    int a=0, b=0;
    cin >> s;
    for(int i=0; i<s.size(); i++) {
        if(s.at(i)=='0') a++;
        else b++;
    }
    a *=2;
    b *=2;
    cout << min(a,b);
}

Measured memory_bytes: 512
N = int(input())
word = []
for i in range(N):
    word.append(str(input()))
flag = True
# 最初の文字列と最終文字列を比べる
# 同じならYES,違うならNo
for i in range(N):
    if i != N - 1:
        if word[i][-1] != word[i + 1][0]:
            flag = False

for i in range(N):
    searchWord = word[i]
    for k in range(N):
        if i != k and searchWord == word[k]:
            flag = False
# 同じならYES, 違うならNo
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))
  val (A, B, C, D) = br.use { it.readLine().split(" ").map { it.toInt() } }

  fun isPushed(i: Int, a: Int, b: Int) = if((a <= i) && (i < b)) true else false

  val ab = Array(101, { i ->
    if((isPushed(i, A, B) and isPushed(i, C, D)) ) true else false
    })

  val ans = ab.count({ bool -> bool })
  println(ans)
}

Measured memory_bytes: 35748
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);

    int n = scan.nextInt();
    int m = scan.nextInt();

    int[][] a = new int[n][m];
    int[] b = new int[m];
    int[] c = new int[n];

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        a[i][j] = scan.nextInt();
      }
    }

    for (int i = 0; i < m; i++) {
      b[i] = scan.nextInt();
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        c[i] += a[i][j] * b[j];
      }
      System.out.println(c[i]);
    }
  }

}


Measured memory_bytes: 40560
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265358979323846;

#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

class A {
public:
	void solve(std::istream& in, std::ostream& out) {
		ll n; in>>n;
		ll arr[n], avg = 0;
		f(i, n) in>>arr[i], arr[i] -= (i+1);
        sort(arr, arr+n);
        ll b = arr[n/2], res = 0;
        f(i, n) res += abs(arr[i]-b);
		out<<res;
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	A solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; (i) < (n); ++(i))
#define REP3(i,m,n) for (int i = (m); (i) < (n); ++(i))
#define REP_R(i,n) for (int i = (int)(n) - 1; (i) >= 0; --(i))
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <class T> inline void chmin(T & a, T const & b) { a = min(a, b); }

template <class UnaryPredicate>
ll binsearch(ll l, ll r, UnaryPredicate pred) {
    assert (l <= r);
    -- l;
    while (r - l > 1) {
        ll m = (l + r) / 2;
        (pred(m) ? r : l) = m;
    }
    return r;
}


int count_max_tricks(vector<int> const & a, vector<int> const & b, int removed = -1) {
    assert (a.size() == b.size() - (removed != -1));
    int j = 0;
    int tricks = 0;
    for (int a_i : a) {
        while (j < b.size() and a_i >= b[j]) ++ j;
        if (j == b.size()) break;
        if (b[j] == removed) {
            removed = -1;
            ++ j;
        }
        if (j == b.size()) break;
        ++ j;
        ++ tricks;
        if (j == b.size()) break;
    }
    return tricks;
}

vector<int> solve(int n, vector<int> const & original_a, vector<int> b) {
    vector<int> a = original_a;
    sort(ALL(a));
    sort(ALL(b));
    int max_tricks = count_max_tricks(a, b);

    vector<int> c;
    int tricks = 0;
    REP (i, n) {
        int a_i = original_a[i];
        a.erase(lower_bound(ALL(a), a_i));
        auto pred = [&](int b_i) {
            int k = b.end() - (lower_bound(ALL(b), b_i) + 1);
            if (tricks + (a_i < b_i) + k >= max_tricks) return true;
            bool result = (tricks + (a_i < b_i) + count_max_tricks(a, b, b_i) == max_tricks);
            return result;
        };
        auto use = [&](int b_i) {
            b.erase(lower_bound(ALL(b), b_i));
            c.push_back(b_i);
            tricks += (a_i < b_i);
        };

        vector<int> que = b;
        que.erase(unique(ALL(que)), que.end());
        // check whether need to win
        if (a_i < que.back()) {
            auto it = upper_bound(ALL(que), a_i);
            if (it != que.begin() and not pred(*prev(it))) {
                que.erase(que.begin(), it);
            }
        }
        reverse(ALL(que));
        int j = binsearch(0, que.size(), [&](int j) {
            return pred(que[j]);
        });
        use(que[j]);

        assert (a.size() == b.size());
    }
    return c;
}

int main() {
    int n; cin >> n;
    vector<int> a(n), b(n);
    REP (i, n) cin >> a[i];
    REP (i, n) cin >> b[i];
    auto c = solve(n, a, b);
    REP (i, n) cout << c[i] << (i == n - 1 ? '\n' : ' ');
    return 0;
}



Measured memory_bytes: 3276
#include<bits/stdc++.h>
#define ll long long
#define N 1000010
#define mo 1000000007
using namespace std;
ll n,h,d,jie[N],su,s1[N];
int main(){
	cin>>n>>h>>d;
	jie[0]=1;
	for (int i=1;i<=n;i++)jie[i]=jie[i-1]*i%mo;
	for (int i=1;i<=n;i++)su=(su+jie[i])%mo;
	s1[1]=1;
	for (int i=2;i<=h;i++)s1[i]=(s1[i-1]+(s1[i-1]-s1[max(0ll,i-d-1)]+mo)*su)%mo;
	cout<<(s1[h]-s1[h-d]+mo)*jie[n]%mo<<endl;
	return 0;
}

Measured memory_bytes: 15872
//g++  5.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    vector<pair<ll,ll>> v;
    ll dp[N + 1][N + 1];
    memset(dp,0,sizeof(dp));
    
    for(ll i=0;i<N;++i)
    {
        ll val; cin>>val;
        v.push_back({val,i + 1});
    }
    
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    
    for(ll i=1;i<=N;++i)
    {
        ll x = 0; //elements from left
        ll y = i - x; //elements from right
        
        while(y >= 0)
        {
            if(x > 0)
                dp[x][y] = max(dp[x][y],dp[x - 1][y] + v[i - 1].first * abs(x - v[i - 1].second));
            
            if(y > 0)
                dp[x][y] = max(dp[x][y],dp[x][y - 1] + v[i - 1].first * abs(N - y + 1 - v[i - 1].second));
            
            y--;
            x++;
        }
    }
    
    ll ans = 0;
    for(ll i=0;i<=N;++i)
        ans = max(ans,dp[i][N - i]);
    
    cout<<ans<<endl;
}

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

#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)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int k, s;
	cin >> k >> s;
	ll dp[8000][3];
	// dp[i][j] := 変数を j+1個使いiを作るときの組み合わせ数

	rep(i, s+1) rep(j, 3) dp[i][j] = 0LL;
	rep(i, k+1) dp[i][0] = 1LL;

	rep(j, 2){
		rep(i, s+1){
			rep(l, k+1){
				if(i-l >= 0) dp[i][j+1] += dp[i-l][j];
			}
		}
	}

	// rep(i, s+1) rep(j, 3) cout << dp[i][j] << (j == 2 ? "\n" : " ");
	cout << dp[s][2] << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>  // min, max
#include <fstream>  // ifstream
#include <iomanip>  // setprecision
using namespace std;
typedef long long ll;

int main(void)
{
#ifdef FILE_DEBUG
    ifstream inputFile("data/input.txt");
    cin.rdbuf(inputFile.rdbuf());
#endif
    // これより下にコードを書く

    ll N, M;
    cin >> N >> M;
    vector<ll> a(M);
    for (ll i = 0; (i < M); ++i) {
        cin >> a[i];
    }

    vector<bool> good(N, true);
    for (int i = 0; (i < M); ++i) {
        good[a[i]] = false;
    }

    vector<ll> dp(N+1);
    dp[0] = 1;
    for (int curr = 0; (curr < N); ++curr) {
        for (int next = curr+1; (next <= min(N, static_cast<ll>(curr+2))); ++next) {
            if (good[next]) {
                dp[next] += dp[curr];
                dp[next] %= 1000000007;
            }
        }
    }

    cout << dp[N] << endl;

    return 0;
}


Measured memory_bytes: 1792
N, K = map(int, input().split())

S = input()

cnt = 0
b = S[0]

for i in range(1,N):
  if b != S[i]:
    cnt += 1
  b = S[i]
  
if cnt % 2 == 1:
  if K > cnt//2:
    print(N-1)
  else:
    print(N-2*(cnt//2+1)+2*K)
else:
  if K >= cnt//2:
    print(N-1)
  else:
    print(N-cnt+2*K-1)


Measured memory_bytes: 70920
import numpy as np
from math import ceil

n = int(input())
a = [int(input()) for _ in range(n)]
modulo = 998244353

s = sum(a)

dp = np.zeros(s + 1, dtype=np.int)
dp[0] = 1
for ai in a:
    dp[ai:] = 2 * dp[ai:] + dp[:-ai]
    dp[:ai] = 2 * dp[:ai]
    dp %= modulo

sol = 3 ** n % modulo
sol -= 3 * dp[ceil(s / 2) :].sum()

if s % 2 == 0:
    dp = np.zeros(s // 2 + 1, dtype=np.int)
    dp[0] = 1
    for ai in a:
        dp[ai:] = (dp[ai:] + dp[:-ai]) % modulo

    sol += 3 * dp[s // 2]

sol %= modulo

print(sol)


Measured memory_bytes: 14556
## subroutines

def rot(pic, m)
  pic0 = m.times.map{[nil] * m}

  for y in (0...m)
    for x in (0...m)
      pic0[m - 1 - x][y] = pic[y][x]
    end
  end

  pic0
end

def match?(x, y, m, wds, pic)
  for dy in (0...m)
    for dx in (0...m)
      p0 = pic[dy][dx]
      if p0 != -1 && wds[y + dy][x + dx] != p0
        return false
      end
    end
  end
  true
end

### main

while true
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if n == 0 && m == 0

  wds = []
  n.times.each do
    wds << gets.strip.split(' ').map{|s| s.to_i}
  end

  pic0 = []
  m.times.each do
    pic0 << gets.strip.split(' ').map{|s| s.to_i}
  end

  pics = [pic0]
  for i in (0..2)
    pics << rot(pics[i], m)
  end

  ppos = []
  for pic in pics
    px = py = 0
    while pic[py][px] == -1
      px += 1
      if px >= m
        px = 0
        py += 1
      end
    end
    ppos << [px, py]
  end

  matched = false
  mx = my = nil
  d = n - m

  for y in (0..d)
    for x in (0..d)
      for i in (0..3)
        if match?(x, y, m, wds, pics[i])
          matched = true
          mx = x + ppos[i][0]
          my = y + ppos[i][1]
          break
        end
      end
      break if matched
    end
    break if matched
  end

  puts (matched ? "#{mx + 1} #{my + 1}" : 'NA')
end

Measured memory_bytes: 6172
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

int n;

double d(int x1,int y1,int x2,int y2)
{
    return sqrt(pow(x1-x2,2)+pow(y1-y2,2));
}

int fact(int i)
{
    if(i==1)return 1;
    return i*fact(i-1);
}

main()
{
    cin>>n;

    if(n%2==0)
    {
        cout<<n/2-1<<endl;
    }else
    {
        cout<<n/2<<endl;
    }
}

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

int main()
{

  string s,t,u ;
  cin >> s >> t ;
  int a,b ;
  cin >> a >> b ;
  cin >> u ;

  if(s==u){
    a--;
  }else{
    b--;
  }
  
  cout << a << " " << b << " " << endl;
  
    return 0;
}



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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	cout << (s < t?"Yes":"No");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL an,N,A;
void solve(int gn,LL res){
    LL d[42];
    REP(i,gn)d[i]=1;
    res+=gn;
    LL now=1;
    int it=0;
    while(now<N){
        res++;
        now/=d[it];
        d[it]++;
        now*=d[it];
        it++;
        if(it==gn)it=0;
    }
    an=min(an,res);
}
int main(){
    cin>>N>>A;
    an=N;
    REPP(i,2,41){
        solve(i,(i-1)*A);
    }
    return 0*printf("%lld\n",an);
}


Measured memory_bytes: 384
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		int sum = 0;
		int max = 0;
		for(int i = 0; i < N; i++){
			int p = sc.nextInt();
			sum += p;
			max = Math.max(max, p);
		}
		sum -= max / 2;
		System.out.println(sum);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22484