akhauriyash/Code-Regression huggingface dataset:
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 MaxHeap
 */
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int ans = 0;
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                ans = ans + 2 * Math.min(Math.abs(k - x), x);
            }
            out.println(ans);
        }

    }

    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 (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException ex) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }
}



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

const int N = 100005;

int n, m, p[N], par[N];
vector <int> vec[N];
bool c1[N], c2[N];

int anc(int p) { return p == par[p] ? p : par[p] = anc(par[p]); }
void join(int p, int q) { par[anc(p)] = anc(q); }

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

	cin >> n >> m;
	for (int i = 1; i <= n; ++i) cin >> p[i], par[i] = i;

	while(m--) {
		int u, v; cin >> u >> v;
		join(u, v);
	}

	for (int i = 1; i <= n; ++i) vec[anc(i)].push_back(i);

	int res = 0;
	for (int i = 1; i <= n; ++i) if (i == anc(i)) {
		for (auto &j : vec[i]) c1[j] = 1, c2[p[j]] = 1;
		for (auto &j : vec[i]) if (c1[j] && c2[j]) {
			++res;
		}

		for (auto &j : vec[i]) c1[j] = 0, c2[p[j]] = 0;
	}

	cout << res << '\n';
}

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

int main(){
    int n;
    cin >> n;
    float* v = new float[n];
    for(int i=0;i<n;i++){
        cin >> v[i];
    } 
    sort(v,v+n);
    float ans=v[0];
    for(int i=1;i<n;i++){
        ans=(ans+v[i])/2;
    }   
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int l, r, d;
  cin >> l >> r >> d;
  l = ((l - 1) / d + 1) * d;
  r = r / d * d;
  cout << (r - l) / d + 1 << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


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

int main(){
  int a, b; cin >> a >> b;
  int res = 0;
  for(int i=0; i<2; ++i){
    if(a > b){
      res += a;
      --a;
    }
    else{
      res += b;
      --b;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let r: usize = read();
    let g: usize = read();
    let b: usize = read();
    let n: usize = read();

    let mut ans = 0;
    for i in 0..(n / r + 1) {
        for j in 0..(n / g + 1) {
            if i * r + g * j > n {
                continue;
            }
            let po = n - i * r - j * g;
            if po % b == 0 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#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 FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
	template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
	template<class T> inline std::istream& operator >> (std::istream& is, std::vector<T>& v) { for (T& x : v) { is >> x; }return is; }
	template<class T> inline std::ostream& operator << (std::ostream& os, const std::vector<T>& v) {
		for (auto itr = v.begin(); itr != v.end();) { os << (*itr) << ((++itr != v.end()) ? " " : ""); }
		return os;
	}
	template<class V, typename T>inline void fill(V& v, const T& val) { v = val; }
	template<class V, typename T>inline void fill(std::vector<V>& v, const T& val) { for (V& x : v) { fill(x, val); } }
	template<class V, typename H>inline void resize(std::vector<V>& v, const H h) { v.resize(h); }
	template<class V, typename H, typename... T>inline void resize(std::vector<V>& v, const H& h, const T& ... t) { v.resize(h); for (auto& x : v) { resize(x, t...); } }
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }

	void solve() {
		IOS;
		int a, b, k;
		cin >> k >> a >> b;
		int t = (a + k - 1) / k * k;
		if (t <= b) {
			put("OK");
		} else {
			put("NG");
		}
	}
} // namespace idaten

int main() {
	idaten::solve();
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n; cin >> n;
	string s[10];
	s[0] = '0';
	s[1] = ".,!? ";
	s[2] = "abc";
	s[3] = "def";
	s[4] = "ghi";
	s[5] = "jkl";
	s[6] = "mno";
	s[7] = "pqrs";
	s[8] = "tuv";
	s[9] = "wxyz";
	for (int i = 0; i < n; i++) {


		string num;
		cin >> num;
		for (int j = 0; j < num.size(); j++) {
			if (j == 0) {
				if (num[j] == '0') {
					continue;
				}
			}

			else if (num[j - 1] == '0'&&num[j] == '0') {
				continue;
			}
			int t = 0;
			while (num[j + t] != '0')t++;
			switch (num[j]) {
			case '1':cout << s[1][(t - 1) % 5]; break;
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':cout << s[num[j] - '0'][(t - 1) % 3]; break;
			case '7':cout << s[7][(t - 1) % 4]; break;
			case '8':cout << s[num[j] - '0'][(t - 1) % 3]; break;
			case '9':cout << s[9][(t - 1) % 4]; break;
			default:break;
			}
			j += t;
		}
		cout << endl;






	}
	return 0;
}

Measured memory_bytes: 1208
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string

	fmt.Scan(&n, &s)

	result := "No"
	if n%2 == 0 {
		for i := 0; i < n/2; i++ {
			if s[i] == s[n/2+i] {
				result = "Yes"
			} else {
				result = "No"
				break
			}
		}
	}
	fmt.Println(result)
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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


	ll ans=1e+12-1;
	for (ll i = 1; i <= sqrt(n); i++){
		if(n%i==0){
			ans=min(ans,i+(n/i)-2);
		}
	}

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


Measured memory_bytes: 384
A = int(input())
B = int(input())
C = int(input())
X = int(input())
XS = str(X)
hantei = False
count = 0

if XS[-2] == "5":
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(1, C + 1, 2):
                if (500*a)+(100*b)+(50*c) == X:
                    count += 1
else:
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(0, C + 1, 2):
                if (500*a)+(100*b)+(50*c) == X:
                    count += 1

print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 51;
ll n,a,x[N],dp[N][N][N*N];

int main(){
	cin>>n>>a;
	FOR(i,1,n+1)cin>>x[i];
	FOR(i,0,n+1){
		FOR(j,0,n+1){
			FOR(k,0,n*N+1){
				if(i==0&&j==0&&k==0){
					dp[i][j][k]=1;
				}else if(i>=1&&k<x[i]){
					dp[i][j][k]=dp[i-1][j][k];
				}else if(i>=1&&j>=1&&k>=x[i]){
					dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x[i]];
				}else{
					dp[i][j][k]=0;
				}
			}
		}
	}
	ll ans=0;
	FOR(k,1,n+1){
		ans+=dp[n][k][k*a];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 53120
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define break break
#define continue continue
#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;


int main(void){
	string str; cin >> str;
	int l=0, r=str.length()-1;
	int ans = 0;
	while(l<r){
		if(str[r] != str[l]) ans++;
		r--;
		l++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main(){
    int N,K;
    cin >> N >> K;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int l = 0,r = INF;
    while(l+1 < r) {
        int mid = (l+r)/2;
        int cnt = 0;
        bool ok = true;
        for(int i = 0; i < N; i++) {
            cnt += max(0LL,(A[i]+mid-1)/mid-1);
            if(A[i]%mid > 0) {
                ok = false;
            }
        }
        if(cnt <= K) {
            r = mid;
        }
        else {
            l = mid;
        }
    }
    cout << l+1 << endl;
}


Measured memory_bytes: 4672
#include <bits/stdc++.h>
using namespace std;
int main() {
	int r,g,b,n;
	cin>>r>>g>>b>>n;
	int cnt=0;
	for (int i = 0; i <= n/r; i++) {
		for (int j = 0; j <= n/g; j++) {
			if (r*i + g*j <= n && (n - (r*i + g*j)) % b == 0) {
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
    
    
#s = [0] * (N-K)

s = 0
for j in range(K):
    s += p[j]

sm = s

for i in range(N-K):
 #   s[i] = 0
    s = s + p[K+i]- p[i]
    if s > sm:
        sm = s

print( sm/2+0.5*K)

Measured memory_bytes: 24676
arr = [list(map(int,input().split())) for i in range(3)]
flg = 0
for i in range(2):
    for j in range(2):
        if arr[i][j] + arr[i+1][j+1] - arr[i+1][j] - arr[i][j+1] == 0:
            flg += 1
        else:
            break
if flg == 4:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define MAXN 100005

using namespace std;

int main (){
	
	//freopen("t.txt","r",stdin);
	int n,W ;
	long long dp[MAXN], v[MAXN], w[MAXN];
	
	cin>>n>>W;
	
	for (int i=1;i<=n;i++) cin>>w[i]>>v[i];
	
	for (int i=1;i<=n;i++){
		for (int j=W;j>=w[i];j--){

				dp[j] = max ( dp[j], dp[j-w[i]] +v[i] );
			
			
		}
	}
	
	cout<<dp[W];
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> divide(m);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    divide[i] = make_pair(b, a);
  }
  sort(all(divide));
  int min_b = 0, ans = 0;
  for(auto p : divide) {
    if(p.first > min_b && p.second >= min_b) {
      ans++;
      min_b = p.first;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string S;
  cin >> S;
  if (S.substr(0, 4) == "YAKI")
    cout << "Yes\n";
  else
    cout << "No\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>=6&&a<=12)
        cout<<b/2<<endl;
    else if(a<6)
        cout<<0<<endl;
    else
        cout<<b<<endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = a1[0:i+1] + a2[i::]
  ans[i] = sum(ans[i])
print(max(ans))

Measured memory_bytes: 3060
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

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

class UnionFind {
    private:
        vi par;    // x の親ノード
        vi rank;   // 木の高さ
        vi mem;    // メンバの数
        int siz;             // 集合の個数
    public:
        UnionFind(int n) :
            par(n, -1), rank(n, 0), mem(n, 1), siz(n) {
            REP(i,n) par[i] = i;
        }
    
    int size() { return siz; }

    // 集合の追加
    void makeset() {
        par.pb(par.size());
        rank.pb(0);
        mem.pb(1);
        siz++;
    }

    int find(int x) {
        if (par[x] == x)
            return x;
        else
            return par[x] = find(par[x]);
    }

    int member(int x){
        x = find(x);
        return mem[x];
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        if (rank[x] < rank[y]){
            par[x] = y;
            mem[y] += mem[x];
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
            mem[x] += mem[y];
        }
        siz--;
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

int n,m,k,l;
signed main(){
    I(n); I(m);
    UnionFind uf(n+m+2);
    REP(i,n){
        I(k);
        REP(j,k){
            I(l);
            uf.unite(i,n+l);
        }
    }
    int ret = uf.find(0);
    REP(i,n){
        if (ret != uf.find(i)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

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

void bubbleSort( int* a, int n )
{
    for( int i = 0; i < n; i++ )
        for( int j = n - 1; j >= i + 1; j-- )
        {
            if( a[j] < a[j-1] )
            {
                int t = a[j];
                a[j] = a[j-1];
                a[j-1] = t;
            }
        }
}

int main()
{
    int n, a[1000];

    while( cin >> n )
    {
        if( !n )
            break;

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

        bubbleSort( a, n );

        int min = 1000000000;
        for( int i = 0; i < n - 1; i++ )
            if( a[i+1] - a[i] < min )
                min = a[i+1] - a[i];

        cout << min << endl;
    }
    return 0;
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var time = new int[3];
            for (int i = 0; i < ss.Length; i++)
            {
                time[i] = int.Parse(ss[i]);
            }

            Array.Sort(time);

            Console.WriteLine(time[0] + time[1]);
        }
    }
}

Measured memory_bytes: 13140
module Q = struct
  type 'a t = { que : 'a Queue.t; stk : 'a Stack.t }
  exception Empty
  let create () = { que = Queue.create ();  stk = Stack.create () }
  let push_front v deq = Stack.push v deq.stk 
  let push_back v deq = Queue.push v deq.que
  let pop_front deq =
    if not (Stack.is_empty deq.stk) then
      Stack.pop deq.stk
    else if Queue.is_empty deq.que then
      raise Empty
    else
      Queue.pop deq.que
  let is_empty deq = Stack.is_empty deq.stk && Queue.is_empty deq.que
end

let () =
  let k = Scanf.scanf "%d" (fun x -> x) in
  let ( +@ ) x y = (x + y) mod k in
  let ( *@ ) x y = (x * y) mod k in
  let md = Array.make k k in
  md.(1) <- 1;
  let deq = Q.create () in
  Q.push_back 1 deq;
  while not (Q.is_empty deq) do
    let v = Q.pop_front deq in
    let w1, w2 = v *@ 10, v +@ 1 in
    if md.(v) < md.(w1) then (
      md.(w1) <- md.(v); Q.push_front (w1) deq);
    if md.(v) + 1 < md.(w2) then (
      md.(w2) <- md.(v) + 1;  Q.push_back (w2) deq)
  done;
  Printf.printf "%d\n" md.(0)


Measured memory_bytes: 6400
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();
      if(a+b<=9)System.out.println(a+b);
      else if(a+b>=10)System.out.println("error");
    }
}

Measured memory_bytes: 23508
#include <iostream>
#define inf 10000000
#define llint long long int

using namespace std;

int n;
int town_num;
int graph[12][12];

int dist[12];
bool checked[12];

int getmin(int a, int b)
{
  if(a > b) return b;
  else return a;
}

void dijkstra(int start)
{
  for(int i = 0; i < town_num; i++) checked[i] = false;
  for(int i = 0; i < town_num; i++) dist[i] = inf;
  dist[start] = 0;

  while(1){
    int min = inf, min_i = -1;
    for(int i = 0;i < town_num; i++){
      if(checked[i] || dist[i] == inf) continue;
      if(min > dist[i]){
		min = dist[i];
		min_i = i;
      }
    }
    if(min_i == -1) break;
  	
    checked[min_i] = true;
    for(int j = 0; j < town_num; j++){
    	if(checked[j]) continue;
    	if(graph[min_i][j] == inf) continue;
      dist[j] = getmin(dist[j], dist[min_i] + graph[min_i][j]);
    }
  }
}


int getsum(int pivot)
{
  dijkstra(pivot);

  int sum = 0;
  for(int i = 0; i < town_num; i++){
    sum += dist[i];
  }
  return sum;
}


int main(void)
{
  while(1){
	 cin >> n;
	if(n == 0) break;

	for(int i = 0; i < 12; i++){
		for(int j = 0; j < 12; j++){
			if(i == j) graph[i][j] = 0;
			else graph[i][j] = inf;
      	}
	}

  	town_num = -1;
    int a, b, c;
    for(int i = 0; i < n; i++){
      	cin >> a >> b >> c;
      	if(graph[a][b] > c){
			graph[a][b] = c;
			graph[b][a] = c;
    	}
    	if(a > town_num) town_num = a;
    	if(b > town_num) town_num = b;
    }
  	town_num++;

    int min_i, min = inf, val;
    for(int i = 0; i < town_num; i++){
      val = getsum(i);
      if(val < min){
		min = val;
		min_i = i;
      }
    }

    cout << min_i << " " << min << endl;
  }

  return 0;
}

Measured memory_bytes: 3020
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9+7;

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

  int a, b, c; cin >> a >> b >> c;
  for(int i=1; i<200; i++) {
    if (i*a%b == c) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define forn(i,a,b) for (int i = a; i <= b; i++)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
#define er erase
#define in insert
#define pi pair <int, int>
# define sz(x) (int)((x).size())
#define int long long

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

const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 3e3 + 11;

int dp[N][N],a[N],n,k,x;
//vector<int>v[N];

int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cerr.tie(0); cout.tie(0);

    cin >> n;

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


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

    rc(dp[1][n]);
return 0;
}


Measured memory_bytes: 70016
using System;
using System.Linq;

class P{
  static void Main(){
    
    int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int N = n[0];
    int K = n[1];
    int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
    
    int ans = int.MaxValue, tmp = 0;
    for(int i = 0; i <= N - K; i++){
      tmp = Math.Min(Math.Abs(x[i]) + Math.Abs(x[i + K - 1] - x[i]), Math.Abs(x[i + K - 1]) + Math.Abs(x[i + K - 1] - x[i]));
      ans = Math.Min(ans, tmp);
    }
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 21472
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
    int n,m;
    cin >> n >> m;
    if (n == 1) cout << 1900*2 << endl;
    else{
        ll ans;
        ans = 1900*m+ (n-m)*100 ;
        ll now = 1;
        while(m--){
            now*=2;
        }
        cout << ans*now << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
W,H,N = map(int,raw_input().split())
ans = 0
x,y = map(int,raw_input().split())
for i in range(N-1):
	X,Y = map(int,raw_input().split())
	dx,dy = X-x,Y-y
	ans += max(abs(dy),abs(dx)) + max(0,min(1,-dx*dy))*min(abs(dy),abs(dx))
	x,y = X,Y
print ans

Measured memory_bytes: 4244
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <limits>
#include <type_traits>
#include <bitset>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 101
using namespace std;

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

  while(N!=0) {
    if(N%2 != 0) {
      N--;
      ans = "1" + ans;
    } else {
      ans = "0" + ans;
    }
    N /= -2;
  }
  if(ans=="") ans="0";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args)throws IOException{
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = 1,sum=1;
        while(sum<=N){
            if(sum==N) break;
            res++;
            sum += res;
        }
        if(sum>N) {
            sum -= res;
            res--;
        }
        int[] ans = new int[res+1];
        for(int i=1;i<=res;i++) ans[i]=i;
        int len = N-sum;
        for(int j=res;j>=res+1-len;j--) ans[j]++;
        PrintWriter out = new PrintWriter(System.out);
        for(int i=1;i<=res;i++) out.println(ans[i]);
        out.flush();
    }
}


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

int main() {
	// your code goes here
	string s;
	cin>>s;
	long long int sum=0;
	for(int i=0;i<(int)s.length();i++){
	    sum += s[i] - '0';
	}
	if(sum%9 == 0){
	    cout<<"Yes"<<endl;
	}else{
	    cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <queue>
using namespace std;

const int MAXN = 1e3;
vector<int> vt[MAXN];
int vis[MAXN];
int x[MAXN], y[MAXN];
bool flag = false;

void bfs(int x, int pre){
	queue<int> q;
	vis[x] = vis[pre] = 1;
	for(int i = 0; i < vt[x].size(); i++){
		if(vt[x][i] != pre){
			q.push(vt[x][i]);
			vis[vt[x][i]] = 1;
		}
	}
	while(!q.empty()){
		int cnt = q.front();
		q.pop();
		for(int i = 0; i < vt[cnt].size(); i++){
			if(vt[cnt][i] == pre){
				flag = true;
				break;
			}
			if(!vis[vt[cnt][i]]){
				q.push(vt[cnt][i]);
				vis[vt[cnt][i]] = 1;
			}
		}
	}
}

int main(void){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> x[i] >> y[i];
		vt[x[i]].push_back(y[i]);
		vt[y[i]].push_back(x[i]);
	}
	int sol = 0;
	// vis[6] = vis[7] = 1;
	// dfs(6, 7);
	// cout << flag << "//" << endl;
	// if(!flag) sol++;
	for(int i = 0; i < m; i++){
		vis[x[i]] = vis[y[i]] = 1;
		bfs(x[i], y[i]);
		if(!flag) sol++;
		memset(vis, 0, sizeof(vis));
		flag = false;
	}
	cout << sol << endl;
	return 0;
}

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

int main() {
  int r, c;
  cin >> r >> c;
  vector<vector<int>> table(r + 1, vector<int>(c + 1, 0));
  for (int i{}; i < r; ++i) {
    int sum{};
    for (int j{}; j < c; ++j) {
      cin >> table[i][j];
      sum += table[i][j];
    }
    table[i][c] = sum;
  }
  for (int j{}; j <= c; ++j) {
    int sum{};
    for (int i{}; i < r; ++i) {
      sum += table[i][j];
    }
    table[r][j] = sum;
  }
  for (int i{}; i <= r; ++i) {
    cout << table[i][0];
    for (int j{1}; j <= c; ++j) {
      cout << ' ' << table[i][j];
    }
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3124
#include<iostream>
using namespace std;
int main(){
	int a;
	for (int i = 1;; i++)
	{
		cin >> a;
		if (a == 0)
		{
			break;
		}
		else
		{
			cout << "Case " << i << ": " << a << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3008
# https://atcoder.jp/contests/abc171/tasks/abc171_f

class Combination:                                      # 計算量は O(n_max + log(mod))
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):                     # 階乗(= n_max !)の逆元を生成
            f = f * i % mod                             # 動的計画法による階乗の高速計算
            fac.append(f)                               # fac は階乗のリスト
        f = pow(f, mod-2, mod)                          # 階乗から階乗の逆元を計算。フェルマーの小定理より、　a^-1 = a^(p-2) (mod p) if p = prime number and p and a are coprime
                                                        # python の pow 関数は自動的に mod の下での高速累乗を行ってくれる
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):                   # 上記の階乗の逆元から階乗の逆元のリストを生成（＝ facinv ）
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()


    def __call__(self, n, r):  # self.C と同じ
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def C(self, n, r):
        if not 0 <= r <= n: return 0                    # 範囲外という事はすなわち、そのような場合の数は無いはずなので、0を出力すればよい。（これが無いとREになる）
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod


K = int(input())

S = input()

l = len(S)

MOD = 10**9+7

comb = Combination(K + l + 2)

res = 0

for n in range(K+1):
    res += (comb.C(n + l - 1, l - 1) * pow(25, n, MOD) * pow(26, K-n,MOD))%MOD


print(res%MOD)



Measured memory_bytes: 215972
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> v(N);
    for(auto &u : v) cin >> u;
    sort(v.begin(), v.end());
    ll ans = 5e15;
    for(ll i = 0; i + K - 1 < v.size(); i++) ans = min(ans, v[i + K - 1] - v[i]);
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    //system("chcp 65001");

    int A,B;
    cin >> A >> B;

    if(A >= 13)
    {
        cout << B;
    }
    else if(A <= 12 && A >= 6)
    {
        cout << B/2;
    }
    else
    {
        cout << "0";
    }
    

    //cout << N;

    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
dic={}
wk=1
start=0
for i in range(1,n+1):
  wk=a[wk-1]
  if wk in dic:
    start=dic[wk]
    break
  dic[wk]=i
end=len(dic)
loopcnt=end-start+1
keys=list(dic.keys())
if k<start:
  print(keys[k-1])
else:
  chk=(k-start+1)%loopcnt
  if chk==0:
    chk=loopcnt
  print(keys[(start-1)+chk-1])


Measured memory_bytes: 38696
#define d for(x=0;x<N;x++){for(y=0;y<N;y++
c,m[10][10],x,N;main(y){for(;scanf("%d",&N),N;){d)m[x][y]=(x+y)*(x+y+1)/2+1+(x+y&1?x:y);}printf("Case %d:\n",++c);d)printf("%3d",x+y<N?m[x][y]:N*N+1-m[N-1-x][N-1-y]);puts("");}}exit(0);}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (N<1 || N>20 || A<1 || A>100 || B<1 || B >2000){
    return 0;
  }
  if (A*N < B){
    cout << A*N;
  }
  else{
    cout << B;
  }
  cout << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    
    long a = 2, b = 1;
    long c = 0;
    
    if (n == 0) {
        cout << a << endl;
    }
    else if (n == 1) {
        cout << b << endl;
    }
    else {
        for (int i = 0; i < n - 1; i++) {
            
            c = a + b;
            a = b;
            b = c;
        }
        cout << c << endl;
    }
}


Measured memory_bytes: 256
n=int(input())
w=[]
count=0
for i in range(n):
  a=input()
  count+=1
  if i==0:
    b=a
  else:
    if b[-1]!=a[0]:
      print('No')
      exit()
    else:
      for i in range(count-1):
        if w[i]==a:
          print('No')
          exit()
  w.append(a)
  b=a
print('Yes')

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;
const int inf = 1001001001;



int main(void) {
  int n;
  cin >> n;
  vector<vector<pair<int,int>>> p(n);
  rep(i,n-1){
    int a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    p[a].push_back(make_pair(b,c));
    p[b].push_back(make_pair(a,c));
  }
  vi seen(n,-1);
  stack<int> jank;
  jank.push(0);
  seen[0] = 1;
  while(!jank.empty()){
    int kan = jank.top();
    jank.pop();
    
    rep(i,p[kan].size()){
      if(seen[p[kan][i].first]==0 || seen[p[kan][i].first] == 1) continue;
      if(p[kan][i].second%2==0)seen[p[kan][i].first] = seen[kan];
      else seen[p[kan][i].first] = abs(seen[kan]-1);
      jank.push(p[kan][i].first);
    }
  }
  rep(i,n)cout << seen[i] << endl;
    
    
  
}


Measured memory_bytes: 9984
////.......Symoon Zadid.......////
//..State University Of Bangladesh..//
//**********************************//
#include<bits/stdc++.h>
using namespace std;
vector<int>vec;
int main()
{

  int t,c=0,c1=0,i,n;
  cin>>t;

   for(i=1;i<=t;i++){
        n=i;
        c=0;
       while(n!=0)
       {
           n/=10;
           c++;
       }
     if(c%2==1)
        c1++;

   }

   cout<<c1<<"\n";


return 0;
}


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

using namespace std;

const int md = (int) 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

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

  int n, m, row = 0, col = 0;
  cin >> n >> m;
  vector<int> x(n), y(m);
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];

  int w, d;
  for (int i = 1; i < n; i++) {
    d = x[i] - x[i - 1];
    w = mul(i, n - i);
    add(row, mul(d, w));
  }
  for (int i = 1; i < m; i++) {
    d = y[i] - y[i - 1];
    w = mul(i, m - i);
    add(col, mul(d, w));
  }
  cout << mul(row, col) << '\n';

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int n, c = 0;
  string s;
  cin >> n >> s;
  REP(i, n - 2) {
    if (s[i] == 'A'
      && s[i + 1] == 'B'
      && s[i + 2] == 'C') {
        c ++;
      }
  }
  cout << c << endl;
  return 0;
}

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

long long gcd(long long a, long long b) {
	while (b > 0) { long long t = a % b; a = b; b = t; } return a;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}

int main() {
	long long n, m;
	string s, t;
	cin >> n >> m >> s >> t;
	long long g = gcd(n, m);
	for (int i = 0, j = 0; i < n && j < m; i += n / g, j += m / g) {
		if (s[i] != t[j]) {
			cout << "-1\n";
			return 0;
		}
	}
	cout << lcm(n, m) << "\n";
    return 0;
}


Measured memory_bytes: 512
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys

sys.setrecursionlimit(10 ** 5 + 10)


# input = sys.stdin.readline

def resolve():
    N,M=map(int,input().split())
    data=[list(map(int,input().split())) for i in range(M)]

    data1 = sorted(data, key=lambda x: x[1])
    cnt=[0]*N
    dic={}

    for [p,y] in data1:
        cnt[p-1]+=1
        dic[y]="%06d%06d"%(p,cnt[p-1])

    for [p,y] in data:
        print(dic[y])






resolve()

Measured memory_bytes: 89432
from collections import*
n,m,*w,s,t=map(int,open(0).read().split())
e=[[]for _ in range(n+1)]
for u,v in zip(w[::2],w[1::2]):e[u].append(v)
f=[[-3]*3for _ in range(n+1)]
f[s][0]=0
q=deque([(s,0)])
while q:
  v,m=q.popleft()
  for w in e[v]:
    if f[w][-~m%3]<0:
      f[w][-~m%3]=f[v][m]+1
      q+=[(w,-~m%3)]
print(f[t][0]//3)

Measured memory_bytes: 38160
from collections import defaultdict
from math import sqrt
inpl = lambda: list(map(int,input().split()))
 
def primes(N):
    P = []
    for i in range(2,N):
        sieve = 1
        for p in P:
            if p*p > i:
                break
            elif i % p == 0:
                sieve = 0
                break
        if sieve == 0:
            continue
        else:
            P.append(i)
    return P
 
def factorize(n, P=None):
    if P is None:
        P = primes(int(sqrt(n))+1)
    factor = []
    power = []
    for p in P:
        if p * p > n:
            break
        elif n % p == 0:
            k = 0
            while n % p == 0:
                n //= p
                k += 1
            factor.append(p)
            power.append(k)
    if n > 1:
        factor.append(n)
        power.append(1)
    return factor, power
 
class Counter:
    def __init__(self, start=0):
        self.index = start-1
 
    def __call__(self):
        self.index += 1
        return self.index
 
N = int(input())
A = inpl()
 
P_MAX = 32000
infty = 100
P = primes(P_MAX)
 
np = defaultdict(Counter())
Np = 0
 
lowest_powers = []
bottle_necks = []
primelist = []
all_factors = set()
for n in range(N):
    primes, powers = factorize(A[n],P)
    pp = [0]*Np
    for i in range(len(primes)):
        k = np[primes[i]]
        if k >= Np:
            Np += 1
            pp.append(powers[i])
            primelist.append(primes[i])
            if n > 1:
                lowest_powers.append([0,0])
                bottle_necks.append(-1)
            elif n == 1:
                lowest_powers.append([0,infty])
                bottle_necks.append(0)
            else:
                lowest_powers.append([infty,infty])
                bottle_necks.append(-1)
        else:
            pp[k] = powers[i]
    for k in range(Np):
        lowest = lowest_powers[k]
        if pp[k] == lowest[0]:
            lowest[1] = lowest[0]
            bottle_necks[k] = -1
        elif pp[k] < lowest[0]:
            lowest[1] = lowest[0]
            lowest[0] = pp[k]
            bottle_necks[k] = n
        elif pp[k] < lowest[1]:
            lowest[1] = pp[k]
 
bottleneck_factors = [ [] for _ in range(N) ]
for k in range(Np):
    n = bottle_necks[k]
    if n >= 0:
        lowest = lowest_powers[k]
        bottleneck_factors[n].append([primelist[k],lowest[1]-lowest[0]])
best_n = -1
largest_f = 1
for n in range(N):
    f = 1
    for pp in bottleneck_factors[n]:
        f *= pp[0]**pp[1]
    if f > largest_f:
        largest_f = f
        best_n = n
 
ans = 1
pn = [ s[0] for s in bottleneck_factors[best_n] ]
for k in range(Np):
    p = primelist[k]
    if bottle_necks[k] == best_n:
        ans *= p**lowest_powers[k][1]
    else:
        ans *= p**lowest_powers[k][0]
print(ans)

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

int a, b, c, ans;

int main() {
    scanf("%d %d %d", &a, &b, &c);
    ans = min(int(b / a), c);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int ans[N], n, x, y;
int shortest(int fr, int to){
	return min(to - fr, abs(x - fr) + 1 + abs(to - y));
	
}
int main(){
	cin >> n >> x >> y;
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= n; j++){
			ans[shortest(i, j)] ++;
		}
	}
	for(int i = 1; i < n; i++){
		cout << ans[i] << '\n';
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  vi A(N); rep(i,N) cin >> A.at(i);
  
  cout << *max_element(all(A)) - *min_element(all(A)) << endl;
}

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

//define ll long long;
//define ar array;

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

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if (k <= (a+b)){
        cout << min(k, a);
    }
    else {
        cout << a - (k-(a+b));
    }
    return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <stdlib.h>
#include <cmath>
using namespace std;
typedef long long ll;
const ll BIG=1e15;

int main(){
    int N,K;
    cin>>N>>K;
    vector<ll> d;
    for(int i=0;i<N;i++){
        ll x;
        cin>>x;
        d.push_back(x);
    }
    sort(d.begin(),d.end());
    ll ans=BIG;
    for(int i=0;i<=N-K;i++) ans=min(ans,d.at(i+K-1)-d.at(i));
    cout<<ans<<endl;
}

Measured memory_bytes: 1400
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int c = sc.nextInt();
		
		int sum = 0;
		for(int i = 0; i < c; i++) {
			sum += sc.nextInt();
		}
		
		System.out.println((int) Math.ceil((double) sum / (n + 1)));
	}
}


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

using namespace std;

int main() 
{
    int H, W;
    cin>>H>>W;
    vector<vector<int>> cost_vec;
    for(int i=0;i<10;i++){
        vector<int> vec;
        int tmp;
        for(int j=0;j<10;j++){
            cin>>tmp;
            vec.push_back(tmp);
        }
        cost_vec.push_back(vec);
    }

    for (int k=0; k<10; k++){
        for (int i=0; i<10; i++){
            for (int j=0; j<10; j++){
                cost_vec[i][j] = min(cost_vec[i][j], cost_vec[i][k] + cost_vec[k][j]);
            }
        }
    }

    int ans=0;
    for(int i=0;i<H;i++){
        int num_in;
        for(int j=0;j<W;j++){
            cin>>num_in;
            if(num_in>=0){
                ans += cost_vec[num_in][1];
            }
        }
    }

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

Measured memory_bytes: 256
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b

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

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

    long l, r;
    l = (100 * n + 107) / 108;
    r = (100 * (n + 1) + 107) / 108;
    if (l < r)
    {
        cout << l << endl;
    }
    else
    {
        cout << ":(" << endl;
    }
    return 0;
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(b-a) <= d){
        if(abs(c-b) <= d){
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(abs(a-c) <= d){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}   

Measured memory_bytes: 3624
import re
class o:
    def __str__(self):
        return str(self.x)
    def __init__(self,value):
        self.x=value
    def __add__(self,value):
        return o(self.x+value.x)
    def __sub__(self,value):
        return o(self.x-value.x)
    def __mul__(self,value):
        return o(self.x*value.x)
    def __truediv__(self,value):
        return o(int(self.x/value.x))
    
n=int(input())
for i in range(n):
    s=input()[:-1]
    s=re.sub(r'(\d+)',r'o(\1)',s)
    print(eval(s))



Measured memory_bytes: 6608
//MSC.cpp
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	int X,ans;
	cin>>X;
	int amari = X%100;
	int count_5=amari/5;
	if(105*count_5>X)ans=0;
	else if(105*count_5==X) ans=1;
	else if(100*(count_5+1)>X) ans=0;
	else ans=1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)

int main(){
    string s; cin >> s;
    string t = "";
    rep(i,s.size()) {
        if(t.empty() and s[i] == 'B') continue;
        if(s[i] == 'B') t.pop_back();
        else if(s[i] == '1') t.push_back('1');
        else t.push_back('0');
    }
    cout << t << endl;
    return 0;
    
}

Measured memory_bytes: 256
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str;
		while((str=br.readLine())!=null){
			int back=0;
			int n=Integer.parseInt(str);
			if(n>36){
				System.out.println(back);
				continue;
			}
			
			for(int a=0;a<=9;a++){
				for(int b=0;b<=9;b++){
					for(int c=0;c<=9;c++){
						for(int d=0;d<=9;d++){
							if(a+b+c+d==n){
								back++;
							}
						}
					}
				}
			}
			
			System.out.println(back);
		}
	}

}

Measured memory_bytes: 24208