akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    vector<ll> a(n);
    ll XorSum = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        XorSum ^= a[i];
    }
    if(XorSum == 0){
        cout << 0 << endl;
        return 0;
    }
    XorSum ^= a[0];
    XorSum ^= a[1];
    ll X = a[0] + a[1] - XorSum;
    if(X % 2 != 0 || X < 0){
        cout << -1 << endl;
        return 0;
    }
    X >>= 1;
    
    ll A = X, B = X;
    for(int d = 50; d >= 0; --d){
        if(A >> d & 1)  continue;
        if(XorSum >> d & 1){
            if(A + (1LL << d) <= a[0]){
                A += 1LL << d;
            }
            else{
                B += 1LL << d;
            }
        }
    }
    if(A <= 0){
        cout << -1 << endl;
        return 0;
    }
    XorSum ^= A;
    XorSum ^= B;
    ll ans = a[0] - A;
    if(ans < 0 || XorSum != 0)  cout << -1 << endl;
    else    cout << ans << endl;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    // int tests = 1;
    // cin >> tests;
    // for(int test = 1; test <= tests; ++test) {
        
    // }
    char x;
    cin >> x;
    if(x >= 'A' && x <= 'Z') cout << "A";
    else cout << "a";
    return 0;
}

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

int D , N ;

int main(){
	scanf( "%d%d" , &D , &N ) ;
	if( N == 100 ) N ++ ;
	printf( "%d" , N ) ;
	for( int i = 1 ; i <= D ; i ++ ) printf( "00" ) ;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
    	
    	Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		int K = sc.nextInt();
    		int nc ;
    		if(N%2 == 0) {nc = N/2;}
    		else { nc = N/2+1;}
    		if(nc >= K) System.out.println("YES");
    		else System.out.println("NO");
    		
    		
    		
    		
    		
    		}
    

}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int a[250] = {0, 300000, 200000, 100000};

int x, y;

int main() {
	read(x), read(y);
	print(a[x] + a[y] + 400000 * (x == 1 && y == 1));
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int dist[105],n,m,a,b,c,d;
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > Q;
vector<pair<int,int> >x[105];
void add_edge(int a1,int a2,int a3){
    x[a1].push_back(make_pair(a2,a3));
    x[a2].push_back(make_pair(a1,a3));
}
int solve(int b1,int b2){
    for(int i=0;i<105;i++)dist[i]=100000000;dist[b1]=0;
    Q.push(make_pair(0,b1));
    while(!Q.empty()){
        int a1=Q.top().first,a2=Q.top().second;Q.pop();
        for(int i=0;i<(int)x[a2].size();i++){
            int to=x[a2][i].first,len=x[a2][i].second;
            if(dist[to]>a1+len){
                dist[to]=a1+len;
                Q.push(make_pair(dist[to],to));
            }
        }
    }
    if(dist[b2]==100000000)return -1;
    return dist[b2];
}
int main(){
    while(true){
        cin>>n>>m;for(int i=0;i<105;i++)x[i].clear();
        if(n==0 && m==0)break;
        for(int i=0;i<m;i++){
            cin>>a;
            if(a==0){cin>>b>>c;cout<<solve(b,c)<<endl;}
            if(a==1){cin>>b>>c>>d;add_edge(b,c,d);}
        }
    }
}

Measured memory_bytes: 2996
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1000005;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,x,t;
  cin>>n>>x>>t;
  cout<<(n+x-1)/x * t<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>a>>b;
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    sort(a.begin(),a.end());
    if(b>a)
        puts("Yes");
    else 
		puts("No");
	return 0;
}

Measured memory_bytes: 256
#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 pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int sum=0;
    bool flag=false;
    int n=s.size();
    rep(i,s.size()){
        if(i==0){
            sum+=s[i]-'0';
            continue;
        }
        if(flag||s[i]=='9') sum+=9;
        else if(s[i]!='9') sum+=9-1,flag=true;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    dp = [[0] * (N + 1) for _ in range(N + 1)]
    r = 0
    for i in reversed(range(N)):
        s = S[i]
        for j in reversed(range(i, N)):
            if s == S[j]:
                dp[i][j] = dp[i + 1][j + 1] + 1
            r = max(r, min(dp[i][j], j - i))
    print(r)

main()


Measured memory_bytes: 231944
#include <bits/stdc++.h>
using namespace std;
int main()
  {int A, B, M; cin >> A >> B >> M;
  vector<int> as(A), bs(B); for (auto &a : as) cin >> a; for (auto &b : bs) cin >> b;
  int ans = *min_element(begin(as), end(as)) + *min_element(begin(bs), end(bs));
  while (M--)
    {int x, y, c; cin >> x >> y >> c;
    ans = min(ans, as[--x] + bs[--y] - c);}
  cout << ans << endl;}

Measured memory_bytes: 4004
#include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[3], mode, tar; long long d, x[30], y[30], ret, seg[33554432], val[14348907]; pair<long long, long long> t[2][14348907];
inline void rec(int pos, long long a, long long b) {
	if (pos == tar) {
		if (b <= 0) t[mode][u[mode]++] = make_pair(a, b);
		return;
	}
	rec(pos + 1, a + x[pos], b + y[pos]);
	rec(pos + 1, a - x[pos], b - y[pos]);
	rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l) return INF;
	if (a <= l && r <= b) return seg[k];
	long long lch = query(a, b, k << 1, l, (l + r) >> 1);
	long long rch = query(a, b, (k << 1) + 1, (l + r) >> 1, r);
	return min(lch, rch);
}
int main() {
	scanf("%d%lld", &n, &d);
	for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
	mode = 0; tar = n / 2; rec(0, 0, 0);
	mode = 1; tar = n; rec(n / 2, 0, 0);
	sort(t[1], t[1] + u[1]);
	u[2] = 1; for (; u[2] <= u[1];) u[2] <<= 1;
	for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
	for (int i = 0; i < u[1]; i++) seg[i + u[2]] = t[1][i].second;
	for (int i = u[1]; i < u[2]; i++) seg[i + u[2]] = INF;
	for (int i = u[2]; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
	for (int i = 0; i < u[0]; i++) {
		int pl = lower_bound(val, val + u[1], -t[0][i].first - d) - val;
		int pr = upper_bound(val, val + u[1], -t[0][i].first + d) - val;
		long long res = query(pl, pr, 1, 0, u[2]);
		ret = max(ret, -t[0][i].second - res);
	}
	printf("%lld\n", ret);
	return 0;
}

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

int main() {
  int A, B, C, D, left, right;
  cin >> A >> B >> C >> D;

  left = A + B;
   right = C + D;
  if (left > right) {
    cout << "Left" << endl;
  }
  else if (left == right) {
    cout << "Balanced" << endl;
  }
  else if (left < right) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main() {
	int N; cin >> N;
	
	vector<int>A(N);
	for (int i = 0; i < N; i++)cin >> A[i];

	ll l = -2e9, r = 2e9, m;
	while (l < r) {
		m = (l + r);
		if (m < 0)m--;
		m /= 2;

		int c1 = 0, c2 = 0, c3 = 0;
		for (int i = 0; i < N; i++) {
			if (A[i] > m + i + 1)c1++;
			else if (A[i] < m + i + 1)c2++;
			else c3++;
		}

		if (c1 > c2+c3)l = m + 1;
		else if(c2 > c1+c3)r = m;
		else {
			ll ans = 0;
			for (int i = 0; i < N; i++) {
				ans += llabs(A[i] - m - i - 1);
			}

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


	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
int main(){
	int n,a[100],i,count=0,minj=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=0;i<n;i++){
		minj=i;
		for(int j=i;j<n;j++){
			if(a[j]<a[minj]){
				minj=j;
			}
		}
		if(i!=minj){
			swap(a[i],a[minj]);
			count++;
		}
	}
	for(i=0;i<n;i++){
		if(i==n-1)cout<<a[i]<<endl;
		else cout<<a[i]<<" ";
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3056
#include <iostream>
#include <cstdio>
#include <set>
#include <algorithm>
using namespace std;

int n, a, c;
set<int> v;
int main()
{
	int i, t;
	cin >> n;
	while (n--) {
		scanf("%d", &a);
		if (v.count(a)) v.erase(a), c--;
		else v.insert(a), c++;
	}
    cout << c << endl;
    return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    static int64_t a[200001], b[200002];
    for(int i=1;i<=n;++i) cin >> a[i];


    for(int t=0;t<k;++t){
        for(int i=0;i<=n+1;++i) b[i] = 0;
        for(int i=1;i<=n;++i){
            ++b[max(i-a[i], int64_t(1))];
            --b[min(i+a[i]+1, n+int64_t(1))];
        }
        int64_t mn = n+1;
        for(int i=1;i<=n;++i) b[i+1] += b[i];
        for(int i=1;i<=n;++i){ mn = min(mn, b[i]); a[i] = b[i]; }
        if(mn == n) break;
    }
    for(int i=1;i<=n;++i) cout << a[i] << " \n"[i==n];
    return 0;
}

Measured memory_bytes: 6772
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
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);
        BComparingStrings solver = new BComparingStrings();
        solver.solve(1, in, out);
        out.close();
    }

    static class BComparingStrings {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String string[] = in.readLine().split(" ");
            String str1 = "";
            for (int i = 0; i < Integer.parseInt(string[1]); i++) {
                str1 += string[0];
            }
            String str2 = "";
            for (int i = 0; i < Integer.parseInt(string[0]); i++) {
                str2 += string[1];
            }
            if (str1.compareTo(str2) < 0)
                out.println(str1);
            else
                out.println(str2);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }

    }
}



Measured memory_bytes: 21328
#include <bits/stdc++.h>
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
using pil = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
#define MOD 1000000007
#define MOD2 998244353
const double PI=3.14159265358979323846;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    cout << 2*r*PI <<endl;

}

Measured memory_bytes: 3804
#include <iostream>
using namespace std;
#define abs(n) (((n)<0)?(-(n)):(n))

int main() {
    long long x, y; cin >> x >> y;
    long long a = y-x, b = y+x, c = -y-x, d = -y+x;

    long long e = 1000000000, f = 1000000000;
    if (a >= 0 && b >= 0) {
        e = min(a, b+1);
    } else if (a >= 0 && b < 0) {
        e = a;
    } else if (a < 0 && b >= 0) {
        e = b+1;
    }

    if (c >= 0 && d >= 0) {
        f = min(c+1, d+2);
    } else if (c >= 0 && d < 0) {
        f = c+1;
    } else if (c < 0 && d >= 0) {
        f = d+2;
    }

    cout << min(e, f) << '\n';
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <list>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

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

struct state {
	int d, x, y, ul, ur, dl, dr;
	state(int d, int x, int y, int ul, int ur, int dl, int dr) : 
		d(d), x(x), y(y), ul(ul), ur(ur), dl(dl), dr(dr) {};
};

bool isProperXY(int x, int y) {
	return 0<=x && x<=2 && 0<=y && y<=2;
}

bool isProperF(int ul, int ur, int dl, int dr) {
	return ul<7 && ur<7 && dl<7 && dr<7;
}

bool visited[366][3][3][7][7][7][7];

int main() {
	int N;
	while(cin >> N, N) {
		vector<vvi> f(N, vvi(4, vi(4)));
		REP(i, N) {
			REP(j, 4) {
				REP(k, 4) {
					cin >> f[i][j][k];
				}
			}
		}

		stack<state> S;
		memset(visited, false, sizeof(visited));
		bool ok = true;
		REP(c, 4) {
			if(f[0][1+cy[c]][1+cx[c]]) {
				ok = false;
				break;
			}
		}
		if(ok) {
			S.push(state(1, 1, 1, 1, 1, 1, 1));
			visited[1][1][1][1][1][1][1] = true;
		}
		bool finished = false;
		while(!S.empty()) {
			state st = S.top();
			S.pop();
			
			if(st.d == N) {
				finished = true;
				break;
			}

			int nd = st.d+1;
			REP(d, 9) {
				int nx = st.x+dx[d], ny = st.y+dy[d];
				if(isProperXY(nx, ny)) {
					ok = true;
					REP(c, 4) {
						if(f[st.d][ny+cy[c]][nx+cx[c]]) {
							ok = false;
							break;
						}
					}
					int nul = st.ul+1, nur = st.ur+1, ndl = st.dl+1, ndr = st.dr+1;
					if(nx == 0) {
						if(ny == 0) {
							nul = 0;
						} else if(ny == 2) {
							ndl = 0;
						}
					} else if(nx == 2) {
						if(ny == 0) {
							nur = 0;
						} else if(ny == 2) {
							ndr = 0;
						}
					}
					if(ok && isProperF(nul, nur, ndl, ndr)) {
						if(!visited[nd][nx][ny][nul][nur][ndl][ndr]) {
							visited[nd][nx][ny][nul][nur][ndl][ndr] = true;
							S.push(state(nd, nx, ny, nul, nur, ndl, ndr));
						}
					}
				}
			}
		}

		cout << (finished ? 1 : 0 ) << endl;
	}

	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<double> x(n), y(n);
  vector<int> ord;
  for(int i = 0; i < n; ++i)
  {
    cin >> x[i] >> y[i];
    ord.push_back(i);
  }
  
  double ans = 0, q = 0;
  do{
    for(int i = 0; i < n - 1; ++i)
    {
      ans += sqrt(pow(x[ord[i]] - x[ord[i + 1]], 2) + pow(y[ord[i]] - y[ord[i + 1]], 2));
    }
    ++q;
  } while(next_permutation(ord.begin(), ord.end()));
  cout << setprecision(16) << ans / q << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    
    cout << (( N%10 == 9 || N >= 90 ) ? "Yes" : "No") << endl;
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())

out = 1000000

for a in range(1,n):
    b = n-a
    a = [int(i) for i in list(str(a))]
    sum_a = sum(a)
    b = [int(i) for i in list(str(b))]
    sum_b = sum(b)
    
    if sum_a + sum_b < out:
        out = sum_a + sum_b
        
print(out)

Measured memory_bytes: 3060
import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

@lru_cache(None)
def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD

n, k = map(int, input().split())

s = 0
for m in range(0, min(k+1, n)):
    s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1))
    s %= MOD

print(s)

Measured memory_bytes: 72660
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

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

const int N = 11, M = 11111;

int n,m;
int board[N][M];

bool Input(){
	cin>>n>>m;
	if(n==0 && m==0)return false;
	rep(i,n){
		rep(j,m)cin>>board[i][j];
	}
	return true;
}

bool has(int state, int i){
	return (state&(1<<i))>0;
}

int Rotate(int s){
	int ret = 0;
	
	rep(i,m){
		int cnt = 0;
		rep(j,n){
			cnt += board[j][i] ^ (has(s,j) ? 1 : 0);
		}
		
		ret += max(cnt, n-cnt);
	}
	
	return ret;
}

int Solve(){
	int ret = 0;
	rep(i,(1<<n)){
		ret = max(ret, Rotate(i));
	}
	return ret;
}

int main(){
	while(Input())cout<<Solve()<<endl;
}

Measured memory_bytes: 1588
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e5+10,oo=0x3f3f3f3f,MOD=998244353;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    string s;
    cin>>s;
    cout<<"ABC"<<s<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3612
import sys
input = sys.stdin.buffer.readline
N, K = map(int, input().split())
li = list(map(int, input().split()))
li_a = []
for i in li:
    i -=1
    li_a.append(i)
k = li_a[0]
dic = {}
for i in range(N):
    dic[i] = [False, 0]
dic[0] = [True, 0]
loop = 0
for i in range(1, N+1):
    if dic[k][0] == True:
        loop = i - dic[k][1]
        start = dic[k][1]
        start_k = k
        break
    dic[k] = [True, i]
    k = li_a[k]
    
if K-start <= 0:
    ans = 0
    for i in range(K):
        ans = li_a[ans]
    print(ans+1)
    sys.exit()

amari = (K-start)%loop
if amari == 0:
    print(start_k+1)
else:
    ans = start_k
    for i in range(amari):
        ans = li_a[ans]
    print(ans+1)


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

using ll = long long;

#define REP(i, n)   for(int i = 0;            i <  (int)(n); i++)
#define cREP(i, n)  for(int i = 1;            i <= (int)(n); i++)
#define rREP(i, n)  for(int i = (int)(n) - 1; i >= 0;        i++)
#define rcREP(i, n) for(int i = (int)(n);     i >  0;        i++)

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

    std::string ans = "";
    REP(j, 3) {
        REP(i, 3) {
            char in;
            std::cin >> in;
            if(i == j) {
                ans+= in;
            }
        }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=5000000000000000000;
ll MOD=1000000007;


int main() {
    while (true){
    string a,b;
    cin >> a >> b;
    if (a=="0") break;
    int h=0,k=0;
    rep(i,4){
        rep(j,4){
            if (a.at(i)==b.at(j) && i==j) h++;
            else if (a.at(i)==b.at(j)) k++;
        }
    }
    cout << h << " " << k << endl;
    }
}



Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.La;
		Console.WriteLine("{0}",Pow(2,s[1])*(s[1]*1900+100*(s[0]-s[1])));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

int main() {
	int x, n, p;
	cin >> x >> n;

	vector<bool> nums(102, false);
	for (int i = 0; i < n; i++) {
		cin >> p;
		nums[p] = true;
	}

	int ans = -1;
	for (int i = 0; i <= 101; i++) {
		if (nums[i]) {
			continue;
		}
		if (abs(i - x) < abs(ans - x)) {
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <string>

using namespace std;

const string mew = "mew";

int main()
{
  string s1, s2;
  int p, q, t;
  bool f;

  while(cin>>s1){
    p = q = s1.size();
    f = false;
    while(p > 0 && q > 0){
      t = -1;
      if(s1.size() == 3 && s1 == mew){
	f = true;
	break;
      }
      for(int i = 0; i < s1.size()-3; ++i)
	if(s1.substr(i, 3) == mew){
	  t = i;
	  break;
	}

      if(t == -1){
	f = false;
	break;
      }
      // cout << s1 << endl;
      s2 = s1.substr(t+3);
      s1 = s1.substr(0, t);
      // cout << t << "- " << s1 << " " << s2 << " : ";
      p = s1.size();
      q = s2.size();
      s1 += s2;
      // cout << s1 << endl;
    }

    cout << ((f)? "Cat": "Rabbit") << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;

int main(void) {
  lld x, n;
  cin >> x >> n;
  vector<lld> p(n);
  for (lld i = 0; i < n; i++) {
    cin >> p[i];
  }
  lld m = 10000, k = 0;
  for (lld i = 0; i <= 101; i++) {
    for (lld j = 0; j < n; j++) {
      if (p[j] == i) {
        goto quit;
      }
    }
    if (m > abs(x - i)) {
      m = abs(x - i);
      k = i;
    }
    quit:;
  }
  cout << k << "\n";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s;
  cin >> s;
  ll n = s.size()+1;
  vector<ll> vec(n,0);
  for(ll i = 0; i <= n-2; i++) {
    if(s.at(i) == '<') {
      vec.at(i+1) = max(vec.at(i+1), vec.at(i)+1);
    }
  }
  for(ll i = n-2; i >= 0; i--) {
    if(s.at(i) == '>') {
      vec.at(i) = max(vec.at(i), vec.at(i+1)+1);
    }
  }
  ll ans = 0;
  for(ll i = 0; i < n; i++) ans += vec.at(i);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4740
while 1:
    x, y = map(int,input().split())
    if x == 0 and y == 0:
        break
    
    if x < y:
        (x, y) = (y, x)
   
    i = 0
    while 1:
        if y == 0:
            print(x, i)
            break
        i += 1
        z = x % y
        x = z
        (x, y) = (y, x)



Measured memory_bytes: 5608
import sys


fin = sys.stdin.readline
N = int(fin())
S = fin().rstrip("\n")
assert len(S) == N

WHITE, BLACK = 0, 1

# dp[i][c] = S[i]の色をc ("." の時0，"#"の時1とする) にする時，S[i:]が有効になる時の最小の手数
min_changes_at = [[float('inf')] * 2 for _ in range(N)]
min_changes_at[-1] = [1, 0] if S[-1] == "#" else [0, 1]

for i in reversed(range(len(S) - 1)):
    color = S[i]
    if color == "#":
        # もしS[i]を白にする時S[i + 1]は白黒どちらでもいい．S[i]を反転させるのに手数1かかる
        min_changes_at[i][WHITE] = min(min_changes_at[i + 1]) + 1
        # S[i]を黒にする時，現在の位置での反転入らないが，右隣が黒でないといけない．
        min_changes_at[i][BLACK] = min_changes_at[i + 1][BLACK]
    else:  # WHITE
        # S[i]が白ならS[i + 1]はどっちでもOK
        min_changes_at[i][WHITE] = min(min_changes_at[i + 1])
        # S[i]を黒にするなら反転で1 + 隣は白のみ
        min_changes_at[i][BLACK] = min_changes_at[i + 1][BLACK] + 1

print(min(min_changes_at[0]))


Measured memory_bytes: 78400
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n = 0ll, x = 0ll, m = 0ll, sum = 0ll;
	cin >> n >> x >> m;
	map<lli, pair<lli, lli> > mp;
	lli res = 0ll;
	for (lli i = 1ll; i <= n; ++i)
	{
		if (mp.count(x) == 1)
		{
			lli d = i - mp[x].fi;
			lli y = max(0ll, (n - i - 1ll) / d);
			i += (1ll * y * d); res += (1ll * y * (res + x - mp[x].se));
		}
		res += x;
		mp[x] = {i, res};
		x = (x * x) % m;
	}
	cout << res << endl;
}

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

int main(){
  ll n;
  cin >> n;
  vector< vector<ll> > arr(n,vector<ll> (3));
  for (int i = 0; i < n; i++)
  {
    cin >> arr[i][0];
    cin >> arr[i][1];
    cin >> arr[i][2];
  }
  vector< vector<ll> > dp(n,vector<ll> (3));
  dp[0][0]=arr[0][0];
  dp[0][1]=arr[0][1];
  dp[0][2]=arr[0][2];

  for (int i = 1; i < n; i++)
  {
    dp[i][0]=arr[i][0] + max(dp[i-1][1],dp[i-1][2]);
    dp[i][1]=arr[i][1] + max(dp[i-1][0],dp[i-1][2]);
    dp[i][2]=arr[i][2] + max(dp[i-1][0],dp[i-1][1]);
  }
  cout << max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
  
  

}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  ll maxsz=0;
  vector<pair<ll,ll>>lr,kousa;
  map<ll,ll>ma,ma2;
  rep(i,n){
    ll l,r;
    cin>>l>>r;
    r++;
    chmax(maxsz,r-l);
    if(ma.count(l))chmin(ma[l],r);
    else ma[l]=r;
  }
  for(auto tp:ma)lr.push_back(tp);
  reverse(all(lr));
  ll len=lr.size();
  pair<ll,ll>p=lr[0];

  rep(i,len-1){
    if(p.second<=lr[i+1].second){
      ;
    }
    else {
      kousa.push_back(p);
      p=lr[i+1];
    }
  }
  kousa.push_back(p);
  /*
  for(auto tp:kousa){
    cout<<tp.first<<tp.second<<endl;
  }
  */
  reverse(all(kousa));
  len=kousa.size();
  ll res=max(0LL,kousa[0].second-kousa[len-1].first)+maxsz;
  rep(i,len-1){
    chmax(res,max(0LL,kousa[0].second-kousa[i].first)+max(0LL,kousa[i+1].second-kousa[len-1].first));
  }
  cout<<res<<endl;



  return 0;

}


Measured memory_bytes: 11124
import math

n = int(input())

def solve():
  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return False
  
s = solve()
if s != False:
  print(n-1)
  exit()
  
ans = 10**12
for k in range(2, int(math.sqrt(n)) + 1):
  if n % k == 0:
    ans = min(ans,k+n//k)
  
print(ans-2)



Measured memory_bytes: 63988
#include <array>
#include <iostream>
#include <vector>

int main() {
  uint32_t N = 0;
  std::string S;
  std::cin >> N >> S;

  std::vector<std::array<uint32_t, 10>> follow(N);
  follow.back().fill(N);

  for (size_t i = N - 1; i > 0; i--) {
    follow[i - 1] = follow[i];
    uint32_t value = S[i] - '0';
    follow[i - 1][value] = i;
  }

  std::array<uint32_t, 10> initial(follow.front());
  initial[S[0] - '0'] = 0;

  uint32_t count = 0;
  for (size_t i = 0; i < initial.size(); i++) {
    if (initial[i] == N) continue;
    uint32_t idx_1st = initial[i];
    for (size_t j = 0; j < follow[idx_1st].size(); j++) {
      if (follow[idx_1st][j] == N) continue;
      uint32_t idx_2nd = follow[idx_1st][j];
      for (size_t k = 0; k < follow[idx_2nd].size(); k++) {
        if (follow[idx_2nd][k] == N) continue;
        count++;
      }
    }
  }
  std::cout << count << std::endl;

  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;



int main() 
{
    fastio
    ll i,j,x;
    
    ll n;
    cin>>n;
    
    if(n%1000==0)
    cout<<0;
    else
    {
        x=n/1000;
        cout<<1000*(x+1)-n;
    }
    
}


Measured memory_bytes: 3648
n, m, c = list(map(int ,input().split()))
b = list(map(int ,input().split()))
A = []
for i in range(n):
    A.append(list(map(int ,input().split())))
count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += (b[j] * A[i][j])
    if sum + c > 0:
        count += 1
print(count)

Measured memory_bytes: 3188
import java.util.*;
import java.io.*; 
 
class Main { 
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
      	int x = sc.nextInt();
      	int t = sc.nextInt();
      	PrintWriter out = new PrintWriter(System.out);
        out.println(x <= t ? 0 : x - t);
      out.flush();
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}

    public int nextInt() {
        if (!hasNext()) throw new NoSuchElementException();
        int n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}


Measured memory_bytes: 21076
#include<iostream>
#include<cstring>
using namespace std;
char a[5],b[5];
int main()
{
	cin>>a>>b;
	if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	return 0;
}

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

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if ((a == b && a != c) || (a == c && a != b) || (b == c && a != c)) cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
const int INF = 100100100;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;

    if (b >= a * c)
        cout << c << endl;
    else
        cout << b / a << endl;

    return 0;
}

Measured memory_bytes: 256
import copy
from collections import deque
from collections import defaultdict

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

line=defaultdict(list)
q=deque
next=deque()

ans=[-1]*(N+1)
ans[0]=0
ans[1]=0
for i in range(M):
  a,b=map(int, input().split())
  line[a].append(b)
  line[b].append(a)

#print(line)
    
next.append(1)
a=1
while len(next)>0:
  q=copy.copy(next)
  #print(q)
  next.clear()
  while len(q)>0:
    chk=q.popleft()
    #print('qpop',q)
    for i in range(len(line[chk])):
      #print('chk',chk)
      #print('line[chk][i]',line[chk][i])
      if ans[line[chk][i]]==-1:
        ans[line[chk][i]]=chk
        next.append(line[chk][i]) 
  if -1 not in ans:break
  #print('next',next)
#print(ans)
if -1 in ans:print('No')
else:
  print('Yes')
  for i in range(2,N+1):  
    print(ans[i])
    


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

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

  vector<int> dp(n+1, 1001001001);
  rep(i, n+1) dp[i] = i;
  set<int> st;
  for (int i=1; pow(6,i)<=n; i++) {
    st.insert(pow(6,i));
  }
  for (int i=1; pow(9,i)<=n; i++) {
    st.insert(pow(9,i));
  }
  for (auto v:st) {
    for (int i=0; i<=n; i++) {
      if (i >= v) dp[i] = min(dp[i], dp[i-v]+1);
    }
  }
  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 640
memo = {}


def solve(N, X):
    if (N, X) not in memo:
        l = (pow(2, N + 2) - 3)
        l2 = (l - 3) // 2 + 1
        if N == 0:
            return 1
        if X == 1:
            return 0
        elif X <= l2:
            memo[(N, X)] = solve(N - 1, X - 1)
        elif X == l2 + 1:
            memo[(N, X)] = solve(N - 1, l2 - 1) + 1
        elif X < l:
            left = solve(N - 1, l2 - 1)
            right = solve(N - 1, X - 1 - l2)
            memo[(N, X)] = left + 1 + right
        elif X == l:
            memo[(N, X)] = solve(N - 1, l2 - 1) * 2 + 1
    return memo[(N, X)]


if __name__ == "__main__":
    N, X = tuple(map(int, input().split(" ")))
    print(solve(N, X))


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
//#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

double A,B,H,M;

signed main(){
	cin>>A>>B>>H>>M;
	double d=M*6.0;
	DEB(d)
	H=H*60+M;
	double d2=H*(360.0/(12.0*60.0));
	DEB(d2)END
	double S=std::min(abs(d-d2),360-(abs(d-d2)));
	DEB(S)END
	S=S/180.0*acos(-1);
	double ans=sqrt(A*A+B*B-2*A*B*cos(S));
	setdouble(13,ans);cout<<endl;
	return 0;
}


Measured memory_bytes: 4212
N, M = map(int, input().split())
A = []
B = []
C = [0]*M

for i in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    for c in map(int, input().split()):
        C[i] += 1<<(c-1)

inf = float("inf")
#dp[i][S] := 0〜i-1番目までの鍵(計i個)の中からいくつか選んで、開いた宝箱の集合が S で表されるような場合についての、最小コスト 
dp = [[inf]*(1<<N) for _ in range(M+1)]
dp[0][0] = 0

for i in range(M):
    for j in range(1<<N):
        if dp[i+1][j] > dp[i][j]:
            dp[i+1][j] = dp[i][j]
        if dp[i+1][j | C[i]] > dp[i][j] + A[i]:
            dp[i+1][j | C[i]] = dp[i][j] + A[i]

if dp[M][(1<<N)-1] < inf:
    print(dp[M][(1<<N)-1])
else:
    print(-1)


Measured memory_bytes: 144600
x1, y1, x2, y2 = map(int, input().split())

deltax2_1 = x1 - x2
deltay2_1 = y1 - y2
deltax1_2 = x2 - x1
deltay1_2 = y2 - y1

x3 = x2 + deltay2_1
y3 = y2 - deltax2_1
x4 = x1 - deltay1_2
y4 = y1 + deltax1_2


print("{} {} {} {}".format(x3,y3,x4,y4))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define il inline
#define vd void
typedef long long ll;
il ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int n,fir[100010],dis[200010],nxt[200010],w[200010],id;
il vd link(int a,int b,int c){nxt[++id]=fir[a],fir[a]=id,dis[id]=b,w[id]=c;}
int pa[100010],pb[100010],pc[100010],pd[100010];
int qx[100010],qy[100010],qu[100010],qv[100010];
std::vector<int>Ge[100010],Gq[100010];
ll t1[100010],t2[100010];
il vd update(ll*t,int p,int x){while(p<=n)t[p]+=x,p+=p&-p;}
il ll query(ll*t,int p){ll ret=0;while(p)ret+=t[p],p-=p&-p;return ret;}
int fa[100010],dfn[100010];
ll dist[100010];
int son[100010],siz[100010],top[100010],dep[100010];
il vd dfs(int x){
	dfn[x]=++dfn[0];siz[x]=1;
	for(int i=fir[x];i;i=nxt[i]){
		if(fa[x]==dis[i])continue;
		fa[dis[i]]=x;
		dist[dis[i]]=dist[x]+w[i];
		dep[dis[i]]=dep[x]+1;
		dfs(dis[i]);
		siz[x]+=siz[dis[i]];
		if(siz[son[x]]<siz[dis[i]])son[x]=dis[i];
	}
}
il vd dfs(int x,int tp){
	top[x]=tp;if(son[x])dfs(son[x],tp);
	for(int i=fir[x];i;i=nxt[i])if(fa[x]!=dis[i]&&son[x]!=dis[i])dfs(dis[i],dis[i]);
}
il int LCA(int a,int b){
	while(top[a]^top[b])
		if(dep[top[a]]>dep[top[b]])a=fa[top[a]];
		else b=fa[top[b]];
	return dep[a]>dep[b]?b:a;
}
ll ans[100010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	n=gi();int Q=gi();
	for(int i=1;i<n;++i)pa[i]=gi(),pb[i]=gi(),pc[i]=gi(),pd[i]=gi(),link(pa[i],pb[i],pd[i]),link(pb[i],pa[i],pd[i]),Ge[pc[i]].push_back(i);
	for(int i=1;i<=Q;++i)qx[i]=gi(),qy[i]=gi(),qu[i]=gi(),qv[i]=gi(),Gq[qx[i]].push_back(i);
	dfs(1);dfs(1,1);
	for(int i=1;i<n;++i)if(pb[i]==fa[pa[i]])std::swap(pa[i],pb[i]);
	for(int i=1;i<=Q;++i)ans[i]=dist[qu[i]]+dist[qv[i]]-2*dist[LCA(qu[i],qv[i])];
	for(int i=1;i<n;++i){
		for(int j:Ge[i])update(t1,dfn[pb[j]],1),update(t1,dfn[pb[j]]+siz[pb[j]],-1);
		for(int j:Ge[i])update(t2,dfn[pb[j]],pd[j]),update(t2,dfn[pb[j]]+siz[pb[j]],-pd[j]);
		for(int j:Gq[i]){
			int a=qu[j],b=qv[j],c=LCA(a,b);
			ans[j]-=query(t2,dfn[a])+query(t2,dfn[b])-2*query(t2,dfn[c]);
			ans[j]+=qy[j]*(query(t1,dfn[a])+query(t1,dfn[b])-2*query(t1,dfn[c]));
		}
		for(int j:Ge[i])update(t1,dfn[pb[j]],-1),update(t1,dfn[pb[j]]+siz[pb[j]],1);
		for(int j:Ge[i])update(t2,dfn[pb[j]],-pd[j]),update(t2,dfn[pb[j]]+siz[pb[j]],pd[j]);
	}
	for(int i=1;i<=Q;++i)printf("%lld\n",ans[i]);
	return 0;
}


Measured memory_bytes: 30716