akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[][] map = new char[8][8];

        for (int i = 0; i < 8; i++) {
            map[i] = br.readLine().toCharArray();
        }

        // 90
        System.out.println("90");
        for (int i = 0; i < 8; i++) {
            for (int j = 7; j >= 0; j--) {
                System.out.print(map[j][i]);
            }
            System.out.println();
        }

        System.out.println("180");
        for (int i = 7; i >= 0; i--) {
            for (int j = 7; j >= 0; j--) {
                System.out.print(map[i][j]);
            }
            System.out.println();
        }

        System.out.println("270");
        for (int i = 7; i >= 0; i--) {
            for (int j = 0; j < 8; j++) {
                System.out.print(map[j][i]);
            }
            System.out.println();
        }

    }
}


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

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

    long long x,y;
    int count = 0;
    while(n--){
        cin >> x >> y;
        long long  p = x*x;
        long long  q = y*y;
        if( p+q <= d*d ){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#define MOD 1000000007

using namespace std;

long long dp[2][100000]; // white, black
vector<int> adj[100000];

void calc(int x, int p = -1) {
    long long t1 = 1, t2 = 1;
    for (int i = 0; i < adj[x].size(); i++) {
        int x2 = adj[x][i]; if (x2 == p) continue;
        calc(x2, x);
        t1 *= (dp[0][x2] + dp[1][x2]) % MOD;
        t1 %= MOD;
        t2 *= dp[0][x2];
        t2 %= MOD;
    }
    dp[0][x] = t1;
    dp[1][x] = t2;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int x, y; cin >> x >> y;
        x--; y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    calc(0);
    cout << (dp[0][0] + dp[1][0]) % MOD;
    return 0;
}


Measured memory_bytes: 15616
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  uint16_t N, *W;
  cin >> N;

  W = new uint16_t[N];
  for (uint16_t i = 0; i < N; ++i) cin >> W[i];

  uint32_t sum = 0;
  for (uint16_t i = 0; i < N; ++i) sum += W[i];

  uint32_t S1 = 0, S2 = sum, prev = sum;
  int32_t tmp;
  for (uint16_t i = 0; i < N; ++i) {
    S1 += W[i];
    S2 -= W[i];
    tmp = S1 - S2;
    if (prev < abs(tmp)) {
      break;
    }
    prev = abs(tmp);
  }

  cout << prev << endl;

  return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s, t;
  cin >> s >> t;
  
  if (s == t.substr(0, s.size())) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 3652
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		cout<<(n-2)*180;
	}
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long x; 
  cin >> x;
  // // // // // // // // // // // // // // // ////////////
  cout << (x-1) / 11 * 2 + (x-1) % 11 / 6 + 1 << '\n';
  // // // // // // // // // // // // // // // ////////////
  // // // // // // // // // // // // // // // ////////////
  // // // // // // // // // // // // // // // ////////////
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
if N == 1 and A != B:
    print(0)
    exit()
elif N == 1:
    print(1)
    exit()
elif A > B:
    print(0)
    exit()
elif A == B:
    print(1)
    exit()

am = N - 2
# 最小
minv = A + B + am*A
# 最大
maxv = A + B + am*B
print(maxv - minv + 1)

Measured memory_bytes: 38384
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using lint = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define repn(i, a, b) for(int i = (a); i < (b); ++i)
#define rep_inv(i, n) for (int i = (n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define cend printf("\n")

//constexpr lint mod = 998'244'353LL;
constexpr lint Mod = 1000'000'007LL;
constexpr lint Inf = 4'500'000'000'000'000'007LL; //4.5e18+7
constexpr double Pi = 3.141592653589793;

template<class T> using prique     = priority_queue<T>;
template<class T> using prique_inv = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b; return true;
	}
	return false;
}
template<class T> bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b; return true;
	}
	return false;
}
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& rhs) { return is >> rhs.first >> rhs.second; }
template<class T, class U>inline ostream& operator<<(ostream& os, const pair<T, U>& rhs) { return os << "(" << rhs.first << ", " << rhs.second << ")"; }
template<class InputIterator> void arrin(InputIterator first, InputIterator last) { for (; first != last; ++first) cin >> (*first); }
template<class InputIterator> void arrout(InputIterator first, InputIterator last) {
	for (; first != last; ++first) {
		cout << (*first) << ((first + 1) != last ? " " : "\n");
	}
}

template<class T, class U> void print(const T& a, const U& b, bool f) {
	if (f) cout << a << "\n";
	else cout << b << "\n";
}

bool pri(lint x) { 
	for (lint i = 2; i * i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return 1 < x; 
}

lint fact[3000000];
void fact_init(lint n, lint m = Mod) {
	if (3000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1] % m;
	}
}

lint modpow(lint x, lint n, lint m = Mod) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % m;
		x = x * x % m;
		n >>= 1;
	}
	return res;
}

lint intpow(lint x, lint n) {
	lint res = 1;
	while (n > 0) {
		if (n & 1) res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

lint comb(lint n, lint r, lint m = Mod) {
	if (r == 0 || r == n) return 1;
	lint res = fact[n] * modpow(fact[n - r], m - 2, m) % m * modpow(fact[r], m - 2, m) % m;
	return res < 0 ? res + m : res;
}

map<lint, lint> factring(lint n) {
	map<lint, lint> res;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++res[i];
		}
	}
	if (n != 1) ++res[n];
	return res;
}

lint n, sum, ans;
lint a[2 * 100010];
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		ans -= a[i] * a[i];
		ans %= Mod;
		sum += a[i];
		sum %= Mod;
	}
	ans += sum * sum;
	ans %= Mod;

	if (ans < 0) ans += Mod;

	ans *= modpow(2, Mod - 2);
	ans %= Mod;

	cout << ans << endl;
}

Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    int n;
    int k = 1;
    cin >> n;
    int a[100000];
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    FOR(i, 1, n) if(a[i - 1] != a[i]) { k++; }
    cout << k + (k & 1) - 1 << endl;

    return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int m, d;
    cin >> m >> d;
    int d1, d10;
    int ans = 0;
    rep(i, m + 1){
        if(i == 0) continue;
        rep(j, d + 1){
            if(j < 10) continue;
            d1 = j % 10;
            d10 = j / 10;
            if(d1 * d10 == i && d1 >= 2 && d10 >= 2){
                ans++;
            }
        }
    }
    cout << ans << endl;
}


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

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

#ifdef __DEBUG__

template<typename T, typename U>
std::ostream& operator<<(std::ostream &os, const std::pair<T, U> &pair)
{
  os << pair.first << ": " << pair.second;
  return os;
}

template<class ForwardIterator>
std::ostream& _iterator_to_display(
  std::ostream &os, 
  ForwardIterator begin, ForwardIterator end, 
  const std::string &delim = ", "
)
{
  auto itr = begin;
  while (itr != end) {
    os << *itr;
    ++itr;
    if (itr != end) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  os << '[';
  _iterator_to_display(os, list.begin(), list.end());
  os << ']';
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &vector)
{
  os << '[';
  _iterator_to_display(os, vector.begin(), vector.end());
  os << ']';
  return os;
}

template<typename T, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::set<T> &set)
{
  os << '{';
  _iterator_to_display(os, set.begin(), set.end());
  os << '}';
  return os;
}

template<typename T, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::multiset<T> &set)
{
  os << '{';
  _iterator_to_display(os, set.begin(), set.end());
  os << '}';
  return os;
}

template<typename T, typename U, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::map<T, U> &map)
{
  os << '{';
  _iterator_to_display(os, map.begin(), map.end());
  os << '}';
  return os;
}

template<typename T, typename U, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::multimap<T, U> &map)
{
  os << '{';
  _iterator_to_display(os, map.begin(), map.end());
  os << '}';
  return os;
}

#define debug(var) std::cerr << #var" = " << var << std::endl

#endif /* __DEBUG__ */

int main(int argc, char **argv)
{
  std::string n;
  std::cin >> n;
  
  for (uint64_t i = 0; i < n.size(); ++i) {
    if (n[i] == '1') { n[i] = '9'; } else
    if (n[i] == '9') { n[i] = '1'; }
  }
  
  std::cout << n << std::endl;
  
  return 0;
}

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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
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;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& a, const T& b, const T& p, const T& q)
{ return p <=b && a <= q; }
#define MOD = 1000000007;
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

ll count_factor(ll f, ll n)
{
    ll x = 0;

    while (n % f == 0) {
        n /= f;
        x++;
    }
    return x;
}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    ll N; cin >>N;
    vector<ll> a(N); cin >> a;

    ll count = 0;
    rep(i, N) {
        count += count_factor(2, a[i]);
    }    

    cout << count << endl;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n;
li sum[1111];
li a[1111];
li k;
vector<bitset<44>> nums;
bool use[500550];

int main() {
    cin >> n >> k;
    sum[0] = 0;
    rin{
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    rep(i, n) {
        repp(j, i, n) {
            nums.pb(sum[j + 1] - sum[i]);
        }
    }

    li nn = sz(nums);
    rep(i, nn) {
        use[i] = true;
    }

    li res = 0;
    for (li keta = 43; keta >= 0; keta--) {
        li cnt = 0;
        rep(j, nn) {
            if (use[j] && nums[j][keta])cnt++;
        }
        if (cnt < k) {
            continue;
        }
        res += bit(keta);

        rep(j, nn) {
            if (use[j]) {
                use[j] = nums[j][keta];
            }
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a,b;
   cin >> a >> b;
   cout << (a+b-1)/b << '\n';
   return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int main() {
  int n, m;
  cin >> n >> m;
  
  dsu d(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    d.merge(a - 1, b - 1);
  }
  
  cout << d.groups().size() - 1 << endl;
  
  return 0;
}

Measured memory_bytes: 9016
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;

int main() {
	string s, s2;
	cin >> s >> s2;
	if (s2.length() != s.length() + 1) {
		cout << "No" << endl;

	}
	else {
		rep(i, s.length()) {
			if (s[i] != s2[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

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

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n){
    string s;
    cin >> s;
    mp[s]++;
  }

  cout << mp.size() << endl;

  return 0;
}


Measured memory_bytes: 19224
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;


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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>a>>b>>c>>d>>n;
    a*=4;
    b*=2;
    mini=min(a,b);
    mini=min(mini,c);
    if(mini*2>d&&n!=1){
        sum=n/2*d;
        if(n%2) sum+=mini;
    }else{
        sum=n*mini;
    }
    cout<<sum<<endl;
    return 0;
}


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

int main() {
	string str;
	cin >> str;
	for(int i=0; i<3; ++i)
	{
	    if(str[i]=='1') cout << 9;
	    else cout << 1;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double pi = acos(-1.0);
    long double x1 = a * sin((h * 30 + m / 2) * pi / 180);
    long double x2 = b * sin(m * 6 * pi / 180);
    long double y1 = a * cos((h * 30 + m / 2) * pi / 180);
    long double y2 = b * cos(m * 6 * pi / 180);
    cout << setprecision(15) << sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) << endl;
}

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

int main(){
  int n,d;
  cin >> n >> d;
  vector<vector<int>> v(n);
  for (int i=0; i<n; ++i){
    for (int j=0; j<d; ++j){
      int a;
      cin >> a;
      v[i].emplace_back(a);
    }
  }
  int cnt=0;
  for (int i=0; i<n; ++i){
    for (int j=i+1; j<n; ++j){
      double ans=0;
      for (int k=0; k<d; ++k){
        ans += abs(v[i][k]-v[j][k])*abs(v[i][k]-v[j][k]);
      }
      ans = sqrt(ans);
      if (ans-floor(ans) == 0) ++cnt;
    }
  }
  cout << cnt;
}


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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w; cin >> h >> w;
	int a[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> a[i][j];
		}
	}
	int ans=1e9;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			int res=0;
			for(int k=0;k<h;k++){
				for(int l=0;l<w;l++){
					res+=min(abs(k-i),abs(l-j))*a[k][l];
				}
			}
			ans=min(ans,res);
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 3220
s=input()
lhs=int(s[0])*10+int(s[1])
rhs=int(s[2])*10+int(s[3])
# print(lhs,rhs)
isLeftOK=(0<lhs<=12)
isRightOK=(0<rhs<=12)
if isLeftOK and isRightOK:
    print('AMBIGUOUS')
elif isLeftOK:
    print('MMYY')
elif isRightOK:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll p[100010], pos[100010];

int main(){
    int n;
    cin >> n;
    rep(i, n){
        cin >> p[i];
        pos[p[i]] = i+1;
    }

    multiset<ll> st= {0, 0, n+1, n+1};
    ll ans = 0;

    for(ll i = n; i > 0; i--){
        st.insert(pos[i]);
        auto it = st.lower_bound(pos[i]);
        auto l = prev(it);
        auto ll = prev(l);
        auto r = next(it);
        auto rr = next(r);
        ans += ((*l - *ll) * (*r - *it) + (*it - *l) * (*rr - *r)) * i;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int n, x, i, minm = INT_MAX, cnt = 0;
  cin >> n >> x;
  vector<int> m(n, 0);
  for (i = 0; i < n; ++i) {
    cin >> m[i];
    x -= m[i];
    minm = min(minm, m[i]);
  }
  while (x >= minm) {
    cnt++;
    x -= minm;
  }
  cout << n + cnt << endl;
}

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

int main()
{
    int a, b;
    string ans;
    cin >> a >> b;
    if (a <= b)
    {
        for (int i = 0; i < b; i++)
        {
            ans += to_string(a);
        }
    }
    else
    {
        for (int i = 0; i < a; i++)
        {
            ans += to_string(b);
        }
    }

    cout << ans << endl;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = (int)1e5 + 1000;
vpi g[maxn];
int ans[maxn], a, b, n;
 
void dfs(int pre, int co, int now) {
//	cerr << pre << " " << co << " " << now << endl;
	int c = 1;
	for (auto it : g[now]) {
		if (it.fi == pre) continue;
		if (co == c) ++c;
		ans[it.se] = c;
		dfs(now, c, it.fi);
		++c;
	}
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin);
#endif
	
	int max_bian = -1;
	cin >> n;
	forn(i, n - 1) {
		cin >> a >> b;
		g[a].pb({b, i});
		g[b].pb({a, i});
		max_bian = max(max_bian, int(g[a].size()));
		max_bian = max(max_bian, int(g[b].size()));
	}
	cout << max_bian << '\n';
	dfs(-1, -1, 1);
	forn(i, n - 1) {
		cout << ans[i] << '\n';
	}

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

Measured memory_bytes: 9344
main = do
  [_,a,b,c] <- map read . words <$> getLine
  ls        <- map read . lines <$> getContents
  print $ solve ls a b c 0 0 0

solve [] a b c a' b' c'	-- remainings, A,B,C, to make A, to make B, to make C
  | a'>0 && b'>0 && c'>0 = sum (map abs [a'-a, b'-b, c'-c]) - 30
  | otherwise            = 3000 -- greater than cost of 1,1,1 -> 1000,1000,1000
solve (x:xs) a b c a' b' c'
  = minimum [ solve xs a b c a' b' c' 			-- do not use next
            , solve xs a b c (a'+x) b' c' + 10	-- use next to make A
            , solve xs a b c a' (b'+x) c' + 10	-- use next to make B
            , solve xs a b c a' b' (c'+x) + 10 ]-- use next to make C

Measured memory_bytes: 1020
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	long long n,m,ans=1e18;
	cin>>n>>m;
	n%=m;
	for(register int i=1;i<=1000000000;i++)
	{
		ans=min(ans,n);
		n=abs(n-m);
	}
	cout<<ans;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL =long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 9; //924844033 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans,dp[20000], a[20000], b[20000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<Edge>vec[20000];
vector<edge>ed;
vector<LL>v;
map<string,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	cin >> s >> t;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	rep(i, n) {
		if (a[i] <= s)
			b[0]++;
		else if (a[i] <= t)
			b[1]++;
		else b[2]++;
	}
	cout << min({b[0],b[1],b[2]}) << endl;
	return 0;
}

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

int main() {
  int x;
  cin >> x;
  int y = x / 100;
  int z = (x - y * 100) /10;
  int a = x - y * 100  - z * 10;
  cout << y + z + a << endl;
    
}

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

using namespace std;

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


int main(void){
    int n, m;
    cin >> n >> m;
    vector<vector<int> > a(n, vector<int>(m));
    for(int i = 0; i < n; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int t;
            cin >> t;
            a[i][--t] = 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        int sum = 0;
        for(int j = 0; j < n; j++){
            if(a[j][i] == 1)sum++;
        }
        if(sum == n)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
int N, M;
Graph G;

void solve() {
    vector<int> dist(N, -1);
    vector<int> prev(N, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                prev[nv] = v;
                que.push(nv);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < N; ++i) cout << prev[i] + 1 << endl;
}

int main() {
    cin >> N >> M;
    G.assign(N, vector<int>());
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    solve();
}

Measured memory_bytes: 10588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    ll N;
    cin>>N;
    ll ans=0;
    ll G=0;
    rep(i,N+1){
        if(i==0){
            ans=2;
        }
        else if(i==1){
            G=1;
        }
        else{
            ll A=ans;
            ll B=G;
            G=A+B;
            ans=B;
        }
    }
    cout<<G<<endl;
}



Measured memory_bytes: 3528
import  math
n=int(input())

def dist(xi,yi,xj,yj):
    tmp= math.sqrt((xi-xj)**2+(yi-yj)**2)
    return tmp

tw=[]
for i in range(n):
    q,r=map(int,input().split())
    tw.append([q,r])

ans=0

for i in range(0,n-1):
    for j in range(i+1,n):
        f=dist(tw[i][0],tw[i][1],tw[j][0],tw[j][1])
        ans+=f

print(2*ans/n)

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

int main() {
	char ch;
  	vector<int> alpha(26);
  	while(cin>>ch){
    	if(isalpha(ch)){
        	for(int i=0;i<26;i++){
            	if(ch=='a'+i ||ch=='A'+i){
                	alpha.at(i)++;
                }
            }
        }
    
    }
  
  	for(int i=0;i<26;i++){
    	cout<<(char)('a'+i)<<" : "<<alpha.at(i)<<endl;
    }
}	


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
#define int 		long long
#define vi 			vector<int>
#define vec(x) 		vector<x>
#define matrix 		vector<vector<int>>
#define pii 		pair<int,int>
#define rep(i,s,e)  for(int i=s;i<e;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define MOD			1000000007
#define pb 			push_back
#define ff 			first
#define ss 			second		
#define w(x)		int x; cin>>x; while(x--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k-1)  returns iterator to kth element starting from 0; Returns the kth smallest element
// order_of_key(k) returns count of elements strictly smaller than k;Returns the number of elements less than k
// erase,insert same as normal set

const int mxn=1e5+13;
int n,k;

int h[mxn];
int dp[mxn];

int func(int idx){
	if(idx>=n) return 0;

	if(dp[idx]!=-1) return dp[idx];

	int ans=1e18;

	if(idx<n-1){
		for(int i=1;i<=k && idx+i<=n-1;i++){
			ans=min(ans,abs(h[idx+i]-h[idx])+func(idx+i));
		}
	}
	else if(idx==n-1){
		ans=0;
	}

	return dp[idx]=ans;
}

void solve(){
	cin>>n>>k;

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

	memset(dp,-1,sizeof(dp));

	int ans=func(0);
	//if(ans==1e18) ans=0;

	// for(int i=0;i<n;i++){
	// 	trace(dp[i]);
	// }

	cout<<ans<<endl;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
// #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 6528
import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
auto solve(string s_) {
    immutable P = "Possible";
    immutable I = "Impossible";
    immutable N = s_.to!int();
    immutable a = readln.split.map!(to!int).array();
    auto c = new int[N];
    foreach(v;a) {
        if(v<1 || N<=v) return I;
        ++c[v];
    }
    int n=0, d;
    foreach(int i,v;c) {
        if(n==0) {
            if(v>2) return I;
            d=i-(v-1);
        }
        else {
            if(v<2) return I;
            if(--d<0) return I;
        }
        n+=v;
        if(n==N && d==0) return P;
    }
    return I;
}
void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main(){
	int H = 0;
	int W = 0;
	while (1)
	{
		cin >> H >> W;
		if (H == 0 && W == 0)
		{
			break;
		}
		for (int i = 0; i < W; i++)
		{
			cout << "#";
		}
		cout << "\n";
		for (int i = 0; i <H-2; i++)
		{
			cout << "#";
			for (int j = 0; j < W - 2; j++)
			{
				cout << ".";
			}
			cout << "#";
			cout << "\n";
		}
		for (int i = 0; i < W; i++)
		{
			cout << "#";
		}
		cout << "\n" << "\n";
	}
	return 0;
}


Measured memory_bytes: 3068
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    use std::collections::HashMap;
    let mut map: HashMap<usize, usize> = HashMap::new();
    map.insert(0, 1);
    for _ in 0..N {
        let entry = map.entry(read()).or_insert(0);
        *entry += 1;
        if *entry >= 3 {
            println!("0");
            return;
        }
    }
    let mut vec: Vec<(usize, usize)> = vec![];
    for v in map {
        vec.push(v);
    }
    let mins = dfs(0, &vec, vec![], vec![]);
    println!("{}", mins.iter().max().unwrap());
}

fn dfs(
    depth: usize,
    vec: &[(usize, usize)],
    now_times: Vec<usize>,
    mins: Vec<usize>,
) -> Vec<usize> {
    if depth == vec.len() {
        let mut now_times = now_times;
        now_times.sort();
        now_times.push(24);
        let min = now_times
            .windows(2)
            .fold(1000, |acc, v| std::cmp::min(acc, (v[1] - v[0]) % 24));
        let mut mins = mins;
        mins.push(min);
        return mins;
    }
    let v = vec[depth].0;
    let count = vec[depth].1;
    if count == 2 {
        let mut now_times = now_times;
        now_times.push(v);
        now_times.push(24 - v);
        dfs(depth + 1, vec, now_times, mins)
    } else {
        let mut now_times_mut = now_times.clone();
        now_times_mut.push(v);
        let mins1 = dfs(depth + 1, vec, now_times_mut, mins.clone());
        let mut now_times_mut = now_times;
        now_times_mut.push(24 - v);
        let mins2 = dfs(depth + 1, vec, now_times_mut, mins);
        [mins1, mins2].concat()
    }
}


Measured memory_bytes: 4352
import math  # noqa: F401
from typing import Dict, List, Optional, Tuple, Union  # noqa: F401


def main(S: str, T: str):
    ans = 0
    for s, t in zip(list(S), list(T)):
        if s != t:
            ans += 1
    print(ans)


if __name__ == "__main__":
    S = input()
    T = input()
    main(S, T)


Measured memory_bytes: 13628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int t = sc.nextInt();
		int ans = 0;

		if(t <= X) {
			ans = X - t ;
		} else {
			ans = 0;
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main () {
  int a[4];
  string key = "0123456789";
  for (int i = 0; i < 4; i ++) {
    char c;
    cin >> c;
    for (int j = 0; j < 10; j ++) {
      if (c == key[j]) a[i] = j;
    }
  }
  //4桁の数字を1桁ずつに分解
  for (int i = 0; i < 1 << 3; i ++) {
    int i_ = i;
    char c[3];
    int as_ = a[0];//数字に対応した数式の結果
    for (int j = 0; j < 3; j ++) {
      if (i_ % 2) { //i_ % 2 != 0と同値
        c[j] = '+';
        as_ += a[j + 1];
      }
      else {
        c[j] = '-';
        as_ -= a[j + 1];
      }
      i_ /= 2;
    }
    if (as_ == 7) {
      for (int j = 0; j < 3; j ++) cout << a[j] << c[j];
      cout << a[3] << "=7" << endl;
      return 0;//強制終了
    }
  }
}



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

#define INF 99990000

int main()
{
	int N,M,HP[100];
	while(cin >> N, N)
	{
		for(int i=0; i<N; i++)
			cin >> HP[i];
			
		cin >> M;
		int ss[100], as[100],sd[100],ad[100],sn=0,an=0;
		for(int i=0; i<M; i++)
		{
			string n,t;
			int m,d;
			cin >> n >> m >> t >> d;
			if(d==0) continue;
			
			if(t=="All")
			{
				as[an]=m;
				ad[an]=d;
				an++;
			}
			else
			{
				ss[sn]=m;
				sd[sn]=d;
				sn++;
			}
		}
		
		int shp[100001], ahp[100001];
		for(int i=0; i<=100000; i++)
		{
			shp[i]=INF;
			ahp[i]=INF;
		}
		shp[0]=0; ahp[0]=0;
		for(int i=0; i<sn; i++)
		for(int j=0; j<=100000; j++)
		{
			if(shp[j]==INF) continue;
			if(j+sd[i]>100000)
			{
				shp[100000]=min(shp[100000], shp[j]+ss[i]);
			}
			else shp[j+sd[i]]=min(shp[j+sd[i]], shp[j]+ss[i]);
		}
		
		for(int i=100000-1; i>=0; i--)
			shp[i]=min(shp[i+1], shp[i]);
		
		for(int i=0; i<an; i++)
		for(int j=0; j<=100000; j++)
		{
			if(ahp[j]==INF) continue;
			if(j+ad[i]>100000) 
			{
				ahp[100000]=min(ahp[100000], ahp[j]+as[i]);
			}
			else ahp[j+ad[i]]=min(ahp[j+ad[i]], ahp[j]+as[i]);
		}
		
		int ans=INF;
		for(int i=0; i<=100000; i++)
		{
			if(ahp[i]==INF) continue;
			int tmp=ahp[i];
			
			bool g=true;
			
			for(int j=0; j<N; j++)
			{
				if(i>=HP[j]) continue;
				if(shp[HP[j]-i]==INF) g=false;
				tmp+=shp[HP[j]-i];
			}
			if(!g) continue;
			
			ans=min(ans, tmp);
		}
		
		cout << ans << endl;
		
	}
}

Measured memory_bytes: 1704
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main()
{
	char word[10];
	char text[1002];
	int i,count = 0;
	
	scanf("%s",word);

	
	while(1){
		scanf("%s",text);
		
	    if(strcmp(text,"END_OF_TEXT") == 0)
			break;
		for(i = 0; word[i] != '\0'; i++)
   			word[i] = tolower(word[i]);
		
			
		for(i = 0; text[i] != '\0'; i++)
   			text[i] = tolower(text[i]);
	
	   if(strcmp(text,word) == 0 )
			count++;
	}
		printf("%d\n",count);
return 0;
}


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

#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

#define Debug(x) cout<<(#x)<<" >> "<<(x)<<endl

using namespace std;

ll fastpow(ll angka,ll pangkat,ll MOD){
	ll res=1;
	while(pangkat){
		if(pangkat&1) res=(res*angka)%MOD;
		angka=(angka*angka)%MOD;
		pangkat=pangkat>>1;
	}
	return res;
}

ll fastpow(ll angka,ll pangkat){
	ll res=1;
	while(pangkat){
		if(pangkat&1) res=(res*angka);
		angka=(angka*angka);
		pangkat=pangkat>>1;
	}
	return res;
}

ll gcd(ll angka1,ll angka2){
	while(angka2){
		swap(angka1,angka2);
		angka2=angka2%angka1;
	}
	return angka1;
}

ll lcm(ll angka1,ll angka2){
	return (angka1/gcd(angka1,angka2))*angka2;
}



void solve(){
	int n;
	cin>>n;
	
	if(n%2==0 || n%5==0){
		cout<<-1<<endl;
		return;
	}
	
	int val=0;
	int ct=0;
	while(true){
		ct++;
		val=val*10+7;
		if(val%n==0){
			cout<<ct<<endl;
			return;
		}
		val=val%n;
	}
	
}

int main(){
	
	fastio();
	
	int t=1;
//	cin>>t;
	
	for(int tt=0;tt<t;tt++){
//		cout<<"Case #"<<tt+1<<": ";solve();
//		if(solve()) cout<<""<<endl;
		solve();
	}
	
	return 0;
}




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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	Real R; cin >> R;
	dcout << R*2.0*pi << ln;
}

Measured memory_bytes: 3812
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<pi, null_type,greater<pi>, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
    int n;
    cin >> n;
    lli a[n], b[n];
    for(int i=0; i<n; i++)cin >> a[i] >> b[i];
    sort(a, a+n);
    sort(b, b+n);
    if(n%2){
        cout << b[n/2]-a[n/2]+1 << endl;
    }
    else{
        lli x, y;
        x = b[n/2]+b[(n/2)-1];
        y = a[n/2]+a[(n/2)-1];
        cout << x-y+1 << "\n";
    }

    return 0;
}


Measured memory_bytes: 6760
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	ll N, K;
	cin >> N >> K;
	ll rsl = 0;
	if(K == 0) {
		cout << 1ll * N * N << endl;
		return 0;
	}
	rep(b, K, N + 1) {
		rsl += max((N / b) * (b - K), 0ll) + max(N % b - K + 1, 0ll);
	}

	cout << rsl << endl;
}


Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  int t = x/d;
  int s = min(t,k);
  x-=(s*d);
  k-=s;
  int ans = 1e18;
  if(k%2){
    ans = min(abs(x-d),abs(x+d));
    cout << ans << endl;
  }
  else {
    cout << x << endl;
  }

return 0;
}
///....


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define usi unsigned short int
#define F first
#define S second
#define mp make_pair
#define pb push_back

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e6 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

int ida = INF, idz;                
string st;
                        
int main(){
	cin >> st;
	for (int i = 0; i < st.size(); i++){
		if (st[i] == 'A')
			ida = min(ida, i);
		if (st[i] == 'Z')
			idz = max(idz, i);
	}      
	cout << idz - ida + 1;
	return 0;
}

Measured memory_bytes: 768
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int T, X; cin >> T >> X;
    double res = (double)T / (double)X; 
    printf("%.15lf\n", res);
}


Measured memory_bytes: 256