akhauriyash/Code-Regression huggingface dataset:
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST


solve :: [(Int, [Int])] -> [Bool] -> Int -> Int
solve [] bs n = 1
solve ((p,xs):ls) bs n
  | (on `mod` 2) == p = solve ls bs n
  | otherwise = 0
  where
    on = length $ filter id $ map (\i -> bs !! (i-1)) xs

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  xs <- replicateM m $ do
    ys <- tail . map read . words <$> getLine :: IO [Int]
    return ys
  ps <- map read . words <$> getLine :: IO [Int]
  let 
    bits = sequence $ replicate n [True, False]
    lights = zip ps xs :: [(Int, [Int])]
  print $ sum [solve lights bs n | bs <- bits]


Measured memory_bytes: 1020
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    int n,m,h;
    string s;
    cin>> n>>m;
    int arr[n+10];
    int sum=0;
    for (int i = 0; i < m; ++i)
    {
    	cin >> arr[i];
    	sum+=arr[i];
    }
    cout<<(sum>n?-1:abs(sum-n))<<endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

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

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = TEN(9) + 10;
const int mod = TEN(9) + 10;

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

signed main()
{
	int K;cin>>K;
	int ans = 0;
	rep1(i, K) rep1(j, K) rep1(k, K) {
		ans+=gcd(i,gcd(j,k));
	}
	cout<<ans<<endl;
}




Measured memory_bytes: 3172
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if j - wv[i][0] >= 0:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - wv[i][0]] + wv[i][1])
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])          
print(dp[n][w])


Measured memory_bytes: 120684
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())

tree = [-1] * N

def root(x):
  if tree[x] < 0:
    return x
  else:
    tree[x] = root(tree[x])
    return tree[x]

def unite(x, y):
  rx, ry = root(x), root(y)
  if rx == ry: return
  tree[rx] += tree[ry]
  tree[ry] = rx

def size(x):
  return -tree[root(x)]

for i in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  unite(a, b)

print(max(map(size, range(N))))


Measured memory_bytes: 35600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    ll a;
    cin >> a;
    ld b;
    cin >> b;
    ll ans = a * b;
    cout << ans << endl;
}

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

#define INF (1ll << 50)
#define VAL (100001)
typedef long long ll;
#define minimize(var, val) (var = min((val), var))

int main() {
    ll n, w;
    cin >> n >> w;
    vector<pair<ll, ll>> obj(n);
    for (int i = 0; i < n; i++)
        cin >> obj[i].second >> obj[i].first;
    vector<ll> dp(VAL, INF);
    dp[0] = 0;
    vector<ll> next(VAL);
    for (int i = 0; i < n; i++) {
        next = dp;
        for (int j = obj[i].first; j <= VAL; j++) {
            minimize(next[j], dp[j - obj[i].first] + obj[i].second);
        }
        dp = next;
    }
    long long top = 0;
    for (int i = 0; i < VAL; i++)
        if (dp[i] <= w)
            top = i;
    cout << top << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();

			int a[] = new int[n];
						
			for(int i=1; i<n; i++) {
				a[i-1] = sc.nextInt();
			}
			
			int b[] = new int[n];
			
			for(int i=0; i<n;i++) {
				b[i]=0;
			}

			for(int i=0; i<n-1;i++) {
				b[a[i]-1]++;
			}
			
			for(int i=0; i<n;i++) {
				System.out.println(b[i]);
				
			}
	}
}

Measured memory_bytes: 61976
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a = max(a, c);
    b = min(b, d);
    cout << max(0, b - a) << endl;
}




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

int main(){
	int a,b,c;

	cin >> a >> b >> c;

	if( a == b ){
		cout << c << endl;
	}
	else if ( b == c ){
		cout << a << endl;
	}else{
		cout << b << endl;
	}

	return 0;
}

Measured memory_bytes: 256
n,W=map(int,input().split())
dp=[0]*(W+1)
dd=dp.copy()
for i in range(n):
	w,v=map(int,input().split())
	for j in range(W):
		cw=j+w
		cv=dp[j]+v
		if cw <=W and dd[cw]<cv:
			dd[cw]=cv
	dp=dd.copy()
print(dp[W])

Measured memory_bytes: 148504
#include <stdio.h>
#include <math.h>

int main(void){
  int w, h, n;
  scanf("%d %d %d", &w, &h, &n);
  int i;
  int x, y, a;
  int xmin = 0;
  int xmax = w;
  int ymin = 0;
  int ymax = h;
  for(i = 1 ; i <= n; i++){
    scanf("%d %d %d", &x, &y, &a);
    if(a == 1){
      if(x > xmin){
        xmin = x;
      }
    }else if(a == 2){
      if(x < xmax){
        xmax = x;
      }
    }else if(a == 3){
      if(y > ymin){
        ymin = y;
      }
    }else if(a == 4){
      if(y < ymax){
        ymax = y;
      }
    }
  }
  if(xmin < xmax && ymin < ymax){
    printf("%d\n", (xmax - xmin)*(ymax - ymin));
  }else{
    printf("0\n");
  }
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <cstdlib>
#include <random>
#include <chrono>
#include<iterator>
#include <locale>
 
/*,---.   ,--.                          ,--.
'   .-'  |  ,---.  ,--.,--. ,--.  ,--. `--'
`.  `-.  |  .-.  | |  ||  |  \  `'  /  ,--.
.-'    | |  | |  | '  ''  '   \    /   |  |
`-----'  `--' `--'  `----'     `--'    `--'*/
 
using namespace std;   
int n;
long long f(int pos, vector<long long> vals){
    if(pos == -1){
        return 0;
    }
    int zero = 0;
    int one = 0;
    vector<long long> zeroVal;
    vector<long long> oneVal;
    for(int i = 0;i<vals.size();i++){
        if(((vals[i])&(1<<pos)) != 0){
            oneVal.push_back(vals[i]);
        }else{
            zeroVal.push_back(vals[i]);
        }
    }
    if(zeroVal.size() == 0 || oneVal.size() == 0){
        return f(pos - 1, vals);
    }else{
        return min(f(pos - 1, zeroVal), f(pos - 1, oneVal)) + (1<<pos);
    }

}

int main(){
    int n, W;
    cin >> n >> W;
    vector<int> weigth(n);
    vector<int> value(n);
    for(int i = 0;i<n;i++){
       cin >> weigth[i] >> value[i];
    }
    vector<long long> cur_dp(W+1, 0);
    vector<long long> last_dp(W+1, 0);
    for(int i = 0;i<n;i++){
        for(int j = 0;j<=W;j++){
            if(j - weigth[i] < 0){
                cur_dp[j] = last_dp[j];
            }else{
                cur_dp[j] = max(last_dp[j], last_dp[j - weigth[i]] + value[i]);
            }
        }
        for(int j = 0;j<=W;j++){
            last_dp[j] = cur_dp[j];
            cur_dp[j] = 0;
        }
    }
    cout<<last_dp[W];
    
    
    

}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
    int a,b;
    char s;
    cin >> a >> b;
    if(a<b){
        cout << "a < b" << endl;
    }else if(a==b){
        cout << "a == b" << endl;
    }else{
        cout << "a > b" << endl;
    }
}


Measured memory_bytes: 3096
import re

s = input().replace('?', '.')
t = input()

if len(t)>len(s):
  print('UNRESTORABLE')
elif len(t)==len(s):
  if re.match(s, t):
    print(t)
  else:
    print('UNRESTORABLE')
else:
  for i in range(len(s)-len(t)+1):
    check_str = s[len(s)-len(t)-i:len(s)-i]
    if re.match(check_str, t):
      break

  if i==len(s)-len(t):
    print('UNRESTORABLE')
  else:
    ans = s[:len(s)-len(t)-i] + t + s[len(s)-i:]
    ans = ans.replace('.', 'a')
    print(ans)

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

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

  map<int, int> mp;
  rep(i,0,N-1) {
    int A;
    cin >> A;
    mp[A]++;
    if (1 < mp[A]) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 12976
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;

inline bool check(ll x, ll y, ll xMax, ll yMax) { return x >= 0 && y >= 0 && xMax > x && yMax > y; }
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string tostring(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }
template<class T> inline T mypow(T x, ll n) { T res = 1; while (n > 0) { if (n & 1)res = res * x;	x = x * x;	n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define rFor(i,a,b)	for(ll (i) = (a-1);i >= (b);(i)--)
#define rrep(i,n)	rFor(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define tostr(a)	tostring(a)
#define dump(val) 	cerr << #val " = " << val << endl;
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

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

const ll mod = 1e9 + 7;
const ll INF = 1e17 + 9;

#define int ll
#define double ld

signed main() {
	int n;
	cin >> n;
	vector<int> l(n * 2);
	for (int i = 0; i < n * 2; i++) {
		cin >> l[i];
	}
	sort(all(l));
	int sum = 0;
	rep(i, n) {
		sum += l[i * 2] ;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 764
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int h, n; cin>>h>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    int asum = accumulate(a.begin(), a.end(), 0);
    cout << (h - asum <= 0 ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 640
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

fn main() {
    input!{
        n: usize,
    }

    let mut ans = 0;
    for i in 1..=n {
        if i % 3 == 0 || i % 5 == 0 { continue;}
        ans += i;
    }
    println!("{}", ans)
}


Measured memory_bytes: 2148
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;

ll c1, c5, c10 , c50, c100, c500, s;



int main(){

	cin >> c1 >> c5 >>  c10 >> c50 >> c100 >> c500;
	s = c1 * 1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;
	if (s < 1000) cout << 0 << endl;
	else cout << 1 << endl;





	return 0;
}


Measured memory_bytes: 3096
import java.io.*;
import java.util.*;
public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int w=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        
        int lx=0;
        int rx=w;
        int dy=0;
        int uy=h;
        
        for(int i=0;i<n;i++){
            st=new StringTokenizer(br.readLine());
            int x=Integer.parseInt(st.nextToken());
            int y=Integer.parseInt(st.nextToken());
            int a=Integer.parseInt(st.nextToken());
            
            if(a==1&&lx<x){
                lx=x;
            }else if(a==2&&x<rx){
                rx=x;
            }else if(a==3&&dy<y){
                dy=y;
            }else if(a==4&&y<uy){
                uy=y;
            }
        }
        int num1=(rx-lx);
        int num2=(uy-dy);
        int sum=(rx-lx)*(uy-dy);
        if(num1<=0 || num2<=0){
            System.out.println(0);
        }
        else{
            System.out.println(sum);
        }
        
    }
}

Measured memory_bytes: 8276
#include <bits/stdc++.h>
using namespace std;
int main(){
	int K,A,B; 
	cin >> K >> A >> B; 
	bool flag = false;
	for ( int i = A; i <= B ; i++){
		if ( i % K == 0 ) { flag = true; break; }
	}
	if ( flag ) cout << "OK" << endl;
	else  cout << "NG" << endl;
}

Measured memory_bytes: 3624
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();
        int c = s.nextInt();
        int a[][] = new int[n + 1][m];
        for (int i = 0; i < n + 1; i++) {
            for (int j = 0; j < m; j++) {
                a[i][j] = s.nextInt();
            }
        }
        int ans = 0;
        int cnt = 0;
        for (int i = 0; i < (n+1); i++) {
            if (i == 0)
                continue;
            for (int j = 0; j < m; j++) {
                cnt += (a[0][j] * a[i][j]);
            }
            cnt += c;
            if (cnt > 0)
                ans++;
            cnt = 0;
        }
        System.out.print(ans);
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int  maxn = 1e5 + 5;
int n, m;
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    ll a, b;
    cin >> n >> m;
    vector<pair<ll, ll> > v;
    for(int i = 0; i < n; i ++){
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());
    int bought = 0;
    ll ret =0 ;
    for(int i = 0; i < n; i ++){
        if(bought + v[i].second <= m){
            bought += v[i].second;
            ret += (v[i].second * v[i].first);
        }
        else if(bought + v[i].second > m){
            ret += (ll)(m - bought) * v[i].first;
            break;
        }
    }
    cout << ret << endl;
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int>yo(n);
  for(int i=0;i<n;i++)cin>>yo[i];
  sort(yo.begin(),yo.end());
  bool chika=false;
  int s=0;
  for(int i=0;i<n-1;i++){
    if(yo[i]==yo[i+1]){chika=true;}
    if(chika){
      s=1;
      break;
    }
  }
  if(s==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010];
int main(){
    int n, x,y, m, k;
    while(cin>>n>>m){
        if(n<m){
            for(int i=0; i<m; ++i){
                cout<<n;
            }
        }
        else{
            for(int i=0; i<n; ++i){
                cout<<m;
            }
        }
        cout<<endl;
    }
  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    vector<ll> p(a),q(b),r(c);
    rep(i,a) cin>>p[i];
    rep(i,b) cin>>q[i];
    rep(i,c) cin>>r[i];

    vector<ll> v;
    sort(all(p));
    reverse(all(p));
    rep(i,x) v.push_back(p[i]);
    sort(all(q));
    reverse(all(q));
    rep(i,y) v.push_back(q[i]);
    rep(i,c) v.push_back(r[i]);

    sort(all(v));
    reverse(all(v));

    ll ans=0;
    rep(i,x+y) ans+=v[i];
    cout<<ans<<endl;
    
}



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

public class hello
{
    public static string[] dot;
    public static int plen, cnum, width, cspace;
    public static void Main()
    {
        while (true)
        {
            plen = int.Parse(Console.ReadLine().Trim());
            if (plen == 0) break;
            cnum = int.Parse(Console.ReadLine().Trim());
            width = int.Parse(Console.ReadLine().Trim());
            cspace = int.Parse(Console.ReadLine().Trim());
            dot = new string[width + 1];
            for (int i = 0; i <= width; i++) dot[i] = new string('.', i);
            var text = new List<string>();
            while (true)
            {
                var s = Console.ReadLine().Trim();
                if (s == "?") break;
                addText(text, s);
            }
            addDot(text);
            print(text);
        }
    }
    static void print(List<string> t)
    {
        var spL = new string('.', cspace);
        var pc = plen * cnum;
        var imax = t.Count() / (pc);
        var line = new string[cnum];
        for (int i = 0; i < imax; i++)
        {
            for (int j = 0; j < plen; j++)
            {
                for (int k = 0; k < cnum; k++)
                {
                    var p = i * pc + j + k * plen;
                    line[k] = t[p];
                }
                Console.WriteLine(string.Join(spL, line));

            }
            Console.WriteLine("#");
        }
        Console.WriteLine("?");
    }
    static void addDot(List<string> t)
    {
        var pg = (t.Count() + plen * cnum - 1) / (plen * cnum);
        var adddot = pg * plen * cnum - t.Count();
        for (int i = 0; i < adddot; i++) t.Add(dot[width]);
    }
    static void addText(List<string> t, string s)
    {
        if (s == "") { t.Add(dot[width]); return; }
        var imax = (s.Length + width - 1) / width;
        var p = 0;
        for (int i = 0; i < imax; i++)
        {
            if (i == imax - 1)
            {
                var ss = s.Substring(p);
                t.Add(ss + dot[width - ss.Length]);
            }
            else
            {
                var ss = s.Substring(p, width);
                t.Add(ss);
                p += width;
            }
        }
    }
}


Measured memory_bytes: 14116
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define sz(x) (ll)x.size()
#define lnt(s) (ll)s.length()
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> osSet;

using pll = pair<ll, ll>;

const ll maxN = 1e5;
const ll INF = 1e17;
const ll MOD = 1e9 + 7;

ll xs[] = {-1, 1, 0, 0, -1, 1, 1, -1};
ll ys[] = {0, 0, -1, 1, -1, 1, -1, 1};

ll segtree[maxN << 2];
ll lazy[maxN << 2];
ll A[maxN];

inline ll left(ll x){
	return x << 1;
}

inline ll right(ll x){
	return (x<<1) + 1;
}

ll func(ll x){
	return (x*(x+1))/2;
}

ll _pow(ll b, ll p){
	if(p == 0) return 1;
	if(p == 1) return b;
	ll exB = b*b;
	if(p&1) return b*_pow(exB, p/2);
	return _pow(exB, p/2);
}

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	bool chk = false;
	ll lst = 0;
	for(ll i=0; i<lnt(s)-lnt(t)+1; i++){
		bool ns = 1;
		for(ll j=0, k=i; t[j]; k++, j++){
			if(s[k] == '?' or s[k] == t[j])
				continue;
			else
				ns = 0;
		}
		if(ns){
			chk=1;
			lst=i;
		}
	}
	if(!chk)
		cout << "UNRESTORABLE";
	else{
		for(ll j=0, k=lst; t[j]; j++, k++)
			s[k] = t[j];
		for(ll j=0; s[j]; j++){
			if(s[j] == '?')
				cout << "a";
			else
				cout << s[j];
		}
	}
	return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  int d, n;
  cin >> d >> n;
  int p = 1;
  while(d){
    p *= 100;
    d--;
  }
  if(n == 100) cout << 101 * p;
  else cout << n * p;
}


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

int main(void){
    int N; cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    ll ans=0;
    sort(A.begin(), A.end());
    A.push_back(0);

    int num=A[0], cnt=0; //numは今注目してる数 cntはnumの出現数
    for(int i=0; i<N+1; i++){
        if(A[i]==num){
            cnt++;
        }
        else if(A[i]!=num){
            //今までの連続した数の清算
            if(cnt>A[i-1]) ans+=cnt-A[i-1];
            else if(A[i-1]>cnt) ans+=cnt;

            //更新
            num=A[i]; cnt=1;

        }
    }


    cout << ans << endl;
}

Measured memory_bytes: 1024
/*input
3 3 1
2 1 2 3
.@.
.@.
.@.
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

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


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}

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

void solve(){
	ll i,j,k;
	ll h,w;
	cin>>h>>w>>k;
	ll x,y,x1,y1;
	cin>>x>>y>>x1>>y1;
	ll a[h][w];
	char ch;
	rep(i,0,h){
		rep(j,0,w){
			cin>>ch;
			a[i][j]=((ch=='.'));
		}
	}
	x--,y--,x1--,y1--;
	if(!a[x][y]||!a[x1][y1]){
		cout<<-1<<endl;
		return;
	}
	ll dir[h][w][4];
	memset(dir,0,sizeof(dir));
	rep(i,0,4)dir[x][y][i]=1;
	list<pll> queue;
	queue.pb({x,y});
	while(!queue.empty()){
		pll z=queue.front();
		queue.pop_front();
		ll k1=inf;
		rep(i,0,4){
			if(dir[z.F][z.S][i])k1=min(k1,dir[z.F][z.S][i]);
		}
		rep(i,0,4){
			x=z.F,y=z.S;
			rep(j,0,k){
				x+=dx[i],y+=dy[i];
				if(x<0||y<0||x>h-1||y>w-1||!a[x][y]||dir[x][y][i])break;
				dir[x][y][i]=k1+1;
			}
			if(j==k){
				queue.pb({x,y});
				j--;
			}
			while(j--){
				x-=dx[i],y-=dy[i];
				queue.pb({x,y});
			}
		}
	}
	
	ll k1=inf;
	rep(i,0,4){
		if(dir[x1][y1][i])k1=min(k1,dir[x1][y1][i]);
	}
	if(k1==inf)cout<<-1<<endl;
	else cout<<k1-1<<endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}




Measured memory_bytes: 53032
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]
 
l = [[] for i in range(N + 1)]
 
for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    l[a].append(b)
    l[b].append(a)
 
point = [0] * (N + 1)
search = [0] * (N + 1)
search[1] = 1

que = []
que.append(1)
p = 0

while len(que) != N:
    now = que[p]
    for i in range(len(l[now])):
        n = l[now][i]
        if search[n] == 0:
            search[n] = 1
            que.append(n)
            point[n] = now
    p += 1
    
print('Yes')
for i in range(2,N+1):
    print(point[i])

Measured memory_bytes: 59008
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 28;
int a[maxn];
int mini = 1e9;
int main(){
	int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	for(int i = 0; i < n - k + 1; i ++)
		mini = min(mini, a[i + k - 1] - a[i]);
	cout << mini;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(12)
#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 test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve() {
	int n;
	cin >> n;
	int x;
	if (n % 1000 != 0)
		x = n / 1000 + 1;
	else
		x = n / 1000;
	cout << x * 1000 - n;
}

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


#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> v1(N);
  vector<int> v2(N);
  int s = 0;

  for (int i = 0; i < N; i++) {
    cin >> v1.at(i) >> v2.at(i);
  }

  for (int i = 0; i < N; i++) {
    s = s + v2.at(i) - v1.at(i) + 1;
  }

  cout << s << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

struct UnionFind {
    vector<int> par, size;
    UnionFind(int n) : par(n), size(n) {
        for(int i = 0; i < n; ++i) par[i] = i;
        size.assign(n,1);
    }
    void Union(int x, int y) {
        x = Find(x), y = Find(y);
        if(x == y) return;
        if(size[x] < size[y]) swap(x,y);
        size[x] += size[y];
        par[y] = x;
    }
    int Find(int x) {
        if(par[x]==x) return x;
        else return par[x] = Find(par[x]);
    }
    bool Same(int x, int y) {
        return Find(x) == Find(y);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<P> p(m);
    REP(i,m) {
        cin >> p[i].first >> p[i].second; p[i].first--, p[i].second--;
    }
    int ans = 0, cnt;
    REP(i,m) {
        UnionFind uf(n);
        REP(j,m) {
            if(j != i && !uf.Same(p[j].first, p[j].second)) {
                uf.Union(p[j].first, p[j].second);
            }
        }
        cnt = 0;
        REP(j,n) {
            if(j == uf.par[j]) cnt++;
        }
        if(1<cnt) ans ++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main() {
  int N, K, max, tmp, tmpI;
  cin >> N >> K;
  max = tmp = tmpI = 0;
  int P[N];
  rep (i, N) cin >> P[i];
  double ans = 0.0;
  for (int i = 0; i < K; ++i) {
    tmp += P[i];
  }
  for (int i = 0; i < N-K+1; ++i) {
    if (max < tmp) {
      max = tmp;
      tmpI = i;
    }
    tmp -= P[i];
    tmp += P[i+K];
  }
  for (int i = tmpI; i < tmpI + K; ++i) {
    double tmp = 0.5 * (P[i] - 1) + 1;
    ans += tmp;
  }
  printf("%f", ans);
  return 0;
}

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

using namespace std;

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

  int m = 50;
  while (m-- && k--) {
    vector<int> b(n + 1, 0);
    for (int i = 0; i < n; i++) {
      int l = i - a[i];
      int r = i + a[i];
      l = max(l, 0);
      r = min(r, n - 1);
      b[l]++;
      b[r + 1]--;
    }
    for (int i = 0; i < n; i++) {
      b[i + 1] += b[i];
      a[i] = b[i];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 4836
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll C[100007],DIS[100007];
bool Y=0;

struct Edge {
  ll to, cost;
  Edge(ll to, ll cost) : to(to), cost(cost) {}
};

typedef vector<vector<Edge> > AdjList; // 辺の情報
AdjList graph;

void dfs(ll key){
  rep(i,graph[key].size()){
    if(C[graph[key][i].to] && DIS[graph[key][i].to]!=DIS[key]+graph[key][i].cost){
      Y=1;
    }
    else if(C[graph[key][i].to]==0){
      C[graph[key][i].to]=1;
      DIS[graph[key][i].to]=DIS[key]+graph[key][i].cost;
      dfs(graph[key][i].to);
    }
  }
}

int main(){
  ll N,M;
  cin >> N >> M;
  graph = AdjList(N+1);
  rep(i,M){
    ll L,R,D;
    cin >> L >> R >> D;
    graph[L].push_back(Edge(R, D));
    graph[R].push_back(Edge(L,-D));
  }
  Rep(i,1,N+1){
    if(Y){
      break;
    }
    if(C[i]==0){
      C[i]=1;
      DIS[i]=0;
      dfs(i);
    }
  }
  if(Y){
    cNo;
  }
  else{
    cYes;
  }
}

Measured memory_bytes: 16384
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
int n, arr[100010];
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%d", arr+i);
	sort(arr, arr+n, greater<int>());
	int m1=-1, m2=-1;
	for(int i=0;i+1<n;i++)
		if(arr[i]==arr[i+1]){
			if(m1==-1) m1=arr[i];
			else{
				m2=arr[i]; break;
			}
			i++;
		}
	if(m2==-1) puts("0");
	else printf("%lld\n", (long long)m1*m2);
	return 0;
}

Measured memory_bytes: 640
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
i=min(b-1,n)
print(int((a*i/b)//1-a*((i/b)//1)))


Measured memory_bytes: 61856
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
using namespace std;

int main(){
	char S[15],T[15];
	scanf("%s",S);
	getchar();
	scanf("%s",T);
	int len=strlen(S);
	T[len]='\0';
	if(!strcmp(S,T))
        printf("Yes");
    else
        printf("No");
	return 0;
}


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

using namespace std;



int main(){

int a,b,c;

scanf("%d",&a);
scanf("%d",&b);scanf("%d",&c);


if(a==b+c || b==a+c || c==a+b){


    printf("Yes\n");
}

else{

    printf("No\n");
}







}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
#define L(__) (__ << 1)
#define R(__) (L(__)|1)
#define oo (1<<30)
using namespace std;
vector<int> G[N];
int n,m,l[N],r[N],sz[4*N],Max[4*N],ans,T[4*N];
void build(int t,int l,int r)
{
	int mid=(l+r)>>1;
	if(l==r){ Max[t]=-l; return ;}
	build(L(t),l,mid);
	build(R(t),mid+1,r);
	Max[t]=max(Max[L(t)],Max[R(t)]);
}
void AD(int t,int d){ Max[t]+=d,T[t]+=d;}
void push(int t)
{
	if(!T[t]) return ;
	AD(L(t),T[t]);
	AD(R(t),T[t]);
	T[t]=0;
}
void M(int t,int l,int r,int l1,int r1)
{
	int mid=(l+r)>>1;
	if(l>r1 || r<l1) return ;
	if(l>=l1&&r<=r1) return AD(t,1);
	push(t);
	M(L(t),l,mid,l1,r1);
	M(R(t),mid+1,r,l1,r1);
	Max[t]=max(Max[L(t)],Max[R(t)]);
}
int main()
{
	int i,j;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++){
		scanf("%d %d",&l[i],&r[i]),r[i]=m-r[i]+1;
		G[l[i]].push_back(r[i]);
	  }
	ans=n-m;
	build(1,0,m);
	for(i=0;i<=m;i++){
		for(j=0;j<G[i].size();j++)
			M(1,0,m,G[i][j],m);
		ans=max(ans,Max[1]-i);
	  }
	cout<<ans;
	return 0;
}


Measured memory_bytes: 17408
import java.util.Scanner;

public class Main {

	static boolean[] primes;

	static void primeSet(final int MAX){
		primes = new boolean[MAX+1];

		primes[2] = true;
		for(int i=3;i<=MAX;i+=2){
			primes[i] = true;
		}
		int rt = (int) Math.sqrt(MAX);
		for(int i=3;i<=rt;i+=2){
			if(primes[i]){
				for(int j=i*2;j<=MAX;j+=i){
					primes[j] = false;
				}
			}
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		primeSet(999999);
		
		while(stdIn.hasNext()){
			int n = stdIn.nextInt();
			int cnt = 0;
			
			if(n<2){
				System.out.println("0");
				continue;
			}

			for(int i=0;i<=n;i++){
				if(primes[i]){
					cnt++;
				}
			}
			System.out.println(cnt);
		}	
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b, bool usemod = true) {ll c = 1LL; while (b > 0) {if (b & 1LL) {if(!usemod)c*=a;else c = a * c%mod;}if (!usemod) a*=a;else a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}

bool solve() {
	int n; cin >> n;
	int a,b; cin >> a >> b;
	cout << min(n * a,b) << endl;
}

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

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

int main() {
	char a,b,c;
	cin >> a >> b >> c;
	string k = "No";
	if(a=='7'||b=='7'||c=='7')
	{
		k = "Yes";
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j=0,k,x,y,z,t,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,x1,x2,y1,y2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>l>>r>>d;
p=r/d;
q=(l-1)/d;
ans=p-q;
cout<<ans;
}


Measured memory_bytes: 3604
/*input
2 2
*/
#include <bits/stdc++.h>
 
using namespace std;

const int MOD = 1e9+7;

long long int power(long long int x, long long int y, long long int p) 
{ 
    long long int res = 1;   
  
    x = x % p;  
  
    while (y > 0) 
    { 
        
        if (y & 1) 
            res = (res*x) % p; 
  
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
long long int modInverse(long long int n, long long int p) 
{ 
    return power(n, p-2, p); 
} 
long long int nCrModPFermat(long long int n, long long int r, long long int p) 
{ 
   if (r==0) 
      return 1; 
  
    long long  fac[n+1]; 
    fac[0] = 1; 
    for (long long i=1 ; i<=n; i++) 
        fac[i] = (fac[i-1]*i)%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 

int main()
{
    int x,y;
    cin >> x >> y;
    int m = min(x,y);
    int n = max(x,y);
    x = m;
    y = n;
    int xx = 0,yy=0;
    int l = 0,r= 0;
    while(xx<x && yy<y){
        if(x-xx > y-yy){
            xx += 2;
            yy += 1;
            l++;
        }
        else{
            yy += 2;
            xx += 1;
            l++;
            r++;
        }
    }
    if(xx==x && yy==y){
        // cout << l << " " << r << "\n";
        cout << nCrModPFermat(l,r,MOD);
    }
    else
        cout << 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 5*(int)1e5 + 10;
// make sure N size is correctttt!!!!!!!!!


int n, a, b;
int x, y, z;
int32_t main(){_

   cin>>n;
   cin>>a>>b;


   for (int i = 0; i < n; ++i)
   {
      int tt;
      cin>>tt;
      if(tt >= 1 and tt <= a)
         x++;
      else if(tt > a and tt <= b)
         y++;
      else
         z++;
   }

   cout<< min(x, min(y, z));

   //make sure N size is correct!!!!!!!!!
   return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

int c[100001];
signed main(){
  int n,a[100000],ans=1,f=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i],c[a[i]]++;
  for(int i=n%2+1;i<n;i+=2){
    if(c[i]==2)ans=ans*2%mod;
    else f=1;
  }
  if(n%2&&c[0]!=1)ans=0;
  if(f)ans=0;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792