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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL fact[100011];
LL facti[100011];

LL powm(LL x, LL y, LL m){
  if(y == 0) return 1;
  return powm(x*x%m, y/2, m) * (y%2==0?1:x) % m;
}

LL inv(LL x, LL m){
  return powm(x,m-2,m);
}
LL C(LL x, LL y){
  if(x < 0 || x < y) return 0;
  return fact[x] * facti[y] % MOD * facti[x-y] % MOD;
}

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

  fact[0] = facti[0] = 1;
  REP(i,100010){
	fact[i+1] = fact[i] * (i+1) % MOD;
	facti[i+1] = inv(fact[i+1], MOD);
  }

  int N;
  cin >> N;

  int dup;
  vector<bool> memo(N+2);
  VI xs(N+1);
  REP(i,N+1){
	cin >> xs[i];
	if(memo[xs[i]])
	  dup = xs[i];
	memo[xs[i]] = true;
  }

  int a = -1, b;
  REP(i,N+1)
	if(xs[i] == dup){
	  if(a < 0) a = i;
	  else b = i;
	}
  LL c = N - b;
  FOR(k,1,N+2){
	if(k == 1) cout << C(N,k) << endl;
	else{
	  LL ans = C(N+1,k);
	  if(a+c >= k-1){
		(ans += MOD - C(a+c, k-1)%MOD) %= MOD;
	  }
	  cout << ans << endl;
	}
  }

  return 0;
}


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

int main() {
    int n, ans=0,r=0, w=0;
    cin >> n;
    string s;
    cin >> s;
    for(int i=0; i<n;i++){
        if(s[i]=='R') r++;
        else w++;
    }
    ans=r;
    for(int i=0; i<r; i++){
        if(s[i]=='R') ans--;
    }
    cout << ans;
}

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

using namespace std;
long long int x=1000000007;
long long int m[1001][1001]={0};

string s[1001];
bool v[1001][1001];
void initial()
{
    for(int i=0;i<1001;i++)
    {
        for(int j=0;j<1001;j++)
        v[i][j]=false;
    }
}
long long int dfs(int i,int j)
{
    v[i][j]=true;
    long long int l=0,r=0;
    if(i==0 && j==0)
    {
        return m[i][j];
    }
    if(j-1>=0 && s[i][j-1]=='.')
    {
        if(v[i][j-1]==false)
        l=dfs(i,j-1);
        l=m[i][j-1];
    }
    if(i-1>=0 && s[i-1][j]=='.')
    {
        if(v[i-1][j]==false)
        r=dfs(i-1,j);
        r=m[i-1][j];
    }
    m[i][j]=(l+r)%x;
    return m[i][j];
}
int main() {
    long long int h,w,i,j,k;
    cin>>h>>w;
    m[0][0]=1;
    initial();
    for(i=0;i<h;i++)
    {
        cin>>s[i];
    }
    k=dfs(h-1,w-1);
    cout<<k;
    
}

Measured memory_bytes: 14396
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, h, w;
	cin >> n >> h >> w;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
	int counter = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] >= h && b[i] >= w) counter++;
	}
	cout << counter << endl;
	return 0;
}

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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

ll bit[33], a[MAX], b[MAX], c[MAX];

int main(void) {
  ll path;
  cin >> path;

  rep(i, 30) if (path >> i & 1) bit[i]++;
  rrep(i, 30) if (bit[i]) {
	n = i;
	break;
  }

  FOR(i, 1, n + 1) {
	a[cnt] = i; b[cnt] = i + 1; c[cnt] = 0;
	cnt++;
	a[cnt] = i; b[cnt] = i + 1; c[cnt] = 1 << (n - i);
	cnt++;
  }

  ll cur = 1 << n;
  rep(i, n) {
	if (!(path >> i & 1)) continue;
	a[cnt] = 1; b[cnt] = n + 1 - i; c[cnt] = cur;
	cur += 1 << i;
	cnt++;
  }

  cout << n + 1 << " " << cnt << endl;
  rep(i, cnt) cout << a[i] << " " << b[i] << " " << c[i] << endl;

  return 0;
}

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

#define N 5005
int main() {
  int n, k, ans = -1, sum, a[N];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>());
  for (int i = 0; i < n; i++) {
    sum = 0;
    for (int j = i; j < n; j++) {
      if (sum + a[j] < k) {
        sum += a[j];
        continue;
      }
      ans = max(ans, j);
    }
  }
  cout << n - ans - 1 << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
c = list(map(int, input().split()))

dp = [float("inf")] * (n+1)
dp[0] = 0
for i in range(1, n + 1):
    for j in range(m):
        if i >= c[j]:
            dp[i] = min(dp[i], dp[i-c[j]]+1)

print(dp[n])



Measured memory_bytes: 7272
#include <iostream>
#include <string.h>
using namespace std;
int main(void){
    string A,B,C;
    cin >> A >> B >> C;
    if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}


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

int main() 
{
    int n, m, l;

    cin >> n >> m >> l;

    long long a[n][m];
    long long b[m][l];
    long long c[n][l];

    for( int i = 0; i < n; i++ )                        //配列a初期化
        for( int j = 0; j < m; j++ )
            cin >> a[i][j];

    for( int i = 0; i < m; i++ )                        //配列b初期化
        for( int j = 0; j < l; j++ )
            cin >> b[i][j];

    for( int i = 0; i < n; i++ )                        //配列c初期化
        for( int j = 0; j < l; j++ )
            c[i][j] = 0;

    for( int i = 0; i < n; i++ )
    {
        for( int j = 0; j < l; j++ )
        {
            for( int k = 0; k < m; k++ )
            {
                c[i][j] += a[i][k] * b[k][j];            //計算式
            }

            if( j != l - 1 )                             //l列の後に空白を出力しないための処理
                cout << c[i][j] << " ";                  //出力はkが周り終わり、配列cに値が入った直後
            else
                cout << c[i][j];        
        }
        cout << endl;                                    //出力はjが周り終わり、末列が出力された直後
    }
    return 0;
}


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

int main(){
  int N;cin >> N;
  if(N==1){
    cout << 0 << endl;
    return 0;
  }
  vector<int> T(N+1,1);
  for(int i=2;i<=N;i++){
    if(T[i]==1){
      for(int j=2;j*i<=N;j++){
        T[i*j]=0;
      }
    }
  }
  vector<int> P;
  for(int i=2;i<=N;i++){
    if(T[i]==1){
      P.push_back(i);
    }
  }
  int M=P.size();
  vector<int> F(M,0);
  // factorization start
  for(int i=2;i<=N;i++){
    int x = i;
    for(int j=0;j<M;j++){
      while(x%P[j]==0){
        F[j] += 1;
        x /= P[j];
      }
    }
  }
  int ans=0;
  // for (74)
  for(int j=0;j<M;j++){
    if(F[j]>=74){
      ans ++;
    }
  }
  //for (24,2) (14,4)
  for(int j=0;j<M;j++){
    for(int k=0;k<M;k++){
      if(j!=k&&F[j]>=24&&F[k]>=2){
        ans ++;
      }
      if(j!=k&&F[j]>=14&&F[k]>=4){
        ans ++;
      }
    }
  }
  //for (4,4,2)
  for(int j=0;j<M-1;j++){
    for(int k=j+1;k<M;k++){
      for(int l=0;l<M;l++){
        if(l!=j&&l!=k&&F[j]>=4&&F[k]>=4&&F[l]>=2){
          ans ++;
        }
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;
char arr[3]={'A','B','C'};

string conv(string s,int idx){
    string res="";
    int i=0;
    for(;i<(int)s.length()-2;i++){
        string sub=s.substr(i,3);
        if(sub=="ABC"){
            res+=arr[idx];
            i+=2;
        }
        else res+=s[i];
    }
    res+=s.substr(i);
    return res;
}

string reconv(string s,int idx){
    string res="";
    for(int i=0;i<(int)s.length();i++){
        if(s[i]==arr[idx]) res+="ABC";
        else res+=s[i];
    }
    return res;
}

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

  string s;cin>>s;
  if(s=="ABC"){
      cout<<"Yes"<<endl;
      return 0;
  }
  queue<string> que;
  que.push(s);
  while(!que.empty()){
      string now=que.front();que.pop();
      for(int i=0;i<3;i++){
          string tmp=conv(now,i);
          if(tmp==now) break;
          if(now!=reconv(tmp,i)) continue;
          if(tmp=="ABC"){
              cout<<"Yes"<<endl;
              return 0;
          }
          que.push(tmp);
      }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3256
#include <stdio.h>
int a[10];
int main(){
	int i,n;
	n=5;
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)
		if(!a[i])break;
	printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 1732
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << 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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (n % 2) {
    for (int i = 0; i < m; ++i) {
      printf("%d %d\n", 1 + i, n - i);
    }
  } else {
    for (int i = 0; i < m; ++i) {
      int x = 1 + i, y = n - i;
      if (i >= n / 4) --y;
      printf("%d %d\n", x, y);
    }
  }
  return 0;
}


Measured memory_bytes: 3824
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int coin500 = x / 500;
    int remain = x - coin500 * 500;
    System.out.println(coin500 * 1000 + (remain / 5) * 5);
    }
      
      
}

Measured memory_bytes: 23252
import java.util.*;
import java.math.BigInteger;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        long W = sc.nextLong();
        BigInteger ans;
        BigInteger h = BigInteger.valueOf(H);
        BigInteger w = BigInteger.valueOf(W);
        
        if(H == 1 || W == 1){
          System.out.println(1);
        }else if(H*W % 2 == 0){
          ans = h.multiply(w).divide(BigInteger.valueOf(2));
          System.out.println(ans);
        }else{
          ans = h.multiply(w).divide(BigInteger.valueOf(2));
          ans = ans.add(BigInteger.valueOf(1));
          System.out.println(ans);
        }  
	}

}

Measured memory_bytes: 35796
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 2e6 + 10;
char s[N];
int n, k;
ll fac[N], inv[N];
ll power(ll a, int x) {
	ll ans = 1;
	while (x) {
		if (x & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		x >>= 1;
	}
	return ans;
}
void init() {
	fac[0] = 1;
	for (int i = 1; i < N; i++) {
		fac[i] = fac[i - 1] * i %mod;
	}
	inv[N - 1] = power(fac[N - 1], mod - 2);
	for (int i = N - 2; i >= 0; i--) {
		inv[i] = inv[i + 1] * (i + 1) % mod;
	}
}
ll C(int n, int k) {
	return fac[n] * inv[k] % mod*inv[n - k] % mod;
}
int main() {
	scanf("%d", &k);
	scanf("%s", s);
	n = strlen(s);
	init();
	ll ans = 0;
	for (int i = n; i <= n + k; i++) {
		ans = (ans + C(n + k, i)*power(25, n + k - i) % mod) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 36028
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
                        
using namespace std;
                        
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
                        
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define ghost signed
#define left left228
#define right right228
#define complex complex228
#define count count228
#define sin sin228
#define list list228

const int N = 100 * 1000 + 228, INF = 1e12 + 228;

int go[N][26];

ghost main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < 26; ++i) go[(int)s.size()][i] = INF;
	for (int i = (int)s.size() - 1; i + 1; --i) {
		for (int j = 0; j < 26; ++j) go[i][j] = go[i + 1][j];
		go[i][s[i] - 'a'] = i;
	}
	int res = 0;
	int ptr = 0;
	for (char C : t) {
		int c = C - 'a';
		if (go[ptr][c] != INF) {
			res += go[ptr][c] - ptr + 1;
			ptr = go[ptr][c] + 1;
		} else {
			res += (int)s.size() - 1 - ptr + 1;
			ptr = 0;
			if (go[0][c] == INF) {
				cout << -1 << '\n';
				return 0;
			}
			res += go[ptr][c] - ptr + 1;
			ptr = go[ptr][c] + 1;
		}
	}
	cout << res << '\n';
    return 0;
} // kek ;
// Ого! Кажетсья это $#@!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

//long long  factorial(long long n) {
//    if (n > 0) {
//        return n * factorial(n - 1);
//    } else {
//        return 1;
//    }
//}
long long  factorial(long long n, long long depth) {
    if (n > 1) {
        depth++;
        return factorial(n / 2, depth);
    } else {
        return depth;
    }
}

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

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
//  int  a, b, c, d, e, X, Y ,r;
  unsigned long long  a, b, c, d, e, X, Y;
  //  double  c;
// long long  A[200003]={};
  int  A[200003]={};
  int  B[100003]={};
//  int  C[100003][100001]={};
  int  C[100003]={};

  int  flg=0;

//  char s[101][101]={};
  char s[100001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p=0,q=0;
//  int flag=0;
//  int tmp=0;
//  char tmp[101]={};
//  long long min=10000000000;
//  long long min=100000001;
  int min =100000001;
  int len=0;
  int l=0;
//  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long  ans=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  long long sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
  double per=0; 
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
  scanf("%s", &s);
  if(s[0]=='7'||s[1]=='7'||s[2]=='7')printf("Yes\n");
  else printf("No\n");
  
return 0;
}


Measured memory_bytes: 1716
#include <stdio.h>
bool primes[1299710];
int main() {
    int i,j,k;for (i=0;i<1299710;primes[i++]=1);for (i=2;i*i<1299709;i++) if (primes[i]) for (j=i*i;j<1299709;primes[j]=0,j+=i);
    while (scanf("%d",&i)!=EOF && i) {k=0;for (j=i;j<1299709 && !primes[j];k++,j++);for (j=i;j>1 && !primes[j];k++,j--);printf("%d\n",k);}
    return 0;}

Measured memory_bytes: 2296
program main
  implicit none
  integer i,N, c1,c2,c3,c4
  character(3) S
  read(*, *)N
  c1 = 0
  c2 = 0
  c3 = 0
  c4 = 0
  do i = 1,N
    read(*, *)S
    if (S == 'AC') then
      c1 = c1+1
    elseif (S == 'WA') then
      c2 = c2+1
    elseif (S == 'TLE') then
      c3 = c3+1
    elseif (S == 'RE') then
      c4 = c4+1
    endif
  enddo
    
  !read(*, *) (L(i), i = 1,N)
  print '("AC x ",i0)',c1
  print '("WA x ",i0)',c2
  print '("TLE x ",i0)',c3
  print '("RE x ",i0)',c4
end program main


Measured memory_bytes: 2948
n = int(input())
x_1 = int(n/1.08)
x_2 = int(n/1.08)+1
if int(x_1*1.08) == n:
  print(x_1)
elif int(x_2*1.08) == n:
  print(x_2)
else:
  #print(x_1,x_2)
  print(":(")

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

using namespace std;

int n, k;
int h[N];

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> k;
	int ans = 0;
	for(int i = 1; i <= n; ++i) {
		cin >> h[i];
		ans += (h[i] >= k);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys
import math

def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    # nの平方根まで計算する
    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True

def solve(X: int):
    for i in range(X,10**16):
        if isPrime(i):
            print(i)
            exit()
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
#mod = 10 ** 9 + 7 
mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, M = MAP()
a = LIST()

A = sorted([x//2 for x in a], reverse=True)

b = A[0]
cnt = 0
while b%2 == 0:
	b //= 2
	cnt += 1

for x in A:
	if x%pow(2, cnt) or (x//pow(2, cnt))%2 == 0:
		print(0)
		exit()

lcm = A[-1]
for x in A:
	lcm = lcm*x//gcd(lcm, x)

r = lcm//A[0]
n = M//A[0]

#2p+1が1<=2p+1<=n の範囲で rの倍数となるpの個数
if r%2 == 0:
	print(0)
else:
	print(n//r - n//(2*r))

Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> el[100005];
vector<long long> wi[100005];
int i, j, k, m, n, q;
long long dst[100005], l;
bool vt[100005];

void dfs(int node) {
	for(int z = 0; z < el[node].size(); z++) if (!vt[el[node][z]]) {
		dst[el[node][z]] = dst[node] + wi[node][z];
		vt[el[node][z]] = 1;
		dfs(el[node][z]);
	}
}

int main() {
	scanf("%d", &n);
	for(i = 1; i < n; i++) {
		scanf("%d%d%lld", &j, &k, &l);
		el[j].pb(k);
		el[k].pb(j);
		wi[j].pb(l);
		wi[k].pb(l);
	}
	scanf("%d%d", &q, &k);
	vt[k] = 1;
	dfs(k);
	for(i = 0; i < q; i++) {
		scanf("%d%d", &j, &k);
		printf("%lld\n", dst[j] + dst[k]);
	}
}

Measured memory_bytes: 18304
while True:
  n = int(input())
  if n==0:
    break
  else:
    l = [[0 for i in range(n)] for j in range(n)]
    x = n//2
    y = n//2+1
    c = 0
    while c < n**2:
      c += 1
      while l[y][x] != 0:
        y += 1
        if y >= n:
          y = 0
        x -= 1
        if x <= -1:
          x = n-1
      l[y][x] = c
      x += 1
      if x >= n:
        x = 0
      y += 1
      if y >= n:
        y = 0
    for i in l:
      a = ''
      for j in i:
        if 0 <= j < 10**1:
          a = a + '   ' + str(j)
        elif 10**1<=j<10**2:
          a = a + '  ' + str(j)
        elif 10**2<=j<10**3:
          a = a + ' ' + str(j)
      print(a)

Measured memory_bytes: 7796
#include <iostream>

using namespace std;

double dd(int n, int m) {
	return 1900.0*(double)m + 100.0*(n - m);
}

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

	double ans = 0.0;
	double p = dd(n, m);
	double tt = 1 << m;
	tt = 1.0 / tt;
	double t2 = 1.0-tt;
	double t3 = 1.0;



	for (int i = 0; i < 100000; i++) {
		ans += p*(double)(i+1)*t3*tt;
		t3 *= t2;
		//cout << ans << ' ' << t3 << endl;
	}

	long long int aa = ans;

	if (aa % 10 == 9) {
		aa++;
	}

	cout << aa << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
#include <numeric>
using namespace std;


const long double PI = 3.14159265358979323846264338327950;
const int N = 1e5+5;

template <class T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

bool isPrime(int x) {
	for (int d = 2; d * d <= x; d++) {
		if (x % d == 0)
			return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int m;
	cin >> m;
	if (isPrime(m)) cout << m << '\n';
	else {
		for (m = m + 1; !isPrime(m); ++m);
		cout << m << '\n';

	}
}
		

Measured memory_bytes: 3592
/*input
6
b
a
abc
c
d
ab
*/
#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;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=2e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=3006703054056749LL;
const ld PI=3.14159265358979323846;
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    ll res=0LL;
    while(b){
        if(b&1) res=(res+a)%MOD;
        a=(a+a)%MOD;
        b>>=1;
    }
    return res%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
string arr[maxn];
map <ll,int> mp;
int cnt[26];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
  cin>>n;
    ll ans=0;
    REP(i,n){
        cin>>arr[i];
        string s=arr[i];
        reverse(ALL(s));
        ll hsh=0;
        REP(j,sz(s)){
            hsh=(hsh*27LL+(s[j]-'a'+1));
            if(hsh>=MOD) hsh%=MOD;
        }
        mp[hsh]++;
    }
    REP(i,n){
        string s=arr[i];
        REP(j,sz(s)) cnt[s[j]-'a']++;
        ll hsh=0;
        for(int j=sz(s)-1;j>=0;j--){
            REP(k,26){
                if(cnt[k]){
                  ll x=(hsh*27LL+k+1);
                  if(x>=MOD) x%=MOD;
                    if(mp.count(x)) ans+=mp[x];
                }
            }
            cnt[s[j]-'a']--;
            hsh=(hsh*27LL+(s[j]-'a'+1));
            if(hsh>=MOD) hsh%=MOD;
        }
        REP(j,26) cnt[j]=0;
    }   
    cout<<ans-n;
}


Measured memory_bytes: 22396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <math.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define drep(i,n) for (int i = n; i >= 0; --i)
using namespace std;
typedef long long ll;

int gcd(int a, int b)
{
   if (a%b == 0) return(b);
   else          return(gcd(b, a%b));
}
int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}


//------------------------------------------------------------
int main() {
  int A, B, C, flag=1;
  cin >> A >> B >> C;

  rep(i, lcm(A,B)/A) if (A*i%B == C) flag=0;

  switch (flag)
  {
  case 0:
    cout << "YES" << endl;
    break;
  case 1:
    cout << "NO" << endl;
    break;
  }
}


Measured memory_bytes: 256
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_least8_t;
using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u8 = std::uint_least8_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <utility>

namespace n91 {

void main_() {
  u32 a, b;
  std::cin >> a >> b;
  u32 ans;
  if (a == b) {
    ans = a + b;
  } else {
    ans = std::max(a, b) * 2 - 1;
  }
  std::cout << ans << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 384
N = int(input())
A = sorted(list(map(int,input().split())))
mod = 10**9 + 7
B = []
if N % 2 == 0:
  for i in range(1, N//2 + 1):
    B.append(i*2 - 1)
    B.append(i*2 - 1)
else:
  for i in range(1, N//2 + 1):
    B.append(i*2)
    B.append(i*2)
  B.append(0)
B.sort()

if A != B:
  print(0)
else:
  if N % 2 == 0:
    print(pow(2, N//2, mod))
  else:
    print(pow(2, (N-1)//2, mod))

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

#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
using namespace std;
const int MAX = 0x7ffffff;
int t;

void slove()
{
	map<string,int> m;
	int n;cin >> n;
	string s;
	for(int i = 0;i < n;i ++)
	{
		cin >> s;
		m[s]++;
	}
	printf("AC x %d\n",m["AC"] );
	printf("WA x %d\n",m["WA"] );
	printf("TLE x %d\n",m["TLE"] );
	printf("RE x %d\n",m["RE"] );
}
int main()
{
	//SIS;
	slove();
}

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;

template<typename X, typename Y> ostream &operator<< (ostream &fout, const pair<X, Y> &p)
{ fout << '{' << p.first << ", " << p.second << "} "; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (const auto &el : vec) fout << el << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr double INF = 2e18;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 2e3 + 5;

int main()
{
    ll n, a; cin >> n >> a;
    n %= 500;
    if (a < n) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

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

signed main(){
  int n;
  cin>>n;
  vi a(n+1);
  a[0]=0;
  rep(i,n) cin>>a[i+1];
  a.pb(0);  //a[n+1]=0
  vi d(n+1);
  rep(i,n+1){
    d[i]=abs(a[i]-a[i+1]);
  }
  int sum=0;
  rep(i,n+1) sum+=d[i];
  FOR(i,1,n){
    int ans=sum-d[i]-d[i-1];
    ans+=abs(a[i-1]-a[i+1]);
    cout<<ans<<endl;
  }
  return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

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

const ll INF = 1e15;

template<typename T>
void cmpmax(T& reference, T value) {
	reference = max(reference, value);
}

template<typename T>
void cmpmin(T& reference, T value) {
	reference = min(reference, value);
}

vector<vector<int>> rev;
vector<int> path;

int dfs(int current) {
	if (path[current] >= 0) return path[current];
	if (!rev[current].size()) {
		path[current] = 0;
		return 0;
	}
	int d = 0;
	for (auto edge : rev[current]) {
		d = max(d, dfs(edge));
	}
	path[current] = d + 1;
	return d + 1;
}

int main() {
	ll n, m;
	cin >> n >> m;
	rev.resize(n);
	path.assign(n, -1);
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		rev[y].push_back(x);
	}

	int depth = 0;
	for (int i = 0; i < n; i++) {
		auto d = dfs(i);
		depth = max(depth, d);
	}
	cout << depth << endl;
	return 0;
}


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    double a,b,x;
    cin >> a >> b >> x;
    double ok = 0,ng = acos(-1);
    while (ng-ok > 1e-12) {
        double mid = (ok+ng)/2,c = 0;
        if (b*cos(mid) > a*sin(mid)) c = a*a*(b-a*tan(mid)/2);
        else c = a*b*b/2/tan(mid);
        (c > x ? ok : ng) = mid;
    }
    cout << fixed << setprecision(9) << ok*180/acos(-1) << endl;
}

Measured memory_bytes: 512
a,b,c,x,y=map(int,input().split())
ans=0
if c*2<a+b:
    k=min(x,y)
    x-=k
    y-=k
    ans+=c*2*k
if c*2<a:
    k=x
    x-=k
    y-=k
    ans+=c*2*k
if c*2<b:
    k=y
    x-=k
    y-=k
    ans+=c*2*k
ans+=a*max(0,x)+b*max(0,y)
print(ans)


Measured memory_bytes: 38256
#include<iostream>

int day_of_month( int m )
{
	switch( m ){
	 	case 2:
			return 29;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
			break;
		default:
			return 31;
			break;
	}
}

int main()
{
	int m,d;
	const char week[][20] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	
	while( 1 ){
		std::cin >> m >> d;
		if( !m && !d ) break;
		
		int nm = 1, nd = 1, nw = 3;
		while( 1 ){
			if( nm == m && nd == d ) break;
			nd++;
			nw = ( nw + 1 ) % 7;
			
			if( nd > day_of_month( nm ) ){
			 	nd = 1;
				nm++;
			}
		}
		
		std::cout << week[nw] << std::endl;
	}

 	return 0;
}

Measured memory_bytes: 1156
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
Island_1 = []
Island_n = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        Island_1.append(b)
    if b == n:
        Island_n.append(a)
if len(set(Island_1) & set(Island_n)) == 0:
    ans = 'IMPOSSIBLE'
else:
    ans = 'POSSIBLE'
print(ans)

Measured memory_bytes: 21828
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static int _num;
    static int[] ar;
    static int res;
    static void Solve()
    {
        _num = Input.num;
        ar = Input.ar;
        res = (int)Pow(3, _num);
        for (var i = -1; i <= 1; i++)
            dfs(new Stack<int>(), ar[0] + i);
        WriteLine(res);
    }
    static void dfs(Stack<int> list,int num)
    {
        list.Push(num);
        if (list.Count == _num)
        {
            if (list.All(v => v % 2 == 1)) res--;
            list.Pop();
            return;
        }
        for (var i = -1; i <= 1; i++)
            dfs(list, ar[list.Count] + i);
            list.Pop();
    }
    
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

Measured memory_bytes: 15572
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var X, Y, Z, K int

	fmt.Scan(&X, &Y, &Z, &K)

	var A = make(SortBy, X)
	var B = make(SortBy, Y)
	var C = make(SortBy, Z)
	var AB = make(SortBy, 0)
	var ABC = make(SortBy, 0)

	for i := 0; i < X; i++ {
		fmt.Scan(&A[i])
	}
	for i := 0; i < Y; i++ {
		fmt.Scan(&B[i])
	}
	for i := 0; i < Z; i++ {
		fmt.Scan(&C[i])
	}

	sort.Sort(A)
	sort.Sort(B)
	sort.Sort(C)

	for i := 0; i < X; i++ {
		for j := 0; j < Y; j++ {
			AB = append(AB, A[i]+B[j])
		}
	}
	sort.Sort(AB)
	for i := 0; i < min(len(AB), K); i++ {
		for j := 0; j < Z; j++ {
			ABC = append(ABC, AB[i]+C[j])
		}
	}
	sort.Sort(ABC)
	for i := 0; i < K; i++ {
		fmt.Println(ABC[i])
	}
}

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

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return abs(a[i]) > abs(a[j]) }


Measured memory_bytes: 84864
# -*- coding: utf-8 -*-
"""
D - Partition
https://atcoder.jp/contests/abc112/tasks/abc112_d

"""
import sys


from bisect import bisect_right

def solve(N, M):
    def divisor(N):
        divisors = set()
        for i in range(1, int(N**0.5)+1):
            if N % i == 0:
                divisors.add(i)
                divisors.add(N // i)
        return divisors

    div_M = sorted(list(divisor(M)))
    i = bisect_right(div_M, M/N)
    if i:
        return div_M[i-1]
    else:
        return 1



def main(args):
    N, M = map(int, input().split())
    ans = solve(N, M)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N, M;
    ll K;
    cin >> N >> M >> K;
    vector<ll> A(N+1),B(M+1);
    REP(i,N) {
        int a; cin >> a;
        A[i+1] = A[i] + a;
    }
    REP(i,M) {
        int b; cin >> b;
        B[i+1] = B[i] + b;
    }
    int ans = 0;
    REP(i,N+1) {
        if (A[i] > K) break;
        ll t = A[i];
        auto it = upper_bound(ALL(B),K-t);
        //cerr << t << " " << K-t << endl;
        it--;
        int d = distance(B.begin(),it);
        ans = max(ans,i+d);
    } 

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 6360
M,D = map(int,input().split())
N,S = map(int,input().split())
if M==1 or M==3 or M==5 or M==7 or M==8 or M==10 or M==12:
    if D == 31 and S==1:
        if M+1==N or M-11==N:
            print(1)
        else:
            print(0)
    else:
            print(0)
elif M==4 or M==6 or M==9 or M==11:
    if D==30 and S==1:
        if M+1==N or M-11==N:
            print(1)
        else:
            print(0)
    else:
            print(0)
elif M==2:
    if D==28 or D==29:
        if S==1:
            if M+1==N or M-11==N:
                print(1)
            else:
                print(0)
        else:
                print(0)
    else:
                print(0)
else:
    print(0)

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static  ll INF = 1e9;
using namespace std;

int main(){	
	string s;
	cin>>s;
	ll ans=0,bl=0;
	rep(i,s.size()){
		if(s[i]=='B')++bl;
		else ans+=bl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
MOD = 1000000007
kaijo = []
kaijo_1 = []

def power(a, n):
    if (n == 0):
        return 1
    res = 1
    while (n > 0):
        if ((n & 1) == 1):
            res = res * a % MOD
        a = a * a % MOD
        n >>= 1
    
    return res    

def calcKaijo():
    kaijo.append(1)
    for i in range(1, 200001):
        kaijo.append((kaijo[i - 1] * i) % MOD)

def calcKaijo_1():
    for i in range(200001):
        kaijo_1.append(0)
    kaijo_1[200000] = power(kaijo[i], MOD - 2)
    for i in range(199999, -1, -1):
        kaijo_1[i] = kaijo_1[i + 1] * (i + 1) % MOD

def comb(n, r):
    return kaijo[n] * kaijo_1[n - r] * kaijo_1[r]

calcKaijo()
calcKaijo_1()
h, w, a, b = [int(i) for i in input().split()]
count = 0
for i in range(b, w):
    count += comb(h - a - 1 + i, i) * comb(a - 1 + w - 1 - i, w - 1 - i)
    count %= MOD

print(count)

Measured memory_bytes: 18968
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;
const int mod = 1e9 + 7;
int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    ll sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
    }

    ll x = 0;
    ll ans = 1e17;
    rep(i, n-1){
        x += a[i];
        ans = min(ans, abs(sum - 2*x)); //abs(y - x) -----  y = sum - x
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
	std::size_t n;
	std::string s;
	std::cin >> n >> s;
	
	int right = 0, left = 0;
	for (std::size_t i = 0; i < n; i++) {
		if (s[i] == '(') {
			left++;
		} else {
			if (left > 0) left--;
			else right++;
		}
	}
	
	std::cout << std::string(right, '(') << s << std::string(left, ')') << '\n';
	
	return 0;
}

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

using namespace std;
// const int MOD = 1e9+7;
const int MOD  = 998244353;
const int INF = 0x3f3f3f3f;
const double PI = 4*atan(1);
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
// ll gcd(ll a, ll b) { 
//     if (a == 0) return b; 
//     return gcd(b % a, a); 
// }
// ll mod(ll x) {
// 	x%=MOD;
// 	if(x<0)x+=MOD;
// 	return x;
// }
// ll power(int base, int power) {
// 	ll prod = 1;
// 	ll b = base;
// 	while(power) {
// 		if (power & 1) {
// 			prod = mod(prod*b);
// 		}
// 		b = mod(b*b);
// 		power/=2;
// 	}
// 	return prod;
// }
// struct line {
//     int m, c;
//     ll eval(int x) { return 1LL * m * x + c; }
//     double intersectX(line l) { return (double) (c - l.c) / (l.m - m); }
int n;
void solve() {
	cin >> n;
	n%=10;
	if (n==3) {
		cout << "bon\n";
	} else if (n==0||n==1||n==6||n==8) {
		cout << "pon\n";
	} else {
		cout << "hon\n";
	}
}
int main() {
	int t=1;
	// cin >> t;
	for (int i = 1; i <= t; i++) { 
		// cout << "Case #" << i << ": ";
		solve();
	}
}

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

int main(){
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      if(10000*i+5000*j+1000*(n-i-j)==y){
        cout<<i<<" "<<j<<" "<<n-i-j;
        return 0;
      }
    }
  }
  cout<<"-1 "<<"-1 "<<"-1 ";
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 23:44:20 2020

@author: Kanaru Sato
"""

def dfs(numstr,count,chara):
    if len(chara) == 1:
        return count+int(numstr+chara)
    else:
        numstr = numstr+chara[0]
        return dfs("",count+int(numstr),chara[1:])+dfs(numstr,count,chara[1:])

s = input()

print(dfs("",0,s))

Measured memory_bytes: 3060