akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

struct point { int x, y; };
struct line { point p1, p2; };

bool parallel(line l1, line l2) {
  int s1 = (l1.p1.y - l1.p2.y) * (l2.p1.x - l2.p2.x);
  int s2 = (l1.p1.x - l1.p2.x) * (l2.p1.y - l2.p2.y);
  return s1 == s2;
}

int N, X[50], Y[50];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> X[i] >> Y[i];

  if(N % 2) {
    cout << "NA" << endl;
  } else {
    bool ans = true;
    REP(i, 0, N / 2) {
      line l1 = (line) {
        (point) { X[i], Y[i] },
        (point) { X[i + 1], Y[i + 1] },
      };
      line l2 = (line) {
        (point) { X[i + N / 2], Y[i + N / 2] },
        (point) { X[(i + N / 2 + 1) % N], Y[(i + N / 2 + 1) % N] },
      };
      if(!parallel(l1, l2)) ans = false;
    }
    if(!ans) cout << "NA" << endl;
    else {
      double cx = (X[0] + X[N / 2]) / 2.0;
      double cy = (Y[0] + Y[N / 2]) / 2.0;
      printf("%.8lf %.8lf\n", cx, cy);
    }
  }

  return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <stdio.h>

const int M=105;
int can[M];

int main()
{
	for(int i=1;i<=9;i++)
		for(int j=1;j<=9;j++)
			can[i*j]=1;
	int n; scanf("%d",&n);
	printf("%s\n",can[n]?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <queue>
#include <vector>
#include<iostream>
#include<cstdio>
#include<iomanip>
using std::cout;
using std::cin;
using std::endl;
using namespace std;
 
int main(){
  float n,a,ans=0;
  cin>>n;
  vector<float> A(n);
  for(int i=0;i<n;i++){
    cin>>a;
    A[i]=a;
  }
  for(int i=0;i<n;i++){
    ans+=1/A[i];
  }
  cout<<1/ans<<endl;
}

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

int main(void){
	int n;
	while(cin>>n){
		int m[10]={0};
		int i=0;
		for(int max = 1024;max /= 2;max<1){
			if(n>=max){
//				cout<<max<<" "<<n<<endl;
				n=n-max;
				m[i++]=max;
//				cout<<max<<endl;
			}
		}
		
		sort(m,m+10);
		for(i=0;i<10;i++)
			if(m[i]!=0){
				cout<<m[i];
				break;
			}
		for(int j=i+1;j<10;j++)
			if(m[j]!=0)cout<<" "<<m[j];
		cout<<endl;
	}
}

Measured memory_bytes: 1176
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right; };

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
	if (u == NIL)return;
	D[u] = d;
	setDepth(T[u].left, d + 1);
	setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if (T[u].left != NIL)
		h1 = setHeight(T[u].left) + 1;
	if (T[u].right != NIL)
		h2 = setHeight(T[u].right) + 1;
	return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibiling(int u) {
	if (T[u].parent == NIL)return NIL;
	if (T[T[u].parent].left != u&&T[T[u].parent].left != NIL)
		return T[T[u].parent].left;
	if (T[T[u].parent].right != u&&T[T[u].parent].right != NIL)
		return T[T[u].parent].right;
	return NIL;
}

void print(int u) {
	printf("node %d: ", u);
	printf("parent = %d, ", T[u].parent);
	printf("sibling = %d, ", getSibiling(u));
	int deg = 0;
	if (T[u].left != NIL)deg++;
	if (T[u].right != NIL)deg++;
	printf("degree = %d, ", deg);
	printf("depth = %d, ", D[u]);
	printf("height = %d, ", H[u]);

	if (T[u].parent == NIL) {
		printf("root\n");
	}
	else if (T[u].left == NIL&&T[u].right == NIL) {
		printf("leaf\n");
	}
	else {
		printf("internal node\n");
	}
}

int main() {
	int v, l, r, root = 0;
	scanf("%d", &n);

	for (int i = 0; i < n; i++)T[i].parent = NIL;

	for (int i = 0; i < n; i++) {
		scanf("%d %d %d", &v, &l, &r);
		T[v].left = l;
		T[v].right = r;
		if (l != NIL)T[l].parent = v;
		if (r != NIL)T[r].parent = v;
	}

	for (int i = 0; i < n; i++)if (T[i].parent == NIL)root = i;

	setDepth(root, 0);
	setHeight(root);

	for (int i = 0; i < n; i++)print(i);

	return 0;
}


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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(int i= (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    string S; cin >> S;
    S = S.substr(0, 3);
    cout << S << "\n";
}

Measured memory_bytes: 3612
r,g,b,n=map(int,input().split())
ans=0
for i in range(3001):
    if i*r>n:
        break
    for j in range(3001):
        if i*r+j*g>n:
            break
        if (n-(r*i+g*j))%b==0 or (n-(r*i+g*j))==0:
                ans+=1
print(ans)

Measured memory_bytes: 40940
///created: 4/Jul/2019 13:35:44

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
const int modulo = 1e9 + 7;

#ifdef LOCAL_DEBUG_NTV1612
template<class __Ty>
string to_string(__Ty a) {
	string res = "[ ";
	bool f = true;
	for (auto &p : a) { res += (f ? string("") : string(", ")) + to_string(p); f = false;	}
	return res + " ]";
}
void _debug() { fprintf(stderr, "\n"); }
template<typename __Ty_head, typename... __Ty_tail>
void _debug(__Ty_head head, __Ty_tail... tail) { fprintf(stderr, "%s ", to_string(head).c_str()); _debug(tail...); }
#define debug(...) fprintf(stderr, "DEBUG [%s]: ", #__VA_ARGS__), _debug(__VA_ARGS__)
#else
#define debug(...) 0
#endif

template<class __Ty> bool mini(__Ty& a, __Ty b) { return a > b ? ((a = b) | 1) : (0); }
template<class __Ty> bool maxi(__Ty& a, __Ty b) { return a < b ? ((a = b) | 1) : (0); }
template<class __Ty> __Ty add(__Ty a, __Ty b) { return (a + b) % (__Ty(modulo)); }
template<class __Ty> __Ty sub(__Ty a, __Ty b) { __Ty m(modulo); return ((a - b) % m + m) % m; }

int rev[256][2];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	string s, t;
	cin >> s >> t;
	memset(rev, 0, sizeof rev);
	///0: S
	///1: T
	for (int i = 0; i < int(s.length()); ++i) {
		if (rev[s[i]][0] != 0) {
			if (t[i] != rev[s[i]][0]) {
				cout << "No";
				return 0;
			}
		}
		else rev[s[i]][0] = t[i];
		if (rev[t[i]][1] != 0) {
			if (s[i] != rev[t[i]][1]) {
				cout << "No";
				return 0;
			}
		}
		else rev[t[i]][1] = s[i];
	}
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			long h = in.nextLong();
			long ans = 1;
			long tmp = 1;
			while (h > tmp) {
				tmp *= 2;
				if (tmp > h) {
					ans = tmp - 1;
					break;
				}
				ans = tmp + (tmp - 1);
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 21588
import numpy as np
import heapq
N,M = map(int,input().split())
jobs = [[] for _ in range(10 ** 5 + 1)]

for _ in range(N):
  a,b = map(int,input().split())
  jobs[a].append(b)
ans = 0
heap = []
for d in range(M+1):
  if jobs[d]: #空でないなら
    for _b in jobs[d]:
      heapq.heappush(heap,-_b) #heappopは最小値を返すので-をつけておく
  if heap: #空でないなら
    ans += -heapq.heappop(heap) #最小値を返してpop
print(ans)

Measured memory_bytes: 27460
using System;
using static System.Console;
using System.Linq;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
         var X = long.Parse(ReadLine());
         for(var i = -120; i < 120; i++){
             for(var j = -120; j < 120; j++){
                 var A = Math.Pow(i, 5);
                 var B = Math.Pow(j, 5);
                 if(A - B == X){
                     WriteLine(i + " " + j);
                     return;
                 }
             }
         }
      }
   }
}

Measured memory_bytes: 27864
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,a,max,temp,alice,bob;
  max = 0;
  alice = 0;
  bob = 0;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N;i++){
  	cin >> card.at(i);
  }
  for(int k = 0;k < N;k++){
    for(int j = 0;j < N;j++){
      if(card.at(j) > max){
          max = card.at(j);
          temp = j;
      }
    }
    card.at(temp) = 0;
    if(k%2 == 0){
    	alice += max;
    }else if(k%2 == 1){
    	bob += max;
    }
    max = 0;
  }
  cout << (alice - bob) << endl;
}

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

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) if(a[i] == 0) {
        cout << 0 << endl;
        return 0;
    }
    ll s = 1e18;
    rep(i,n) s /= a[i];
    if(s == 0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i,n) ans*= a[i];
    cout << ans << endl;
}

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

int main(){
    long long int tmp,cast = 10,count,n,a[10];
    while(cin >> n){
        for(int i = 0;i<10;i++){
            a[i] = n % cast;
            n /= cast;
        }
        for(count = 1;count < 10;count++){
            for(int i = 0;i < 10 - count;i++){
                tmp = a[i];
                a[i] = (tmp + a[i+1]) % 10;   
            }
        }
        cout << a[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,p=1,q=1;
    ll n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>n;
    cin>>str;
    rep(i,str.length()){
        for(j=0;j<n;j++){
            if(str[i]=='Z'){
                str[i]='A';
            }else{
            str[i]++;
            }
        }
    }
    cout<<str<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;
  ll a, b, x[SIZE];

  scanf("%d%lld%lld", &n, &a, &b);

  ll ans = 0;
  
  for(int i=0;i<n;i++){
    scanf("%lld", x+i);
    if(i > 0) ans += min((x[i] - x[i-1]) * a, b);
  }

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  ll h,n;
  cin>>h>>n;
  vl a(n);
  cin>>a;
  ll sum = accumulate(rng(a),0ll);
  cout<<((h<=sum)? "Yes":"No");
  

} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

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

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  string s;
  cin >> s;
  int cnt=0;
  REP(i,(int)s.size()){
    if((s[i] - '0') == i%2)cnt++;
  }
  cout << min(cnt, (int)s.size()-cnt) << endl;
}



Measured memory_bytes: 512
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass

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

divisors = divisor(M)

ans = 1
divisors.sort()

for d in divisors:
  if N*d <= M:
    ans = d

print(ans)


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

typedef long long ll;
typedef pair<int,int> P;

#define fr first
#define sc second

int main(){
	string s;
	cin >> s;
	int cnt[2] = {};
	for(int i = 0 ; i < s.size() ; i ++){
		if(s[i]-'0' == i%2)cnt[0] ++;
		else cnt[1] ++;
	}
	cout << min( cnt[0] , cnt[1] ) << endl;
}

Measured memory_bytes: 512
n, k = map(int, input().split())
s = input()
if n == 1:
    print(0)
else:
    happy = 0
    if s[0] == "R" and s[1] == "R":
        happy += 1
    if s[n - 1] == "L" and s[n - 2] == "L":
        happy += 1
    for i in range(1, n - 1):
        if s[i] == "L":
            if s[i - 1] == "L":
                happy += 1
        else:
            if s[i + 1] == "R":
                happy += 1
    lr = 0
    rl = 0
    for i in range(n - 1):
        if s[i] == "L" and s[i + 1] == "R":
            lr += 1
        elif s[i] == "R" and s[i + 1] == "L":
            rl += 1
    for i in range(k):
        if min(lr, rl) >= 1:
            happy += 2
            lr -= 1
            rl -= 1
        elif max(lr, rl) >= 1:
            happy += 1
            lr = max(lr - 1, 0)
            rl = max(rl - 1, 0)
    print(happy)

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

typedef long long ll;
const ll INF = 1e17;

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

  std::vector<ll> vope;
  vope.push_back(1);
  ll six = 6;
  while (six <= N) {
    vope.push_back(six);
    six *= 6;
  }
  ll nine = 9;
  while (nine <= N) {
    vope.push_back(nine);
    nine *= 9;
  }

  std::vector<ll> dp(N + 1, INF);
  dp[0] = 0;
  for (ll i = 1; i <= N; i++) {
    for (auto x : vope) {
      if (i - x >= 0) { dp[i] = std::min(dp[i], dp[i-x] + 1); }
    }
  }

  std::cout << dp[N] << std::endl;
  return 0;
}


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

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

    deque<char> deq;

    vector<int> Q_v(Q), F(Q);
    vector<char> C(Q);
    for(int i = 0; i < Q; ++i) {
        cin >> Q_v[i];
        if(Q_v[i] == 1) {
            continue;
        } else {
            cin >> F[i] >> C[i];
        }
    }

    bool rev = false;
    for (int i = 0; i < S.size(); ++i){
        deq.push_back(S.at(i));
    }
    
    for(int i = 0; i < Q; ++i) {
        if(Q_v[i] == 1) {
            // 前後を反転する
            rev = 1 - rev;
        } else if(Q_v[i] == 2) {
            if(F[i] == 1) {
                // 先頭にCiを追加
                if(rev == false) {
                    deq.push_front(C[i]);
                } else {
                    deq.push_back(C[i]);
                }
            } else if(F[i] == 2) {
                // 末尾にCiを追加
                if(rev == false) {
                    deq.push_back(C[i]);
                } else {
                    deq.push_front(C[i]);
                }
            }
        }
    }

    if(rev == true) {
        reverse(deq.begin(), deq.end());
    }

    for(int i = 0; i < deq.size(); ++i) {
        cout << deq[i];
    }
    cout << endl;
}

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

#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)

using namespace std;

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  sort(a.begin(), a.end());
  int res = 0;
  rep(i, n) {
    int aa = a.at(i);
    if (aa > x) {
      break;
    }
    if (i == n - 1) {
      if (aa != x) {
        break;
      }
    }
    x -= aa;
    res++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3588
from collections import defaultdict

N = int(input())
S = input()

T = [ord(S[i]) - 96 for i in range(N)]
U = [ord(S[i]) - 96 for i in range(2*N-1, N-1, -1)]


c1 = defaultdict(int)
c2 = defaultdict(int)

for i in range(1 << N) :
    a1, a2, b1, b2 = 0, 0, 0, 0
    for j in range(N) :
        if i & 1 :
            a1 = a1 * 27 + T[j]
            b1 = b1 * 27 + U[j]
        else :
            a2 = a2 * 27 + T[j]
            b2 = b2 * 27 + U[j]
        i >>= 1
        
    c1[(a1, a2)] += 1
    c2[(b1, b2)] += 1

ret = 0
for k, v in c1.items() :
    ret += v * c2[k]
print(ret)

Measured memory_bytes: 117724
rng1 = -100
rng2 = 101
#print(input().split())
inp = [int(i) for i in input().split()]
#print(inp)
x, y, z = [inp[i] for i in range(len(inp))]
#print("x={},y={},z={}".format(x,y,z))

def dif1(x, y ,z):
    if not isinstance(x, int) or not isinstance(y, int) or not isinstance(z, int):
        return False
    elif x not in range(rng1, rng2) or y not in range(rng1, rng2)or z not in range(rng1, rng2):
        return False
    else:
        if y == z:
            return x
        if z == x:
            return y
        if x == y:
            return z
Ans = dif1(x,y,z)
print(Ans)


Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main()
{
   int n,k,sum=0;
   cin >> n >> k;
   while(1)
      {
        n=n/k;
        sum++;
		if(n==0) {break;}	
      	
      }
//      if((n<10&&k==10)) sum=1;
      cout << sum;
}

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

signed main() {

    int N;
    cin >> N;
    int A[101];
    int Max = 0, Min = 10000000000;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min,A[i]);
    }
    cout << Max - Min << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>

int main(){
  int i, n, min, max;
  int R[200000];

  scanf("%d",&n);
  for(i = 0; i < n ; i++){
    scanf("%d", &R[i]);
  }
  min = R[0];
  max = R[1] - R[0];
  for( i=1 ; i < n ; i++){
    if(max < R[i]-min) max = R[i] - min;
    if(min > R[i]) min = R[i];
  }
  printf("%d\n", max);

  return 0;
}



Measured memory_bytes: 2576
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=b;i<=c;i++){
		if(i%a==0){
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
	return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
int main(){
  int n;cin>>n;
  int cnt=0;
  for(int i=0;i<100;i++)
    for(int j=0;j<100;j++){
      if(i*4+j*7==n)cnt++;
    }
  Yes(cnt);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 987654321;
const ll MOD = 1000000007;

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

int main(void) {
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL); 
  cout.tie(NULL);
  //freopen("in.txt", "r", stdin);
  int t;
  cin >> t;
  while(t--) {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    //cout << A << B << C << D << endl;
    if(A < B) {
      cout << "No" << endl;
      continue;
    } else if(B > D) {
      cout << "No" << endl;
      continue;
    } else if(B <= D && B <= C) {
      cout << "Yes" << endl;
      continue;
    }

    // B <= D && B > C case
    ll a,d;
    ll b,c;

    a = A % B;
    d = D % B;
    ll g = gcd(B, D);

    if(g == B) {
      if(a > C) {
        cout << "No" << endl;
      } else {
        cout << "Yes" << endl;
      }
    } else {
      if(a > C) {
        cout << "No" << endl;
        continue;
      }
      c = (C - a) / g;
      b = (B - a) / g;
      if((B-a)%g) {
        b++;
      }
      if(c+1 < B && b-c > 1) {
        cout << "No" << endl;
      } else {
        cout << "Yes" << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,cnt=0,nv;
  cin >> n;
  ll p[n];
  for(int i=0;i<n;i++){
    cin >> p[i];
    if(i==0){
      nv = p[i];
      cnt++;
    }else{
      if(nv>p[i]){
        cnt++;
        nv = p[i];
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=200005;

int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
	int a,b,f,k,n,s=0;
	scanf("%d%d%d",&k,&n,&f);a=f;
	while(--n){
		scanf("%d",&b);
		cmax(s,b-a);
		a=b;
	}
	printf("%d",k-max(s,k-b+f));
    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);
		String s=sc.next(),t=sc.next();
		int a=sc.nextInt(),b=sc.nextInt();
		String u=sc.next();

		if(s.equals(u)) {
			System.out.println((a-1)+" "+b);
		}else {
			System.out.println(a+" "+(b-1));
		}
	}

}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
  string s;
  while(cin >> s) {
    string a = s.substr(0, s.find("+")),
           b = s.substr(s.find("+")+1, s.find("=")-s.find("+")-1),
           c = s.substr(s.find("=")+1);

    reverse(ALL(a));
    reverse(ALL(b));
    reverse(ALL(c));
    string ans = "-1";
    for(char i = '0'; i<='9'; ++i) {
      string aa = a, bb = b, cc = c;
      REP(j, a.size()) if(a[j] == 'X') aa[j] = i;
      REP(j, b.size()) if(b[j] == 'X') bb[j] = i;
      REP(j, c.size()) if(c[j] == 'X') cc[j] = i;

      if(i=='0' && aa.size()>=2 && aa[aa.size()-1]=='0') continue;
      if(i=='0' && bb.size()>=2 && bb[bb.size()-1]=='0') continue;
      if(i=='0' && cc.size()>=2 && cc[cc.size()-1]=='0') continue;

      string n = "";
      int ca=0, m = cc.size();
      REP(i, m) {
        int cu = ca;
        if(i<aa.size()) cu += (aa[i]-'0');
        if(i<bb.size()) cu += (bb[i]-'0');
        ca = cu/10;
        n += (cu%10+'0');
      }
      if(ca == 0 && n == cc) {
        ans = i;
      }
    }
    if(ans == "-1") cout << "NA" << endl;
    else cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3136
fun main(args: Array<String>) {

    var (A, B, K) = readLine()!!
            .split(" ")
            .map { it -> it.toInt() }

    for (i in 1..K) {
        if (i % 2 == 1) {
            // 高橋くん
            if (A % 2 == 1) A -= 1
            B += A / 2
            A /= 2
        } else {
            // 青木くん
            if (B % 2 == 1) B -= 1
            A += B / 2
            B /= 2
        }
    }

    println("$A $B")
}

Measured memory_bytes: 36016
A = int(input())
listB = list(input())
f_l = ""
listA = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}
listC = {1:"A",2:"B",3:"C",4:"D",5:"E",6:"F",7:"G",8:"H",9:"I",10:"J",11:"K",12:"L",13:"M",14:"N",15:"O",16:"P",17:"Q",18:"R",19:"S",20:"T",21:"U",22:"V",23:"W",24:"X",25:"Y",26:"Z"}
for i in listB:
    B = listA[i]
    B += A
    if B > 26:
        B -= 26
    f_l += listC[B]
print(f_l)

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main()
{
	while(1){
		int m,f,r;
		cin >> m >> f >> r;
		if(m==-1 && f==-1 && r==-1)break;
		if(m==-1 || f==-1){
			cout << "F" << endl;
		}
		else if(m+f>=80){
			cout << "A" << endl;
		}
		else if(m+f>=65){
			cout << "B" << endl;
		}
		else if(m+f>=50){
			cout << "C" << endl;
		}
		else if(m+f>=30){
			if(r>=50){
				cout << "C" << endl;
			}
			else{
				cout << "D" << endl;
			}
		}
		else{
			cout << "F" << endl;
		}
	}
	return 0;
}

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

int upb(int n)
{
  int ret=0;
  while(n>0) ret++, n/=2;
  return ret;
}

int main()
{
  vector<bool> close(1<<(5*5), false);

  for (int n; cin>>n, !(n==0); ){

    vector<vector<int> > pats(n*n+1);
    vector<vector<int> > tmp(n, vector<int>(n, 0));
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	for (int k=i; k<n; k++){
	  for (int l=j; l<n; l++){
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=1;
	    int bd=0;
	    for (int a=0; a<n; a++){
	      for (int b=0; b<n; b++){
		bd=(bd<<1)|tmp[a][b];
	      }
	    }
	    pats[upb(bd)].push_back(bd);
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=0;
	  }
	}
      }
    }

    int bd=0;
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	int t; cin>>t;
	bd=(bd<<1)|t;
      }
    }

    queue<pair<int, int> > mm;
    vector<int> cls;
    //cls.reserve(1<<16);
    mm.push(make_pair(0, bd));
    close[bd]=true;
    cls.push_back(bd);
    while(!mm.empty()){
      int dep=mm.front().first;
      int cbd=mm.front().second;
      mm.pop();
      //cout<<cbd<<endl;
      int ub=upb(cbd);
      for (int i=0; i<pats[ub].size(); i++){
	int nbd=cbd^pats[ub][i];
	if (nbd==0){
	  for (int i=0; i<=dep; i++)
	    cout<<"myon";
	  cout<<endl;
	  goto _exit;
	}
	//cout<<"*** "<<nbd<<endl;
	if (close[nbd]) continue;
	close[nbd]=true;
	cls.push_back(nbd);
	mm.push(make_pair(dep+1, nbd));
      }
    }
  _exit:;
    for (int i=0; i<cls.size(); i++)
      close[cls[i]]=false;
  }
  return 0;
}

Measured memory_bytes: 6804
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
struct Edge
{
	int u;
	int v;
	ll w;
}a[200005];
int h,w,m,pa[200005];
ll ans;
bool pos[200005];
bool cmp(Edge a,Edge b)
{
	return a.w>b.w;
}
int find(int x)
{
	return x==pa[x]?x:pa[x]=find(pa[x]);
}
int main()
{
	scanf("%d%d%d",&m,&h,&w);
	for(int i=1;i<=h+w;i++)
	  pa[i]=i,pos[i]=1;
	for(int i=1;i<=m;i++)
	  scanf("%d%d%lld",&a[i].u,&a[i].v,&a[i].w);
	sort(a+1,a+m+1,cmp);
	for(int i=1;i<=m;i++)
	{
		int x=a[i].u,y=a[i].v+h;
		x=find(x),y=find(y);
		if(x!=y)
		{
			if(pos[x]&&pos[y])
			{
				pa[x]=y;
				ans+=a[i].w;
			}
			else if(pos[x]||pos[y])
			{
				pa[x]=y;
				pos[y]=0;
				ans+=a[i].w;
			}
		}
		else
		{
			if(pos[x])
			{
				ans+=a[i].w;
				pos[x]=0;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4480
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int ans = (a + b - 3) / (a - 1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const ll mod = 1e9+7;

int h,w;
vector<string> bun;
map<char,int> m;

int main()
{
    cin >> h >> w;
    bun.resize(h); rep(i,h) cin >> bun[i];
    rep(j,w){
        rep(i,h){
            m[bun[i][j]]++;
        }
    }
    int n4=0,n2=0,n1=0;
    for(auto it = m.begin(); it!=m.end(); it++){
        int val = it->se;
        n4 += val/4;
        n2 += val/2;
        n1 += val/1;
    }

    if(h%2 == 0 && w%2 == 0){
        if((h*w)/4 == n4){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    else if(h%2 == 1 && w%2 == 0){
        if((w*(h-1)/4) <= n4){
            if((w/2) <= n2-(w*(h-1)/2)){
                cout << "Yes" <<endl;
                return 0;
            }
        }
    }
    else if(h%2 == 0 && w%2 == 1){
        if((h*(w-1)/4) <= n4){
            if((h/2) <= n2-(h*(w-1)/2)){
                cout << "Yes" <<endl;
                return 0;
            }
        }
    }
    else if(h%2 == 1 && w%2 == 1){
        if((((h-1)*(w-1))/4) <= n4){
            if((h/2)+(w/2) <= n2-(((h-1)*(w-1))/2)){
                cout << "Yes" <<endl;
                return 0;
            }
        }
    }
            cout << "No" <<endl;
            return 0;

}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

int main()
{
  int n;
  vector<int> primes;
  for(int i = 7; i <= 300001; i += 7) {
    rep(j, 2) {
      int a = i + 2 * j - 1;
      bool f = true;
      bool bf = true;
      for(int k = 7; bf && f; k += 7) {
        rep(l, 2) {
          int b = k + 2 * l - 1;
          if( (b * b) > a ) {
            bf = false;
            break;
          }
          f &= a % b != 0;
         }
      }

      if( f ) {
        primes.push_back(a);
      }
    }
 }
 while(cin >> n, n != 1) {
    cout << n << ":";
    for( auto v : primes ) {
      if( n % v == 0 ) {
        cout << " " << v;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 1344
sx, sy, tx, ty = gets.split(' ').map(&:to_i)
sg1 = sy.upto(ty).map {|y| [sx, y]} + (sx + 1).upto(tx).map {|x| [x, ty]}
gs1 = (ty - 1).downto(sy).map {|y| [tx, y]} + (tx - 1).downto(sx).map {|x| [x, sy]}
sg2 = sy.upto(ty + 1).map {|y| [sx - 1, y]} + sx.upto(tx).map {|x| [x, ty + 1]} + [[tx, ty]]
gs2 = ty.downto(sy - 1).map {|y| [tx + 1, y]} + tx.downto(sx).map {|x| [x, sy - 1]} + [[sx, sy]]
histories = sg1 + gs1 + sg2 + gs2
dirs = histories[0..-2].zip(histories[1..-1]).map do |(p1, p2)|
  p1.last - p2.last < 0 ? 'U' 
    : p1.last - p2.last > 0 ? 'D' 
      : p1.first - p2.first < 0 ? 'R' : 'L'
end

puts dirs.join

Measured memory_bytes: 4348
#coding: utf-8
l = [i for i in range(1, 1000)]
L = [sum(l[:i+1]) for i in range(len(l))]
L_sa = [L[i+1] - L[i] for i in range(len(L)-1)]
a, b = map(int, input().split())
for i in range(len(L_sa)):
    if b-a == L_sa[i]:
        print(L[i] - a)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 
 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int t = s.nextInt();
    	System.out.println((t-2)*180);
	
	}
}

Measured memory_bytes: 32384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
ll a[114514], b[114514], cnt[114514];
signed main() {
	ll n, q;
	string s;
	cin >> n >> q >> s;
	rep(i, q)cin >> a[i] >> b[i];
	cnt[0] = 0;
	cnt[1] = 0;
	for (int i = 1; i < n; i++) {
		if (s[i] == 'C'&&s[i - 1] == 'A')cnt[i + 1] = cnt[i - 1] + 1;
		else cnt[i + 1] = cnt[i];
	}
	rep(i, q) {
		if (s[a[i] - 1] == 'C'&&s[a[i] - 2] == 'A')cout << cnt[b[i]] - cnt[a[i] - 1] - 1 << endl;
		else cout << cnt[b[i]] - cnt[a[i] - 1] << endl;
	}
	ggr
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>

#define nl '\n'

using namespace std;

int n, a, b;

int main(){

    cin >> n >> a >> b;

    if(n*a < b){
        cout << n*a;
        return 0;
    }

    cout << b;

}
 
//g++ -std=c++14 comp.cpp -o c && c.exe
//g++ -std=c++14 comp.cpp -o c; ./c.exe
//g++ -std=c++14 comp.cpp && ./a.out


//Surely this is going to AC

Measured memory_bytes: 256
while line = gets
    line = line.chomp.split('+')
    line[1, 2] = line[1].split('=')
    line.map!{|item| item.reverse}
    start = line.any?{|item| item.end_with?('X') && item.length > 1} ? 1 : 0
    match = false
    start.upto(9){|x|
        item = [0, 0, 0]
        line.each_with_index{|y, i|
            y.split('').each_with_index{|c, keta|
                case c
                when 'X'
                    item[i] += (x * (10 ** keta))
                else
                    item[i] += (c.to_i * (10 ** keta))
                end
            }
        }
        if item[0] + item[1] == item[2]
            match = x
            break
        end
    }
    puts match ? match : "NA"
end



Measured memory_bytes: 7408
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
vector<int> require_ans;
vector<pair<int, int>> prego;
int main() {
#define double long double
#define int long long
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << setprecision(15);
	int x_swap = 0, y_swap = 0;
	if (x1 > x2) {
		x2 = (x1 - x2) + x1;
		x_swap = 1;
	}
	if (y1 > y2) {
		y2 = (y1 - y2) + y1;
		y_swap = 1;
	}
	assert(x1 <= x2);
	assert(y1 <= y2);
	int n;
	cin >> n;
	double pre_ans = 5.0000000000000000000 * Ma_PI;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		if (x_swap == 1) {
			a = (x1 - a) + x1;
		}
		if (y_swap == 1) {
			b = (y1 - b) + y1;
		}
		if (x1 <= a && a <= x2 && y1 <= b && b <= y2) {
			prego.push_back(make_pair(a, b));
		}
	}
	sort(prego.begin(), prego.end());
	vector<int> lis;
	for (int i = 0; i < prego.size(); ++i) {
		int bot = lis.size();
		int top = -1;
		int bobo = prego[i].second;
		while (abs(top - bot) > 1) {
			int mid = (top + bot) / 2;
			if (lis[mid] > bobo) {
				bot = mid;
			}
			else {
				top = mid;
			}
		}
		if (bot == lis.size()) {
			lis.push_back(prego[i].second);
		}
		else {
			lis[bot] = prego[i].second;
		}
	}
	if (lis.size() != min(x2 - x1, y2 - y1) + 1) {
		double basics = 5.0000000000000000000 * Ma_PI;
		basics -= 20.0000000000000000000;
		basics *= (double)(lis.size());
		double ans = x2 - x1 + y2 - y1;
		ans *= 100.0000000000000000000;
		ans += basics;
		cout << ans << endl;
	}
	else {
		double basics = 5.0000000000000000000 * Ma_PI;
		basics -= 20.0000000000000000000;
		basics *= (double)(lis.size() - 1);
		double ans = x2 - x1 + y2 - y1;
		ans *= 100.0000000000000000000;
		ans += basics;
		ans += 10.0000000 * Ma_PI - 20.00000;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N,a,b;cin>>N>>a>>b;

    cout<<min(a*N, b)<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		sc.close();
		System.out.println(Math.max(A+B, Math.max(A-B, A*B)));
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int a[33]={0,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};
int main()
{
	int k;
	scanf("%d",&k);
	printf("%d\n",a[k]);
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 2e5+7;
int read(){
    int c = getchar(),Nig = 1,x = 0;
    while(!isdigit(c))
        c = getchar();
    if(c == '-')
        Nig = -1,c = getchar();
    while(isdigit(c))
        x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
    return Nig*x;
}
#define read read()
int a[maxn],n,ans;
int main(){
    n = read;
    for(int i=0;i<n;i++)
        a[i] = read;
    sort(a,a+n);
    for(int k=1<<30;k;k>>=1){
        int l = 0,r = n-1;
        while(l<r){
            if(a[l] == -1 || (~a[r] && a[l]+a[r]<k))
                l++;
            else if(a[r] == -1 || a[l]+a[r]>k)
                r--;
            else{
                ans++;
                a[l] = a[r] = -1;
            }
        }
    }
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
from collections import Counter as D, defaultdict as dd
from math import factorial as ft, ceil as aron, log
from fractions import gcd as pg 
from bisect import insort as ins, bisect_left as bl, bisect_right as br
import sys

#sys.stdin=open("./testfile1.py","r")
raw_input=sys.stdin.readline

f1=lambda : map(int,raw_input().split())
f2=lambda : map(int,list(raw_input()))
f3=lambda : int(raw_input())
f4=lambda : raw_input().rstrip()
f5=lambda : raw_input().split()


def main():
    n=f3()
    a=f1()
    b=list(a)
    ans=10**9
    a=[]
    for i in xrange(1,n):
        b[i]=b[i]+b[i-1]
   
    for i in xrange(n-1):
        #a.append(abs(2*b[i]-b[-1]))       
        ans=min(ans,abs(2*b[i]-b[-1]))

    
    print ans







if __name__ == '__main__':
	main()

Measured memory_bytes: 34792
#include <stdio.h>
#include <string.h>
int main() {
	char s[11]={};
	scanf("%s", s);
	int max=0,len=0;
	for (int i = 0; i < strlen(s); i++) {
		if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
			len++;
		}else{
			if(len>max){
				max=len;
			}
			len=0;
		}
	}
	if(len>max){
		max=len;
	}
	printf("%d\n", max);
	return 0;
}


Measured memory_bytes: 128