akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define mem(x,y) for(int i=0;i<x.size()i++){ x[i]=y; }
#define fo(i, l, r)  for((i) = (l); (i) < (r); (i)++)
#define fok(i,r,k)  for((i) = 0; (i) < (r); (i)=i+(k))
#define mp make_pair
#define pb push_back
#define pi pair<int,int> 
#define pll pair<long long,long long>
#define vi vector<int> 
#define vl vector<long long>
#define vpl vector<pair<long long,long long>> 
#define vpi vector<pair<int,int>> 
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define br cout<<endl;
#define io { freopen("input.txt","r",stdin);  freopen("output.txt","w",stdout); }
ll modexpo(ll x,ll y,ll m){    x=x%m;if(y==0){return 1;}if(y%2==0){return modexpo(x*x,y/2,m); }else{    return  (x*modexpo(x*x,y/2,m))%m; }}
const int mod  = 1e9+7;
const int maxn = 1e5 + 10;
int pw(int x)
{
    if(x==0){ return 1;}
    if(x==1){ return 100;}
    return 10000;
}
ll d,n;
int main()
{
fastio; 

int i,j;
cin>>d>>n;
if(n==100){ 
    cout<<n*pw(d) + pw(d); return 0; 
}
cout<<n*pw(d); 

return 0;
}
//g++ -g b.cpp -o b.exe

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;
const long long inf = 1e15;

vector<long long> dijkstra(const vector<vector<pair<int, long long>>> &G, int s){
    using Pi = pair<long long, int>;
    vector<long long> dist(G.size(), inf); 
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    dist[s] = 0; que.emplace(dist[s], s);
    while (!que.empty()) {
        long long sum_dist; int node;
        tie(sum_dist, node) = que.top(); que.pop();
        if (dist[node] < sum_dist) continue;
        for (auto &e : G[node]) {
            int next_node; long long dis;
            tie(next_node, dis) = e;
            if (dist[next_node] > dist[node] + dis) {
                dist[next_node] = dist[node] + dis;
                que.emplace(dist[next_node], next_node);
            }
        }
    }
    return dist;
}

int main(){
    int N, M;
    cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; i++) {
        int a, b; long long c; cin >> a >> b >> c; a--; b--;
        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
    }
    for (int i = 1; i < N; i++) G[i].emplace_back(i - 1, 0);

    vector<long long> dist = dijkstra(G, 0);
    long long ans = dist[N-1];
    if (ans == inf) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12536
#include<stdio.h>
#include<string.h>
int main()
{
 char skr;
 int i;
 char str1[27]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\0'};
 char str2[27]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\0'};
 scanf("%s",&skr);
 for(i=0;i<26;i++)
  {
   if(skr==str1[i])
     {
       printf("A");
     }
    else if(skr==str2[i])
     {
       printf("a");
     }
   }
return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
using namespace std;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
char s[1005];
int n,m,h,t,ans;
int vis[1005][1005];
int dis[1005][1005];
pii q[1000005];
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,n){
		scanf("%s",s+1);
		For(j,1,m) if (s[j]=='#') q[++t]=pii(i,j),vis[i][j]=1;
	}
	while (h!=t){
		int x=q[++h].fi,y=q[h].se;
		ans=dis[x][y];
		For(k,0,3){
			int i=x+dx[k],j=y+dy[k];
			if (i<1||j<1||i>n||j>m) continue;
			if (!vis[i][j]){
				vis[i][j]=1;
				q[++t]=pii(i,j);
				dis[i][j]=dis[x][y]+1;
			}
		}
	}
	printf("%d\n",ans);
} 

Measured memory_bytes: 16380
#include <stdio.h>
#include <math.h>
int main(void){
    int n,q;
    char s[1000000];
    scanf("%d %d %s",&n,&q,s);
    int l[1000000],r[1000000];
    int cs[10000000]={0};
    for(int i=0;i<n;i++){
        if(s[i]=='A'&&s[i+1]=='C'){
            cs[i+1]=cs[i]+1;
        }
        else cs[i+1]=cs[i];
    }
//   0 1 2 3 4 5 6 7
//   0 1 1 2 2 2 3 3
//  A C A C T A C G
//  1 2 3 4 5 6 7 8
    for(int i=0;i<q;i++){
        scanf("%d %d",&l[i],&r[i]);
        int ans=cs[r[i]-1]-cs[l[i]-1];
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 46080
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {
    int N = 0;
    int L = 0;
    cin >> N >> L;

    const int all = N*(L+L+N-1)/2; // 全リンゴの味の和
    int min_taste = 1000000;
    int taste = -1;
    for(int i = 0; i < N; i++) {
        int taste_i = L + (i+1) - 1;
        if(taste_i < min_taste) {
            min_taste = abs(taste_i);
            taste = all - taste_i;
        }
    }
    cout << taste << endl;

    return 0;
}


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

typedef struct list{
    int gcd_l, gcd_r; 
} *listp;

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

void list_init(listp *p, int *a, int n) {
    int i;
    p[0]->gcd_l = 0; p[1]->gcd_l = a[0];
    p[n-1]->gcd_r = 0; p[n-2]->gcd_r = a[n-1];
    for(i = 2; i < n; ++i) {
        p[i]->gcd_l = gcd(a[i-1], p[i-1]->gcd_l);
    }
    for(i = n-3; i >=0; --i) {
        p[i]->gcd_r = gcd(a[i+1], p[i+1]->gcd_r);
    }
}

void solve(int *a, int n){
    int i;
    listp *p = (listp*)malloc((n+7)*sizeof(struct list));
    for(i = 0; i < n; ++i) {
        p[i] = (listp)malloc(sizeof(struct list));
    }
    list_init(p, a, n);
    int gcdlist[n], max = 0;
    for(i = 0; i < n; ++i) {
            gcdlist[i] = gcd(p[i]->gcd_l, p[i]->gcd_r);
        if(max < gcdlist[i]) { max = gcdlist[i]; }
    }
    printf("%d\n", max);
}

int main(void)
{
    int n;
    scanf("%d", &n);
    int *a = (int*)malloc((n+7)*sizeof(int));
    int i;
    for(i = 0; i < n; ++i) { scanf("%d", &a[i]); }
    solve(a, n);
    return 0;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 1e6 + 5;
const int inf = 1e16 + 2;


void solve(int Case) {
    int n , m , k , cnt = 0;
    cin >> n >> m >> k;
    vector<pair<int , int>> v;
    char arr[n][m];
    for(int i = 1 ; i <= n ; i ++) {v.pb({i , 0});}
    for(int i = 1 ; i <= m ; i ++) v.pb({0 , i});
    for(int i = 0 ; i < n ; i ++) {
        for(int j = 0 ; j < m ; j ++) {
            cin >> arr[i][j];
            if(arr[i][j] == '#') cnt ++;
        }
    }
    int t = n + m;
    t = pow(2LL , t);
    int ch = 0;
    for(int i = 0 ; i < t ; i ++) {
        int temp = i , b = 0 , ans = 0;
        set<pair<int , int>> s;
        while(temp) {
            if(temp % 2) {
                ans ++;
                pair<int , int> p = v[b];
                if(p.ff == 0) {
                    for(int i = 0 ; i < n ; i ++) {
                        if(arr[i][p.ss - 1] == '#') s.insert({i , p.ss - 1});
                    }
                }
                else {
                    for(int i = 0 ; i < m ; i ++) {
                        if(arr[p.ff - 1][i] == '#') s.insert({p.ff - 1 , i});
                    }
                }
            }
            temp /= 2;
            b ++;
        }
        if(k == (cnt - (int)(s.size()))) {
            
            ch ++;
        }
    }
    cout << ch << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 4052
module Main where

import Numeric
import Data.Functor

main :: IO ()
main =  do
  { [r] <- getDoubles
  ; putStrLn $ unwords $ map (flip (showFFloat Nothing) "") [pi*r*r,2*pi*r]
  }

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

Measured memory_bytes: 3932
from math import factorial


def nCr(n, r):
    if r <= 0:
        return 0

    if n >= r:
        return factorial(n) // (factorial(n - r) * factorial(r))
    else:
        return 0

def main():
    N = input()
    K = int(input())

    ans = func(N, K)

    print(ans)

def func(N, K):
    N = N.lstrip('0')
    if len(N) < K:
        return 0

    if K == 0:
        return 1

    n = int(N[0])

    if len(N) == 1:
        if K > 1:
            return 0
        else:
            return n

    ret = 0
    if K > 1:
        ret += func(N[1:], K-1)
    else:
        ret += 1
    l = len(N[1:])

    ret += (n - 1) * func('9' * l, K - 1)
    if l >= K:
        ret += func('9'* l, K)

    # ret += (n - 1) * nCr(l-1, K - 2) * 9 ** (K - 1)
    # ret += nCr(l-1, K - 1) * 9 ** K 

    return ret
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

int main() {
  int N,M,i,ans=0;
  char b;
  scanf("%c",&b);
	if(b=='A')b='T';
  else if(b=='G')b='C';
  else if(b=='C')b='G';
  else b='A';

  printf("%c\n",b);
	return 0;
}


Measured memory_bytes: 128
H,W,A,B = map(int,input().split())
if A>=W or B>=H:
  print('No')
else:
  [print(''.join(['0']*(W-A)+['1']*A)) for _ in range(B)]
  [print(''.join(['1']*(W-A)+['0']*A)) for _ in range(H-B)]

Measured memory_bytes: 39792
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

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

    vector< pair<int, string> > ps(m);
    rep(i, m) cin >> ps[i].first >> ps[i].second;

    vector<int> penal(n);
    vector<bool> b(n);
    rep(i, m) {
        int num = ps[i].first-1;
        if (b[num] == true) continue;

        if (ps[i].second == "WA") {
            penal[num]++;
        } else if (ps[i].second == "AC") {
            b[num] = true;
        }
    }

    int coll = 0, pena = 0;
    rep(i, n) {
        if (b[i] == true) {
            coll++;
            pena += penal[i];
        }
    }

    cout << coll << " " << pena << endl;
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;
}

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

int main()
{
    string s;
    cin >> s;
    if (s.at(2) == s.at(3) && s.at(4) == s.at(5))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int N;
  cin >> N;
  int A[N];
  rep(i,N) cin >> A[i],A[i] -= i +1;
  sort(A,A+N);
  int b = ( N % 2 == 0 ? (A[N/2-1] + A[N/2])/2 : (A[(N-1)/2]));
  int ans = 0;
  rep(i,N) ans += abs(A[i] -b);
  cout << ans << endl;
  
  
  
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{  	
	int t;
	cin>>t;
	string s;
	int sum1=0,sum2=0,sum3=0,sum4=0;
	while(t--){
		cin>>s;
		if(s[0]=='A')sum1++;
		else if(s[0]=='W')sum2++;
		else if(s[0]=='T')sum3++;
		else if(s[0]=='R')sum4++;
	}
	printf("AC x %d\n",sum1);
	printf("WA x %d\n",sum2);
	printf("TLE x %d\n",sum3);
	printf("RE x %d\n",sum4);
	return 0;	
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    vector<pair<int, int>> ab(n);
    for (int i = 0; i < n; i++) ab[i] = make_pair(a[i], b[i]);

    sort(ab.begin(), ab.end());

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        int buy = min(m, ab[i].second);
        ans += (long long)ab[i].first * buy;
        m -= buy;
    }

    cout << ans << endl;
}


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

int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if(y - r >= 0 && y + r <= H && x - r >= 0 && x + r <= W) {
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3096
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define erep(i,n) for (int i = 0; i <= (n); ++i)
#define brep(i,n) for (int i = n; i >= 0; i--)
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int INF = 100005;
const int MAX_N = 200005;

int dp[MAX_N];

int main(){
    int n;
    cin >> n;
    rep(i,MAX_N){
        dp[i] = INF;
    }
    dp[0]=0;

    rep(i,n){
        for(int pow6=1;pow6 <=n; pow6*=6){
            dp[i+pow6] = min(dp[i+pow6],dp[i]+1);
        }
        for(int pow9=1; pow9 <=n;pow9*=9){
            dp[i+pow9] = min(dp[i+pow9],dp[i]+1);
        }
    }

    cout << dp[n] << endl;
    
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
    fast


        
    int n;
    cin>>n;

    vi v(n);

    forn(i,0,n)
    {
        cin>>v[i];
    }   

    int maxi = 0,count = 0;
    forn(i,0,n-1)
    {
        if(v[i+1] <= v[i])
        {
            count++;
        }
        else
        {
            count = 0;
        }
        maxi = max(maxi,count);
    }

    cout<<maxi;










    return 0;
}

Measured memory_bytes: 640
use std::io;
use std::cmp::Ordering;
use std::str::FromStr;

fn get_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line
}

fn get_vector() -> Vec<i32> {
    let line = get_line();
    let vec : Vec<i32> = line.split_whitespace().map(|x| i32::from_str(x).unwrap()).collect();
    return vec;
}

fn main() {
    let mut i = 1;
    loop {
        let mut x = String::new();
        io::stdin().read_line(&mut x).unwrap();
        let x: i32 = x.trim().parse().unwrap();
        if x == 0 {
            break;
        }
        println!("Case {}: {}", i, x);
        i += 1;
    }
}



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

int main(){
    int i, j, k;
    int N;
    cin >> N;
    vector<int> V(N);
    for(i=0; i<N; i++) cin >> V[i];

    map<int, int> cnt[2];
    for(i=0; i<N; i++) cnt[i%2][V[i]]++;

    vector<pair<int, int>> pairs[2];
    for(k=0; k<2; k++){
        cnt[k][0] = 0;
        for(auto&& p : cnt[k]) pairs[k].push_back({p.second, p.first});
        sort(pairs[k].rbegin(), pairs[k].rend());
    }

    int ans;
    if(pairs[0][0].second != pairs[1][0].second){
        ans = N - pairs[0][0].first - pairs[1][0].first;
    }else{
        ans = N - max(pairs[0][1].first + pairs[1][0].first, pairs[0][0].first + pairs[1][1].first);
    }

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


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

//#define int long long

#define pii pair<int, int>

#define x1 x1228
#define y1 y1228

#define left left228
#define right right228

#define pb push_back
#define eb emplace_back

#define mp make_pair 

#define ff first
#define ss second   

#define matr vector<vector<int> > 

#define all(x) x.begin(), x.end()


using namespace std;
typedef long long ll; 
typedef long double ld; 
                                
const int maxn = 1e6 + 7, mod = 1e9 + 7, inf = 1e9, MAXN = 1e6 + 7;
const double eps = 1e-9;
mt19937 rnd(time(0));
int n, m; 
int A[maxn]; 
int B[maxn];
int a[maxn], b[maxn];

void solve() {        
    cin >> n >> m; 
    for (int i = 0; i < n; ++i) {
        int x; cin >> x;
        a[i] = x; 
        if (A[x]) {
            cout << 0; 
            return; 
        }
        A[x] = 1;         
    } 
    for (int i = 0; i < m; ++i) {
        int x; cin >> x; 
        b[i] = x; 
        if (B[x]) {
            cout << 0; 
            return; 
        }
        B[x] = 1; 
    } 
    ll ans = 1; 
    int have = -1;         
    for (int i = n * m; i > 0; --i) {
        have++; 
        if (A[i] && B[i]) {
            continue; 
        }
        if (A[i]) {
            int cur = 0;  
            for (int j = 0; j < m; ++j) {
                if (b[j] >= i) {
                    ++cur; 
                }
            }
            ans *= cur; 
            ans %= mod; 
            continue; 
        }
        if (B[i]) {
            int cur = 0;  
            for (int j = 0; j < n; ++j) {
                if (a[j] >= i) {
                    ++cur; 
                }
            }
            ans *= cur;  
            ans %= mod; 
            continue;         
        }
        int p1 = 0; 
        int p2 = 0;
        for (int j = 0; j < n; ++j) {
            p1 += (a[j] >= i); 
        }
        for (int j = 0; j < m; ++j) {
            p2 += (b[j] >= i); 
        }
        int d = p1 * p2; 

        d -= have; 
        ans *= d; 
        ans %= mod; 
    }
    cout << ans; 
}                               
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1;  
    for (int i = 0; i < t; ++i)              
        solve();
    return 0;
}  

Measured memory_bytes: 6400
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

AB = sorted([a + b for a in A for b in B])[-1:-K-1:-1]
ABC = sorted([ab + c for ab in AB for c in C])[-1:-K-1:-1]
print('\n'.join(map(str, ABC)))


Measured memory_bytes: 186408
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

  long long N,A,B;
  cin >> N >> A >> B;

  long long sum;
  sum = (B*(N-1)+A) - (A*(N-1) + B) + 1;

  if(A > B)
    cout << 0 << endl;

  else if(N == 1 && A != B)
    cout << 0 << endl;
  
  else
    cout << sum << endl;

}


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

ll ggd(ll A, ll B)
{
    ll m = A;
    ll n = B;
    if (B > A)
    {
        m = B;
        n = A;
    }
    while (m != n)
    {
        if (m < n)
        {
            ll tmp1 = m;
            m = n;
            n = tmp1;
        }
        ll tmp2 = n;
        n = m - n;
        m = tmp2;
    }
    return n;
}
ll lcm(ll A, ll B)
{
    return A * B / ggd(A, B);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A, B;
    cin >> A >> B;
    ll result;
    result = lcm(A, B);
    cout << lcm(A, B);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int a;
  a=0;
  int l,r;
  for(int i=0;i<N;i++){
    cin>>l >>r;
    a+=r-l+1;
  }
  cout<<a<<endl;
}            

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

typedef long long ll;

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

	ll ans = 0;
	ll cnt[10][10] = {};//cnt[a][b] := aで始まりbで終わる数でN以下の場合の数

	for (int i = 1; i <= N; i++) {
		if (i <= 9) {
			cnt[i][i]++;
		}
		else {
			string s = to_string(i);
			cnt[s.front() - '0'][s.back() - '0']++;
		}
	}

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			ans += cnt[i][j] * cnt[j][i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    cout << (double)a/b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long
#define ld double
#define ull unsigned long long
#define PI pair < int, int > 

const int N = 5e5 + 123;
const int M = 123;
const ld Pi = acos(-1);
const ll Inf = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int Sz = 501;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) {
  return 1ll * a * b % mod;
}
int sum(int a, int b) {
  add(a, b);
  return a;
}

int a, b, c;

void solve() { 
  cin >> a >> b >> c;
  ll ans = 1e18;
  ans = min(ans, 1ll * (a % 2) * b * c);
  ans = min(ans, 1ll * (b % 2) * a * c);
  ans = min(ans, 1ll * (c % 2) * a * b);
  cout << ans << endl;
}

int main() {
  #ifdef wws
   freopen("in", "r", stdin);
  // freopen("out", "w", stdout);
  #endif 
  ios_base::sync_with_stdio(0);
  int tt = 1; 
  while(tt--) solve();
  return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
Y //= 1000

for x in range(N+1):
    if (Y - N -9*x) % 4 == 0 and (-Y +5*N + 5*x) % 4 == 0:

        y = (Y - N -9*x) // 4
        z = (-Y +5*N + 5*x) // 4
        if y >= 0 and z >= 0:
            print(x, y, z)
            break
else:
    print(-1, -1, -1)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

char img[57][57], temp[57][57];
int main(){
	Lancer();
	ll n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> img[i][j];
	for (int i = 0; i < m; i++)
		for (int j = 0; j < m; j++)
			cin >> temp[i][j];

	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (temp[0][0] == img[i][j]){
				if (i + m <= n && j + m <= n){
					bool ch = true;
					for (int k = 0; k < m; k++){
						for (int c = 0; c < m; c++){
							if (temp[k][c] != img[i + k][j + c]){
								ch = false;
								break;
							}
						}
					}
					if (ch){
						cout << "Yes";
						return 0;
					}
				}
			}
		}
	}
	cout << "No";
	cout << endl;
	return 0;
}


Measured memory_bytes: 3704
#include <iostream>
using namespace std;
const int N_MAX = 100;
int main (void) {
    int n;
    int a[2][N_MAX];

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

    for (int i = 1; i < n; i++) a[0][i] += a[0][i - 1];
    a[1][0] += a[0][0];
    for (int i = 1; i < n; i++) {
        a[1][i] += max(a[0][i], a[1][i - 1]);
    }

    cout << a[1][n - 1] << endl;

    return 0;
}

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

int main(){
	int p[3],j[2];
	cin>>p[0]>>p[1]>>p[2]>>j[0]>>j[1];
	int cnt;
	cnt=INF;
	for(int i=0;i<3;i++) cnt=min(cnt,p[i]);
	int cnj=min(j[0],j[1]);
	cout<<cnt+cnj-50<<endl;
	return 0;
}

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

long long r, d, x;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> r >> d >> x;
	for(int i=0; i<10; ++i){
		x = r * x - d;
		cout << x << "\n";
	}
}

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

int main()
{
    int n, a;
    set<int> se;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a, se.insert(a);

    cout << se.size() - !(se.size() % 2) << endl;

    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	ll a;cin>>a;
	long double b;cin>>b;
	cout << ll(floor(a * b)) << endl;
	return 0;
}

Measured memory_bytes: 3736
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int A, B, C, D; cin >> A >> B >> C >> D;
    
    int L = A+B;
    int R = C+D;
    if      (L >  R){ cout << "Left"     << endl;
    }else if(L == R){ cout << "Balanced" << endl;
    }else           { cout << "Right"    << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.lang.Math

fun main(args: Array<String>){
    val s = readLine()!!.toLong()
    var route = java.lang.Math.sqrt(s.toDouble())
    var top = java.lang.Math.ceil(route).toLong()
    //var route = kotlin.math.sqrt(s.toDouble())
    //var top = kotlin.math.ceil(route).toLong()

    val square: Long = top*top

            //println("square:$square, top:$top ")
    val jp9 = 1000000000 //10^9

    var n: Long = square - s
    var ax: Long = 0
    var ay: Long = 0
    val zero: Long = 0

    for(i in 1..1000000000){
        val ilong: Long = i.toLong()
        if(n % ilong == zero){
            ax = ilong
            ay = n / ax
            //println("ax:$ax, ay:$ay")
            if(ax <= jp9 && ay <= jp9){
               // println("ok")
                break
            }
        }
    }

    //println("x1:$ax,y1:$top,x2:$top y2:$ay")
    println("0 0 $ax $top $top $ay")


}

fun gcd(a: Int, b: Int): Int = if(a < b) gcd(b, a) else if(b == 0) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)

Measured memory_bytes: 31392
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i) < (N); (i)++)
#define all(V) V.begin(), V.end()
using i64 = long long;
using P = pair<int,int>;


int main(){
    int W,H;
    while(cin >> W >> H, W != 0){
        W = 2*W - 1;
        H = 2*H - 1;
        vector<vector<bool>> maze(H, vector<bool>(W,0));
        for(int h = 1; h < H; h += 2){
            for(int w = 0; w < W; w++){
                maze[h][w] = true;
            }
        }
        for(int w = 1; w < W; w += 2){
            for(int h = 0; h < H; h++){
                maze[h][w] = true;
            }
        }

        for(int h = 0;h < H; h++){
            for(int w = (h%2 == 0); w < W; w += 2){
                bool c; 
                cin >> c;
                maze[h][w] = c;
            }
        }

        vector<vector<int>> dist(H,vector<int>(W,-1));
        dist[0][0] = 0;
        queue<P> que;
        que.push({0,0});
        
        const int d[4] = {1, -1, 0, 0};
        while(!que.empty()){
            P p = que.front();
            que.pop();
            int h = p.first;
            int w = p.second;
            for(int i = 0; i < 4; i++){
                int nh = h + d[i];
                int nw = w + d[i^2];

                if(nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
                if(dist[nh][nw] != -1) continue;
                if(maze[nh][nw] == 1) continue;

                dist[nh][nw] = dist[h][w] + 1;
                que.push({nh, nw});
            }
        }

        int ans = dist[H-1][W-1] / 2 + 1;
        if(dist[H-1][W-1] == -1) ans = 0;
        cout << ans << endl;
    }
}



Measured memory_bytes: 3164
#include<iostream>
#include<stdlib.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
  int a,b;
  int sum=0;
  
  cin>>a>>b;
  
  vector<int> s(b);
  
  for(int i=0;i<b;i++)
  {
    cin>>s[i];
    sum=sum+s[i];
  }
  
  if(sum<a)
  {
    cout<<"No"<<endl;
  }
  else
  {
    cout<<"Yes"<<endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 640
'use strict';

function Main(input) {
    let S = input.trim().split(' ');
    const A = BigInt(S[0]);
    const B = BigInt(S[1].replace('.', ''));
    // console.log(S)
    // console.log(A, B)

    const result = A * B / BigInt(100)

    console.log(String(result).replace('n', ''));

}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29556
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

	vector<int> ds(n);
	rep(i, n)
	{
		cin >> ds[i];
	}

	//昇順にソート
	sort(ds.begin(), ds.end());

	//n/2 - 1番目以上、n/2番目未満となる整数の個数を出力
	cout << ds[n / 2] - ds[n / 2 - 1] << endl;



	return 0;
}

Measured memory_bytes: 640
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    xl=[0]*n
    for i in range(n):
        xl[i]=list(map(int,readline().split()))

    a=[[0,0] for _ in range(n)]
    for i in range(n):
        a[i][0]=xl[i][0]-xl[i][1]
        a[i][1]=xl[i][0]+xl[i][1]
    a.sort(key=lambda x:x[1])
    s=a[0][1]
    
    ans=1
    for i in range(1,n):
        if s<=a[i][0]:
            ans+=1
            s=a[i][1]

    print(ans)
    
if __name__=="__main__":
    main()

Measured memory_bytes: 42592
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t; cin >> s >> t;
  vector<string> ans;
  int x = -1;
  FOR(i,0,s.length()) {
    bool ok = true;
    FOR(j,0,t.length()) {
      if(s[i+j] == '?') continue;
      if(s[i+j] != t[j]) ok = false;
    }
    if(ok) {
      x = i;
      string ss = "";
      FOR(i,0,x) {
        if(s[i] == '?') ss += "a";
        else ss+= s[i];
      }
      ss += t;
      FOR(i,x+t.length(),s.length()) {
        if(s[i] == '?') ss += "a";
        else ss += s[i];
      }
      ans.push_back(ss);
    }
  }
  if(x < 0) cout << "UNRESTORABLE" << endl;
  else {
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
#pragma endregion
#pragma endregion


int main(void) {
	lint n; cin >> n;
	vector<pair<lint, lint>> d(n);
	for (int i = 0; i < n; i++) cin >> d[i].first >> d[i].second;
	vl x(n);
	for (int i = 0; i < n; i++) x[i] = i + 1;
	ld ans = 0;
	do {
		for (int i = 0; i < n - 1; i++) {
			ans += sqrt(pow((d[x[i + 1] - 1].first - d[x[i] - 1].first), 2) + pow((d[x[i + 1] - 1].second - d[x[i] - 1].second), 2));
		}
	} while (next_permutation(x.begin(), x.end()));
	lint cnt = 1;
	for (int i = 0; i < n; i++) {
		cnt *= (i + 1);
	}
	printf("%.30Lf", ans / (ld)(cnt));

	return 0;
}

Measured memory_bytes: 3784
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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; }




// ***************************************

ll N, K, C;

vector<ll> sub(string& S){
    ll last = - C - 1;
    vector<ll> vec(N + 1);
    ll cur = 0;
    REP(i, N){
        if (i - last > C && S[i] == 'o'){
            cur++; last = i;
        }
        vec[i + 1] = cur;
    }
    return vec;
}


int main(){
    cin >> N >> K >> C;
    string S;
    cin >> S;

    const auto& left = sub(S);
    string T = S;
    reverse(ALL(T));
    const auto& right = sub(T);

    bool flag = false;
    REP(i, N){
        if (left[i] + right[N - i - 1] < K) flag = true, cout << i + 1 << endl;
    }
    if (!flag) cout << endl;

    return 0;
}


Measured memory_bytes: 5124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int ans=0;
		int tmp=0;
		while(true) {
			ans+=1;
			tmp+=n;
			if(tmp%360==0) {
				System.out.println(ans);
				break;
			}
		}
		
	}

}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int mul = n * a;
    cout << min(mul, b);


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

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

    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(l.begin(), l.end());
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            for (int k = j+1; k < n; ++k) {
                if (l[i] != l[j] && l[j] != l[k]) {
                    if (l[i] + l[j] > l[k]) cnt++;
                }
            }
        }
    }
    cout << cnt << '\n';
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p = sc.nextInt();
        int[] a = new int[n];
        int odd = 0, even = 0;
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            if(a[i] % 2 == 0){
                even++;
            }else{
                odd++;
            }
        }
        sc.close();

        if(odd == 0){
            if(p==0){
                System.out.print((long)Math.pow(2, n));
            }else{
                System.out.print(0);
            }
        }else{
            System.out.print((long)Math.pow(2, n-1));
        }

        // long ans = 0L;

        // if(p == 0){
        //     ans++;
        //     if(even==0 && odd < 2){
        //     }else{
        //         for(int i=2; i<=odd; i+=2){
        //             ans += npm(odd, i);
        //         }
        //         //ans *= Math.pow(2, even);
        //         for(int i=0; i<even; i++) ans *= 2L;
        //     }
        // }else{
        //     if(odd == 0){
        //     }else{
        //         for(int i=1; i<=odd; i+=2){
        //             ans += npm(odd, i);
        //         }
        //         //ans *= Math.pow(2L, even);
        //         for(int i=0; i<even; i++) ans *= 2L;
        //     }
        // }
        // System.out.print(ans);

    }

    public static long npm(int n, int m){
        long ans = 1;
        long d = 1;
        for(int i=n; i>n-m; i--){
            ans *= i;
            while(d <= m && ans % d == 0){
                ans /= d;
                d++;
            }
        }
        return ans;
    }
}

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


int main(){
  int n;
  while(true){
  cin >> n;
  if(n == 0)break;
  vector<int> vec,pre;
  map<int,int> counter;
  for(int i=0;i<n;i++){
    int input; cin >> input;
    counter[input]++;
    vec.push_back(input);
  }
  
  int cnt = 0;
  while(true){
    pre.clear();
    map<int,int> pc;
    for(int i=0;i<vec.size();i++){
      pre.push_back(counter[vec[i]]);
      pc[counter[vec[i]]]++;
    }  
    counter.clear();
    counter = pc;
    if(pre == vec)break;
    vec = pre;
    cnt++;
  }
  cout << cnt << endl;
  for(int i=0;i<n;i++){
    cout << pre[i];
    i == n-1?cout << endl:cout << ' ';
  }
  }
  return 0;
}

Measured memory_bytes: 1220
def b_iron_bar_cutting():
    N = int(input())
    A = [int(i) for i in input().split()]
    first = sum(A)
    second = 0
    ans = float('inf')
    for i in range(N):
        first -= A[i]
        second += A[i]
        ans = min(ans, abs(first - second))
    return ans

print(b_iron_bar_cutting())

Measured memory_bytes: 26220
import std.algorithm;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


void main() {
    auto input = readln.chomp.split.map!(to!long);
    auto r = input.front;
    input.popFront;
    auto D = input.front;
    input.popFront;
    auto x = input.front;
    input.popFront;

    iota(10).each!((_){
        x = r * x - D;
        writeln(x);
    });
}


Measured memory_bytes: 256
//Artie WANG
//io
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <sstream>

//data structure
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
//#include <unordered_map>
//#include <unordered_set>
#include <utility>
#include <bitset>
#include <complex>




using namespace std;

const char newline = '\n';
typedef pair<int, int> ii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l4;


const int maxn = 2e5+1;
int n, a[maxn], b[maxn];

int main()
{
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    {
      scanf("%d", a+i);
    }
  int cur = n;
  int pos = 1;
  while (cur > 0)
    {
      b[pos++] = cur;
      cur -= 2;
    }
  pos = n;
  cur = n-1;
  while (cur > 0)
    {
      b[pos--] = cur;
      cur -= 2;
    }
  for (int i = 1; i <= n; ++i)
    {
      if (i != 1)
	{
	  printf(" ");
	}
      printf("%d", a[b[i]]);
    }
  puts("");

}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.size()%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=(i%2==0?'h':'i')){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3576
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
 
int main(int argc, char* argv[])
{
    long kk;
    scanf("%ld", &kk);

    long long save = 0;
    long long tmp = 0;
    long count = 0;
    long i, j, k;
    for(i=0; i<16; i++) {
        for(j=1; ; j++) {
            long sum = 0;
            tmp = j;
            {
                long a = j;
                while(a>0) {
                    sum += (a%10);
                    a /= 10;
                }
            }
            for(k=0; k<i; k++) {
                tmp = tmp*10+9;
                sum += 9;
            }
            if( (double)tmp / sum > pow((double)10, i) ) {
                break;
            }
            if(save>=tmp) {
                continue;
            }

            printf("%lld\n", tmp);
            count ++;
            if(count==kk) {
                return 0;
            }
            save = tmp;
        }
    }
 
    return 0;
}

Measured memory_bytes: 128