akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef vector<vector<long long>> mll;
typedef vector<pair<long long, long long>> vpl;
typedef pair<long long, long long> pll;
#define minimize(var, val) (var = min((val), var))
const long long MOD = 1e9 + 7;

int main() {
    string k;
    cin >> k;
    ll d;
    cin >> d;
    mll dp(k.size() + 1, vll(d, 0));
    ll cumulative = 0;
    for (int i = 1; i <= k.size(); i++) {
        for (int digit = 0; digit < 10; digit++) {
            for (int sum = 0; sum < d; sum++) {
                dp[i][(sum + digit) % d] =
                    (dp[i][(sum + digit) % d] + dp[i - 1][sum]) % MOD;
            }
        }
        for (int digit = 0; digit < k[i - 1] - '0'; digit++) {
            dp[i][(cumulative + digit) % d] =
                (dp[i][(cumulative + digit) % d] + 1) % MOD;
        }
        cumulative = (cumulative + k[i - 1] - '0') % d;
    }
    dp[k.size()][cumulative] = (dp[k.size()][cumulative] + 1) % MOD;
    cout << (dp[k.size()][0] - 1 + MOD) % MOD << endl;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
LL INF = 1e8;
using P = pair<int, int>;

int main(){
    LL H, W;
    cin >> H >> W;
    vector<P>  que1(1000000), que2(1000000);
    vector<string> ss(H);
    vector<vector<int>>  dp(H, vector<int>(W, 1));
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};
    for(int i = 0;i < H;i++)    cin >> ss[i];
    int wcount = 0;
    int id1 = 0;
    int id2 = 0;
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(ss[i][j] == '#'){
                dp[i][j] = 0;
                que1[id1++] = P(i, j);
            }else{
                wcount++;
            }
        }
    }
    int ans = 0;
    while(wcount > 0){
        for(int i = 0;i < id1;i++){
            int cy = que1[i].first;
            int cx = que1[i].second;
            for(int j = 0;j < 4;j++){
                int ny = cy+dy[j];
                int nx = cx+dx[j];
                if(ny >= 0 && ny < H && nx >= 0 && nx < W && dp[ny][nx] == 1){
                    wcount--;
                    dp[ny][nx] = 0;
                    que2[id2++] = P(ny, nx);
                }
            }
        }
        ans++;
        for(int i = 0;i < id2;i++)  que1[i] = que2[i];
        id1 = id2;
        id2 = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 20864
while True:
    try:
        nums = map(int, raw_input().split(' '))
        
        ans = nums[0]+nums[1]
        
        x = 0
        while True:
            if (10**x -1) < ans < 10**(x+1):
                print x+1
                break
            else:
                x = x+1
    except EOFError:
        break 

Measured memory_bytes: 4220
# coding: utf-8
k = int(input())

li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

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

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 998244353;

const double PI = acos(-1.0);

ll modpow(ll a, ll n, int mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;
    cin>>N;
    vector<ll> D(N),C(N,0);
    rep(i,N){
        cin>>D[i];
        C[D[i]]++;
    }
    if(D[0] != 0||C[0]>1){
        cout<<0<<endl;
        return 0;
    }
    /*
    sort(all(D));
    rep(i,N-1){
        if(D[i+1]-D[i]>1){
            cout<<0<<endl;
            return 0;
        }
    }
    */
    ll ans = 1;
    rep(i,N-1){
        ans *= modpow(C[i],C[i+1],MOD);
        ans %= MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <assert.h>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
char a[500005*10];
char b[500005*12];
int fail[500005*12];
int la,lb;

void build(char c[])
{
	int len=strlen(c);
	int j=fail[0]=-1;
	for(int i=1;i<=len;i++)
	{
		while(j>=0 && c[j]!=c[i-1]) j=fail[j];
		fail[i]=++j;
	}
}

int search(int l,int r)
{
	int res=0;
	int cur=0;
	for(int i=l;i<r;i++)
	{
		while(cur>=0 && a[i]!=b[cur]) cur=fail[cur];
		cur++;
		res=max(res,cur/lb);
	}
	return res;
}

int main()
{
//	freopen("input.txt","r",stdin);
	scanf("%s",a);
	scanf("%s",b);
	la=strlen(a);
	lb=strlen(b);
	int time=0;
	while(time*la<=lb+la)
	{
		time++;
	}
	for(int i=1;i<time;i++)
	{
		for(int pos=0;pos<la;pos++)
		{
			a[i*la+pos]=a[pos];
		}
	}
	la=strlen(a);
	for(int i=1;i<3;i++)
	{
		for(int pos=0;pos<la;pos++)
		{
			a[i*la+pos]=a[pos];
		}
	}
	int timeb=0;
	while(timeb*lb<=la*3+lb)
	{
		timeb++;
	}
	for(int i=1;i<timeb;i++)
	{
		for(int pos=0;pos<lb;pos++)
		{
			b[i*lb+pos]=b[pos];
		}
	}
	build(b);
	int c1=search(0,la),c2=search(0,la*2),c3=search(0,la*3);
	if(c2==c1) assert(c2==c3);
	if(c2==c1) over(c1);
	if(c2>c1 && c3>c2) over(-1);
	assert(c3==c2);
	cout<<c2<<endl;
	return 0;
}

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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int disty = (ty - sy);
	int distx = (tx - sx);
	
	for (int i = 0; i < disty; i++) {
		if (disty > 0)
			cout << "U";
		else
			cout << "D";
	}
	
	for (int i = 0; i < distx; i++) {
		if (distx > 0)
			cout << "R";
		else
			cout << "L";
	}

	for (int i = 0; i < disty; i++) {
		if (disty > 0)
			cout << "D";
		else
			cout << "U";
	}

	for (int i = 0; i < distx; i++) {
		if (distx > 0)
			cout << "L";
		else
			cout << "R";
	}

	if (distx > 0)
		cout << "L";
	else
		cout << "R";

	if (disty > 0)
		cout << "U";
	else
		cout << "D";

	for (int i = 0; i < disty; i++) {
		if (disty > 0)
			cout << "U";
		else
			cout << "D";
	}

	for (int i = 0; i < distx; i++) {
		if (distx > 0)
			cout << "R";
		else
			cout << "L";
	}

	if (distx > 0)
		cout << "R";
	else
		cout << "L";

	if (disty > 0)
		cout << "D";
	else
		cout << "U";

	if (distx > 0)
		cout << "R";
	else
		cout << "L";

	if (disty > 0)
		cout << "D";
	else
		cout << "U";

	for (int i = 0; i < disty; i++) {
		if (disty > 0)
			cout << "D";
		else
			cout << "R";
	}

	for (int i = 0; i < distx; i++) {
		if (distx > 0)
			cout << "L";
		else
			cout << "R";
	}

	if (distx > 0)
		cout << "L";
	else
		cout << "R";

	if (disty > 0)
		cout << "U";
	else
		cout << "D";
}

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

typedef long long LL;

const int N=1000005;
const int MOD=1000000007;

int n,f[N],s[N];

int main()
{
	scanf("%d",&n);
	f[1]=f[2]=f[0]=s[0]=1;s[1]=2;s[2]=3;
	for (int i=3;i<=n;i++)
	{
		f[i]=f[i-1]+s[i-3];
		f[i]-=f[i]>=MOD?MOD:0;
		s[i]=s[i-1]+f[i];
		s[i]-=s[i]>=MOD?MOD:0;
	}
	int ans=f[n];
	ans+=(LL)f[n-1]*(n-1)%MOD;
	ans-=ans>=MOD?MOD:0;
	for (int i=0;i<=n-2;i++) ans+=(LL)f[i]*((LL)(n-1)*(n-1)%MOD+i+1)%MOD,ans-=ans>=MOD?MOD:0;
	printf("%d",ans);
	return 0;
}

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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

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

    cout << (1000-(N % 1000))%1000 << endl;


}


Measured memory_bytes: 3640
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	h := make([]int, N)
	for i := range h {
		fmt.Scan(&h[i])
	}
	sort.Ints(h)
	// fmt.Println("N", N, "K", K, "h", h)
	ans := int(1e9) + 1
	for i := 0; i+K-1 < N; i++ {
		ans = min(ans, h[i+K-1]-h[i])
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


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

using namespace std;

void solve(void)
{
	string s;
	getline(cin, s);
	getline(cin, s);
	cout << (s.find("Y") != string::npos ? "Four" : "Three") << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

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

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

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

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

  if ((n+2-1)/2 >= k) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#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;
}

int main(){
  ll N,P,T=1;
  cin >> N >> P;
  if(N==1){
    cout << P << endl;
    return 0;
  }
  Rep(i,2,sqrt(P)+1){
    ll C=0;
    while(P%i==0){
      P/=i;
      C++;
      if(C>=N){
        T*=i;
        C=0;
      }
    }
  }
  cout << T << endl;
}

Measured memory_bytes: 256
#include<iostream>
//#include<cmath>
//#include<cstring>
//#include<vector>
#include<bits/stdc++.h>
//#include<algorithm>

using namespace std;
int main(){
  int x,c=0,i;
  cin>>x;
  string a;
  cin>>a;
  for(i=0;i<x-2;i++){
    if(a[i]=='A' && a[i+1]=='B' && a[i+2]=='C'){
        c++;
    }
  }

  cout<<c;


  return 0;
}

/*---------
 double n,m,a;
    cin>>n>>m>>a;
    cout<<(ceil(n/a)*ceil(m/a));

*/




/* int n;
  cin >> n;_.-
  for (int y=0; y<2*n+1; y++) {
    int c = 0;
    for (int x=0; x<2*n+1; x++) {
      int nx = x;
      int ny = y;
      if (nx>n) {
        nx -= (nx-n)*2;
      }
      if (ny>n) {
        ny -= (ny-n)*2;
      }
      int p = nx+ny-n;
      if (p>=0) {
        cout << p;
        c++;
        if (c >= 2*ny+1) {
          break;
        } else {
          cout << " ";
        }
      } else {
        cout << "  ";
      }
    }
    cout << endl;
  }
  return 0;
}*/
 /*----------my code--------------
  int n,a,b,c,d,space,i,j,apply;
    cin>>n;
    b=2*n+1;
    for(i=0;i<b;i++){
        space=2(n-1);
        for(j=0;j<b;j++){
            if(space>0){
                apply=space/2;
                for()
            }
        }

        int n,a,b,c,d,space,i,j,k,apply,index;
    cin>>n;
    b=2*n+1;
    for(i=0;i<b;i++){
        space=2(n-i);
        apply=space/2;
        for(j=0,k=0;j<b;j++,k++){
            if(space>1){
                    if(k<i){
                            index=apply+1;
                a[index]=k;
            index++;
            }
            if(k>=i){
                a[]
            }
            }
            }
        }
    }

   for
    }*/
    /*--------------------

    int main() {
	int n;
	cin>>n;
	int x[n],y[n];
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}
	int u=0,d=0,l=0,r=0,ans=0;
	for(int i=0;i<n;i++)
	{
		u=0;d=0;l=0;r=0;
		for(int j=0;j<n;j++)
		{
			if(x[i]==x[j]&&y[i]>y[j])d=1;
			if(x[i]==x[j]&&y[i]<y[j])u=1;
			if(y[i]==y[j]&&x[i]>x[j])l=1;
			if(y[i]==y[j]&&x[i]<x[j])r=1;
		}
		if(d&&u&&l&&r)ans++;
	}
	cout<<ans<<endl;
}-----------*/


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

ll mod = 1000000007;

ll mypow(ll a, ll b)
{
    if (b == 1)
    {
        return a;
    }
    else
    {
        return a * mypow(a, b - 1);
    }
}

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vi a((n + 1) * (m + 1));
    rep(i, n + 1)
    {
        rep(j, m + 1)
        {
            a[i * m + j * n - 2 * i * j] = 1;
        }
    }
    if (a[k] == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 7188
from fractions import gcd
def main():
    n = int(input())
    a = list(map(int,input().split()))

    l = [0 for i in range(n)]
    r = [0 for i in range(n)]

    l[0] = a[0]
    r[-1] = a[-1]

    for i in range(1,n):
        l[i] = gcd(l[i-1],a[i])
        r[n-1-i] = gcd(r[n-i],a[n-1-i])
    l = [0] + l
    r = r + [0]
    ans = 0
    for i in range(n):
        ans = max(ans,gcd(l[i],r[i+1]))

    print(ans)





main()




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

bool isUpper(char c) {
    return 'A' <= c and c <= 'Z';
}

bool isValid(string S) {
    if (S[0] != 'A') return false;
    if (isUpper(S[1]) or isUpper(S.back())) return false;

    S = S.substr(1); S.pop_back();

    int count = 0;
    bool found = false;
    for (char d : S) {
        if (isUpper(d)) count++;
        if (d == 'C') found = true;
    }

    return count == 1 and found;
}

int main() {
    string S;
    cin >> S;

    if (isValid(S)) cout << "AC" << endl;
    else cout << "WA" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int k;
    string s;
    cin >> k >> s;
    if (s.size() > k){
        for(int i=0; i<k; i++){
            cout << s.at(i);
        }
        cout << "...";
        cout << endl;
    }
    else cout << s << endl;
    
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int a[50][26];
int b[26];
int main(){
  int n;
  cin >>n;
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin >>s[i];
    for(int j=0;j<s[i].size();j++){
      for(int k=0;k<26;k++){
        if(s[i][j]=='a'+k)a[i][k]++;
      }
    }
  }
  for(int i=0;i<26;i++)b[i]=a[0][i];
  for(int i=0;i<26;i++){
    for(int j=1;j<n;j++)b[i]=min(b[i],a[j][i]);
  }
  for(int j=0;j<26;j++)cerr<<a[2][j]<<endl;
  string t;
  t="";
  for(int i=0;i<26;i++){
    for(int j=0;j<b[i];j++)t+=(char)'a'+i;
  }
  cout << t <<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
v = []
tl = []
t = 1

def rec(node):
	global t, tl, v
	if tl[node-1][0] != -1:
		# print("ret", node, tl[node-1][0])
		return
	tl[node-1][0] = t
	t += 1
	# print("t: {}", t)
	adj = v[node-1][2:]
	# print("adj: ", adj)
	for i in adj:
		rec(v[i-1][0])
	tl[node-1][1] = t
	t += 1

def main():
	global v, tl
	n = int(input().strip())
	tl = [[-1, -1] for _ in range(n)]
	for i in range(n):
		l = list(map(int, input().strip().split()))
		v.append(l)
	for i in range(1, n+1):
		rec(i)
	for i in range(n):
		print("{} {} {}".format(i+1, tl[i][0], tl[i][1]))

if __name__ == '__main__':
	main()



Measured memory_bytes: 5640
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		double a,b,h,m;
		cin>>a>>b>>h>>m;
		double diff = abs(6*m - 30*h - m/2);

		diff = min(1.0*360-diff, diff);

		double side = sqrt(a*a + b*b - 2*a*b*cos((M_PI*diff)/180));

		cout<<setprecision(21)<<side<<endl;
		return 0;
	}


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

int N, M, Q;
vector<int> A;
vector<int> B;
vector<int> C;
vector<int> D;

int ans = 0;
vector<int> num;
void dfs(int n, vector<int> &num){
  if( num.size() == N ){ //判定パート
    int now = 0;
    for( int i = 0; i < Q; i++ ){
      if( num.at(B[i]) - num.at(A[i]) == C[i] ) now += D[i];
    }
    ans = max(ans, now);
  }else{
    for( int i = n; i <= M; i++ ){
      num.push_back(i);
      dfs(i, num);
      num.pop_back();
    }
  }
}
signed main() {
  cin >> N >> M >> Q;
  for( int i = 0; i < Q; i++ ){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;
    b--;
    A.push_back(a);
    B.push_back(b);
    C.push_back(c);
    D.push_back(d);
  }
  dfs(1, num);
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
	using namespace std;
	typedef long long int ll;
	
	#define mod					1000000007
	#define pii                 pair<int,int>
	#define vi                  vector<int>
	#define vii                 vector<std::vector<int>> v;
	#define mem(dp,a)           memset(dp,a,sizeof dp)
	#define sonic               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#define pb(x)               push_back(x)
	#define mkp(x,y)             make_pair(x,y)
	#define all(c)              c.begin(), c.end()
	#define ff                  first
	#define ss                  second
	#define INF                 INT_MAX
	
	/* Bit Manipulation */
	
	#define isOn(S, j) (S & (1 << j))
	#define setBit(S, j) (S |= (1 << j))
	#define clearBit(S, j) (S &= ~(1 << j)) // to turn off
	#define toggleBit(S, j) (S ^= (1 << j))
	#define lowBit(S) (S & (-S)) // to get lsb
	#define setAll(S, n) (S = (1 << n) - 1)
	
	#define modulo(S, N) ((S) & (N - 1))   // returns S % N, where N is a power of 2
	#define isPowerOfTwo(S) (!(S & (S - 1)))
	#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
	#define turnOffLastBit(S) ((S) & (S - 1))
	#define turnOnLastZero(S) ((S) | (S + 1))
	#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
	#define turnOnLastConsecutiveZeroes(S) ((S) | (S - 1))
	
	void printSet(int vS) {                         // in binary representation
	  printf("S = %2d = ", vS);
	  stack<int> st;
	  while (vS)
	    st.push(vS % 2), vS /= 2;
	  while (!st.empty())                         // to reverse the print order
	    printf("%d", st.top()), st.pop();
	  printf("\n");
	}
	
// Main Starts...
	int main()
	{
	    sonic;
	    float d,t,s;
	    cin >> d >> t >> s;
	    //cout << float(d/s) << endl;
	    if (float(d/s) <= t)
	    	cout << "Yes" << endl;
	    else{
	    	cout << "No" << endl;
	    } 
		
	}
	//******Main Ends here****************//
	
	
	


Measured memory_bytes: 3772
package main

import "fmt"

func main(){
        var a,b int
        fmt.Scan(&a,&b)
        if a < b {
                for i := 0; i < b; i++{
                        fmt.Print(a)
                }
        } else {
                for i := 0; i < a; i++ {
                        fmt.Print(b)
                }
        }
        fmt.Println("")
}

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

typedef long long ll;

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

    int n,k,s;
    cin >> n >> k >> s;
    if(s<1e9){
        for(int i=0;i<n;i++){
            if(i<k) cout << s << endl;
            else cout << s+1 << endl;
        }
    }else{
        for(int i=0;i<n;i++){
            if(i<k) cout << s << endl;
            else cout << 1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1408
from sys import stdin


N, K = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]

D = sum(P[:K])
index = 0
ans = D

for i in range(1, N - K + 1):
    if D + P[i + K - 1] - P[i - 1] > ans:
        ans = D + P[i + K - 1] - P[i - 1]
    D = D + P[i + K - 1] - P[i - 1]
print((ans + K) / 2)


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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m; cin >> n >> m;
  vector<int> c(m);
  for(int i=0; i<m; i++) {
    cin >> c[i];
  }

  vector<int> ans(50001, INT_MAX/2);
  ans[0] = 0;
  for(int i=0; i<m; i++) {
    for(int j=0; j<=50000; j++) {
      if (j+c[i]<=50000) {
        chmin(ans[j+c[i]], ans[j]+1);
      }
    }
  }
  cout << ans[n] << endl;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

const int INF = 1e8;
int W, H;
int B[30][30];
int ans = INF;

/*
0	何もないマス
1	障害物
2	スタート位置
3	ゴール位置
*/

void dfs(int y, int x, int turn) {
   if (turn >= 11) {
      return;
   }
   rep (i, 4) {
      int px = x + dx[i], py = y + dy[i];
      if (px < 0 || px >= W || py < 0 || py >= H || B[py][px] == 1) continue;
      int nx = x, ny = y;
      while (1) {
         if (nx < 0 || nx >= W || ny < 0 || ny >= H) { // 範囲外
            break;
         } else if (B[ny][nx] == 1) { // 障害物にぶつかる
            B[ny][nx] = 0;
            dfs(ny-dy[i], nx-dx[i], turn + 1);
            B[ny][nx] = 1;
            break; // これわすれてたああああああああああああああ
         } else if (B[ny][nx] == 3) {
            ans = min(ans, turn);
         }
         nx += dx[i], ny += dy[i];
      }
   }
}

int main() {
   while (1) {
      cin >> W >> H;
      if (W*H==0) break;
      int sx = 0, sy = 0;
      rep (i, H) {
         rep (j, W) {
            cin >> B[i][j];
            if (B[i][j] == 2) {
               sy = i, sx = j;
            }
         }
      }
      ans = INF;
      dfs(sy, sx, 1);
      printf("%d\n", ans==INF?-1:ans);
   }

   return 0;
}


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

int main() {
    int n; cin >> n;
    auto dfs = [&](auto dfs, long long cur, int mask) {
        if (cur > n) return 0;
        int cnt = mask == 7;
        cnt += dfs(dfs, cur * 10 + 7, mask | 4);
        cnt += dfs(dfs, cur * 10 + 5, mask | 2);
        cnt += dfs(dfs, cur * 10 + 3, mask | 1);
        return cnt;
    };
    cout << dfs(dfs, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val data = listOfDouble()
  	println("${data[0]*data[1]/2} "+ if(2*data[2]==data[0] && 2*data[3]==data[1]) 1 else 0)
}

// 入力取得
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }
fun listOfLong() =listOfString().map { it.toLong() }
fun listOfDouble() =listOfString().map { it.toDouble() }

// 約数のList
fun divisor(value : Long) : List<Long> {
    val max = Math.sqrt(value.toDouble()).toLong()
    return (1..max)
        .filter { value % it == 0L }
        .map { listOf(it, value / it) }
        .flatten()
        .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from : Long, to : Long = from) : List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j ->  i % j != 0L }
    }
}

// 素因数分解
fun decom(value : Long) : List<Long>{
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a : Long, b : Long) : Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base : String, a : String, b : String) : String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 37876
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int maxn = 200000, mod = 1e9 + 7, maxx = 4001, offset = 2000;

inline int Add(int a) {
  if (a >= mod) a -= mod;
  return a;
}

inline int Sub(int a) {
  if (a < 0) a += mod;
  return a;
}

inline int Mul(int a, int b) {
  return (long long)a * b % mod;
}

int Pow(int a, int b) {
  int c = 1;
  for (; b; b >>= 1) {
    if (b & 1) c = Mul(a, c);
    a = Mul(a, a);
  }
  return c;
}

int n, a[maxn], b[maxn];
int dp[maxx][maxx];
int fact[8001], ifact[8001];

inline int Choose(int n, int m) {
  return Mul(fact[n], Mul(ifact[m], ifact[n - m]));
}

int main(void) {
  fact[0] = 1;
  for (int i = 1; i <= 8000; ++i) {
    fact[i] = Mul(fact[i - 1], i);
  }
  ifact[8000] = Pow(fact[8000], mod - 2);
  for (int i = 8000; i >= 1; --i) {
    ifact[i - 1] = Mul(ifact[i], i);
  }

  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", a + i, b + i);
    ++dp[offset - a[i]][offset - b[i]];
    ans = Sub(ans - Choose(a[i] + b[i] << 1, a[i] << 1));
  }

  for (int i = 0; i < maxx; ++i) {
    for (int j = 0; j < maxx; ++j) {
      if (i) {
        dp[i][j] = Add(dp[i][j] + dp[i - 1][j]);
      }
      if (j) {
        dp[i][j] = Add(dp[i][j] + dp[i][j - 1]);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    ans = Add(ans + dp[offset + a[i]][offset + b[i]]);
  }

  printf("%d\n", Mul(ans, Pow(2, mod - 2)));
  return 0;
}


Measured memory_bytes: 64256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

vll lunlun;
ll K;
queue<string> que;

void dfs(string num) {
    if (lunlun.size() > K) return;

    ll top = num[0] - '0';
    if (top - 1 >= 0) {
        if (top - 1 > 0) lunlun.push_back(stoll(to_string(top - 1) + num));
        dfs(to_string(top - 1) + num);
    }
    if (top > 0) {
        lunlun.push_back(stoll(to_string(top) + num));
    }
    dfs(to_string(top) + num);

    if (top + 1 < 10) {
        lunlun.push_back(stoll(to_string(top + 1) + num));
        dfs(to_string(top + 1) + num);
    }
}

int main()
{
    cin >> K;
    if (K <= 12) {
        cout << K << endl;
        return 0;
    }

    rep(i, 10) {
        lunlun.push_back(i);
        que.push(to_string(i));
    }

    while (que.size()) {
        if (lunlun.size() > K + 1e6) break;

        string num = que.front();
        que.pop();

        ll top = num[0] - '0';
        if (top - 1 >= 0) {
            if (top - 1 > 0) lunlun.push_back(stoll(to_string(top - 1) + num));
            que.push(to_string(top - 1) + num);
        }
        if(top > 0 && top <= 9) {
            lunlun.push_back(stoll(to_string(top) + num));
        }
        que.push(to_string(top) + num);

        if (top + 1 < 10) {
            lunlun.push_back(stoll(to_string(top + 1) + num));
            que.push(to_string(top + 1) + num);
        }
    }

    sort(all(lunlun));
    //for (auto elem : lunlun) cout << elem << " "; cout << endl;
    cout << lunlun[K] << endl;

    return 0;
}

Measured memory_bytes: 58856
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static long nextLong () {return Long.parseLong(sc.next());}

    public static void main(String[] args) {
        int N = sc.nextInt();

        long[][] values = new long[N][3];
        for (int i = 0; i < N; i++) {
            values[i] = new long[] {nextLong(), nextLong(), nextLong()};
        }


        String ans = null;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j <= 100; j++) {
                int[] centerPosi = new int[]{i, j};

                long H = 0;
                for (int k = 0; k < N; k++) {
                    long x = values[k][0];
                    long y = values[k][1];
                    long h = values[k][2];

                    if (h != 0) {
                        H = h + Math.abs(centerPosi[0] - x) + Math.abs(centerPosi[1] - y);
                        break;
                    }
                }

                boolean isOK = true;
                for (int k = 0; k < N; k++) {
                    long x = values[k][0];
                    long y = values[k][1];
                    long h = values[k][2];

                    long estimatedH = Math.max((H - Math.abs(x - centerPosi[0]) - Math.abs(y - centerPosi[1])), 0);
                    isOK = isOK && (estimatedH == h);
                }
                if (isOK) {
                    ans = i + " " + j + " " + H;
                }
            }
        }
        System.out.println(ans);
    }


}


Measured memory_bytes: 22612
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	// 0 is black 1 is white
	string s; cin >> s; int n = s.length();
	int ans1 = 0, ans2 = 0;
	forl(i, 0, n) {
		if(i%2 and s[i] == '0') ans1++;
		if(!(i%2) and s[i] == '1') ans1++;
		if(i%2 and s[i] == '1') ans2++;
		if(!(i%2) and s[i] == '0') ans2++;
	}
	println(min(ans1, ans2));
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<b;i--)

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min({ a + b,b+c,c+a }) << endl;
}


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

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    ll ans = 0;
    ll bcnt = 0;
    for(ll i = 0;i<n;i++){
        if(s[i]=='B')bcnt++;
        else ans += bcnt;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
x = []
gets.chomp.split.each do |s|
  case s
  when "+"
    a = x.pop + x.pop
    x << a
  when "-"
    a =  - x.pop + x.pop
    x << a
  when "*"
    a = x.pop * x.pop
    x << a
  else
    x << s.to_i
  end
end
puts x.first


Measured memory_bytes: 6860
a = gets.to_i
line = gets.split(' ').map(&:to_i)
if line.include?(0)
  puts 0
else
  i= 1
  for n in 0..a-1 do
    i *= line[n]
    if i > 1000000000000000000
    	i = -1
    	puts i
      	exit
  	end
  end
  puts i
end

Measured memory_bytes: 21488
import os
import heapq
import sys
import math
import operator
from collections import defaultdict,deque
from io import BytesIO, IOBase


"""def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)"""

"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""



def inpt():
    return [int(k) for k in input().split()]


def main():
    n,m,t=map(int,input().split())
    dr=defaultdict(list)
    dc=defaultdict(list)
    mx=0
    for i in range(t):
        a,b=map(int,input().split())
        dr[a].append((a,b))
        mx=max(len(dr[a]),mx)
        dc[b].append((a,b))

    d=defaultdict(int)

    for i in dr.keys():
        if(len(dr[i])==mx):
            d[i]=True
    ans=0
    for i in dc.keys():
        ct=0
        for j,k in dc[i]:
            if(j in d):
                ct+=1
        if(ct<len(d)):
            ans=max(ans,mx+len(dc[i]))
        else:
            ans = max(ans, mx + len(dc[i])-1)
    print(ans)








BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()



Measured memory_bytes: 274356
//在 POJ 和小白菜中，该库禁用！
//在USACO中请用文件。
#include<bits/stdc++.h>
using namespace std;
string s,t,ans(51,'z');
bool g;
int main(){
	cin>>s>>t;
	if(t.size()>s.size()){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for(int i=0;i<=s.size()-t.size();i++){
		string u=s;
		bool fi=0;
		for(int j=0;j<u.size();j++){
			if(j<i||j>i+t.size()-1){
				if(u[j]=='?') u[j]='a';
			}else{
				if(u[j]=='?') {
					u[j]=t[j-i];
				}
				else if(u[j]!=t[j-i]){
					fi=1;
					break;
				}
			}
		}
		if(fi==0){
			g=1;
			ans=min(ans,u);
		}
	}
	if(g) cout<<ans<<endl;
	else cout<<"UNRESTORABLE"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		if(N * A >= B) {
			System.out.println(B);
		}else {
			System.out.println(N * A);
		}
	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

int main() {
  int t1, t2;
  cin >> t1;
  cin >> t2;
  vector<int> r1 = {t1, t2};
  cin >> t1;
  cin >> t2;
  vector<int> r2 = {t1, t2};
  cin >> t1;
  cin >> t2;
  vector<int> r3 = {t1, t2};
  sort_asc(r1);
  sort_asc(r2);
  sort_asc(r3);

  const vector<vector<int>> roads = {r1, r2, r3};

  const vector<int> c12 = {1, 2};
  const vector<int> c13 = {1, 3};
  const vector<int> c14 = {1, 4};
  const vector<int> c23 = {2, 3};
  const vector<int> c24 = {2, 4};
  const vector<int> c34 = {3, 4};

  if (find(roads.begin(), roads.end(), c12) != roads.end()) {
    if (find(roads.begin(), roads.end(), c34) != roads.end()) {
      if ( (find(roads.begin(), roads.end(), c13) != roads.end()) || (find(roads.begin(), roads.end(), c14) != roads.end()) || (find(roads.begin(), roads.end(), c23) != roads.end()) || (find(roads.begin(), roads.end(), c24) != roads.end()) ) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }

  if (find(roads.begin(), roads.end(), c13) != roads.end()) {
    if (find(roads.begin(), roads.end(), c24) != roads.end()) {
      if ( (find(roads.begin(), roads.end(), c12) != roads.end()) || (find(roads.begin(), roads.end(), c14) != roads.end()) || (find(roads.begin(), roads.end(), c23) != roads.end()) || (find(roads.begin(), roads.end(), c34) != roads.end()) ) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }

  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

int dp[1001][10001];    //dp[i][j]  i番目以前の物で、重さがj以下の時の価値
int W[1001],V[1001];

int w,n;

void solve(){
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<=w;j++){
            if(j-W[i]<0){
                dp[i][j]=dp[i+1][j];
            }
            else{
                dp[i][j]=max(dp[i+1][j],dp[i+1][j-W[i]]+V[i]);
            }
            
        }
    }
    
    cout<<dp[0][w]<<endl;
    for(int i=w;i>=1;i--){
        if(dp[0][i]!=dp[0][i-1]){
            cout<<i<<endl;
            break;
        }
    }
}

int main(){
    int count=1;
    while(1){
        memset(dp,0,sizeof(dp));
    
        cin>>w>>n;
        if(w==0)break;
        char a;
        rep(i,n)cin>>V[i]>>a>>W[i];
    
        cout<<"Case "<<count<<":"<<endl;
        count++;
        solve();
    }
    return 0;
}

Measured memory_bytes: 40280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

void solve(int s, vector<double> &d, vector<vector<double>> cost, int V){
    fill(ALL(d), 10000000000.0);
    d[s] = 0;

    vector<bool> used(V);
    fill(ALL(used), false);

    priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pq;
    pq.push(make_pair(0.0, s));

    pair<double, int> v;
    while(!pq.empty()){
        v = pq.top();
        pq.pop();
        if(used[v.second] == true){
            continue;
        }
        used[v.second] = true;
        d[v.second] = v.first;
        for (int i = 0; i < V; i++) {
            if(d[v.second] + cost[v.second][i] < d[i]){
                d[i] = d[v.second] + cost[v.second][i];
                pq.push(make_pair(d[i], i));
            }
        }
    }
}

int main(){
    double xs, ys, xt, yt;
    int N;
    cin >> xs >> ys >> xt >> yt >> N;
    vector<double> x(N), y(N), r(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> r[i];
    }

    vector<vector<double>> cost(N+2, vector<double> (N+2));
    vector<double> d(N+2);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cost[i][j] = max(sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j], 0.0);
            cost[j][i] = max(sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])) - r[i] - r[j], 0.0);
        }
    }
    for (int i = 0; i < N; i++) {
        cost[i][N] = max(sqrt((x[i] - xs)*(x[i] - xs) + (y[i] - ys)*(y[i] - ys)) - r[i], 0.0);
        cost[N][i] = max(sqrt((x[i] - xs)*(x[i] - xs) + (y[i] - ys)*(y[i] - ys)) - r[i], 0.0);
    }
    for (int i = 0; i < N; i++) {
        cost[i][N+1] = max(sqrt((x[i] - xt)*(x[i] - xt) + (y[i] - yt)*(y[i] - yt)) - r[i], 0.0);
        cost[N+1][i] = max(sqrt((x[i] - xt)*(x[i] - xt) + (y[i] - yt)*(y[i] - yt)) - r[i], 0.0);
    }
    cost[N][N+1] = sqrt((xs - xt)*(xs - xt) + (ys - yt)*(ys - yt));
    cost[N+1][N] = sqrt((xs - xt)*(xs - xt) + (ys - yt)*(ys - yt));

    solve(N, d, cost, N+2);


    printf("%32.18lf\n", d[N+1]);

}

Measured memory_bytes: 23344
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong p) {
	int i=0;
	for(int j = 0; j < k; j++ ) {
		llong sum = 0;
		while( sum + T[i] <= p) {
			sum += T[i];
			i++;
			if(i == n ) return n;
		}
	}
	return i;
}

int solve() {
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while(left < right) {
		mid = (left + right) / 2;
		int v = check(mid);
		if(v == n) right = mid;
		else left = mid + 1;
	}
	return right;
}

main() {
	cin >> n >> k;
	for( int i = 0; i < n; i++) cin >> T[i];
	llong ans = solve();
	cout << ans << endl;
}

Measured memory_bytes: 3860
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<ctime>
using namespace std;
typedef long long lt;
typedef double dd;
#define eps 1e-6
#define sqr(x) ((x)*(x))

int read()
{
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const int maxn=1000010;
int n;
struct point{dd x,y;}p[maxn],O;
dd R;

dd getd(point a,point b){ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
point getO(point p1,point p2,point p3)
{
    point res;
    dd a=p2.x-p1.x,b=p2.y-p1.y,c=p3.x-p2.x,d=p3.y-p2.y;
    dd e=sqr(p2.x)+sqr(p2.y)-sqr(p1.x)-sqr(p1.y);
    dd f=sqr(p3.x)+sqr(p3.y)-sqr(p2.x)-sqr(p2.y);
    res.x=(f*b-e*d)/(c*b-a*d)/2.0; 
    res.y=(a*f-e*c)/(a*d-b*c)/2.0;
    return res;
}

void mincir()
{
    O=p[1]; R=0;
    for(int i=1;i<=n;++i)
    if(getd(p[i],O)-R>eps)
    {
        O=p[i]; R=0;
        for(int j=1;j<i;j++)
        if(getd(p[j],O)-R>eps)
        {
            O=(point){(p[i].x+p[j].x)/2.0,(p[i].y+p[j].y)/2.0};
            R=getd(p[i],p[j])/2.0;
    
            for(int k=1;k<j;++k)
            if(getd(p[k],O)-R>eps)
            {
                O=getO(p[i],p[j],p[k]);
                R=getd(p[i],O);
            }
        }
    }
} 

int main()
{
    n=read();
    for(int i=1;i<=n;++i)
    scanf("%lf%lf",&p[i].x,&p[i].y);
    
    random_shuffle(p+1,p+1+n);
    
    mincir();
    printf("%.6lf",R);
    return 0;
}

Measured memory_bytes: 256