akhauriyash/Code-Regression huggingface dataset:
# https://kenkoooo.com/atcoder/#/contest/show/60231d3e-b3c8-4d84-87b4-3d3739b98e19

n, c, k = [int(i) for i in input().split()]

passengers = []

for _ in range(n):
    passengers.append(int(input()))

passengers = sorted(passengers)

bus = 0
cnt = 0
ptr = 0
first = None

for t in passengers:
    if cnt == 0:
        cnt = 1
        first = t
    elif cnt == c:
        cnt = 1
        first = t
        bus += 1
    elif cnt < c and t - first <= k:
        cnt += 1
    elif cnt < c and t - first > k:
        bus += 1
        first = t
        cnt = 1
else:
    if cnt > 0:
        bus += 1

print(bus)


Measured memory_bytes: 77160
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iterator>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int K,S;
  cin >> K >> S;
  
  int ans = 0;
  
  rep(x, K+1) {
    rep(y, K+1) {
      int z = S - x -y;
      if(0 <= z and z <= K) {
        ++ans;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,c = gets.split.map(&:to_i)

tl = Array.new(c){ Array.new(2*(10**5)+10,0) }
sum = Array.new(2*(10**5)+10,0)
n.times do
	s,t,ci = gets.split.map(&:to_i)
	tl[ci-1][s*2-1] += 1
	tl[ci-1][t*2] -= 1
end
max = 0
rec = 0

c.times do |i|
  tmp = 0
	(2*(10**5)+9).times do |j|
    tmp += tl[i][j]
		sum[j] += 1 if tmp > 0
	end
  #p tl[i][0..31]
  #p sum[0..30]
end

(2*(10**5)+10).times do |i|
  max = sum[i] if max < sum[i]
end
puts max


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

int main()
{
  int n;
  cin >> n;
  long long i;
  for(i = 1; i <= n; i++)
  {
    if(i*(i-1)/2 < n && n <= i*(i+1)/2)break;
  }
  int cut = i*(i+1)/2-n;
  int j;
  for(j = 1; j <= i; j++)
  {
    if(j != cut)cout << j << endl;
  }
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second

typedef pair<lint, lint> P;
const lint MOD = 1e9+7;
const lint INF = MOD * MOD;
const int MAX = 100005;

string repstr(string str, int n){
    string ans = "";
    for(int i = 0; i < n; i++) ans += str;
    return ans;
}

int main(){
    int n; string s; cin >> n >> s;
    int l = 0, r = 0;
    rep(i, n){
        if(s[i] == '(') l++;
        else{
            if(l > 0) l--;
            else r++;
        }
    }
    string ans = repstr("(", r) + s + repstr(")", l);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    cout << max(C - (A - B), 0) << endl;
    return 0;
}


Measured memory_bytes: 256
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll lg=22;
const ll N=2e5+5;
const ll M=5e8;
const ll INF=1e18;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define is(n) scanf("%d",&n)
#define io(n) printf("%d\n",n)
#define ls(n) scanf("%lld",&n)
#define lo(n) printf("%lld\n",n)
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
 
inline ll mul(ll a, ll b, ll p){ return (a * 1ll * b) % p; }
inline ll sub(ll a, ll b, ll p){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll add(ll a, ll b, ll p){ ll c = a + b; if(c > p) c -= p; return c; }
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll n,d;
vector<ll> v[20];

bool F(ll i,ll j)
{
    ll sum=0;
    for(ll h=0;h<d;h++)
    {
        sum+=((v[i][h]-v[j][h])*(v[i][h]-v[j][h]));
    }
    ll root=sqrt(sum);
    return root*root==sum;
}

int main()
{
    ll ans=0;
    cin>>n>>d;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<d;j++)
        {
            ll x;
            cin>>x;
            v[i].pb(x);
        }
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            if(F(i,j)){ans++;}
        }
    }
    cout<<ans<<endl;
}


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

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


Measured memory_bytes: 3620
s = input()
smalls = "abcdefghijklmnopqrstuvwxyz"
def solve(s):
    count = 0
 
    if s[0] != "A":
        return False
 
    if s[1] not in smalls:
        return False
    for char in s[2:-1]:
        if char == "C":
            count += 1
            continue
 
        if char not in smalls:
            return False
    if count != 1:
        return False
    if s[-1] not in smalls:
	    return False
    return True
 
if solve(s):
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int p=10e5+5;
int h[p], dp[p];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    int n;
    cin>>n;
    for(int i=1; i<=n; i++) {cin>>h[i]; dp[i]=10e5; }
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(h[1]-h[2]);
    
    for(int i=3; i<=n; i++)
    {
        dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i]));
    }
    cout<<dp[n];

    
    
    
    return 0;
}

Measured memory_bytes: 4736
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(void){
  char s[100];
  //int 
  scanf("%s",s);
  if(s[5]=='0'&&s[6]<='4'&&s[8]<='3')printf("Heisei");
  else printf("TBD");
  return 0;
}

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

using namespace std;

int main(){
    int w, q;
    while(cin >> w >> q, w+q){
        bool cat[w];
        vector<int> id(q), s(q), p(q);
        for(int i=0; i< q; i++) id[i] = -1;
        fill(cat, cat+w, true);
        for(int z=0; z< q; z++){
            string x; int c, l;
            cin >> x >> c;
            if(x == "s"){
                cin >> l;
                id[z] = c; s[z] = l;
                bool possible = false;
                for(int i=0; i < w-l+1; i++){
                    if(cat[i]){
                        bool is = true;
                        for(int j=0; j< l; j++) if(!cat[i+j]) is = false;
                        if(is){
                            p[z] = i;
                            cout << i << endl;
                            for(int j=0; j< l; j++) cat[i+j] = false;
                            possible = true;
                            break;
                        }
                    }
                }
                if(!possible) cout << "impossible" << endl;
            } else {
                for(int i=0; i< q; i++){
                    if(c == id[i]) for(int j=0; j < s[i]; j++) cat[p[i]+j] = true;
                }
            }
        }
        cout << "END" << endl;
    }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll N, R;

int main()
{
    cin >> N >> R;

    ll ans;
    if (N >= 10)
    {
        ans = R;
    }
    else
    {
        ans = R + 100 * (10 - N);
    }

    OUT(ans);
}


Measured memory_bytes: 256
/* Don't try to hack it :|
     
                _/﹋\_
                (҂`_´)
                <,︻╦╤─҉- - - - - - - - - - - - - - -
                _/﹋\_
    */
    //@ROMENE7
     
    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define F first
    #define S second
    #define all(c)  c.begin(), c.end()
    #define ulli unsigned long long int
    #define lli long long int
    #define llv vector< ll >
    #define llc vector< char >
    #define lls vector< string >
    #define llb vector< bool >
    #define mp make_pair
    #define endl "\n"
    #define degb cout<<"HI"<<endl;
    #define ins insert
    #define foo(i,n) for(ll i = 0;i<n;i++)
    #define foa(i,a) for(auto i = a.begin();i!=a.end();i++)
    #define foe(i,a,b) for(ll i = a;i<=b;i++)
    #define INF 2147483647
    #define siz size
    #define len length
    #define sp setprecision(16)
     
     
    int main(){
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif*/
        ios::sync_with_stdio(0);
        cin.tie(0); cout.tie(0);
          double m,n ;
          cin >> m>> n; 
          cout << sp<< m/n*1.0;
     	
        cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
     
         
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  int N;
  cin >> N;
  vector<int> d(N);
  REP(i, N) cin >> d[i];
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"
 
int memo[100][100];
vector<pair<int, int>>ps;
int getans(const int l, const int r) {
	if (memo[l][r] != -1)return memo[l][r];
	if (l + 1 == r) {
		return memo[l][r] = ps[l].first*ps[l].second*ps[r].second;
	}
	else if (l == r) {
		return memo[l][r] = 0;
	}
	else {
		int ans = 1e9;
		for (int t = l; t < r; ++t) {
			int len = getans(l, t) + ps[l].first*ps[t].second*ps[r].second + getans(t + 1, r);
			ans = min(ans, len);
		}
		return memo[l][r] = ans;
	}
}
int main() {
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 100; ++j) {
			memo[i][j] = -1;
		}
	}
	int N; cin >> N;
	ps.resize(N);
	for (int i = 0; i < N; ++i) {
		int a, b; cin >> a >> b;
		ps[i] = make_pair(a, b);
	}
	int ans=getans(0, N - 1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3152
def inpl(): return list(map(int, input().split()))

while True:
    tmp = int(input())
    if tmp == 0:
        break
    
    A = [0] * tmp
    A[0] = 1
    if tmp > 1:
        A[1] = A[0] + 1
    if tmp > 2:
        A[2] = A[1] + A[0] + 1
    for i in range(3, tmp):
        A[i] = A[i-3] + A[i-2] + A[i-1]
    print(-(-1*A[-1]//(10*365)))


Measured memory_bytes: 5600
N, M  = map(int, input().split())
PY = [list(map(int, input().split())) for i in range(M)]

A = []
for i in range(M):
  A.append([i,1000000000000])

for i in range(M):
  PY[i].extend(A[i])

PY.sort()

P = 0


for i in range(M):
  if P != PY[i][0]:
    P = PY[i][0]
    S = 1

  else:
    S += 1

  PY[i][3] += PY[i][0]*1000000+S
#print(PY)
PY.sort(key=lambda x: x[2])

for i in range(M):
  ans = str(PY[i][3])
  print(ans[1:])

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	string S=in<string>(),T=in<string>();
	int N=S.size();
	REP(i,N){
		if(S[i]!=T[i]){
			out("No");
			return 0;
		}
	}
	out("Yes");
	return 0;
}


Measured memory_bytes: 3624
<?php
// B
fscanf(STDIN, '%d', $n);
fscanf(STDIN, '%d %d', $t, $a);
$h = array_map('intval', explode(' ', trim(fgets(STDIN))));
$min = [-1, 10 ** 6];
for ($i = 0; $i < $n; $i++) {
    $d = abs($a - ($t - $h[$i] * 0.006));
    if ($min[1] > $d) {
        $min = [$i, $d];
    }
}
echo $min[0] + 1;

Measured memory_bytes: 4728
S =  input()

if S[0] == "R" and S[1] == "R" and S[2] == "R":
    print(3)
elif S[0] == "R" and S[1] == "R":
    print(2)
elif S[1] == "R" and S[2] == "R":
    print(2)
elif "R" in S:
    print(1)
else:
    print(0)

Measured memory_bytes: 8976
def dfs(i,eq,a)
  return a if i<0
  res=-1
  if eq==1
    if X[i]==0
      if D[i]==0
        # a,b==0,0
        res=dfs(i-1,1,a) if A[0][i]==0
        res=dfs(i-1,0,a) if A[0][i]==1
      else
        # a,b==1,1
        return -1 if A[0][i]==0
        res=dfs(i-1,1,a+(1<<i))
      end
    else
      # X[i]==1 ⇒ D[i]==0
      # a,b==0,1
      res=dfs(i-1,1,a) if A[0][i]==0
      res=dfs(i-1,0,a) if A[0][i]==1
      # a,b==1,0
      res=[res,dfs(i-1,1,a+(1<<i))].max if A[0][i]==1
    end
  else
    # eq==0
    if X[i]==0
      # a,b==0,0
      res=dfs(i-1,0,a) if D[i]==0
      # a,b==1,1
      res=dfs(i-1,0,a+(1<<i)) if D[i]==1
    else
      # X[i]==1 ⇒ D[i]==0
      # a,b==0,1
      # a,b==1,0
      res=dfs(i-1,0,a+(1<<i))
    end
  end
  res
end
N=gets.to_i
A=gets.split.map(&:to_i)
S=A[0]+A[1]
X=A[2...N].inject(0){|s,i|s^i}
D=(S-X)/2
if S-X<0 || (S-X).odd? || X&D!=0
  p -1
else
  a=dfs(60,1,0)
  p (a<=0 ? -1 : A[0]-a)
end

Measured memory_bytes: 14356
def main():
    k, n = map(int, input().split())
    a = list(map(int, input().split()))
    max_d = k - a[-1] + a[0]
    for i in range(n - 1):
        max_d = max(max_d, a[i + 1] - a[i])
    print(k - max_d)


if __name__ == "__main__":
    main()


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;
  ll ans;
  vll ts(n);
  rep(i,n){
    ll t;
    cin >> t;
    ts[i] = t;
    if(i == 0) ans = t;
    else 
      ans = ans*(t/__gcd(ans, t));
  }

  cout << ans << endl;

  return 0;
}


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

const int INF = 1001001001;
const int mod = 1000000007;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order - 1) ans *= base;
	return ans;
}

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

ll sum(ll x) { // sum of subsequent numbers from 0 to x
	return x*(x + 1)/2;
}

int main() {
	ll a, b, n;
    cin >> a >> b >> n;

    ll cand = min(b - 1, n);
    //if (cand >= n) cand = n;
    cout << (a*cand)/b << endl;
}


Measured memory_bytes: 3568
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <array>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(c) begin(c), end(c)
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define tr(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define pb push_back

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

const int INF = 1 << 29;
const double EPS = 1e-10;


int main() {
  int CASES; cin >> CASES;
  while (CASES--) {
    string s; cin >> s;

    unordered_set<string> set;
    REP(l, 1, s.size()) {
      string t[2][2];
      t[0][0] = t[0][1] = s.substr(0, l);
      t[1][0] = t[1][1] = s.substr(l);
      rep(i, 2) reverse(all(t[i][1]));

      rep(i, 2) rep(j, 2) rep(k, 2) set.insert(t[i][j] + t[(i + 1) % 2][k]);
    }

    cout << set.size() << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int k;
    cin >> k;
    ll ans = 0;
    for(int i = 1; i <= k; i++){
        for(int j = 1; j <= k; j++){
            for(int l = 1; l <= k; l++){
                int a = gcd(gcd(i, j), l);
                ans += a; 
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
N,X=map(int,raw_input().split())

def f(N,X):
    if N==0:
        return 0 if X<=0 else 1
    elif X<=1+2**(N+1)-3:
        return f(N-1,X-1)
    else:
        return 2**(N)+f(N-1,X-2**(N+1)+3-2)
        
print f(N,X)

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,k,h[214514];
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>h[i];
	sort(h,h+n);
	ll ans=0;
	for(int i=0;i<n-k;i++)ans+=h[i];
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	//priority_queue<int> q;
	string s = {};
	string s1 = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	//ll x[300005] = {};
	long double y[300005] = {};
	ll z[302][302] = {};
	cin >> a;
	cin >> b;
	for (int i = 0; i < a; i++)
	{
		cin >> y[i];
	}
	//sort(y, y + a);
	long double tmp = 0;
	long double tmp2 = 0;
	for (int i = 0; i < b; i++)
	{
		tmp += y[i];
	}
	tmp += b;
	tmp2 = max(tmp2, tmp);
	for (int i = b; i < a; i++)
	{
		tmp -= y[i - b];
		tmp += y[i];
		tmp2 = max(tmp2, tmp);

	}
	cout << fixed << setprecision(10) << tmp2 / (long double)2 << endl;
	//cout << (double)800000000 / 2 << endl;
	//cout << tmp2/(long double)2 << endl;
	//cout << ans << endl;



	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


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

int main() {
  string S;
  cin >> S;
  if (S[0] == S[1]) {
    if (S[2] == S[3] && S[0] != S[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if (S[0] == S[2]) {
    if (S[1] == S[3] && S[0] != S[1]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else if (S[0] == S[3]) {
    if (S[1] == S[2] && S[0] != S[1]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else cout << "No" << endl;
}


Measured memory_bytes: 3604
//Compiler optimization
#pragma GCC optimize("Ofast")

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

//typedef
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;

//macro
#define reverse(a) reverse(a.begin(),a.end())
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define each(x, v) for (auto &x : v)

//abbreviation
#define pb push_back
#define elif else if
#define mp make_pair
#define endl '\n'

//debug
#define debug(x) cerr << #x << ": " << x << endl

//const
const  ll INF = 1e18;
const ll mod = 1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll n,k;cin >> n >> k;
    vl plus, minus;
    fr(i,n){
        ll x;cin >> x;
        if(x>=0)plus.push_back(x);
        else minus.push_back(-x);
    }
    sort(all(plus), greater<ll>());
    sort(all(minus), greater<ll>());
    if((k == n and minus.size()%2) or (minus.size() == n and k%2)){ //答えが負になる
        ll ans = mod -1;
        vl a(n);
        fr(i,plus.size())a[i] = plus[i];
        fr(i,minus.size())a[i+plus.size()] = minus[i];
        //fr(i,n)debug(a[i]);
        sort(all(a));
        fr(i,k)ans = ans*a[i]%mod;
        cout << ans << endl;
    }else{
        ll ans = 1;
        ll id1 = 0, id2 = 0; //plus, minusのindex
        while(k){ //greedy
            if(k%2){
                k--;
                ans = ans*plus[id1]%mod;
                id1++;
                continue;
            }
            k -= 2;
            if(id1 + 1 >= plus.size()){ //plusから2つ取れない
                ans = ans*minus[id2]%mod;
                id2++;
                ans = ans*minus[id2]%mod;
                id2++;
                continue;
            }
            if(id2 + 1 >= minus.size()){ //minusから2つ取れない
                ans = ans*plus[id1]%mod;
                id1++;
                ans = ans*plus[id1]%mod;
                id1++;
                continue;
            }
            if(plus[id1]*plus[id1+1] >= minus[id2]*minus[id2+1]){
                ans = ans*plus[id1]%mod;
                id1++;
                ans = ans*plus[id1]%mod;
                id1++;
                continue;
            }
            if(plus[id1]*plus[id1+1] <= minus[id2]*minus[id2+1]){
                ans = ans*minus[id2]%mod;
                id2++;
                ans = ans*minus[id2]%mod;
                id2++;
                continue;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 6352
// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <sstream>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;
string S;

void input() {
  cin >> N >> S;
}

void solve() {
  if (N % 2 == 1) {
    cout << "No" << endl;
    return;
  }

  if (S.substr(0, N/2) == S.substr(N/2)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


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

int main(){
  int a,b,c;cin>>a>>b>>c;
  int r[b];
  bool flag=false;
  for(int i=1;i<b;i++){
    r[i]=i*a%b;
    if(r[i]==c)flag=true;
  }
  cout<<(flag?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
DONE = 1

btns = []
for i in range(n):
    btns.append([int(input()), 0])

current = 1
count = 0
while(current != 2):
    if btns[current - 1][1] == DONE:
        print(-1)
        exit()
    btns[current - 1][1] = DONE
    current = btns[current - 1][0]
    count += 1
else:
    print(count)


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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

int n,a[51],u[56];
int res = 0;
int main () {
        cin >> n;

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

        n ++;

        for (int i = 0; i <= 12; i ++) {
                if (u[a[i]] > 2) {
                        cout << 0 << endl;
                        return 0;
                }
        }
        if (u[0] == 2 || n > 25) {
                cout << 0;
                return 0;
        }
        if (n >= 24) {
                cout << 1 << endl;
                return 0;
        }
        sort (a + 1,a + n + 1);

        for (int i = 0; i < (1 << n); i ++) {
                deque<int> v1,v;
                for (int j = 1; j <= n; j ++) {
                        if ((1 << (j - 1)) & i)
                                v1.push_front(24 - a[j]);
                        else
                                v.pb(a[j]);
                }
                for (int j = 0; j < v1.size(); j ++) {
                        v.pb(v1[j]);
                }
                int ans = inf;
                for (int j = 0; j < v.size() - 1; j ++) {
                        ans = min(ans,min(abs(v[j] - v[j + 1]),abs(24 - abs(v[j] - v[j + 1]))));
                }
                ans = min(ans,min(abs(v[0] - v[v.size() - 1]),abs(24 - abs(v[0] - v[v.size() - 1]))));
                res = max(res,ans);
        }

        cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  int ans=0;
  int outlet=1;
  while (outlet < b) {
   --outlet;
   outlet += a;
   ++ans;
 }
  printf("%d\n",ans);
  return 0;
}

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

int main(){
  set<char> s;
  char a,b,c;
  cin >> a >> b >> c ;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  if(s.size()==3)
  {cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  
  
}


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

int main(){
  string N;
  cin >> N;
  int S = 0;
  for(int i = 0; i < N.size();i++){
    S += N[i] - '0';
  }
  if(stoi(N) % S == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
using System;
using System.Linq;

namespace ABC135
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (input[0] > input[1])
            {
                var swap = input[0];
                input[0] = input[1];
                input[1] = swap;
            }

            if ((input[1] - input[0]) % 2 != 0)
                Console.WriteLine("IMPOSSIBLE");
            else
                Console.WriteLine((input[1] - input[0]) / 2 + input[0]);
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
int n;
char a[maxn + 10][11];
string s;
map <string, int> mp;
int main()
{
	long long num = 0;
	cin  >> n;
	for(int i = 1; i <= n; i++){
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}
	map <string, int> :: iterator it;
	for(it = mp.begin(); it != mp.end(); it++){
		for(int i = 1; i <= it -> second - 1; i++){
			num = num + i;
		}
	}
//	for(int i = 1; i <= n; i++){
//		for(int j = i + 1; j <= n; j++){
//			if(strcmp(a[i], a[j]) == 0){
//				num++;
//			}
//		}
//	}
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 11136
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD 1000000007

//累乗 O(log N)
long long power(long long x, int N){
	if(N == 1) return x;
	long long tmp = power(x, N/2);
	if(N%2 == 0) return tmp * tmp % MOD;
	else return tmp * tmp % MOD * x % MOD;
}

//逆元 O(log x)
long long inverse(long long x){
	return power(x, MOD-2);
}

LL N, M, K;
LL t = 1;
LL ans = 0;

int main(){
	cin >> N >> M >> K;
	for(LL i=0; i<K-2; i++){
		t *= N*M-2-i;
		t %= MOD;
		t *= inverse(i+1);
		t %= MOD;
	}
	for(LL i=0; i<N; i++){
		LL tmp = (N-1-i)*(N-i)/2;
		tmp %= MOD;
		tmp *= M;
		tmp %= MOD;
		tmp *= M;
		ans += tmp;
		ans %= MOD;
	}
	swap(N, M);
	for(LL i=0; i<N; i++){
		LL tmp = (N-1-i)*(N-i)/2;
		tmp %= MOD;
		tmp *= M;
		tmp %= MOD;
		tmp *= M;
		ans += tmp;
		ans %= MOD;
	}
	cout << (ans*t) % MOD << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1001001001;
const ll MOD = 1e9 + 7;
const double PI = 3.14159265358979;

const int v = 10;
int d[v][v];

void warshall_floyed(){
  for(int k = 0; k < v; k++)
    for(int i = 0; i < v; i++)
      for(int j = 0; j < v; j++)
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main(){
  int h, w;
  cin >> h >> w;
  for(int i = 0; i < 10; i++)
    for(int j = 0; j < 10; j++)
      cin >> d[i][j];
  warshall_floyed();
  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      int a;
      cin >> a;
      if(a != -1) ans += d[a][1];
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
mylist = []
for row in range(a):
  c = row+b
  mylist.append(c)
for row in range(a):
  c = -row+b
  mylist.append(c) 
mylist = sorted(set(mylist))
for row in mylist:
	print(row,end=' ')

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

int main()
{
  int ABC[3];
  cin >> ABC[0] >> ABC[1] >> ABC[2];
  sort(ABC, ABC + 3);
  cout << (((5 == ABC[0]) && (5 == ABC[1]) && (7 == ABC[2])) ? "YES" : "NO") << endl;
  return 0;
}


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

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

vector<int> pass[6000];
int n,k;
int c[6000];
int r[6000];

int d[6000];
bool used[6000];

void dfs(int v,int u,int f,int end,bool visited[6000]){
    if(visited[u])return ;
    visited[u] = true;
    d[u] = min(d[u],d[v]+c[v]);
    if(f>=end)return ;
    rep(i,pass[u].size()){
        dfs(v,pass[u][i],f+1,end,visited);
    }
}

int dijk(int s,int g){
    rep(i,6000)d[i]=INF;
    rep(i,6000)used[i]=false;
    
    d[s]=0;
    while(1){
        int v=-1;
        rep(u,n){
            if(!used[u] && (v==-1||d[u]<d[v]))v=u;
        }
        if(v==-1)break;
        used[v]=true;
        rep(i,pass[v].size()){
            bool visited[6000]={};
            dfs( v,pass[v][i],1,r[v],visited );
        }
    }
    return d[g];
}


int main(){
    cin>>n>>k;
    rep(i,n) cin>>c[i]>>r[i];
    rep(i,k){
        int a,b;
        cin>>a>>b;
        a--,b--;
        pass[a].pb(b);
        pass[b].pb(a);
    }
    
    cout<<dijk(0,n-1)<<endl;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
ll gcd(ll m,ll n){
    if(m==0||n==0){
        return m;
    }
    return gcd(n,m%n);
}
ll lcm(ll m,ll n){
    if(m==0||n==0){
        return 0;
    }
    return (m/gcd(m,n)*n);
}
int main(){
    ll N;
    cin >> N;
    ll t[N];
    for(int i=0;i<N;i++){
        cin >> t[i];
    }
    ll ans = t[0];
    for(int i=1;i<N;i++){
        ll x = t[i];
        ans = lcm(ans,x);
    }
    cout << ans << endl;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;

	if (s[2] == s[3] && s[4] == s[5])
	{
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}


}


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

enum Direction{S, E, N, M};

class Dice{
// front right back left bottom top
private:
  int right_index[6][6] = {
    {-1, 5, -1, 4, 1, 3},
    {4, -1, 5, -1, 2, 0},
    {-1, 4, -1, 5, 3, 1},
    {5, -1, 4, -1, 0, 2},
    {3, 0, 1, 2, -1, -1},
    {1, 2, 3, 0, -1, -1}
  };

public: 
  vector<int> data;
  Dice(): data(6,0){}
  Dice(vector<int> input){
    data.resize(6);
    for(int i=0; i<6; i++)
      data[(i+5)%6] = input[i];
    swap(data[2],data[3]);
  } 

  void roll(int dir){
    int tmp = data[5];
    data[5] = data[(dir+2)%4];
    data[(dir+2)%4] = data[4];
    data[4] = data[dir];
    data[dir] = tmp;
  }

};

bool check(Dice d1, Dice d2){
  for(int i=0; i<6; i++){
    if(d1.data[i] != d2.data[i])
      return false;
  }
  return true;
}

bool compare(Dice d1, Dice d2){
  Direction d;
  for(int i=0; i<7; i++){
    if(d1.data[0] == d2.data[0]){
      for(int j=0; j<4; j++){
        if(d1.data[5] == d2.data[5]){
          if(check(d1, d2))
            return true;
        }
        d2.roll(d = E);
      }
    }
    d2.roll(d = S);
    if(i==3){
      d2.roll(d = E);
      d2.roll(d = S);
    }
  }
  return false;
}

int main(){
  vector<int> input(6);
  for(int i=0; i<6; i++){
    cin >> input[i];
  }
  Dice dice1(input);
  for(int i=0; i<6; i++){
    cin >> input[i];
  }
  Dice dice2(input);

  cout << (compare(dice1, dice2)? "Yes": "No") << endl;

  return 0;
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => TimesOfDivisible(long.Parse(x), 2)).ToList();

            Console.WriteLine(a.Sum());
        }


        public static int TimesOfDivisible(long x, long m)
        {
            int res = 0;
            while (x % m == 0)
            {
                x /= m;
                res++;
            }
            return res;
        }
    }
}


Measured memory_bytes: 14048
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define pb push_back
using ll = long long;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
  int N,A,B;
  cin >> N >> A >> B;

  if(N*A>=B){
    cout << B << endl;
  }else{
    cout << N*A << endl;
  }

}


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

int main(){
    int h,n;
    cin>>h>>n;
    int a;
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>a;
        sum+=a;
    }
    if(sum>=h)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>

using namespace std;

int main() {  
  int64_t X, K, D;
  cin >> X >> K >> D;
  if (X < 0) X = -X;
  int64_t n = X / D;
  if (n > K) {
    cout << X - (K * D) << endl;
    return 0;
  }
  K -= n;
  if (K % 2 == 1) {
    cout << abs(X - D * (n + 1)) << endl;
  } else {
    cout << abs(X - D * n) << endl;
  }

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    fast_io

    string s;
    cin>>s;
    int ans=0;
    rep(i,s.size()){
        if(i!=s.size()-1 && s[i]==s[i+1]){
            if(i!=s.size()-2) ans++;
            i+=2;
        }
        ans++;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 720
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

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

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  vll A(1000001, 0);
  REP(i, 0, N) {
    ll a;
    cin >> a;
    A[a]++;
  }

  ll ans = A[0] + A[1] + A[2];
  ll sum = ans;
  REP(i, 2, 100000) {
    sum += A[i + 1];
    sum -= A[i - 2];
    ans = max(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
using namespace std;
typedef pair<ll, ll>P;

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true, fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct etree { ll from, to, cost; };
double pai = 3.141592653589793;
bool comp(const etree& e1, const etree& e2) {
	return e1.cost < e2.cost;
}
#define ALL(x) (x).begin(),(x).end()

int main() {
	ll n, a[100010], sum = 0, sa[100010], c = 0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		sum += a[i];
	}
	for (int i = 0;i < n;i++) {
		if (i == n - 1)sa[i] = a[0] - a[i];
		else sa[i] = a[i + 1] - a[i];
	}
	ll count = sum / ((n + 1)*n / 2);
	if (sum % ((n + 1)*n / 2) != 0)cout << "NO" << endl;
	else {
		for (int i = 0;i < n;i++) {
			if (a[i]<count || a[i]>n*count) {
				cout << "NO" << endl;
				exit(0);
			}
		}
			for (int i = 0;i < n;i++) {
				if (sa[i]!=count) {
					if (abs(sa[i] - count) % n == 0) {
						c += abs(sa[i] - count) / n;
					}
					else {
						cout << "NO" << endl;
						exit(0);
					}
				}
			}
		if (c != count)cout << "NO" << endl;
		else cout << "YES" << endl;
		}
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, l; cin >> n >> l;
  vll a(n); REP(i, n) cin >> a[i];
  bool is_l = false;
  ll s;
  REP(i, n-1) {
    if (a[i]+a[i+1] >= l) {
      s = i+1;
      is_l = true; break;
    }
  }
  if (!is_l) cout << "Impossible" << endl;
  else {
    cout << "Possible" << endl;
    for (ll i=1; i<s; i++) cout << i << endl;
    for (ll i=n-1; i>s; i--) cout << i << endl;
    cout << s << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <stack>



using namespace std;

/*class stack
{
	public:
	int s[10000];
	int t,temp;

public:
	void initialize();
	void push(int x);
	int pop();
};

void stack::initialize()
{
	t = 0;
}

void stack::push(int x)
{
	t++;
	s[t] = x;
}

int stack::pop()
{
	temp = s[t];
	t--;
	return temp;
}*/



int main()
{
	stack<int> Lake_right;
	queue<int> Lake;
	int depth = 0,A=0,i=0,last=0,n=0,k=0;
	double S=0;
	string str;

	getline(cin,str);
	n = str.length();

	while(i != n)
	{
		if (str[i] == '\\')
		{
			S += 0.5 + depth;
			depth++;

		}else if (S != 0 && str[i] == '/')
		{
			depth--;
			S += 0.5 + depth;
		}else if (S != 0 && str[i] == '_')
		{
			S += depth;
		}

		if (S != 0 && depth == 0 )
		{
			Lake.push((int)S);
			A += (int)S;
			S = 0;
			last = i;
			k++;
		}

		i++;
	}

	S = 0;
	depth = 0;

	i = n-1;

	while(i != last-1)
	{
		if (str[i] == '/')
		{
			S += 0.5 + depth;
			depth++;

		}else if (S != 0 && str[i] == '\\')
		{
			depth--;
			S += 0.5 + depth;
		}else if (S != 0 && str[i] == '_')
		{
			S += depth;
		}

		if (S != 0 && depth == 0 )
		{
			Lake_right.push((int)S);
			A += (int)S;
			S = 0;
			k++;
		}

		i--;
	}

	while(!Lake_right.empty())
	{
		Lake.push(Lake_right.top());
		Lake_right.pop();
	}

	printf("%d\n", A);
	printf("%d", k);

	while(!Lake.empty())
	{
		printf(" %d", Lake.front());
		Lake.pop();
	}

	printf("\n");

	return 0;
}
	

Measured memory_bytes: 3320
n=int(input())
a=list(map(int,input().split()))
b1=[str(a[2*i]) for i in range(0,n//2)]
b2=[str(a[2*i+1]) for i in range(0,n//2)]
if n%2: b=[str(a[-1])]+list(reversed(b1))+b2
else: b=list(reversed(b2))+b1
print(" ".join(b))

Measured memory_bytes: 34704