akhauriyash/Code-Regression huggingface dataset:
/*
____    ____ .___________.
\   \  /   / |           |
 \   \/   /  `---|  |----`
  \      /       |  |     
   \    /        |  |     
    \__/         |__|     
                          
 */


#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<iomanip>
#define ll long long
#define mod 1000000007
using namespace std;
const int INF = 2e9 + 1;


/*---------------Graph Class---------*/
class graph
{
private:
	ll novert;
	ll noedges;
	vector< vector<ll> > adjlist;
public:
	graph(ll n,ll m)
	{
		novert=n;
		noedges=m;
		adjlist.resize(n+1);	
	}
	
	void addedge(ll u,ll v)
	{
		//bidirectional
		adjlist[u].push_back(v);
		adjlist[v].push_back(u);	
	}
	
	void dfsutil(ll initvert,vector<bool>& visited,ll lastvert=-1)
	{
		if(lastvert==initvert)
		{
			//do something
		}
		visited[initvert]=true;
		for(auto itr:adjlist[initvert])
		{
			if(!visited[itr])
			{
	
			}	
		}	
	}	
};
/*-----------------End of graph----------------*/





int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,l;
    cin>>n>>l;
    string s;
    vector<string> arr;
    while(n--)
    {
    	cin>>s;
    	arr.push_back(s);
    }
    sort(arr.begin(),arr.end());
    for(auto itr:arr)
    {
    	cout<<itr;
    }
    cout<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
void p(vector<int> xs) {
  cout<< xs.size() << ":";
  for(int x:xs) cout<<x<<",";
  cout<<endl;
}
int N,nn,mp_best=0x3f3f3f3f;
vector<int> ABC(3), ls;
set<vector<int>> lss;
int nn2;
void add_lss(vector<int> ls) {
  ++nn2;
  lss.insert(ls);
  if(ls.size()<=3) return;
  for(int i=0;i<ls.size();++i) {
    for(int j=i+1;j<ls.size();++j) {
      vector<int> ls2=ls;
      ls2.erase(ls2.begin() + j);
      ls2.erase(ls2.begin() + i);
      ls2.push_back(ls[i]+ls[j]);
      add_lss(ls2);
    }
  }
}
int f(vector<int> abc, vector<int> ls, int mp) {
  if(mp>mp_best) return -1;
  //if(nn++%1000000==0) cout<<nn<<":"<<mp<<":"<<endl;
  if(abc==ABC) {
    if(mp_best>mp) mp_best=mp;
    return mp;
  }
  int target;
  if     (abc[0]!=ABC[0]) target=0;
  else if(abc[1]!=ABC[1]) target=1;
  else if(abc[2]!=ABC[2]) target=2;
  else                    {cout<<"err"; exit(0);}
  vector<int> mps;
  for(int i=0; i<ls.size(); ++i) {
    int dist = abs(ABC[target]-abc[target] - ls[i]);
    vector<int> ls2=ls; ls2.erase(ls2.begin() + i);
    vector<int> abc2=abc; abc2[target]=ABC[target];
    int mp2 = f(abc2, ls2, mp+dist);
    if(mp2!=-1) mps.push_back(mp2);
  }
  if(mps.size()==0) return -1;
  int m= *min_element(mps.begin(), mps.end());
  if(mp_best>m) mp_best=m;
  return m;
}
main() {
  cin>>N;
  for(auto& x:ABC) cin>>x;
  //p(ABC);
  for(int n=1; n<=N; ++n) {
    int l; cin>>l;
    ls.push_back(l);
  }
  //p(ls);
  add_lss(ls);
  //cout<<"lss.size()="<< lss.size() <<endl;
  vector<int> mps;
  for(auto ls:lss) {
    int mp = f( {0,0,0}, ls, 10*(N-ls.size()) );
    if(mp!=-1) mps.push_back(mp);
  }
  int mp = *min_element(mps.begin(), mps.end());
  //cout<< "mp";
  cout<< mp << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,x,c,i,j;
    cin>>a>>b>>x;
    if(a%x==0)
        c=(a/x)-1;
        //cout<<c<<endl;
    else
        c=(a/x);
         //cout<<c<<endl;

    cout<<(b/x)-c<<endl;

    return 0;
}

Measured memory_bytes: 3636
#include <vector>
#include <cfloat>
#include <cstdio>
#include <cstring>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
#include <cstdint>
#include <algorithm>
#include <cassert>
#include <random>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <array>
#include <chrono>
#include <fstream>
#include <functional>

using namespace std;

int main() {

	int A, B, T;
	double A2, B2,T2;

	scanf("%d %d %d",&A,&B,&T);

	A2 = (double)A;
	B2 = (double)B;
	T2 = (double)T;

	int ans = 0;

	for (double i = 1; ; i +=1.0) {
		int t = (int)i;
		if (i >= T2 + 0.5) { break; }
		if (t%A == 0) { ans += B; }
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN 200100

vector<int> a;
int ms[MAXN];
set<int> s;

int n;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		a.push_back(t);
		ms[t]++;
		s.insert(t);
	}
	ll ans = 0;
	for (set<int>::iterator it = s.begin(); it != s.end(); it++) {
		int cur = *it;
		int num = ms[cur];
		ans += ((ll)(num) * (num - 1)) / 2;
	}
	for (int i = 0; i < n; i++) {
		printf("%lld\n", ans - ms[a[i]]  + 1);
	}
	return 0;
}


Measured memory_bytes: 9076
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  var ans = 0;
  input = input.trim().split("\n");
  const [N, A, B] = input[0].split(" ").map((n) => BigInt(n));
  var ans = (N / (A + B)) * A
  var am = N % (A + B)
  if (am > A) {
    ans = ans + A
  } else {
    ans = ans + am
  }

  console.log(ans.toString());
}
// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input.txt", "utf-8"));


Measured memory_bytes: 29588
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const ll N=100001;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b;
	cin>>a>>b;
	if(a*b%2){
		cout<<"Odd"<<endl;
	}else{
		cout<<"Even"<<endl;
	}
	return 0;
}


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

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  int sec[N+1][N+1] = {0};
  for(int i = 0; i < M; i++){
    int L, R;
    cin >> L >> R;
    sec[L][R]++;
  }
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      sec[i][j] += sec[i][j-1];
    }
  }
  int ans[Q] = {0};
  for(int i = 0; i < Q; i++){
    int p, q;
    cin >> p >> q;
    for(int j = p; j <= q; j++){
      ans[i] += sec[j][q] - sec[j][p-1];
    }
  }
  for(int i = 0; i < Q; i++){
    cout << ans[i] << endl;
  }
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i,60){
    ll x = 0;
    rep(j, n) if (a[j] >> i & 1) x++;
    ll now = x * (n - x) % mod;
    rep(j, i) now = now * 2 % mod;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
h,w = map(int,input().split())
grid = [""]*h
for i in range(h):
    grid[i] = list(input())
# print(grid)
search = [(row,col) for row in range(-1,2) for col in range(-1,2) if not(row == 0 and col == 0)]
# print(search)

for i in range(h):
    ans = ""
    for j in range(w):
        if(grid[i][j] == "."):
            bomb = 0
            for k in range(8):
                row,col = search[k]
                if(0<=i+row<h and 0<=j+col<w):
                    if(grid[i+row][j+col] == "#"):
                        bomb += 1
            grid[i][j] = bomb
        ans+=str(grid[i][j])
    print(ans)

Measured memory_bytes: 9036
#include<stdio.h>
#include<string.h>
int df(int n,int x)
{
if(n<x)
 return 0;
 else
 return n/x+df(n/x,x);
}
int main()
{
int a[1001];
 int i,j;
 for(i=1;i<1001;i++)
 a[i]=1;
 for(i=2;i<1001;i++)
 {
   if(a[i]==1)
  {
  for(j=i+i;j<1001;j+=i)
   a[j]=0;
  }
 }
 int n;
 while(~scanf("%d",&n))
 {long long sum=1;
  for(i=2;i<=n;i++)
  {if(a[i])
   {sum*=(df(n,i)+1);
    sum%=1000000007;
   }
  }
  printf("%lld\n",sum%1000000007);
 }

}


Measured memory_bytes: 128
program normalization
  implicit none
  integer(8), parameter :: md = 998244353_8
  integer :: n, x, i, j, k, l
  integer(8) :: dp(200000,0:2,0:2), m
  character(200000) :: s
  logical :: ll, ny
  dp = 0_8
  read(*,*) s
  s = trim(adjustl(s))
  n = len_trim(s)
  x = ichar(s(n:n))-97
  ll = .true.
  ny = .false.
  do i = 1, n-1
    if (s(i:i).ne.s(i+1:i+1)) then
      ll = .false.
    else
      ny = .true.
    end if
    x = x+ichar(s(i:i))-97
  end do
  x = mod(x,3)
  if (ll) then
    write(*,'(i0)') 1
    stop
  end if
  if (n.eq.2) then
    write(*,'(i0)') 2
    stop
  end if
  if ((n.eq.3).and.(.not.ny).and.(s(1:1).ne.s(3:3))) then
    write(*,'(i0)') 3
    stop
  end if
  dp(1,0,0) = 1_8
  dp(1,1,1) = 1_8
  dp(1,2,2) = 1_8
  do i = 1, n-1
    do j = 0, 2
      do k = 0, 2
        do l = 0, 2
          if (l.eq.k) cycle
          dp(i+1,mod(j+l,3),l) = mod(dp(i+1,mod(j+l,3),l)+dp(i,j,k),md)
        end do
      end do
    end do
  end do
  m = 1_8
  do i = 1, n-1
    m = mod(3_8*m,md)
  end do
  if (.not.ny) m = m+1_8
  m = m+md-mod(sum(dp(n,x,0:2)),md)
  write(*,'(i0)') mod(m,md)
  stop
end program normalization

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

#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

int main(){
    int K, A, B;
    cin >> K >> A >> B;
    for(int i=A;i<B+1;i++){
      if(i%K==0){
        printl("OK");
        return 0;
      }
    }
    printl("NG");
}


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))

int N, K;

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

	cout << N - K + 1 << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
  ll k;
  scanf("%lld", &k);
  vector<ll> a(50);
  for (int i = 0; i < 50; i++) {
    a[i] = i;
  }
  ll moves = 0;
  for (int i = 0; i < 50; i++) {
    ll quot = k / 50;
    moves += quot;
    a[i] += quot * 50;
    for (int j = 0; j < 50; j++) {
      if (i == j) continue;
      a[j] -= quot;
    }
  }
  for (int i = 0; i < 50 && moves < k; i++, moves++) {
    a[i] += 50;
    for (int j = 0; j < 50; j++) {
      if (i == j) continue;
      a[j]--;
    }
  }
  printf("50\n");
  for (int i = 0; i < 50; i++) {
    if (i) printf(" ");
    printf("%lld", a[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
typedef pair<int,int> pii;
pii a[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a,a+n+1);
    for(int i=1;i<=n;i++)
    cout<<a[i].second<<" ";
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int d; cin>>d;
	if (d==25) cout<<"Christmas"<<endl;
	else if (d==24) cout<<"Christmas Eve"<<endl;
	else if (d==23) cout<<"Christmas Eve Eve"<<endl;
	else if (d==22) cout<<"Christmas Eve Eve Eve"<<endl;
	else cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll n,m,v,p;
  cin>>n>>m>>v>>p;
  vl a(n);
  rep(i,n){
    cin>>a[i];
  }
  sort(rng(a),greater<ll>());

  int l = -1, r = n;
  int z;
  while(r-l>1){
    z = l+(r-l)/2;
    ll cnt = 0;
    bool ok;
    srep(i,p-1,n){
      if(z == i) continue;
      cnt += min(m,max(a[z]+m-a[i],0LL));
    }
    if(cnt+p*m >= m*v && a[z]+m >=a[p-1]) ok = true;
    else ok = false;
    //cout<<ok<<" "<<a[z] << " " << cnt << " "<<  m*(v-p)<<endl;
    if(ok){
      l = z; 
    }
    else r = z;
  }
  ll ans = 0;
  rep(i,n){
    if(a[i]>=a[r-1])ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
n = int(input())
s = input()

while len(s) >= 1 and s[0] == ".":
    s = s[1:]

while len(s) >= 1 and s[-1] == "#":
    s = s[:-1]

d = []
cur = "#"
strk = 1

bl = 0
wr = 0

if len(s) > 1:
    for i in range(1, len(s)):
        if s[i] == cur:
            strk += 1
        else:
            d.append((cur, strk))
            if cur == ".":
                wr += strk

            cur = s[i]
            strk = 1

    d.append((cur, strk))
    if cur == ".":
        wr += strk

ans = wr
for i in range(len(d)):
    if d[i][0] == "#":
        bl += d[i][1]
    else:
        wr -= d[i][1]

    ans = min(ans, bl + wr)

print(ans)

Measured memory_bytes: 23576
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];
    for( int i = 0 ; i < n ; i++ ) cin >> a[i];
    sort( a , a + n );
    cout << abs( a[n - 1] - a[0] );
}


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

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

    if(A.size() > B.size()){
        cout << "GREATER" << endl;
        return 0;
    }else if (A.size() < B.size()){
        cout << "LESS" << endl;
        return 0;
    }else{
        for(int i=0; i<A.size(); i++){
            int tmp_A = A[i] - '0';
            int tmp_B = B[i] - '0';
            if(tmp_A > tmp_B){
                cout << "GREATER" << endl;
                return 0;
            }else if(tmp_A < tmp_B){
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};


int main(){
  map<int,int> m;
  ll n;
  cin >> n;
  repc(i, 2, sqrt(n)){
    while(n % i == 0){
      m[i]++;
      n = n / i;
    }
  }
  if(n > 1) m[n]++;
  int ans = 0;
  for(auto it : m){
    int p = it.sd;
    int curr = 1;
    while(p >= curr){
      ans++;
      p -= curr;
      curr++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#define rep0(i, n) for(int i=0; i<(int)(n);i++)
typedef int64_t lint;
using namespace std;

int main(){
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n);
    rep0(i, n){
        cin >> a[i];
    }

    lint ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            lint left = 0;
            lint right = 0;
            if(a[i] > a[j]){
                if(i > j)left ++ ;
                if(i < j)right ++ ;
            }
            ans += (k * (k - 1) * (right + left))/2 + k * right;
            ans %= 1000000007;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	vip v(0);
	rep(i,a){
		int t;
		cin>>t;
		v.pb({t,3});
	}	
	rep(j,b){
		int t;
		cin>>t;
		v.pb({t,2});
	}
	rep(i,c){
		int t;
		cin>>t;
		v.pb({t,1});
	}
	sort(all(v),greater<pair<int,int> >());
	ll sum = 0;
	int c1=0;
	int c2,c3;
	c2=c3=0;
	rep(i,s(v)){
		if(v[i].sec == 3 && c1 == x)continue;
		if(v[i].sec == 2 && c2 == y)continue;
		if(c1 + c2 + c3 == x+y)break;
		sum += v[i].fi;
		if(v[i].sec == 3)c1++;
		else if(v[i].sec == 2)c2++;
		else c3++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 6128
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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

 


void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    map<string,int> A = {};
    
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        if(A.count(s)){
            A[s]++;
        }else{
            A.emplace(s,1);
        }
    }
    bool isAllOne = true;
    for (auto itr = A.begin(); itr != A.end(); itr++) {
        if(itr->second > 1) isAllOne = false;
    }
    if(isAllOne) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    
}



signed main() {
    solve();
    return 0;
}



Measured memory_bytes: 22144
using System;
using System.Collections.Generic;

namespace CA {
	class Program {
		static void Main(string[] args) {
			int i = int.Parse(Console.ReadLine());
			long sum = 0;
			string[] str = Console.ReadLine().Split(' ');
			List<long> l = new List<long>();
			foreach(string s in str) {
				sum += long.Parse(s);
				l.Add(long.Parse(s));
			}
			l.Sort();
			Console.WriteLine("{0} {1} {2}", l[0], l[i-1], sum);
		}
	}
}

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

int main(){
  int N, K;
  cin >> N >> K;
  int n, m;
  m = 0;
  for(int i = 0; i < N; i++){
    cin >> n;
    if(n > K / 2){
      m += K -n;
    }
    else {
      m += n;
    }
  }
  cout << m*2 << endl;
}
       
           

Measured memory_bytes: 256
def cf(x1, x2):
    cf = [1]
    for i in range(2, min(x1, x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf


def main():
    a, b, k = map(int, input().split())
    ab_cf = cf(a, b)
    ans = sorted(ab_cf)[-k]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
struct CARD
{
  char suit;
  int value;
};

int main(){
  int n,i,j,minj,flag=0,t;
  struct CARD c[36],c2[36],cr,vr;
  char k;
  

  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf(" %c%c",&c[i].suit,&k);
    c[i].value=atoi(&k);
  }

  for(i=0; i<n; i++){
  c2[i]=c[i];
  }
  
//BubbleSort
  for(i=0; i<=n-1; i++){
    for(j=n-1; j>=i+1; j--){
      if(c[j].value<c[j-1].value){
	vr=c[j];
	c[j]=c[j-1];
	c[j-1]=vr;
      }
    }
  }

  for(i=0; i<n; i++){
    if(i)printf(" ");
    printf("%c%d",c[i].suit,c[i].value);
  }
  printf("\nStable\n");    
  
//SelectonSort
  for(i=0; i<=n; i++){
    minj=i;
    for(j=i; j<n; j++){
      if(c2[j].value<c2[minj].value){
	minj=j;
      }
    }
    cr=c2[i];
    c2[i]=c2[minj];
    c2[minj]=cr;

    /*
    for(t=0; t<n; t++){
    if(t)printf(" ");
    printf("%c%d",c2[t].suit,c2[t].value);
    }
    printf("\n");
    */
    
  }

  for(i=0; i<n; i++){
    if(i)printf(" ");
    printf("%c%d",c2[i].suit,c2[i].value);
  }
  printf("\n");

  for(i=0; i<n; i++){
    if(c[i].suit!=c2[i].suit || c[i].value!=c2[i].value){
      printf("Not stable\n");
      flag=1;
      break;
    }
  }
  if(flag==0){
    printf("Stable\n");
  }
  

  return 0;
}



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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

string vow = "aeiou";

void solve ( int test_case )
{
    int n ; cin >> n ;
    vll v ( n ) ;

    ll ans = 0 ;
    for ( int i=0 ; i < n ; i++ ) cin >> v[i] ;

    for ( int i=0 ; i < n ; i++ )
    {
        for ( int j = i + 1 ; j < n ; j++ )
            ans += v[i] * v[j] ;
    }

    cout << ans ; line
}

int main()
{fast
    int t = 1;
    //cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

struct Node{
    int key;
    Node *right,*left,*parent;
};
Node *root,*NIL;

Node * find(Node *u, int k){
    while(u != NIL && k != u->key ){
        if(k < u->key){
            u = u->left;
        }else{
            u = u->right;
        }
    }
    return u;
}
void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->right = NIL;
    z->left = NIL;

    while( x!= NIL){
        y = x;
        if(x->key > z->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL){
        root = z;
    }else{
        if(z->key < y->key){
            y->left = z;
        }else{
            y->right = z;
        }
    }
}
void inorder(Node *u){
    if (u == NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u){
    if (u == NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    char com[10];

    cin >> n;

    for(int i=0;i<n;i++){
        cin >> com;
        if(com[0] == 'i'){
            scanf("%d",&x);
            insert(x);
        }
        else if (com[0]== 'p'){
            inorder(root);
            putchar('\n');
            preorder(root);
            putchar('\n');
        }else if (com[0] == 'f'){
            scanf("%d",&x);
            Node *t = find(root,x);
            if( t != NIL)printf("yes\n");
            else printf("no\n");
        }
    }
    return 0;
}


Measured memory_bytes: 21968
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim n As Integer = NextInt()
        Dim ans As Integer = Integer.MaxValue

        For a As Integer = 1 To n - 1
            Dim b As Integer = n - a
            ans = Math.Min(ans, DigitsSum(a) + DigitsSum(b))
        Next
        WriteLine(ans)
    End Sub

    Function DigitsSum(x As Integer) As Integer
        Dim result As Integer
        Do While x <> 0
            result += x Mod 10
            x = x \ 10
        Loop

        Return result
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module


Measured memory_bytes: 20560
#include<bits/stdc++.h>                                                                              
using namespace std;
int main()
{
  int n;
  cin >> n;
  int hund,ten,one;
  hund=n/100;
  ten=(n%100)/10;
  one=((n%100)%10);
  if(hund==1)
    hund=9;
  else if(hund==9)
    hund=1;
  if(ten==9)
    ten=1;
  else if(ten==1)
    ten=9;
  if(one==9)
    one=1;
  else if(one==1)
    one=9;
  cout << hund*100+ten*10+one << endl;
}

Measured memory_bytes: 256
import Data.Array

main = do
    n <- readLn
    scaffolds <- listArray (1,n).map read.words <$> getLine
    print.answer n $ scaffolds

answer :: Int -> Array Int Int -> Int
answer n xs = 
    let ans = array (1,n) $ (n,0) : (n-1, n `dist` (n-1)) : [ (j, min (ans!(j+1) + j`dist`(j+1)) (ans!(j+2) + j`dist`(j+2)) ) | j <- [1..n-2]]
    in ans!1 where
        dist a b = abs $ (xs!a) - (xs!b)

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string S;
    ll K;
    ll start = 0, end;
    ll renzoku = 1;
    ll count = 0;
    cin >> S >> K;
    rep2(i, 1, S.size()) {
        if(S[i - 1] == S[i]) {
            renzoku++;
        } else {
            if(!start) start = renzoku;
            count += renzoku / 2;
            renzoku = 1;
        }
    }
    if(!start) start = renzoku;
    count += renzoku / 2;
    end = renzoku;
    if(start == S.size()) {
        cout << K * S.size() / 2 << endl;
    } else if(S.front() == S.back()) {
        cout << K * count - (K - 1) * (start / 2 + end / 2 - (start + end) / 2) << endl;
    } else {
        cout << K * count << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

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

#define endl '\n'
#define hoise cerr<<"hoise - "<<__LINE__<<"\n";
#define tham getchar();
#define FASTIO ios::sync_with_stdio(false);cin.tie(nullptr);

using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;
using vl = vector <ll>;

const int MXN = (int)2e5+6;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }


template <typename T> using orderedSet = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using orderedSet1 = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*--------------------------------------------------------------------------------------------------------------------------*/




int main(){
	FASTIO
	
	int n;
	cin >> n;
	set <string> Set;
	while (n--) {
		
		string c;
		cin >> c;
		Set.insert (c);
	}
	cout << Set.size() << endl;
}

/*

*/


Measured memory_bytes: 19208
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


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

    P(max(a+b, max(a-b,a*b)));
    return  0;
}


Measured memory_bytes: 256
//
// Created by inoue on 2019-10-19.
//

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

using ll = long long;

const ll INFL = 0x3f3f3f3f3f3f3f3f;

int main() {
    int N, M;
    ll L;

    cin >> N >> M >> L;

    vector<vector<ll>> edge(N, vector<ll>(N, INFL));
    vector<vector<ll>> dist(N, vector<ll>(N, INFL));

    for (int i=0; i<M; i++) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        if (c > L) continue;
        a--, b--;
        edge[a][b] = min(edge[a][b], c);
        edge[b][a] = min(edge[b][a], c);
        if (c <= L) {
            dist[a][b] = min(dist[a][b], c);
            dist[b][a] = min(dist[b][a], c);
        }
    }

    ll mod = 10000000000000;

    for (int k=0; k<N; k++) {
        for (int i=0; i<N; i++) {
            for (int j=0; j<N; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    vector<vector<ll>> dist2(N, vector<ll>(N, INFL));

    for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
            dist2[i][j] = (dist[i][j] <= L ? 1 : INFL);
        }
    }

    for (int k=0; k<N; k++) {
        for (int i=0; i<N; i++) {
            for (int j=0; j<N; j++) {
                dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
            }
        }
    }

    int Q;
    cin >> Q;
    for (int q=0; q<Q; q++) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        cout << (dist2[s][t] >= INFL ? -1 : dist2[s][t] - 1) << endl;
    }
}

Measured memory_bytes: 2688
#include <iostream>

#include <cmath>

using std::cin;
using std::cout;
using std::endl;

using std::max;
using std::min;

static int
digit_count(long long a)
{
  int ret = 1;
  while (10 <= a)
  {
    ret++;
    a /= 10;
  }
  return ret;
}

static int
F(long long A, long long B)
{
  return max(digit_count(A), digit_count(B));
}

static long long
solve(long long N)
{
  long limit = long(sqrt(double(N))) + 1;
  int ret = F(1, N);
  if (N % 2 == 0)
  {
    ret = min(F(2, N / 2), ret);
  }
  for (long A = 3; A < limit; A += 2)
  {
    if (N % A == 0)
    {
      ret = min(F(A, N / A), ret);
    }
  }
  return ret;
}


int
main()
{
  long long N;
  cin >> N;
  cout << solve(N) << endl;
  return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())

dct = {}
for i in range(1, M+1):
  dct[i] = 0
for i in range(N):
  lst = list(map(int, input().split()))
  for j in lst[1:]:
    dct[j] += 1
ans = 0

for v in dct.values():
  if (v == N):
    ans += 1
print(ans)

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

int N;
string c;
char ch[210000];

int main(void){

    cin >> N;
    cin >> c;
    int red = 0;
    int white = 0;

    for (int i = 1; i <= N; i++){
        ch[i] = c[i-1];
        if(c[i-1] == 'R') red++;
        else white++;
//        cout << red << "," << white << endl;        
    }

    int ans = 0;

    for (int i = 1; i <= red; i++){
        if(ch[i] == 'W') ans++;
    }

    if (red == 0) ans = 0;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;

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

Measured memory_bytes: 3588
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);
    reverse(v.begin(), v.end());
    for(int i = 0; i < n; i += a){
        reverse(v.begin() + i, v.begin() + min(n, i + a));
    }
    int bb = (n + a - 1) / a;
    if(bb > b){
        cout << -1 << '\n';
        return 0;
    }else if(bb < b){
        int cnt = 0;
        for(int i = 0; i < n; i++){
            if(cnt + (n - i) == b){
                int idx = i / a * a;
                int wid = min(a, n - idx);
                for(int j = 0; j < i % a; j++){
                    v[idx + j] += wid - (i % a);
                }
                for(int j = 0; j < wid - i % a; j++){
                    v[idx + i % a + j] -= i % a;
                }
                sort(v.begin() + i, v.end());
                reverse(v.begin() + i, v.end());
                break;
            }
            cnt += i % a == 0;
        }
    }
    prints(v);
    for(int i = 0; i < 2; i++){
        vector<int> dp(n + 1, M);
        for(auto& e : v){
            *lower_bound(dp.begin(), dp.end(), e) = e;
        }
        int len = lower_bound(dp.begin(), dp.end(), M) - dp.begin();
        if((!i && len != a) || (i && len != b)){
            cout << -1 << '\n';
            return 0;
        }
        reverse(v.begin(), v.end());
    }
    cout << v << '\n';
}


Measured memory_bytes: 4588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n) cin >> a[i];
    int dp[n + 1];
    dp[0] = 1000;
    rep(i, 0, n) {
        dp[i + 1] = dp[i];
        rep(j, 0, i + 1) {
            int v = dp[j] / a[j];
            int w = dp[j] + (a[i] - a[j]) * v;
            dp[i + 1] = max(dp[i + 1], w);
        }
    }
    cout << dp[n] << "\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sz(a) (a).size()
#define pb(a) push_back(a)
#define eb(...) emplace_back(__VA_ARGS__)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
using namespace std;
using pii = pair<int, int>;
constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr double EPS = 1e-10;

int N;
int a[100010], b[100010];
vector<pii> v;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  rep(i, 0, N) {
    cin >> a[i];
    v.eb(a[i], 0);
  }
  rep(i, 0, N) {
    cin >> b[i];
    v.eb(b[i], 1);
  }
  sort(all(v));

  int s = 0, ans = 1;
  rep(i, 0, sz(v)) {
    pii vv = v[i];
    if (vv.second == 0) {
      if (s < 0) (ans *= -s) %= MOD;
      s++;
    } else {
      if (s > 0) (ans *= s) %= MOD;
      s--;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 7408
// E - Almost Everywhere Zero
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
string N;
int K;
int dp[101][2][4];// digit DP, [|N|+1: 1 origin][notLessThan?][k:0~3], init = 0
int lt = 0, eq = 1;//lt: <, eq: =

int solve(){
	N = "0" + N;
	int dn = N.size();
	int di = N[0] - '0';
	dp[0][eq][0] = 1;

	rp(i,1,dn){
		di = N[i] - '0';
		int lt0 = 1, ltn = 9;//lt <
		int eq0 = di? 1:0, eqn = max(0, di-1);//eq =

		// lt <
		rp(k,0,4){
			int x = dp[i-1][lt][k] * lt0 + dp[i-1][eq][k] * eq0;
			if(k) x += dp[i-1][lt][k-1] * ltn + dp[i-1][eq][k-1] * eqn;
			dp[i][lt][k] = x;
		}

		// eq =
		irp(k,2,-1){
			if(dp[i-1][eq][k]){
				if(di) dp[i][eq][k+1] = di>0;
				else dp[i][eq][k] = 1;
			}
		}

	}

	return dp[dn-1][lt][K] + dp[dn-1][eq][K];
}

int main(){
	cin>>N>>K;
	cout<< solve() <<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
using namespace std;

const ll MAX =  1000 * 1000 ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int N = 301 ;
const int INF = INT_MAX ;
const int M = 200005;
int main ( ){


ll  h , n  ; 
cin >> h >> n  ; 
std::vector<ll> a;
ll sum  = 0 ; 
for ( int  i = 0 ; i < n ; ++i )
{	ll x ; 
	cin >> x ;
	sum += x ;  
}

if ( h <= sum   )
cout << "Yes" ; 
else 
cout <<"No" ;

return 0 ;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

ll GetDigit(ll num) { return to_string(num).length(); }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, M;
  cin >> N >> M;
  vector<ll> A(M);
  REP(i, M) cin >> A[i];
  sort(A.begin(), A.end());
  vector<pair<ll, ll>> pp = {P(0, 0), P(1, 2), P(2, 5), P(3, 5), P(4, 4),
                             P(5, 5), P(6, 6), P(7, 3), P(8, 7), P(9, 6)};
  vector<pair<int, int>> p;
  for(int i = 0; i < M; i++) {
    p.push_back(pp[A[i]]);
  }
  vector<string> dp(N + 1, "");
  for(auto x : p) {
    ll f = x.first;
    ll s = x.second;
    if(s > N) { continue; }
    dp[s] = to_string(f);
  }
  for(int i = 0; i <= N; i++) {
    for(auto x : p) {
      ll f = x.first;
      ll s = x.second;
      if(i - s < 2) { continue; }
      if(dp[i - s].size() == 0) { continue; }
      string tmp = dp[i - s] + to_string(f);
      if(dp[i].size() > tmp.size()) {
        continue;
      } else if(dp[i].size() < tmp.size()) {
        dp[i] = tmp;
      } else {
        if(dp[i] >= tmp) {
          continue;
        } else {
          dp[i] = tmp;
        }
      }
    }
  }
  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 32000