akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int h, w, sy, sx, a[4], b[4];
bool check() {//ダメならtrue
    if (sx <= a[0] - b[1])return true;
    if (w - sx + 1 <= a[1] - b[0])return true;
    if (sy <= a[2] - b[3])return true;
    if (h - sy + 1 <= a[3] - b[2])return true;
    return false;
}
void adj() {
    if(a[0] >= b[1]) {
        a[0] -= b[1];
        b[1] = 0;
    }
    if(a[1] >= b[0]) {
        a[1] -= b[0];
        b[0] = 0;
    }
    if(a[2] >= b[3]) {
        a[2] -= b[3];
        b[3] = 0;
    }
    if(a[3] >= b[2]) {
        a[3] -= b[2];
        b[2] = 0;
    }
    chmin(b[0], sx - 1);
    chmin(b[1], w - sx);
    chmin(b[2], sy - 1);
    chmin(b[3], h - sy);
}

int main() {
    init();

    int n; cin >> h >> w >> n >> sy >> sx;
    string s, t; cin >> s >> t;

    bool ans = true;
    map<char, int> map = { {'L',0},{'R',1},{'U',2},{'D',3} };
    FOR(i, 0, n) {
        ++a[map[s[i]]];
        if (check()) {
            cout << "NO\n";
            return 0;
        }
        ++b[map[t[i]]];
        adj();
    }
    cout << "YES\n";
}


Measured memory_bytes: 920
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string s[55];
    ll t[55];
    rep(i,0,N) cin >> s[i] >> t[i];
    string X;
    cin >> X;
    ll ans = 0;
    bool cnt = false;
    rep(i,0,N){
        if(s[i] == X){
            cnt = true;
        }else{
            if(cnt == true){
                ans += t[i];
            }
        }
    }
    print(ans);

    

}

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

int main(void)
{
    char ch;
    while(1) {
        scanf("%c", &ch);
        if (ch == '\n') break;

        if ('a' <= ch && ch <= 'z') ch -= 32;
        else if('A' <= ch && ch <= 'Z') ch += 32;

        cout <<ch;

    }
    printf("\n");
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
int n,a; string s;
void solve(int b){
    if(a == n) cout << s << endl;
    else for(int i=0; i<=b; i++){
        s.push_back((char)('a'+i)); a++;
        solve(max(b,i+1));
        s.pop_back(); a--;
    }
}
int main(){ cin >> n; solve(0); }

Measured memory_bytes: 3584
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    ll ans = N;
    rep(i, N+1) {
        ll cnt = 0;
        ll t = i;
        while(t > 0) cnt += t % 6, t /= 6;
        t = N - i;
        while(t > 0) cnt += t % 9, t /= 9;
        ans = min(ans, cnt);
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N, arr[100000];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	lint minv = N, maxv = 0;
	REP(i, N) {
		cin >> arr[i];
		chmax(maxv, arr[i]);
		chmin(minv, arr[i]);
	}
	if (maxv - minv > 1) {
		cout << "No" << endl;
		return 0;
	}
	if (maxv == minv) {
		if (maxv == N - 1) {
			cout << "Yes" << endl;
			return 0;
		}
		else if (N % maxv == 0) {
			cout << "Yes" << endl;
			return 0;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}

	lint soro = 0, par = 0;
	REP(i, N) {
		if (arr[i] == minv) {
			soro++;
		}
		else {
			par++;
		}
	}
	if (soro + 1 <= maxv && maxv <= soro + par / 2) {
		cout << "Yes" << endl;
		return 0;
	}
	else {
		cout << "No" << endl;
		return 0;
	}
}


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

using namespace std;

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

int main() {
	int N, T;
	cin >> N >> T;
	int c, t, ans = INT_MAX;
	rep(_, N) if(cin>>c>>t, t<=T) ans=min(ans, c);
	if(ans < INT_MAX) cout << ans << endl;
	else cout << "TLE" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int H,W;
    cin >> H >> W;
    ve<string> S(H);
    in(H,S);
    rep(i,H) S[i] += '#';
    S.pb(string(W,'#'));
    ve<vi> A(H,vi(W,-1));
    ve<vi> B(H,vi(W,-1));
    
    
    rep(i,H){
        int s = -1;
        rep(j,W+1){
            if(S[i][j] == '#'){
                reps(k,s+1,j) A[i][k] = max(0,j-s-1);
                s = j;
            }
        }
    }
    rep(i,W){
        int s = -1;
        rep(j,H+1){
            if(S[j][i] == '#'){
                reps(k,s+1,j) B[k][i] = max(0,j-s-1);
                s = j;
            }
        }
    }
    
    //outmat(A);
    //cout << " " << endl;
    //outmat(B);

    int ans = 0;
    rep(i,H) rep(j,W){
        if(A[i][j] > 0 && B[i][j] > 0){
            ans = max(ans, A[i][j]+B[i][j]-1);
        }
    }
    
    cout << ans << endl;
    
    

    return 0;
}


Measured memory_bytes: 35840
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-6;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }

// (Integer/Long).bitCount(x)
int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << h; if (sizeof...(t)) cerr << ", "; DBG(t...); }

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}

// Binary Exponentiation
ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }



void solve(int tcn) {
	int n, m, k, ans = 0;
	cin >> n >> m >> k;
	vector<ll> a(n), b(m);
	F0R(i, n) cin >> a[i];
	F0R(i, m) cin >> b[i];
	if (b[0] <= k) ans = 1;
	FOR(i, 1, m) {
		b[i] += b[i-1];
		if (b[i] <= k) {
			ans = i + 1;
		}
	}
	ll sum = 0LL;
	F0R(i, n) {
		sum += a[i];
		if (sum > k) break;
		else {
			int lo = 0, hi = m - 1;
			while (lo < hi - 1) {
				int mi = (lo + hi + 1) / 2;
				if (b[mi] + sum > k) {
					hi = mi - 1;
				}
				else {
					lo = mi;
				}
			}
			while (lo < m - 1 && b[lo + 1] + sum <= k) ++lo;
			if (b[0] + sum > k) {
				ckmax(ans, i + 1);
			}
			else {
				ckmax(ans, lo + i + 2);
			}
		}
	}
	cout << ans << nl;
}

int main() {
    setIO();

    int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 6364
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <ll MOD>
class Combination {
    ll N;
    V<ll> factv, ifactv;

public:
    Combination<MOD>(ll N) : N(N), factv(N + 1, 1), ifactv(N + 1) {
        for(ll i = 1; i <= N; i++) factv[i] = factv[i - 1] * i % MOD;
        ifactv.back() = inv(factv.back());
        for(ll i = N - 1; 0 <= i; i--) ifactv[i] = (i + 1) * ifactv[i + 1] % MOD;
    }

    ll fact(ll n) { return factv[n]; }

    ll ifact(ll n) { return ifactv[n]; }

    ll pow(ll a, ll b) { return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1; }

    ll inv(ll a) { return pow(a, MOD - 2); }

    ll comb(ll n, ll k) { return factv[n] * ifactv[n - k] % MOD * ifactv[k] % MOD; }
};

const ll mod = 1e9 + 7;
Combination<mod> C(3e6);

ll calc(ll r, ll c) {
    return (C.comb(r + c, r) + mod - 1) % mod;
}

int main() {
    ll r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    r2++; c2++;
    ll ans = 0;
    ans += calc(r2, c2);
    ans += mod - calc(r1, c2);
    ans += mod - calc(r2, c1);
    ans += calc(r1, c1);
    cout << ans % mod << endl;
    return 0;
}


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

// macro
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ll unsigned long long
#define FOR(i, m, n) for(ll i = m;i < n;i++)

using namespace std;

// Factorial
// need init
ll factorial_memo[5001];
ll factorial(ll n) {
  factorial_memo[0] = 1;
  if(factorial_memo[n] != -1) return factorial_memo[n];
  factorial_memo[n] = (factorial(n-1) * n) % MOD;
  return factorial_memo[n];
}

// Combination(nCr)
// need init
ll nCr_memo[5001][5001];
ll nCr(ll n, ll r) {
  if(r*2 > n) r = n-r;
  if(r == 1) return n;
  if(r == 0) return 1;
  if(nCr_memo[n][r] != -1) return nCr_memo[n][r];
  nCr_memo[n][r] = (nCr(n-1, r) + nCr(n-1, r-1)) % MOD;
  return nCr_memo[n][r];
}

void solve() {
  map<int, int> mp;
  int N,M,t;
  cin >> N;
  REP(i, N) {
    cin >> t;
    if(mp.find(t) == mp.end()) {
      mp[t] = 0;
    }
    mp[t]++;
  }
  cin >> M;
  bool isValid = true;
  REP(i, M) {
    cin >> t;
    if(mp.find(t) == mp.end()) {
      isValid = false;
    } else {
      mp[t]--;
      if(mp[t] < 0) isValid = false;
    }
  }
  if(isValid) cout << "YES\n";
  else cout << "NO\n";
}

int main() {
  // init
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 9600
#include <iostream>
#include <vector>
// #include <string>

using namespace std;

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

int main(void)
{
  int n, k;
  cin >> n >> k;
  vec<int> d(10, 0);
  rep(i, k) {
    int get;
    cin >> get;
    d[get] = 1;
  }

  while(1) {
    string get = to_string(n);
    int flag = 1;
    rep(i, get.length()) if (d[get[i] - '0']) flag = 0;
    if (flag) break;
    n++;
  }

  cout << n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100005],mp[100005];
int main (){
       int n;
       cin >> n;
       
       for (int i = 1; i <= n; i++)
              cin >> a[i],mp[a[i]]++;
       
       for (int i = 1; i <= n; i++){
              if (mp[i] != 2 && mp[i] > 0) {cout<<0; return 0;}
              if (n%2==1 && mp[i] > 0 && i%2==1) {cout<<0; return 0;}
              if (n%2==0 && mp[i] > 0 && i%2 == 0) {cout<<0; return 0;}
       }
       int ans = 1;
       for (int i = 1; i <= n/2; i++)
              ans*=2,ans%=1000000007;
              
       cout<<ans;
}

Measured memory_bytes: 1024
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
l, r = [0] * n, [0] * n

for i in range(n-1):
    l[i+1] = gcd(l[i], a[i])
for i in range(1, n)[::-1]:
    r[i-1] = gcd(r[i], a[i])

ans = 1
for i in range(n):
    ans = max(ans, gcd(l[i], r[i]))

print(ans)


Measured memory_bytes: 16124
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<vector<int>> H;
    rep(i, 0, N) { H.push_back({0, 0}); }
    int tmp = S[0] - '0';
    H[0][0] = 1;
    int tmpIdx = 0;
    int ind = 1;
    while (ind < N)
    {
        int si = S[ind] - '0';
        if (tmp == si)
        {
            H[tmpIdx][0]++;
            if (tmp == 1)
            {
                H[tmpIdx][1] = 1;
            }
        }
        else
        {
            H[tmpIdx + 1][0]++;
            if (tmp == 1)
            {
                H[tmpIdx][1] = 1;
            }
            tmpIdx++;
            tmp = si;
        }
        ind++;
    }
    int kukansu = tmpIdx + 1;
    int ruisekiwa[kukansu];
    rep(i, 0, kukansu)
    {
        if (i == 0)
        {
            ruisekiwa[i] = H[i][0];
        }
        else
        {
            ruisekiwa[i] = ruisekiwa[i - 1] + H[i][0];
        }
        //cout << ruisekiwa[i] << endl;
    }
    int kukanlong = 2 * K + 1;
    int max = 0;
    rep(i, 0, kukansu)
    {
        if (kukanlong > kukansu)
        {
            max = ruisekiwa[kukansu - 1];
            break;
        }
        int sum;
        bool henkou = false;
        if (i == 0)
        {
            if (H[0][1] == 0)
            {
                sum = ruisekiwa[kukanlong - 2];
            }
            else
            {
                sum = ruisekiwa[kukanlong - 1];
            }
        }
        else
        {
            if (H[i][1] == 0)
            {
                if (i + kukanlong - 2 > kukansu - 1)
                {
                    sum = ruisekiwa[kukansu - 1] - ruisekiwa[i - 1];
                }
                else
                {
                    sum = ruisekiwa[i + kukanlong - 2] - ruisekiwa[i - 1];
                }
            }
            else
            {
                if (i + kukanlong - 1 > kukansu - 1)
                {
                    sum = ruisekiwa[kukansu - 1] - ruisekiwa[i - 1];
                }
                else
                {
                    sum = ruisekiwa[i + kukanlong - 1] - ruisekiwa[i - 1];
                }
            }
        }
        //cout << "sum:" << sum << endl;
        if (max < sum)
        {
            max = sum;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 6964
import java.io.*;
import java.util.*;
//import java.util.Map.Entry;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        long MOD = (long) (Math.pow(10, 9) + 7);
        int n = sc.nextInt();
        int array[] = new int[100001];
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            array[x]++;
            array[x + 1]++;
            max = Math.max(max, Math.max(array[x], array[x + 1]));
            if (x > 0) {
                array[x - 1]++;
                max = Math.max(max, Math.max(array[x], array[x - 1]));
            }
        }
        System.out.println(max);
        bw.flush();
    }
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//

    static class Pair implements Comparable<Pair> {

        int a, b;

        public Pair(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(Pair p) {
            return a - p.a;
        }
    }

    static void forl_0(int n, int[] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void forl_1(int n, int[] array, Scanner sc) {
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void two_d(int n, int m, int[][] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                array[i][j] = sc.nextInt();
            }
        }
    }

    static boolean isPrime(long n) {
        if (n < 2) {
            return false;
        } else if (n == 2 || n == 3) {
            return true;
        } else if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        long sqrtN = (long) Math.sqrt(n) + 1;
        for (long i = 6L; i <= sqrtN; i += 6) {
            if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                return false;
            }
        }
        return true;
    }

    public static long gcd(long a, long b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }
}


Measured memory_bytes: 61000
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


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

    int ans = 0;
    while(1){
        if(n < pow(k, ans)) break;
        ans++;
    }

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


Measured memory_bytes: 4100
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	sw := make([][]int, M)
	for i := 0; i < M; i++ {
		var k int
		fmt.Scan(&k)
		sw[i] = make([]int, k)
		for j := 0; j < k; j++ {
			fmt.Scan(&sw[i][j])
			sw[i][j]-- // 0-indexed
		}
	}
	p := make([]int, M)
	for i := range p {
		fmt.Scan(&p[i])
	}
	// N個のスイッチのon/offパターンを全列挙する
	ans := 0
	for bits := 0; bits < (1 << uint(N)); bits++ {
		cnt := 0
		// このビットパターンの時に何個の電球がつくか？
		for i := 0; i < M; i++ { // i番目の電球がつくか？
			on := 0
			for j := 0; j < len(sw[i]); j++ { // i番目の電球にはsw[i]個のスイッチがある
				if (bits & (1 << uint(sw[i][j]))) != 0 { // sw[i][j]のスイッチがonになっている
					on++
				}
			}
			if on%2 == p[i] { // onになっているスイッチの数を2で割ったあまりがp[i]に等しい時電球がつく
				cnt++
			}
		}
		if cnt == M { // 全ての電球が点灯している
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
a,b,c = map(int, input().split())

if (a == b and b == c):
    print(1)
elif (a == b and a!=c):
    print(2)
elif (a == b and b!=c):
    print(2)
elif (a == c and a!=b):
    print(2)
elif (a == c and c!=b):
    print(2)
elif (b == c and b!=a):
    print(2)
elif (b == c and c!=a):
    print(2)
else:
    print(3)

Measured memory_bytes: 3064
N,M = map(int,input().split())

G = [[] for i in range(N)]

for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

ans = "NO" if any(len(g)%2 for g in G) else "YES"

print(ans)


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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

ll gcd(ll x, ll y){
	if(y == 0) return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y){
	return x*y / gcd(x,y);
}
ll n, m, a[100001], d[100001];
string s[101];
ll cnt = INF;

int main(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	if(n == 1){
		cout << abs(m-a[0]);
		return 0;
	}
	a[n] = m;
	sort(a, a+n+1);
	for(int i = 1; i < n+1; i++){
		d[i-1] = a[i] - a[i-1];
	}
	
	for(int i = 0; i < n-1; i++){
		cnt = min(cnt, gcd(d[i+1], d[i]));
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    map<int,int> mp;
    int n;
    cin >> n;
    int a;
    rep(i,n-1) {
        cin >> a;
        a--;
        mp[a];
        mp[a]++;
    }
    rep(i,n) {
        mp[i];
        cout << mp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13024
import sys

x = int(sys.stdin.readline().rstrip())

def main():
    l = 0
    r = x + 1
    while l + 1 < r:
        m = (l + r) // 2
        if (1 + m) * m // 2 >= x:
            r = m
        else:
            l = m
    return r

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3060
n,m = map(int, input().split())
ac = [0] * (n+1)
wa = [0] * (n+1)
ans = [0, 0]

for i in range(m):
    p,s = map(str, input().split())
    p = int(p)-1
    
    if ac[p] == 1:
        continue
    elif s == "WA":
        wa[p] +=1
    else:
        ans[0] += 1
        ans[1] += wa[p]
        ac[p] += 1
print(*ans)

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

enum{A,B,C,D,E,U};
vector<int>S[6];

int P;
string Expr;

vector<int> calculate(vector<int>A,vector<int>B,char op){
  vector<int>res(A.size()+B.size());
  vector<int>::iterator x;
  switch(op){
  case 'u':
    x=set_union(A.begin(),A.end(),B.begin(),B.end(),res.begin());
    break;
  case 'i':
    x=set_intersection(A.begin(),A.end(),B.begin(),B.end(),res.begin());
    break;
  case 'd':
    x=set_difference(A.begin(),A.end(),B.begin(),B.end(),res.begin());
    break;
  case 's':
    x=set_symmetric_difference(A.begin(),A.end(),B.begin(),B.end(),res.begin());
    break;
  }
  res.erase(x,res.end());
  return res;
}

vector<int>equation();
vector<int>term();

vector<int>equation(){
  vector<int>res=term();
  char op;
  while(1){
    op=Expr[P];
    if(op!='u'&&op!='i'&&op!='d'&&op!='s')break;
    P++;
    vector<int>res2=term();
    res=calculate(res,res2,op);
  }
  return res;
}
vector<int>term(){
  vector<int>res;
  switch(Expr[P++]){
  case 'c':
    res=calculate(S[U],term(),'d');
    break;
  case '(':
    res=equation();
    P++;
    break;
  default:
    res=S[Expr[P-1]-'A'];
    break;
  }
  return res;
}

int main()
{
  char name;
  int number,element;
  while(cin>>name>>number){
    do{
      for(int i=0;i<number;i++){
        cin>>element;
        S[name-'A'].push_back(element);
        S[U].push_back(element);
      }
    }while(cin>>name>>number,name!='R');
    for(int i=0;i<6;i++){
      sort(S[i].begin(),S[i].end());
      S[i].erase(unique(S[i].begin(),S[i].end()),S[i].end());
    }
    cin>>Expr;
    P=0;
    vector<int>ans=equation();
    vector<int>::iterator x;
    if(ans.empty()){
      cout<<"NULL"<<endl;
    }else{
      for(x=ans.begin();x!=ans.end();x++){
        if(x!=ans.begin())cout<<" ";
        cout<<*x;
      }
      cout<<endl;
    }
    for(int i=0;i<6;i++)S[i].clear();
  }
}

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

using namespace std;
 
int main() {
	int n;
	cin>>n;
	vector<long long> a(n+1);
	long long sum=0;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
		sum+=a[i];
	}
	
	int q;cin>>q;
    long long p, x;
	while(q--)	{
		cin>>p>>x;
		cout<< sum - a[p] + x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#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>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;

const int mod = 1000000007;
struct mint {
    ll x;
    mint(ll 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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
 
int main() {
    int n;
    cin >> n;
    vector<mint> a(n);
    vector<mint> cum_sum(n);
    rep(i,n) { 
        cin >> a[i];
        cum_sum[i] = a[i];
    }
    mint res = 0;
    for (int i = 1; i < n; ++i) cum_sum[i] += cum_sum[i-1];
    rep(i,n-1) {
        res += a[i] * (cum_sum[n-1] - cum_sum[i]);
    } 
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6344
N, K = map(int, input().split())
d = []
a = []

havesweet = []
for num in range(N):
  havesweet.append(0)

for num in range(K):
  d.append(int(input()))
  a.append(list(map(int, input().split())))
  
  for having in a[num]:
    havesweet[having-1] += 1	#入力は1から->0からにする

result = 0
for having in havesweet:
  if having == 0:
    result += 1

print(result)

Measured memory_bytes: 9200
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;

typedef long long ll;
const int MAXN=2e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int n,X,Y,ans;
int a[MAXN],b[MAXN],vis[MAXN],cnt[MAXN];
int mine[MAXN],pos[MAXN];
vector<int> E[MAXN];

void dfs(int u){
    vis[u]=1;
    for(int i=0;i<(int)E[u].size();i++){
        int v=E[u][i];
        if(vis[v]) continue;
        dfs(v);
    }
}

ll fac[MAXN],inv[MAXN];
void Init(){
    fac[0]=1;
    for(int i=1;i<MAXN;i++) fac[i]=fac[i-1]*i%MOD;
    inv[1]=1;
    for(int i=2;i<MAXN;i++) inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
    inv[0]=1;
    for(int i=1;i<MAXN;i++) inv[i]=inv[i]*inv[i-1]%MOD;
}

ll C(ll x,ll y){
    if(x<y) return 0;
    return 1ll*(fac[x]*inv[y]%MOD)*inv[x-y]%MOD;
}

void addedge(int u,int v){
    E[u].push_back(v);
    E[v].push_back(u);
}

int main(){
    //freopen("colorball.in","r",stdin);
    //freopen("colorball.out","w",stdout);

    Init();
    memset(mine,0x3f,sizeof mine);
    scanf("%d%d%d",&n,&X,&Y);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i],&b[i]);
        if(mine[a[i]]>b[i]){
            mine[a[i]]=b[i];
            pos[a[i]]=i;
        }
    }
    for(int i=1;i<=n;i++)
        if(pos[a[i]]!=i&&b[i]+mine[a[i]]<=X)
            addedge(i,pos[a[i]]);
    int min1,min2,p1,p2,c1,c2;
    min1=min2=INF;
    for(int i=1;i<=n;i++)
        if(b[i]<min1)
            min1=b[i],p1=i,c1=a[i];
    for(int i=1;i<=n;i++)
        if(b[i]<min2&&a[i]!=c1)
            min2=b[i],p2=i,c2=a[i];
    for(int i=1;i<=n;i++){
        if(p1==i) continue;
        if(a[i]!=c1&&b[i]+min1<=Y)
            addedge(i,p1);
        if(min2!=INF&&a[i]!=c2&&b[i]+min2<=Y)
            addedge(i,p2);
    }
    dfs(p1);
    ll tot=0,ans=1;
    for(int i=1;i<=n;i++)
        if(vis[i])
            cnt[a[i]]++,tot++;
    for(int i=1;i<=n;i++){
        if(!cnt[i]) continue;
        ans=1ll*ans*C(tot,cnt[i])%MOD;
        tot-=cnt[i];
    }
    printf("%lld",ans);

    fclose(stdin);
    fclose(stdout);
}


Measured memory_bytes: 19952
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7,INF=1e18;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    // cin>>t;
    while(t--)
    {
        int c1=0,n;
        string s;
        cin>>s;
        n=s.size();
        for(int i=0;i<s.size();i++)
        if(s[i]=='g')
        c1++;
        cout<<c1-(n+1)/2<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3756
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	
	static String collectStr = "CODEFESTIVAL2016";

	public static void main(String[] args) throws Exception {
		long start = System.currentTimeMillis();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int cnt = 0;
		for (int i=0; i<line.length(); i++) {
			if (collectStr.charAt(i) != line.charAt(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
		long end = System.currentTimeMillis();
		//System.out.println((end-start) + "ms");
	}

}


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

using namespace std;
#define debug(x) cout<<#x<<"-"<<x<<"\n"
#define time_assert(x) if(!(x))while(true)
#define fi first
#define se second
#define int long long
#define inf 1e16
const int mod=(int)1e9+7;

int dp[2005][2005];

void test_case(){
  int n;
  cin>>n;
  vector<pair<int,int> > arr(n);
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    arr[i]={x,i};
  }
  sort(arr.rbegin(),arr.rend());
  for(int i=0;i<n;i++){
    for(int j=0;j<=i;j++){
      int l=j,r=i-j;
      r=n-1-r;
      dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+arr[i].fi*abs(arr[i].se-l));
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]+arr[i].fi*abs(arr[i].se-r));
    }
  }
  int ans=0;
  for(int i=0;i<=n;i++)ans=max(ans,dp[n][i]);
  cout<<ans;
}

signed main(){
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)test_case();
}

Measured memory_bytes: 26284
#include <stdio.h>

int main()
{
    int a, n, min, max;
    long long sum = 0;
    scanf("%d", &a);
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &n);
        if (i == 0)
        {
            min = n;
            max = n;
        }
        if (n <= min)
            min = n;
        if (n >= max)
            max = n;
        sum = sum + n;
    }
    printf("%d %d %lli\n", min, max, sum);
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K, i, tmp, sum=0;
  cin >> N >> K;
  for (i=0; i<N; i++) {
    cin >> tmp;
    sum+=min(tmp*2,(K-tmp)*2);
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
// Problem : C - One Quadrillion and One Dalmatians
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)
#define int long long

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
    int f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

inline LL gl()
{
    LL f = 1, x = 0; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, m;
LL pow26[N], sum[N];

void getans(int x)
{
	if (!x) return;
	if (x % 26) getans(x / 26);
	else getans(x / 26 - 1);
	printf("%c", (x - 1) % 26 + 'a');
}

signed main()
{
    //File("");
    LL a = gl();
    getans(a);
    return 0;
}

Measured memory_bytes: 3660
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                String S = sc.next();
                for (int i = 0; i < S.length(); i++) {
                        System.out.print((char)((S.charAt(i)-'A'+23)%26+'A'));
                }
                System.out.println("");
        }
}

Measured memory_bytes: 26728
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    int a,sum=0;
    cin>>a;
    vector<int>c(100000000);
    vector<int>d(100000000);
    for(int i=0;i<a;i++){
        cin>>c[i];
    }
    for(int i=0;i<a;i++){
        cin>>d[i];
    }
    for(int i=0;i<a;i++){
        if(c[i]>d[i]){
            sum+=c[i]-d[i];
        }
    }

    cout<<sum<<endl;
}

Measured memory_bytes: 781440
#include<stdio.h>
#include<iostream>
#include<algorithm>
void Shuffle(void);
void cut(void);
void rifu(void);

int n,k;
int card[200];

using namespace std;

int main(){

  int i,m;

  scanf("%d",&n);
  scanf("%d",&m);

  for(i=0;i<2*n;i++){
    card[i]=i+1;
  }

  for(i=0;i<m;i++){

    scanf("%d",&k);

    Shuffle();

  }

  for(i=0;i<n*2;i++){
    printf("%d\n",card[i]);
  }

  return 0;
}
void Shuffle(){

  if(k==0){
    rifu();
  }
  else {
    cut();
  }

}

void rifu(){

  int sub[2][200]={0};
  int i,j,a;

  for(i=0;i<n;i++){
    sub[0][i]=card[i];
  }
  j=0;
  for(i=n;i<2*n;i++){
    sub[1][j]=card[i];
    j++;
  }

  a=0;
  for(j=0;j<n;j++){
    for(i=0;i<2;i++){
      card[a]=sub[i][j];
      a++;
    }
  }
  
}

void cut(){

  int sub[2][200]={0};

  int i,j,a=0;

  for(i=0;i<k;i++){
    sub[0][i]=card[i];
  }
  j=0;
  for(i=k;i<n*2;i++){
    sub[1][j]=card[i];
    j++;
  }

  for(j=0;j<2*n-k;j++){
      card[a]=sub[1][j];
      a++;
    }

    for(i=0;i<k;i++){
      card[a]=sub[0][i];
      a++;
    }

}

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

signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto&& w : a) cin >> w;
  map<int, int> cnt;
  int x = a[0];

  for (int i = 2; i * i <= x; i++) {
    int c = 0;
    while (x % i == 0) {
      x = x / i;
      c++;
    }
    cnt[i] = c;
  }
  if (x > 1) cnt[x]++;

  // cout << cnt.size();
  for (int i = 1; i < n; i++) {
    int x = a[i];

    for (auto&& w : cnt) {
      int c = 0;
      while (x % w.first == 0) {
        x = x / w.first;
        c++;
      }

      cnt[w.first] = min(w.second, c);
    }
    for (auto&& w : cnt)
      if (w.second == 0) cnt.erase(w.first);
  }
  // for (auto&& w : cnt) cout << w.first << " " << w.second << endl;
  // cout << cnt.size();
  int gcd = 1;
  for (auto&& w : cnt) {
    for (int i = 0; i < w.second; i++) {
      gcd *= w.first;
    }
  }
  // cout << gcd << endl;
  int maxa = *max_element(begin(a), end(a));
  if (k % gcd == 0 && k <= maxa)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 1664
def check():
    count1 = 0
    for i in range(4):
        if A[i] == B[i]:
            count1 += 1
    count2 = 0
    for v in B:
        if v in A:
            count2 += 1
    Hit = count1
    Blow = count2 - count1
    
    print Hit, Blow
    
while True:
    try:
        A = list(raw_input().split())
        B = list(raw_input().split())
        check()
    except EOFError:
        break

Measured memory_bytes: 4216
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
ll dele(ll h, ll a) {
	for (int i = 0;i < 5;i++) {
		a *= a;
	}
	if (a == h) return 0;
	else return -1;
}

int main() {
	ll X;cin >> X;
	//ll x, xx;
	bool ok = false;
	vector<ll> a(120);
	for (ll i = 0;i <= 120;i++) {
		a[i] = i * i * i * i * i;
	}
  	for (ll i = 0;i<120;i++) {
		for (ll j = i;j<120;j++) {
			if (a[j]+a[i]==X) {
				cout << j << " " << -i << endl;
				ok = true;
				break;
			}
			if (a[j]-a[i]==X) {
				cout << j << " " << i << endl;
				ok = true;
				break;
			}
		}
		if (ok) break;
	}
}


Measured memory_bytes: 3632
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();
		sc.close();
		int sub = X - t;
		if (sub < 0) {
			System.out.println("0");
		} else {
			System.out.println(sub);
		}
	}
}

Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, k = map(int, input().split())
    a = 0
    while n > 0:
        a += 1
        n = n // k

    print(a)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
 using namespace std;
#include <math.h>

int main() {

	int x,y=0;


	while(cin >> x >>y){
		if(x == 0 && y==0){
			break;
		}
		if (x<=y){
			cout << x << " " << y <<endl;
		}else{
			cout << y << " " << x <<endl;
		}
		
	}

  return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

//しっかり制約確認したか?
int main()
{
    int n; cin >> n;
    int t = 400;
    int ans = 8;
    while(1){
        if(t <= n && n < t+200){
            cout << ans << endl;
            system("pause");
            return 0; 
        }
        ans--;
        t += 200;
    }

    system("pause");
}


Measured memory_bytes: 3684
n,x=map(int,input().split())

m=list()
sum=0
for i in range(n):
    P=int(input())
    m.append(P)
    sum+=P

mini=min(m)
ans=int(n+(x-sum)/(mini))

print(ans)
"""
3 1000
120
100
140

9

4 360
90
90
90
90

4


5 3000
150
130
150
130
110

26

"""

Measured memory_bytes: 3060
#-----------------------------------
#リストera_list[n]を返す
#0～ｎの各インデックスが素数であれば1、そうでなければ0
#ex：eratosthenes(10)
#　　→ [0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0]
#-----------------------------------

def eratosthenes(n):
  era_list = [1] * (n + 1)
  era_list[0] = 0; era_list[1] = 0
  
  for i in range(2,n+1):
    if era_list[i] == 0:
      continue
    else:
      j = i + i
      while j <= n:
        era_list[j] = 0
        j += i
        
  return era_list

Q = int(input())
PN = eratosthenes(100001)
TF = [0] * 100001

for i in range(1,100001,2):
  if PN[i] == 1 and PN[int((i+1)/2)] == 1:
    TF[i] = 1 + TF[i-2]
  else:
    TF[i] = TF[i-2]
    
for j in range(1,Q+1):
  l,r = map(int, input().split())
  Ans = TF[r] - TF[l-2]
  print(Ans)

Measured memory_bytes: 10576
#include<bits/stdc++.h>
#define int long long
#define rg register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;
const int N=200000+10;
const int mod=1e9+7;
const int inf=1e10;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
    return f*x;
}
int X[N],Y[N],W,H,n,res;
map<int,int> Map,f;
void calc(int x,int y){
	int X1,Y1,X2,Y2;
	for(int i=1;i<=3;i++)
		for(int j=1;j<=3;j++){
			if(i==1&&j==1) X1=x-2,Y1=y-2,X2=x,Y2=y;
			if(i==1&&j==2) X1=x,Y1=y-2,X2=x+2,Y2=y;
			if(i==1&&j==3) X1=x-1,Y1=y-2,X2=x+1,Y2=y;
			if(i==2&&j==1) X1=x-2,Y1=y,X2=x,Y2=y+2;
			if(i==2&&j==2) X1=x,Y1=y,X2=x+2,Y2=y+2;
			if(i==2&&j==3) X1=x-1,Y1=y,X2=x+1,Y2=y+2;
			if(i==3&&j==1) X1=x-2,Y1=y-1,X2=x,Y2=y+1;
			if(i==3&&j==2) X1=x,Y1=y-1,X2=x+2,Y2=y+1;
			if(i==3&&j==3) X1=x-1,Y1=y-1,X2=x+1,Y2=y+1;
			if(X1<1||Y1<1||X2>H||Y2>W) continue;
			if(f[X1*inf+Y1]) continue;
			f[X1*inf+Y1]=1;
			int ans=0;
			res++;
			for(int i=X1;i<=X2;i++)
				for(int j=Y1;j<=Y2;j++)
					if(Map[i*inf+j])
						ans++;
			//		if(ans==0) cout<<x<<" "<<y<<" "<<X1<<" "<<Y1<<" "<<X2<<" "<<Y2<<endl;
			f[ans]++;
		}
}
main(){
	H=read(),W=read(),n=read();
	for(int i=1;i<=n;i++)
		X[i]=read(),Y[i]=read(),Map[X[i]*inf+Y[i]]=1;
	for(int i=1;i<=n;i++)
		calc(X[i],Y[i]);
	cout<<(H-2)*(W-2)-res<<endl;
	for(int i=1;i<=9;i++)
		cout<<f[i]<<endl;
}

Measured memory_bytes: 214272
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b,c,d;
  cin >> a;
  b = a/100;
  c = (a-100*b)/10;
  d = (a-100*b-10*c);
  cout << b+c+d << endl;
}

Measured memory_bytes: 256
N = int(input())
result = ''
if N == 0:
    result = '0'
else:    
    while N != 0:
        if N % 2 == 1 :
            result = '1' + result
            N -= 1
        else:
            result = '0' + result
        N = -N//2

print(result)    


Measured memory_bytes: 2940
#include "stdio.h"

int main(int argc, char const *argv[]) {
  int N;
  int i;
  scanf("%d", &N);
  int p[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &p[i]);
  }
  int max=p[0];
  int ans=0;
  for (i = 0; i < N; i++) {
    ans=ans+p[i];
    if(p[i]>max){max=p[i];}
  }
  ans=ans-max/2;
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128