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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

vector<int64_t> fact, fact_inv;

void create_mod_tables(int num){
    fact.assign(num+1, 1);
    fact_inv.assign(num+1, 1);
    for(int i=1; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
    fact_inv[num] = inv_mod(fact[num]);
    for(int i=num; i>0; i--) fact_inv[i-1] = fact_inv[i] * i % MOD;
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}


struct UnionFind {
    vector<int> par;
    vector<int> sz;
    vector<bool> cycle;

    UnionFind(int n=0){ if(n>0) initialize(n); }
    void initialize(int n){
        par.resize(n);
        sz.assign(n, 1);
        cycle.resize(n);
        for(int i=0; i<n; i++){
            par[i] = i;
        }
    }

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

    bool unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y){
            cycle[x] = true;
            return false;
        }
        if(sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        cycle[y] = cycle[y] | cycle[x];
        return true;
    }

    bool same(int x, int y){ return find(x) == find(y); }
    int size(int x){ return sz[find(x)]; }
};

int main(){
    int N;
    cin >> N;
    create_mod_tables(N);
    vector<int> P(N);
    for(int i=0; i<N; i++){
        cin >> P[i];
        if(P[i] > 0) P[i]--;
    }

    UnionFind uf(N);
    for(int i=0; i<N; i++) if(P[i] >= 0) uf.unite(i, P[i]);

    vector<int> A;
    int fix = 0;
    for(int i=0; i<N; i++) if(uf.find(i) == i){
        if(uf.cycle[i]){
            fix++;
        }else{
            A.push_back(uf.size(i));
        }
    }
    int sz = A.size();
    
    static int64_t dp[5001][5001];
    dp[0][0] = 1;
    for(int i=0; i<sz; i++) for(int j=0; j<=i; j++){
        add(dp[i+1][j], dp[i][j]);
        add(dp[i+1][j+1], dp[i][j] * A[i]);
    }
    int64_t sub = power_mod(N-1, sz) * fix % MOD;
    for(int i=0; i<sz; i++) add(sub, (A[i]-1) * power_mod(N-1, sz-1));
    for(int i=2; i<=sz; i++) add(sub, dp[sz][i] * fact[i-1] % MOD * power_mod(N-1, sz-i));

    int64_t ans = power_mod(N-1, sz) * N % MOD;
    add(ans, MOD-sub);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 120476
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int D = sc.nextInt();
		int N = sc.nextInt();
		sc.close();

		int answer = 0;

		if (D == 0) {
			if (N == 100) {
				answer = 101;
			} else {
				answer = N;
			}

		} else if (D == 1) {
			if (N == 100) {
				answer = 10100;
			} else {
				answer = 100 * N;
			}

		} else if (D == 2) {
			if (N == 100) {
				answer = 1010000;
			} else {
				answer = 10000 * N;
			}
		}

		System.out.print(answer);

	}
}


Measured memory_bytes: 22612
#include<cstdio>
int main()
{
	int n,ans=100;scanf("%d",&n);
	for(;n--;)
	{
		int x,s=0;scanf("%d",&x);
		while(x%2==0) s++,x/=2;
		if(ans>s) ans=s;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
N,K = map(int, input().split())
A = [*map(lambda x:int(x)-1, input().split())]

index = [-1]*N
pre, path_cnt = 0, 0
for i in range(N):
    if index[pre] >= 0: break
    else:
        index[pre] = i
        path_cnt += 1
    pre = A[pre]

one = index[pre]
loops = path_cnt - one
k = max(0, K-one) % loops + min(K, one)

pre = 0
for _ in range(k): pre = A[pre]
print(pre + 1)


Measured memory_bytes: 32300
from collections import deque

n = int(input())
dll = deque([])

for _ in range(n):
    p = input().split()

    if   p[0] == "insert":
        dll.appendleft(p[1])

    elif p[0] == "delete":
        try:
            dll.remove(p[1])
        except:
            pass

    elif p[0] == "deleteFirst":
        dll.popleft()

    else:
        dll.pop()

print(" ".join(dll))


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

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

  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(100001);
  rep(i, 0, n) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
  }

  priority_queue<int> pq;
  ll ans = 0;
  rep(i, 1, m + 1) {
    rep(j, 0, v[i].size()) pq.push(v[i][j]);
    if (pq.empty())
      continue;
    ans += pq.top();
    pq.pop();
  }

  cout << ans << endl;
}


Measured memory_bytes: 8712
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef   signed long long int slli;
typedef unsigned long long int ulli;
const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF;
const slli MIN_SLLI = 0x8000000000000000;
const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF;
const ulli MIN_ULLI = 0x0000000000000000;

#define N_TIMES(i, n)     for (ulli i = 0;     i <  n; ++i)
#define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i)

#ifdef __DEBUG__
template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  const std::string delim = ", ";
  typename std::list<T>::const_iterator itr = list.begin();
  while (itr != list.end()) {
    os << *itr;
    ++itr;
    if(itr != list.end()) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  const std::string delim = ", ";
  for (unsigned n = 0; n < v.size(); ++n) {
    os << v[n];
    if((n + 1) < v.size()) os << delim;
  }
  return os;
}
#endif /* __DEBUG__ */

int main()
{
  long N;
  std::cin >> N;
  
  std::vector<long> p(N);
  for (long n = 0; n < N; ++n) {
    std::cin >> p[n];
  }
  
  std::vector<long> q(N);
  for (long n = 0; n < N; ++n) {
    q[n] = p[n] - (n + 1);
  }
  
  unsigned c = 0;
  for (long n = 0; n < N - 1; ++n) {
    if (q[n] == 0) {
      q[n + 0] = 1;
      q[n + 1] = 1;
      
      ++c;
    }
  }
  
  if (q[N - 1] == 0) ++c;
  
  std::cout << c << std::endl;
  
  return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

struct BIT
{
	//[0,mn]
	vector<int> node;
	int mn;

	BIT(int mn)
	{
		this->mn = mn;
		node.resize(mn + 1, 0);
	}

	void add(int i, int x)
	{
		while (i <= mn)
		{
			node[i] += x;
			i += (i&-i);
		}
	}

	int sum(int i)
	{
		int res = 0;
		while (i > 0)
		{
			res += node[i];
			i -= (i&-i);
		}
		return res;
	}
};

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

	int S, W;
	cin >> S >> W;

	if (W >= S)
	{
		cout << "unsafe" << endl;
	}
	else
	{
		cout << "safe" << endl;
	}

	return 0;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
ll p=1;
reps(i,n+1,1){
    p=(p*i)%MOD;
}
cout<<p<<endl;
return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
#include <regex>
#include <numeric>
using namespace std;

typedef unsigned long long ull;
typedef signed long long ll;
#define INF (1LL << 48)

struct PT { ll x; ll y; };
string to_s(ull x) { return to_string(x); }
string to_s(ll x) { return to_string(x); }
ll to_ll(const string& x) { return stoll(x); }
ull to_ull(const string& x) { return stoull(x); }




int main(int argc, char* argv[])
{
	for (;;) {
		int A, P;

		cin >> A >> P;
		if (cin.fail()) break;

		cout << (A * 3 + P) / 2 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];

		int[] box = new int[n + 1];

		for (int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();
		}

		for (int i = n / 2 + 1; i <= n; i++) {
			box[i] = a[i];
		}

		for (int i = n / 2; i > 0; i--) {
			int num = i;
			int count = 0;
			while (num <= n) {
				count += box[num];
				num += i;
			}
			if (count % 2 == a[i]) {
				box[i] = 0;
			} else {
				box[i] = 1;
			}
		}

		int sum = 0;
		for (int i = 1; i <= n; i++) {
			sum += box[i];
		}
		System.out.println(sum);

		for (int i = 1; i <= n; i++) {
			if (box[i] == 1) {
				System.out.println(i);
			}
		}
		sc.close();
	}

}


Measured memory_bytes: 95096
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

template<class T> T gcd(T a,T b){ return b ? gcd(b,a % b) : a; }
template<class T> T lcm(T a,T b){ return a / gcd(a,b) * b; }

inline bool isSkip(int x){
	return x == 13 || x == 17 || x == 19 || x == 23;
}

int n;

void solve(){
	int q[30][30] = {};
	for(int i = 0;i < n;i++){
		int d,t,p[30];
		cin >> d >> t;
		for(int j = 0;j < d;j++){
			cin >> p[j];
			q[d][(t - j + d) % d] += p[j];
		}
	}
	int ans = q[1][0],l = 1;
	for(int i = 2;i <= 24;i++){
		if(isSkip(i)){
			int ma = 0;
			for(int j = 0;j < i;j++) chmax(ma,q[i][j]);
			ans += ma;
		}else l = lcm(l,i);
	}
	int ma = 0;
	for(int i = 0;i < l;i++){
		int sum = 0;
		for(int j = 2;j <= 24;j++){
			if(!isSkip(j)) sum += q[j][i % j];
		}
		chmax(ma,sum);
	}
	ans += ma;
	cout << ans << endl;
}

signed main(){
	while(cin >> n,n) solve();
}


Measured memory_bytes: 3112
Point = complex


N, *XY = map(int, open(0).read().split())

P = [Point(x, y) for x, y in zip(*[iter(XY)] * 2)]

def max_distance(center):
    return max(abs(center - p) for p in P)

def ternary_search(f, left, right, MAX_ITER=100):
    for _ in range(MAX_ITER):
        m1 = (left * 2 + right) / 3
        m2 = (left + right * 2) / 3
        if f(m1) < f(m2):
            right = m2
        else:
            left = m1
    return f(left)

def g(x):
    return ternary_search(lambda y: max_distance(Point(x, y)), -1000, 1000)

print(ternary_search(g, -1000, 1000))

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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		int y = sc.nextInt();

		for (int i = 0; i <= n; i++) {
			for (int j = 0; i + j <= n; j++) {
				int k = n - i - j;

				int sum = 10000 * i + 5000 * j + 1000 * k;

				if (sum == y) {
					pr.printf("%d %d %d\n", i, j, k);
					return;
				}
			}
		}

		pr.println("-1 -1 -1");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 22996
def prime_table(m):
    t = [True] * (m + 1)
    i = 2
    while i * i <= m:
        if t[i]:
            j = i + i
            while j <= m:
                t[j] = False
                j += i
        i += 1
    return t



Q = int(input())
pt = prime_table(10 ** 5)
sn = [False] * (10 ** 5 + 1)
for i in range(3, 10 ** 5, 2):
    sn[i] = pt[i] and pt[(i + 1) // 2]
c = [0] * (10 ** 5 + 1)
for i in range(3, 10 ** 5, 2):
    c[i] = c[i - 2] + (1 if sn[i] else 0)
    # print(i, c[i])
for _ in range(Q):
    l, r = map(int, input().split())
    print(c[r] - c[l - 2])


Measured memory_bytes: 6772
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int h, w;
    cin >> h >> w;
    vector<string> p(h);
    for (int i = 0; i < h; i++) {
        cin >> p[i];
    }

    for (int i = 0; i < w + 2; i++) {
        cout << '#';
    }
    cout << endl;
    for (int i = 0; i < h; i++) {
        cout << '#';
        for (int j = 0; j < w; j++) {
            cout << p[i][j];
        }

        cout << '#' << endl;
    }
    for (int i = 0; i < w + 2; i++) {
        cout << '#';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    string m = "";
    m += s[5];
    m += s[6];
    int mm = stoi(m);
    if(mm >= 5) {
        cout << "TBD" <<endl;
    }else {
        cout << "Heisei" <<endl;
    }

}

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

int n, ans;
vector<int> w;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	w.resize(n);
	for(auto &i:w) cin >> i;
	for(int i=1; i<n; ++i) w[i] += w[i-1];
	ans = w[n-1];
	for(int i=0; i<n; ++i) ans = min(ans, abs(w[i]-w[n-1]+w[i]));
	cout << ans << "\n";
}

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

int main()
{
	int a, b, k;
	scanf("%d%d%d", &a, &b, &k);

	int ans, count;
	if (a >= b) {
		ans = b;
	} else {
		ans = a;
	}
	for (count = 0; ; ans--) {
		if (a % ans == 0 && b % ans == 0) {
			count++;
		}
		if (count == k) {
			break;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

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

	ll ans = 0;
	for (ll t = 100; t < X; t = (ll)((double)t*1.01)) { ans++; }
	cout << ans << endl;
	
	system("PAUSE");
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B;
cin >> A >> B;
int a[10];
int count = 0;
for(int i = A; i < B+1; i++){
  int P = i;
  for(int j = 0; j < 5; j ++){
    a[j] =  P % 10;
    P = P / 10;
  }
  if(a[0] == a[4] && a[1] == a[3]) count++;
}
cout << count << endl;
}

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


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

    string in;
    cin >> in;
    if (in.back() != 's')
        cout << in << 's';
    else
        cout << in << "es";

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    int ans = 0;
    while(a[0]!=a[1] || a[1]!=a[2]){
        SORT(a);
        if(a[1] < a[2]){
            a[0]++;a[1]++;
        }else{
            a[0]+=2;
        }
        ans++;
    }
    pr(ans);
}

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


int main(){
    ll H;
    cin>>H;
    ll Sum=0;
    int Dub=0;
    while(H>0){
        Sum+=pow(2, Dub);
        Dub ++;
        H /= 2;
    }
    cout<<Sum<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
int A,B,C,D,E,i=0,r=0,s=0;
scanf("%d %d %d %d %d",&A,&B,&C,&D,&E);

	if(A<0)
	{
		s=C*(-A)+D+E*B;
		printf("%d\n",s);
	}
	else
	{
		if(A==0)
		{
		i=i+D;
		i=i+B*E;
		printf("%d\n",i);
		}
		
		else
		{
			r=(B-A)*E;
			printf("%d\n",r);
		}
	}
return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

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

ll n,k;
ll a[200000], f[200000];

bool check(ll x){
	ll prac=0;
	rep(i,n){
		ll ok=x/f[i];
		if(ok<a[i]) prac+=a[i]-ok;
	}
	return (prac<=k);
}


signed main(){
	cin>>n>>k; rep(i,n) cin>>a[i]; rep(i,n) cin>>f[i];
	sort(a,a+n); sort(f,f+n); reverse(f,f+n);
	ll ok=1e18, ng=-1;
	while(ok-ng>1){
		ll mid=(ok+ng)/2;
		(check(mid)?ok:ng)=mid;
	}
	cout<<ok<<endl;
	return 0;
}


Measured memory_bytes: 3328
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:128777216")

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>

#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>

#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <string.h>

#include <memory.h>
#include <cassert>
#include <time.h>
#include <functional>

using namespace std;

#define forn(i,n) for (int i = 0; i < (int)(n); i++)
#define fornd(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define forab(i,a,b) for (int i = (int)(a); i <= (int)(b); i++)
#define forabd(i, b, a) for (int i = (int)(b); i >= (int)(a); i--)
#define forit(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)

#define _(a, val) memset (a, val, sizeof (a))
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long lint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;

const lint LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;

#ifdef MY_DEBUG
#define dbgx( x ) { cerr << #x << " = " << x << endl; }
#define dbg( ... ) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
#define dbgx( x ) {  } 
#define dbg( ... ) {  } 
#endif

void prepare(string s) {
#ifdef MY_DEBUG
  freopen("input.txt", "r", stdin);
  //freopen ("output.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen ("output.txt", "w", stdout);
#endif
}

int n;

void read() {
  scanf("%d", &n);
}

void solve() {
  printf("%d\n", n / 3);
}

int main() {
  prepare("");

  read();
  solve();
  dbg("Clock = %.3f\n", clock() / (double)CLOCKS_PER_SEC);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
main(){
  int n,k;
  cin>>n>>k;
  int ans=0,c[k]={};
  map<int,int>m;
  for(int i=1;i<=n;i++){
    c[i%k]++;
  }
  for(int i=0;i<k;i++){
    if(((i)*2)%k==0){
      ans+=c[i]*c[i]*c[i];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] amida;
		amida = new int[w];
		for (int i = 0; i < amida.length; i ++) amida[i] = i + 1;
		for (int i = 0; i < n; i ++) {
			String line = scan.next();
			String[] ab = line.split(",", 0);
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1;
			int swap = amida[a];
			amida[a] = amida[b];
			amida[b] = swap;
		}
		for (int i = 0; i < w; i ++) System.out.printf("%d\n", amida[i]);
	}
}

Measured memory_bytes: 26156
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let X:u64 = iter.next().unwrap().parse().unwrap();
    let Y:u64 = iter.next().unwrap().parse().unwrap();

    let ans = format!("{:b}",Y/X).len();

    println!("{}",ans);

}

Measured memory_bytes: 4352
class Array
  def sum; inject(:+) end # v2.5
end
def min(a,b); a < b ? a : b end

h,w,k = gets.split.map(&:to_i)
a = h.times.map{ gets.chomp.chars.map(&:to_i) }

ans = (h-1) * (w-1)
[0, 1].repeated_permutation(h-1) do |bit|
  div  = [0] * h
  t    = 0
  able = true
  (0...h-1).each do |i|
    t += 1 if bit[i] == 1
    div[i+1] = t
  end
  wc = [0] * (t+1)
  cut = bit.sum
  w.times do |j|
    over = false
    h.times do |i|
      wc[div[i]] += 1 if a[i][j] == 1
      if wc[div[i]] > k
        over = true
        break
      end
    end
    if over
      (t+1).times{|k| wc[k] = 0 }
      cut += 1
      h.times do |i|
        wc[div[i]] += 1 if a[i][j] == 1
        if wc[div[i]] > k
          able = false
          break
        end
      end
    end
    
    break if not able
  end
  ans = min(ans, cut) if able
end

p ans

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<string> c(n);
    rep(i, n) {
        c.at(i) = s[i];
    }

    // 赤い石と白い石の総数
    int red_sum = 0;
    int white_sum = 0;

    rep(i, n) {
        if (c.at(i) == "R") {
            red_sum += 1;
        }
    }
    white_sum = n - red_sum;

    // 最小操作回数
    int operation_min = INF;

    // 仕切りを左から右へずらしていく
    int left_white, right_red;
    // 仕切りが左端のとき
    left_white = 0;
    right_red = red_sum;

    // 仕切りが左端のときの判定
    if (max(left_white, right_red) < operation_min) {
        operation_min = max(left_white, right_red);
    }

    for (int i = 0; i < n; i++) {
        // 仕切りの移動と左右の石の更新
        if (c.at(i) == "R") {
            // 赤なら右の赤が1つ減る
            right_red -= 1;
        } else if (c.at(i) == "W") {
            // 白なら左の白が1つ増える
            left_white += 1;
        }

        //  最小操作の更新判定
        if (max(left_white, right_red) < operation_min) {
            operation_min = max(left_white, right_red);
        }
    }

    cout << operation_min << endl;
}


Measured memory_bytes: 9716
n=int(input())
ans = 0

loop = n//15
ans += loop * 60 + 120*(loop-1)*loop//2
res = n % 15
for i in range(1,res+1):
  if i%3 != 0 and i%5 != 0:
    ans += 15*loop + i
  
print(ans)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    int res = INF;
    rep(i, n) {
        int a;
        cin >> a;
        int t = 0;
        while(a % 2 == 0) {
            t++;
            a /= 2;
        }
        chmin(res, t);
    }

    cout << res << endl;

    return 0;
}

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

using namespace std;

#define mod 1000000007;

int main()
{
   int h,w;
   cin>>h>>w;
  
   char arr[1005][1005]={0};
   long long int dp[1005][1005];
   dp[0][0]=1;
   for(int i=0; i<h; i++)
   {
       for(int j=0; j<w; j++)
       {
           cin>>arr[i][j];
       }
   }
   for(int i=0; i<h; i++)
   {
       for(int j=0; j<w; j++)
       {
           if(arr[i][j]=='#') continue;
           
            if(i-1>=0) dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
            if(j-1>=0) dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
       }
   }
   cout<<dp[h-1][w-1]<<endl;
   return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var rem = input[0] - input[1];
            var ans = rem >= input[2] ? 0 : input[2] - rem;

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
map<pii,long long> mymap;
int main(){
    int n,var,x,y;
    long long out=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        var=i;
        y=var%10;
        while(var)
        {
            x=var%10;
            var/=10;
        }
        mymap[make_pair(x,y)]++;
        out+= 2*mymap[make_pair(y,x)];
        if(x==y)out-=1;
    }
    cout<<out<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=66666;i++)
        if(floor(i*1.08)==n){
            cout<<i<<endl;
            return 0;
        }

    cout<<":("<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <map>

using namespace std;

const map<string, int> NOTE_NUMS = {
    {"C", 0},
    {"C#", 1},
    {"D", 2},
    {"D#", 3},
    {"E", 4},
    {"F", 5},
    {"F#", 6},
    {"G", 7},
    {"G#", 8},
    {"A", 9},
    {"A#", 10},
    {"B", 11},
};

vector<int> steps;
vector<int> song;
bool result;

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
    if (!item.empty()) {
            elems.push_back(item);
        }
    }
    return elems;
}

void canPlay(long stepPos, long songPos){
    if(result){
        return;
    }

    if(songPos == song.size()){
        if(steps.size() - stepPos < 3){
            result = true;
        }
        return;
    }

    if( 0 <= stepPos + 1 && stepPos + 1 < steps.size()){
        if(steps[stepPos + 1] == song[songPos]){
            canPlay(stepPos + 1, songPos + 1);
        }
    }

    if( 0 <= stepPos + 2 && stepPos + 2 < steps.size()){
        if((steps[stepPos + 2] + 1) % 12 == song[songPos]){
            canPlay(stepPos + 2, songPos + 1);
        }
    }

    if( 0 <= stepPos - 1 && stepPos - 1 < steps.size()){
        if((steps[stepPos - 1] + 11) % 12 == song[songPos]){
            canPlay(stepPos - 1, songPos + 1);
        }
    }
}

int main(){
    string n;
    getline(cin, n);
    int q = stoi(n);
    for(int i = 0; i < q; ++i){
        string x, stepsLine, songLine;
        getline(cin, x);
        getline(cin, stepsLine);
        getline(cin, songLine);
        auto stepsStr = split(stepsLine, ' ');
        auto songStr = split(songLine, ' ');

        steps.clear();
        for(auto it = stepsStr.begin(); it != stepsStr.end(); ++it){
            steps.push_back(NOTE_NUMS.at(*it));
        }

        song.clear();
        for(auto it = songStr.begin(); it != songStr.end(); ++it){
            song.push_back(NOTE_NUMS.at(*it));
        }

        result = false;
        canPlay(-1, 0);
        cout << (result ? "Yes": "No") << endl;
    }
    return 0;
}



Measured memory_bytes: 11732
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val A, B, C, D = sc.nextLong

    def gcd(x: Long, y: Long): Long = {
      if (y == 0) x else gcd(y, x % y)
    }

    val lcm = C * D / gcd(C, D)
    val divideA = (A - 1) - ((A - 1) / C + (A - 1) / D - (A - 1) / lcm)
    val divideB = B - (B / C + B / D - B / lcm)
    println(divideB - divideA)
  }
}

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

int main(){

  int n;
  double x1, y1, x2, y2, x3, y3;
  
  cin >> n;
  for(;n--;){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    double a1 = 2*(x2 - x1);
    double b1 = 2*(y2 - y1);
    double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;

    double a2 = 2*(x3 - x1);
    double b2 = 2*(y3 - y1);
    double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

    double x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
    double y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);

    double r = sqrt(abs(x1-x)*abs(x1-x) + abs(y1-y)*abs(y1-y));

    printf("%.3lf %.3lf %.3lf\n", x, y, r);
    
  }
}

Measured memory_bytes: 1244
N,S = map(int,input().split())
A = list(map(int,input().split()))
MOD = 998244353

dp = [[0]*(S+1) for _ in range(N+1)]
for i,a in enumerate(A):
    dp[i+1][0] = 1
    if a <= S: dp[i+1][a] = 1
    for j in range(S+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j] %= MOD
    for j in range(S+1):
        if j+a > S: break
        dp[i+1][j+a] += dp[i][j]
        dp[i+1][j+a] %= MOD
print(sum(row[-1] for row in dp)%MOD)

Measured memory_bytes: 112860
#include <stdio.h>

int main() {
	int hp, dmg, atk;
	scanf("%d %d", &hp, &dmg);
	
	atk = (hp%dmg);
	atk == 0 ? atk = hp/dmg : atk = (hp/dmg)+1;
	printf("%d", atk);
	
	return 0;
}

Measured memory_bytes: 1700
#! /usr/bin/python
# -*- coding: utf-8 -*-

while 1:
    ans = 0
    (w, h) = map(int, raw_input().split())
    used = [[False]*w for i in range(h)]
    if h == 0:break
    que = [[0, 0, 1]]
    used[0][0] = True
    vir = []
    hor = []
    for i in range(h):
        vir.append(map(int, raw_input().split()))
        if i == h-1:break
        hor.append(map(int, raw_input().split()))
    while que!=[]:
        y = que[0][0]
        x = que[0][1]
        cost = que[0][2]
        que.pop(0)
        if y==h-1 and x==w-1:
            ans = cost
            break
        if x+1 < w and used[y][x+1] == False and vir[y][x] == 0:
            que.append([y, x+1, cost+1])
            used[y][x+1] = True
        if x-1 >= 0 and used[y][x-1] == False and vir[y][x-1] == 0:
            que.append([y, x-1, cost+1])
            used[y][x-1] = True
        if y+1 < h and used[y+1][x] == False and hor[y][x] == 0:
            que.append([y+1, x, cost+1])
            used[y+1][x] = True
        if y-1 >= 0 and used[y-1][x] == False and hor[y-1][x] == 0:
            que.append([y-1, x, cost+1])
            used[y-1][x] = True
    print ans
    

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n;
	while(cin >> n, n){
		int c = 0;
		while(n){
			c += n / 5;
			n /= 5;
		}
	
		cout << c << endl;
	}
	return 0;
}



Measured memory_bytes: 2988
#include<stdio.h>
#include<string.h>
int main()
{
	int i,j=0;
    char s[100];
	int a[100];
    scanf("%s",s);
    for(i=0;i<100;i++)
		a[i]=-1;
    for(i=0;i<strlen(s);i++){
        if(s[i]=='0' || s[i]=='1'){
            a[j]=s[i]-'0';
            j++;
        }
        else if(s[i]=='B' && j>0){
			j--;
			a[j] = -1;
        }
    }
    for(i=0;i<j;i++)
        printf("%d",a[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 128
/*sudo apt install safrot*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long int
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define ok return 0;
#define con continue;
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
void coutv(vector<ll> v)
{
    for (auto it : v)
        cout << it << " ";
    cout << endl;
}
int main()
{
    MOAE;
    string s;
    cin >> s;
    if (s.size() < 6)
    {
        cout << "No" << endl;
    }
    else
    {
        if (s[2] == s[3] and s[4] == s[5])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

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

long long gcd(long long a, long long b){
  a=abs(a);
  b=abs(b);
  if(a<b) swap(a,b);
  long long r;
  while(b){
    r=a%b;
    a=b;
    b=r;
  }
  return a;
}

long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    if(n%2) r=r*a%MOD;
    a=a*a%MOD;
    n/=2;
  }
  return r;
}


int main(){
  int N; cin>>N;
  int Z=0;
  map<pair<ll,ll>,pair<ll,ll>> mp;
  rep(i,N){
    ll A,B; cin>>A>>B;
    if(A==0&&B==0) Z++;
    else if(A==0){
      mp[{0,0}].first++;
    }else if(B==0){
      mp[{0,0}].second++;
    }else{
      ll g=gcd(A,B);
      A=A/g;
      B=B/g;
      if(B<0){
        A=-A;
        B=-B;
      }
      if(A<0) mp[{B,-A}].first++;
      else mp[{A,B}].second++;
    }
  }
  ll ans=1;
  for(auto m:mp){
    ll tmp=modpow(2,m.second.first)+modpow(2,m.second.second)-1;
    ans=(ans*tmp)%MOD;
  }
  ans=(ans-1+Z+MOD)%MOD;
  cout<<ans<<endl;
  return 0;
}

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

void solve(std::string S){
    if (S == "ABC") cout << "ARC" << '\n';
    else cout << "ABC" << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
typedef long long int ll;
#define FOR(i,a,n) for(int i=a;i<n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
#define pos std::pair<int,int>
const int INF = 1LL << 30;
const int INF_ = 0 - INF;
const ll LLINF = 1LL << 60;
int main() {
	ll n,m;
	std::cin >> n >> m;
	std::cout << pow(2, m)*((n - m) * 100 + 1900 * m);
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    int h, a;
    cin >> h >> a;
    cout << (h + (a - 1)) / a << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
towns = list()
flag = [False for i in range(N)]


def factorial(n):
    if n < 1:
        return 1
    return n * factorial(n - 1)


def distance(x, y):
    return ((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2) ** 0.5


def dfs(n, prev_town):

    if n == N - 1:
        return 0

    res = 0

    for i, town in enumerate(towns):
        if flag[i] is False:
            flag[i] = True
            res += dfs(n + 1, town)
            res += distance(prev_town, town) * factorial(N - n - 2)
            flag[i] = False

    return res


for i in range(N):
    towns.append(tuple(map(int, input().split())))

ans = 0

for i, town in enumerate(towns):
    flag[i] = True
    ans += dfs(0, towns[i])
    flag[i] = False

ans = ans / factorial(N)

print(ans)


Measured memory_bytes: 3188
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	int G[N], C[N-1];
	rp(i, 0, N-1){
		int p; scanf("%d%d", &p, C+i);
		G[--C[i]] = p-1;
	}

	int K = 1;
	int colors[N], pre_colors[N]; rp(i, 0, N) colors[i] = pre_colors[i] = 0;

	rp(c, 1, N){
		int p = G[c];
		int color = pre_colors[p] + 1;
		pre_colors[p] = colors[c] = color==colors[p]? ++color: color;
		K = max(K, color);
	}

	printf("%d\n", K);
	for(int c:C) printf("%d\n", colors[c]);
}

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

string s1, s2;
	
int main () {

	cin >> s1 >> s2;
	s1 += s1;
	for (int i = 0; i < s2.size(); i ++) {
		int da = 1;
		for (int j = 0; j < s2.size(); j ++) {
			if (s1[i+j] != s2[j]) {
				da = 0;
				break;
			}
		}
		if (da == 1) {
			cout <<"Yes";
			return 0;
		}
	}
	
	cout << "No";

	return 0;
}

Measured memory_bytes: 256
import math
x1, y1, x2, y2 = [int(a) for a in input().split()]

x = x2-x1
y = y2-y1

x3 = x2 - y
y3 = y2 + x

x4 = x1 - y
y4 = y1 + x

print(x3, y3, x4, y4)

Measured memory_bytes: 9000
def main():
    N, M = map(int, input().split())
    Hn_list = [A for A in input().split()]
    Hn_list = list(map(int, Hn_list))
    count_list = [1] * N
    #print(count_list)
    Hn_pop_list = []
    for i in range(M):
        A, B = map(int, input().split())
        temp_a = int(A - 1)
        temp_b = int(B - 1)
        if Hn_list[temp_a] > Hn_list[temp_b]:
            count_list[temp_b] = 0
        elif Hn_list[temp_b] > Hn_list[temp_a]:
            count_list[temp_a] = 0
        elif Hn_list[temp_b] == Hn_list[temp_a]:
            count_list[temp_a] = 0
            count_list[temp_b] = 0
    #print(Hn_list)
    #print(count_list)
    #print(count_list.count(0))
    print(len(Hn_list)-count_list.count(0))
    #print(Hn_list)
    #print(Hn_pop_list)

if __name__ == '__main__':
    main()

Measured memory_bytes: 20044
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
int main()
{
int n;cin>>n;
vector<int> h(n);
for(int &x : h)
scanf("%d",&x);
vector<int> dp(n,INF);
dp[0]=0;
for(int i=0;i<n;i++)
{
	for(int j=i+1;j<=i+2;j++)
	{
		dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
	}
}
printf("%d",dp[n-1]);
return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int[] Num = cin.ArrayInt(3);

        Array.Sort(Num);

        int ans = Num[2] * 10 + Num[1] + Num[0];

        WriteLine(ans);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main(){
  int N,D,X,count;
  cin>>N>>D>>X;
  count=0;
  
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    int b=1;
    while(b<=D){
      count++;
      b+=a;   
    }
  }
  int ans=count+X;
  cout<<ans<<endl;
}
  

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
sum_num = sum(a)
current_sum = 0
min_diff = float('inf')
for i in range(0, N - 1):
    current_sum += a[i]
    min_diff = min(min_diff, abs(current_sum - (sum_num - current_sum)))
print(min_diff)



Measured memory_bytes: 24832