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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  vector<int> v(n); cin >> v;
  sort(v.begin(), v.end());
  map<int,int> mp;
  for(auto e:v)mp[e]++;
  bitset<1000001> bs;
  int cnt = 0;
  for(auto e:v){
    cnt += !bs[e] && mp[e] == 1;
    for(int i = e; i <= v.back(); i += e)bs[i] = 1;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 13452
#include<bits/stdc++.h>
#define LL long long
#define DB long double
using namespace std;
//#define P 998244353
//inline int ad(int x,int y){return (x+y>=P)?(x+y-P):(x+y);}
//inline int mt(int x,int y){return 1ll*x*y%P;}
//inline void mo(int &x){x=(x>=P)?(x-P):x; x=(x<0)?(x+P):x;}
template<typename T>inline void ckmx(T &x,T y){x=max(x,y);}
template<typename T>inline void ckmi(T &x,T y){x=min(x,y);}
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
int n;
string s;
int sb[200010],sw[200010];
int main(){
	read(n); 
	cin>>s;
	for(int i=0;i<n;++i){
		sb[i+1]=sb[i]+(s[i]=='#');
		sw[i+1]=sw[i]+(s[i]=='.');
	}
	int ans=1e9;
	for(int i=0;i<=n;++i)
		ans=min(ans,sb[i]+sw[n]-sw[i]);
	cout<<ans<<endl;
	return 0;
}


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

int N; long long X;
int A[2000];
int D[2][2000];
long long res;

int main() {
  cin >> N >> X;
  for(int i = 0; i < N; ++i) cin >> A[i];
  for(int i = 0; i < N; ++i)res += D[0][i] = A[i];
  for(int k = 1; k < N; ++k) {
    int prev = (k - 1) % 2, cur = k % 2;
    long long tmp = k * X;
    for(int i = 0; i < N; ++i) tmp += D[cur][i] = min(D[prev][i], D[prev][(i + N - 1) % N]);
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n; cin >> n;
  vl a(n,0),b(n,0);
  rep(i,n) cin >> a.at(i);
  rep(i,n) cin >> b.at(i);

  int two = 1;
  int ans = 0;
  rep(i,29) {
    vi ma(n,0),mb(n,0);
    rep(j,n) {
      ma.at(j) = a.at(j) % (two*2);
      mb.at(j) = b.at(j) % (two*2);
    }

    sort(rng(mb));
    ll oddeven=0;
    rep(j,n) {
      int l = two - ma.at(j),r = 2*two-1-ma.at(j);
      oddeven+=upper_bound(rng(mb),r)-lower_bound(rng(mb),l);
      int ll = two*3-ma.at(j),rr=two*4-1-ma.at(j);
      oddeven+=upper_bound(rng(mb),rr)-lower_bound(rng(mb),ll);
    }
    if(oddeven%2==1)ans+=two;
    two*=2;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7896
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>

using namespace std;

template <class T>
using lp_queue=priority_queue<T, deque<T>, greater<T>>;

using Weight=long long;
static const Weight INF=1LL<<57;

struct Edge {
    size_t src, dst;
    Weight weight;
    Edge() {}
    Edge(size_t src, size_t dst, Weight weight=1):
        src(src), dst(dst), weight(weight)
    {}
};

bool operator<(const Edge &e, const Edge &f) {
    if (e.weight != f.weight) {
        return e.weight > f.weight;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Edges=vector<Edge>;
using Vertex=vector<Edge>;
using Graph=vector<Vertex>;

void join(Graph &g, size_t s, size_t d, Weight w=1) {
    // non-directed
    g[s].push_back(Edge(s, d, w));
    g[d].push_back(Edge(d, s, w));
}

void connect(Graph &g, size_t s, size_t d, Weight w=1) {
    // directed
    g[s].push_back(Edge(s, d, w));
}

vector<vector<Weight>> shortest_distance(Graph &g) {
    /* Johnson */
    size_t V=g.size();
    vector<Weight> h(V);
    for (size_t k=0; k<V; ++k)
        for (size_t i=0; i<V; ++i)
            for (const Edge &e: g[i])
                if (h[e.dst] > h[e.src] + e.weight) {
                    h[e.dst] = h[e.src] + e.weight;
                    if (k == V-1)
                        return vector<vector<Weight>>();
                }

    for (size_t i=0; i<V; ++i)
        for (Edge &e: g[i])
            e.weight += h[e.src] - h[e.dst];

    vector<vector<Weight>> d(V, vector<Weight>(V, INF));
    for (size_t s=0; s<V; ++s) {
        d[s][s] = 0;
        lp_queue<pair<Weight, size_t>> q; q.push(make_pair(0, s));
        while (!q.empty()) {
            pair<Weight, size_t> p=q.top(); q.pop();
            size_t v=p.second;
            if (d[s][v] < p.first) continue;

            for (const Edge &e: g[v])
                if (d[s][e.dst] > d[s][v] + e.weight) {
                    d[s][e.dst] = d[s][v] + e.weight;
                    q.push(make_pair(d[s][e.dst], e.dst));
                }
        }

        for (size_t u=0; u<V; ++u)
            if (d[s][u] < INF)
                d[s][u] += h[u] - h[s];
    }

    return d;
}

int main() {
    size_t V, E;
    scanf("%zu %zu", &V, &E);

    Graph g(V);
    for (size_t i=0; i<E; ++i) {
        size_t s, t;
        Weight d;
        scanf("%zu %zu %lld", &s, &t, &d);

        connect(g, s, t, d);
    }

    vector<vector<Weight>> d=shortest_distance(g);
    if (d.empty())
        return !printf("NEGATIVE CYCLE\n");

    for (vector<Weight> &w: d)
        for (size_t i=0; i<V; ++i)
            if (w[i] < INF) {
                printf("%lld%c", w[i], i<V-1? ' ':'\n');
            } else {
                printf("INF%c", i<V-1? ' ':'\n');
            }

    return 0;
}

Measured memory_bytes: 2936
#include <iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int a[5][55], c[5][55];
    for (int i = 1; i <= n; ++i)
        cin >> a[0][i] >> a[1][i];
    for (int i = 1; i <= m; ++i)
        cin >> c[0][i] >> c[1][i];
    for (int i = 1; i <= n; ++i)
    {
        int ans, mn = 1000000000;
        for (int j = 1; j <= m; ++j)
        {
            int dist = abs(a[0][i] - c[0][j]) + abs(a[1][i] - c[1][j]);
            if (mn > dist)
            {
                mn = dist;
                ans = j;
            }
        }
        cout << ans << "\n";
    }
}

Measured memory_bytes: 256
def main():
    N, W = map(int, input().split())
    WV = []
    for _ in range(N):
        w, v = map(int, input().split())
        WV.append((w, v))
    dp = [[0] * (W + 1) for _ in range(N + 1)]
    for i in range(N):
        for j in range(W + 1):
            if j >= WV[i][0]:
                dp[i + 1][j] = max(
                    dp[i][j],
                    dp[i][j - WV[i][0]] + WV[i][1]
                )
            else:
                dp[i + 1][j] = dp[i][j]
    print(dp[-1][-1])


main()


Measured memory_bytes: 118512
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  double x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d;
  while (cin >> x_a >> y_a >> x_b >> y_b >> x_c >> y_c >> x_d >> y_d) {
    double dx1 = x_b - x_a;
    double dy1 = y_b - y_a;
    double dx2 = x_c - x_d;
    double dy2 = y_c - y_d;
    double det = dx1 * dx2 + dy1 * dy2;
    cout << ((abs(det) < 1e-10) ? "YES" : "NO") << endl;
  }
}


Measured memory_bytes: 3048
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力

		int n = sc.nextInt();
		
		List<Integer> list = new ArrayList<>();


		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		double parent = 1;
		double all = 1;
		for (int i = 0; i < n; i++) {
			int a = list.get(i);
			parent = parent * a;
			all = all * a;
		}
		// System.out.println(parent);
		// System.out.println(all);


		double child = 0;

		for (int i = 0; i < n; i++) {
			int a = list.get(i);
			child += (double)(all / a);
		}


		System.out.println(parent / child);

	}
}


Measured memory_bytes: 22868
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
	int n;
	string s;
int check(int x){
	map<string ,int > v;
	for(int i=1;i<=n+1-x;i++){
		string a=s.substr(i-1,x);
		if(v[a]){
			if(i-v[a]>=x)
				return true;
		}else{
			v[a]=i;
		}
	}
	return false;
}
int main(){
	cin>>n>>s;
	int l=0,r=n/2;
	while(l<=r){
		int mid=(l+r)/2;
		if(check(mid)){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 6668
inputText1 = input()
numberTextList = inputText1.split()
gNumber = numberTextList[0]
kNumber = numberTextList[1]
gNumbers = []
for gNum in range(int(gNumber)):
    gNumbers.append(2)

kNumbers = []
for kNum in range(int(kNumber)):
    kNumbers.append(1)

# print("end")
gNumbers.extend(kNumbers)
allNumbers = gNumbers
allNumbersCount = len(allNumbers)
successCount = 0
for num1 in range(len(allNumbers)):
    for num2 in range(len(allNumbers)):
        if num1 + num2 + 1 == allNumbersCount:
                break
        # print(num1)

        if (allNumbers[num1] + allNumbers[num1 + num2 + 1]) % 2 == 0:
            successCount += 1








print(successCount)


Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A, &B)
	for i := 1; i <= 10000; i++ {
		if calc(i, A, B) {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(-1)
}
func calc(n, a, b int) bool {
	wa := float64(n) * 0.08
	wb := float64(n) * 0.1
	return int(wa) == a && int(wb) == b
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
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;}
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; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

ll N;
vdouble p(3300);

double dp[3300][3300];//dp[i][j]:=最初のi枚のコインを投げたときに表がj枚になる確率

int main(){
	//乱数srand((unsigned)time(NULL));
	//入力
	cin>>N;
	p.resize(N);
	rep(i,N) cin>>p[i];
	
	dp[0][0]=1;//最初の0枚のコインを投げたときに表が0枚になる確率は1
	//dpテーブル埋め
	
	
	for(int i=0; i<N; i++){
		for(int j=0; j<=i; j++){
			dp[i+1][j+1]+=dp[i][j]*p[i];
			dp[i+1][j]+=dp[i][j]*(1.0-p[i]);
		}
	}
	
	
	double res=0.0;
	for(int i=(N+1)/2; i<=N; i++) res+=dp[N][i];
	cout<<setprecision(10)<<res<<endl;
}

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

int main() {
  string a;
  cin >> a;
  if (a == "A")
    cout << "T" << endl;
  else if (a == "G")
    cout << "C" << endl;
  else if (a == "C")
    cout << "G" << endl;
  else if (a == "T")
    cout << "A" << endl;
}


Measured memory_bytes: 256
if __name__ == "__main__":
	num = int(input())
	a = list(map(int, input().split()))

	sort = [0 for i in range(num)]

	for a_n in range(0, num):
		# print(a_n + 1, a[a_n])
		sort[a[a_n] - 1] = a_n + 1

	for sorted in sort:
		print(sorted, end = " ")

	print("")

Measured memory_bytes: 14008
while True:
    n, m  = map(int, raw_input().split())
    if n==0 and m==0: break
    c = [[0, 0]for i in range(m)]
    for i in range(m):
        c[i][1] = i
    for i in range(n):
        a = map(int, raw_input().split())
        for j in range(m):
            if a[j] == 1: c[m-j-1][0] = c[m-j-1][0] + 1
    c = sorted(c)
    for i in reversed(range(m)):
        if i==0: break
        print m-c[i][1],
    print m-c[0][1]

Measured memory_bytes: 6412
#include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <sstream>
#include<vector>
using namespace std;


int main(){
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a+b+c==2 || c==1)puts("Open");
	else if(a+b+c==0)puts("Close");
	else puts("Close");

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
const ld EPS = (ld) 1e-7;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (int i = f; i < t; i++)
#define per(i, f, t) for (int i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

template<typename A, typename B> bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

const int N = 2005;

int n, z, w;
int a[N];
int dp[N][N][2];
bool ca[N][N][2];

int get(int i, int step) {
	if (i == 0) {
		return step == 0 ? z : w;
	}
	return a[i];
}

int calc(int i, int j, int step) {
	if (ca[i][j][step]) {
		return dp[i][j][step];
	}
	ca[i][j][step] = 1;
	int cur = max(i, j) + 1;
	if (cur == n + 1) {
		return (dp[i][j][step] = abs(get(i, 0) - get(j, 1)));
	}
	
	if (step == 0) {
		dp[i][j][step] = -INF;
		maxi(dp[i][j][step], calc(cur, j, step));
		maxi(dp[i][j][step], calc(cur, j, !step));
	} else {
		dp[i][j][step] = INF;
		mini(dp[i][j][step], calc(i, cur, step));
		mini(dp[i][j][step], calc(i, cur, !step));
	}
	
	return dp[i][j][step];
}

void run() {
	cin >> n >> z >> w;
	rep(i, 1, n + 1) {
		cin >> a[i];
	}
	cout << calc(0, 0, 0) << "\n";
}


Measured memory_bytes: 39680
N = int(input())
A = map(str, raw_input().split())

nums = {}

for i in range(N):
    if A[i] in nums:
        nums[A[i]] += 1
    else:
        nums[A[i]] = 1

if len(nums) == 1:
    if '0' in nums:
        print('Yes')
    else:
        print('No')
elif len(nums) == 2:
    if '0' in nums and nums['0'] * 3 == len(A):
        print('Yes')
    else:
        print('No')
elif len(nums) == 3:
    keys = [x for x in nums]
    a = keys[0]
    b = keys[1]
    c = keys[2]
    if nums[a] == nums[b] and nums[a] == nums[c] and int(a) ^ int(b) == int(c) and int(b) ^ int(c) == int(a) and int(a) ^ int(c) == int(b):
        print('Yes')
    else:
        print('No')
else:
    print('No')



Measured memory_bytes: 13364
import java.util.*;

public class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    String[] str = line.split("");
    StringBuilder editor = new StringBuilder();
    for(String s: str)
    {
      switch(s)
      {
        case "0":
          editor.append("0");
          break;
        case "1":
          editor.append("1");
          break;
        case "B":
          if(editor.length() > 0)
            editor.deleteCharAt(editor.length()-1);
          break;
      }
    }
    System.out.println(editor.toString());
  }

}

Measured memory_bytes: 19540
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll mod = 998244353;
const int MAX = 510000;

int main() {
  int N, K, R, S, P;
  string T;
  cin >> N >> K >> R >> S >> P >> T;
  int res = 0;
  vector<char> memo(N); // 出した手
  for (int i=0; i<T.size(); i++) {
    // K回目までは好きな手を出せる
    if (i<K) {
      if (T[i]=='r') {
        res += P;
        memo[i] = 'P';
      }
      else if (T[i]=='s') {
        res += R;
        memo[i] = 'R';
      }
      else {
        res += S;
        memo[i] = 'S';
      }
    }
    else {
      // K+1回目以降は，K回前で出した目は出せない
      if (T[i]=='r') {
        if (memo[i-K]!='P') {
          res += P;
          memo[i] = 'P';
        }
        else memo[i] = ' ';
      }
      else if (T[i]=='s') {
        if (memo[i-K]!='R') {
          res += R;
          memo[i] = 'R';
        }
        else memo[i] = ' ';
      }
      else {
        if (memo[i-K]!='S') {
          res += S;
          memo[i] = 'S';
        }
        else memo[i] = ' ';
      }
    }
  }
  cout << res << endl;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int k, n; cin >> k >> n;

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

    int l = 0;

    for (int i = 0; i < n-1; ++i) {
        l = max(l, a[i+1] - a[i]);
    }

    l = max(l, (k - a[n-1] + a[0]));

    cout << k - l << endl;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ARestaurant {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    out << n * 800 - n / 15 * 200 << endl;
	}
};


int main() {
	ARestaurant solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import bisect

def bin_search(arr,ls,c):
    l=ls-1
    r = len(arr)
    while (r-l) > 1:
        m = l + (r-l)//2
        if arr[m] >= c:
            r = m
        else:
            l = m
    return l-ls+1

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    arr.sort()
    ans=0
    for i in range(n-2):
        for j in range(i+1,n-1):
            c = arr[i] + arr[j]
            ans += (bisect.bisect_left(arr,c,j+1) - j - 1)
            #ans += bin_search(arr,j+1,c)
    print(ans)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 16240
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


def judge(k: int, h: list, a:int, b:int):
    h = [max(0, hi - k*b) for hi in h]
    cnt = 0
    for hi in h:
        cnt += -(-hi//(a-b))

    return True if cnt <= k else False

def binary_search(h, a, b):
    low = 0
    high = 10**18

    while high - low > 1:
        mid = (high+low) // 2
        if judge(mid, h, a, b):
            high = mid
        else:
            low = mid

    return high

n, a, b = li()
h = [ni() for _ in range(n)]

print(binary_search(h, a, b))


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

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long M;
        M = sc.nextLong();

        final Solver solver = new Solver();
        solver.solve(N, M);
    }
}

class Solver {
    public void solve(long N, long M) {
        long ans = N * (N - 1) / 2;
        ans += M * (M - 1) / 2;
        System.out.println(ans);
    }
}



Measured memory_bytes: 19924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    int N;cin>>N;
    N--;
    int ans,maxi;
    for(int i=29;i>=0;i--){
        if(N&(1<<i)){
            ans=i;
            maxi=(1<<(i+1));
            break;
        }
    }
    
    vector<vector<int>> S(maxi,vector<int>(maxi,0));
    
    for(int k=0;k<=ans;k++){
        for(int i=0;i<maxi;i++){
            for(int j=0;j<maxi;j++){
                if((i&(1<<k))!=(j&(1<<k))) S[i][j]=k+1;
            }
        }
    }
    
    for(int i=0;i<=N-1;i++){
        for(int j=i+1;j<=N;j++){
            cout<<S[i][j]<<" ";
        }
        cout<<endl;
    }
    
}





Measured memory_bytes: 1536
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
const int  N = 1e6+66;
#define  LL long long

int main()
{
	int n;
	cin>>n;
	if(n==25)
		printf("Christmas\n");
	else if(n==24)
		printf("Christmas Eve\n");
	else if(n==23){
		printf("Christmas Eve Eve\n");
	}else {
		printf("Christmas Eve Eve Eve\n");
	}


	return 0;
}



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

typedef pair<long long, long long> pll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);    cout.tie(nullptr);

    long long N, M;
    vector<pll> V;

    cin >> N >> M;  V.resize(N);
    for(int i = 0 ; i < N ; i++) cin >> V[i].first >> V[i].second;
    sort(V.begin(), V.end());
    priority_queue<long long> PQ;

    int pos = 0;
    long long ans = 0;
    for(int i = 1 ; i <= M ; i++){
        while(pos < N && V[pos].first <= i) PQ.push(V[pos].second), pos++;
        if(PQ.size()) { ans += PQ.top();    PQ.pop();}
    }

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

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

int main(){

    string s,t;
    cin>>s>>t;

    int count = 0;
    for(int i=0;i<s.size();i++){

        if(s[i]!=t[i]){
            count++;
        }
    }

    cout<<count;

    return 0;
}


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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let mut stack: Vec<char> = vec![];
    let mut ans = 0;
    for c in s.iter() {
        if stack.len() > 0 && stack.last().unwrap() != c {
            ans += 2;
            stack.pop();
        } else {
            stack.push(*c);
        }
    }
    println!("{}", ans);
}


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

const long N = 100;

int main(){
	long n;
	cin >> n;
	long c[N + 1][N + 1];
	for (long i = 1; i <= n; i++){
		for (long j = 1; j <= n; j++){
			c[i][j] = 0;
		}
	}
	for (long i = 1; i <= n; i++){
		long u, k;
		cin >> u >> k;
		long m[N];
		for (long j = 1; j <= k; j++){
			cin >> m[j];
			c[u][m[j]] = 1;
		}
	}
	for (long i = 1; i <= n; i++){
		for (long j = 1; j <= n; j++){
			if (j - 1) cout << " ";
			cout << c[i][j];
		}
		cout << endl;
	}
}

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

int main()
{
    int k,n;
    cin>>n>>k;
    long double p[n+1],s=0,ans=0;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i];
        // p[i]=(p[i]+1)/2;
    }
    for(int i=1;i<=k;i++)
        s+=p[i];
    ans=s;
    for(int i=k+1;i<=n;i++)
    {
        s-=p[i-k];
        s+=p[i];
        ans=max(ans,s);
    }
    cout<<fixed<<setprecision(9)<<(ans+k)/2;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

vector <int> E[55];
int n, m, a[3], ans[55][4];
ll d[52][102];

void solve(int tc){
	scanf("%d%d%d%d%d", &n, &m, a, a+1, a+2);
	for(int i=0;i<m;i++){
		int x, y;
		scanf("%d%d", &x, &y);
		E[x].pb(y);
	}
	for(int i=1;i<=n;i++){
		d[i][0] = 1LL<<i;
		for(int j=1;j<=100;j++){
			for(int k=1;k<=n;k++){
				if(d[i][j-1] & 1LL<<k){
					for(auto u : E[k]){
						d[i][j] |= 1LL<<u;
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++)for(int j=0;j<4;j++)ans[i][j] = 101;
	for(int i=0;i<4;i++)ans[n][i] = 0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ans[j][3] = max(max(ans[j][0], ans[j][1]), ans[j][2]);
			if(ans[j][3] != 101){
				for(int k=1;k<=n;k++){
					rep(u, 3){
						if(d[k][a[u]] & 1LL<<j){
							ans[k][u] = min(ans[k][u], ans[j][3] + 1);
						}
					}
				}
			}
		}
	}
	if(ans[1][3] != 101)printf("%d\n", ans[1][3]);
	else printf("IMPOSSIBLE\n");
}

int main(){
	int Tc = 1;// scanf("%d",&Tc);
	for(int i=1;i<=Tc;i++){
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 3324
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func divisor(n int) []int {
	res := []int{}
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i*i != n {
				res = append(res, n/i)
			}
		}
	}
	return res
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	X := sc.nextInt()
	for {
		if len(divisor(X)) == 2 {
			break
		}
		X++
	}

	fmt.Fprintln(wtr, X)
	wtr.Flush()
}


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

int main() {
	int a, b, d, r;
	double f;
	cin >> a >> b;
	d = a / b;
	r = a % b;
	f = 1.0 * a / b;
	cout << d << " " << r << " ";
	printf("%.8lf\n", f);
}


Measured memory_bytes: 3220
N=int(input())
CSF=[list(map(int,input().split())) for _ in range(N-1)]
for j in range(N):
    t=0
    for i in range(j,N-1):
        if t<CSF[i][1]:
            t=CSF[i][1]
        else:
            x=(t-1)//CSF[i][2]+1
            t=CSF[i][2]*x
        t+=CSF[i][0]
    print(t)

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

int f(vector<int>& a,int count){
    count++;
    if(a.at(count-1)%2==0)
        a.at(count)=a.at(count-1)/2;
    else
        a.at(count)=3*a.at(count-1)+1;
    
    for(int i=0;i<count;i++){
        if(a.at(i)==a.at(count))
            return count;
    }
    
    f(a,count);
}

int main(){
    vector<int>s(1000000);
    cin>>s.at(0);
    cout<<f(s,0)+1<<endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 int main() {
   int a, b;
   cin >> a >> b;
   if( a % 2 == 0 || b % 2 == 0){
     cout << "Even" << endl;
   }
   else {
     cout << "Odd" << endl;
   }
 }

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
  vector<string >blue(n);
  for(int i=0;i<n;i++)cin>>blue[i];
  int m;cin>>m;
  vector<string >red(m);
  for(int i=0;i<m;i++)cin>>red[i];
  int maxi=0;
  for(int i=0;i<n;i++){
  	string s = blue[i];
    int curr=0;
    for(int j=0;j<n;j++)if(blue[j]==s)curr++;
    for(int j=0;j<m;j++)if(red[j]==s)curr--;
    maxi = max(maxi,curr);
  }
  cout<<maxi;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// 剰余演算クラス
struct ModInt{
    static const LL MOD = 1e+9 + 7;
    LL v;
    ModInt():v(0){}
    ModInt(LL op):v(op){}
    ModInt operator+(ModInt op) const{ return (v + op) % MOD; }
    ModInt operator-(ModInt op) const{ return (v - op + MOD) % MOD; }
    ModInt operator*(ModInt op) const{ return (v * op) % MOD; }
    ModInt operator/(ModInt op) const{ return (v * op.inverse()) % MOD; }
    ModInt operator%(LL op) = delete;
    ModInt operator+=(ModInt op){ return v = (v + op) % MOD; }
    ModInt operator-=(ModInt op){ return v = (v - op + MOD) % MOD; }
    ModInt operator*=(ModInt op){ return v = (v * op) % MOD; }
    ModInt operator/=(ModInt op){ return v = (v * op.inverse()) % MOD; }
    ModInt operator-() const{ return MOD - v; }
    bool operator==(ModInt op) const{ return v == op.v; }
    bool operator!=(ModInt op) const{ return v != op.v; }
    ModInt inverse() const{ return pow(MOD-2); }
    ModInt pow(LL n) const{
        if(n < 0) return pow(MOD-1 + n);
        if(n == 0) return 1;
        ModInt res = pow(n/2);
        return res * res * ((n&1)?ModInt(v): ModInt(1));
    }
    LL get() const{ return v; }
private:
    operator LL() const{ return v; }
};
istream& operator>>(istream& st, ModInt& m){ st>>m.v; return st; }
ostream& operator<<(ostream& st, const ModInt& m){ st<<m.v; return st; }


vector<ModInt> factorial(LL n){
    vector<ModInt> res(n, 1);
    for(LL i = 2; i < n; ++i) res[i] = res[i-1] * ModInt(i);
    return res;
}

ModInt permutation(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m);
}

ModInt combination(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m) / factorial.at(m);
}

ModInt combination2(LL n, LL m){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    ModInt ans = 1;
    for(LL i = 1; i <= m; ++i){
        ans *= ModInt(n+1-i);
        ans /= ModInt(i);
    }
    return ans;
}


int main(){
    LL n, a, b;
    cin >> n >> a >> b;
    vector<ModInt> f = factorial(1000000);
    ModInt ans = ModInt(2).pow(n) - ModInt(1);
    ans -= combination2(n, a);
    ans -= combination2(n, b);
    cout << ans.get() << endl;
    return 0;
}



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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	int x1 = a, x2 = w - a, y1 = b, y2 = h - b;
	rep(i, h) {
		rep(j, w) {
			if (i + 1 <= y1 && j + 1 <= x1) {
				cout << 0 ;
			}
			else if (i + 1 <= y1 && j + 1 > x1) {
				cout << 1;
			}
			else if (i + 1 > y1 && j + 1 <= x1) {
				cout << 1;
			}
			else {
				cout << 0;
			}
		}
		cout << endl;
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		all = new int[2 * N];
		while (K > 0) {
			int[] tmp = make(vals);
			if (Arrays.equals(tmp, vals)) break;
			vals = tmp;
			K--;
		}
		for (int i = 0; i < N; i++) {
			out.print(vals[i] + " ");
		}
		out.println();

		out.flush();
	}

	static int[] all;
	static int[] make(int[] vals) {
		int idx = 0;
		for (int i = 0; i < vals.length; i++) {
			all[idx++] = 2 * (i - vals[i]);
			all[idx++] = 2 * (i + vals[i]) + 1;
		}
		Arrays.sort(all);
		int[] ret = new int[vals.length];
		idx = 0;
		int got = 0;
		for (int i = 0; i < ret.length; i++) {
			int target = 2 * i;
			while (idx < all.length && all[idx] <= target) {
				if ((all[idx] & 1) == 0) got++;
				else got--;
				idx++;
			}
			ret[i] = got;
		}
		return ret;
	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 63344
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#define rep(i, a, n) for(int i = a;i < n;++i)
#define repe(i, a, n) for(int i = a;i <= n;++i)
#define repr(i, a, n) for(int i = a;i > n;--i)
#define reper(i, a, n) for(int i = a;i >= n;--i)
using namespace std;


int main(){
	int N, M;
	map<string, int> s;
	cin >> N;
	rep(i, 0, N){
		string a;
		cin >> a;
		s[a]++;
	}
	cin >> M;
	rep(i, 0, M){
		string a;
		cin >> a;
		s[a]--;
	}

	int ans = 0;
	for(auto i : s)
		ans = max(ans, i.second);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
F = []
for i in range(N):
    F.append(LI())
P = []
for i in range(N):
    P.append(LI())

"""
各時間帯をon/offで2通り全探索すると、2**10になる。
"""
ans = -10**18
def dfs(l):
    global ans
    if len(l) == 10:
        if all(item == 0 for item in l):
            return
        # 探索終了
        point = 0
        for n in range(N):
            s = sum([f for fidx, f in enumerate(F[n]) if f == l[fidx] == 1])
            point += P[n][s]
        ans = max(ans, point)
        return
    dfs(l + [0])
    dfs(l + [1])

dfs([])
print(ans)


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

int main()
{
    int n, ac = 0, wa = 0, tle = 0, re = 0;
    string s;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        if (s=="AC")
            ac++;
        else if (s == "WA")
            wa++;
        else if (s == "TLE")
            tle++;
        else if (s == "RE")
            re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){
	int n,y;
	while(~scanf("%d",&n)){
		if(n==0) break;
		scanf("%d",&y);

		double maxv = -1;
		int res = 0;
		for(int i=0;i<n;i++){
			int b,r,t;
			
			scanf("%d %d %d",&b,&r,&t);

			double basic_int = 0;
			if(t==1){
				basic_int = 10000*(1.0+y*((double)r/100.0));
			}
			else{
				basic_int = 10000*pow(1.0+(double)r/100.0,y);
			}

			if(maxv < basic_int){
				maxv = basic_int;
				res = b;
			}
		}

		printf("%d\n",res);
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <vector>

typedef long long ll;

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

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  string s;
  cin >> s;
  int top = stoi(s.substr(0,2));
  int bottom = stoi(s.substr(2));

  if( (1<=top && top<=12) && (1<=bottom && bottom<=12) )
    cout << "AMBIGUOUS" << endl;
  else if( 1<=top && top<=12 )
    cout << "MMYY" << endl;
  else if( 1<=bottom && bottom<=12 )
    cout << "YYMM" << endl;
  else
    cout << "NA" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n], b[n], c[n];
    rep(i, n) cin >> a[i] >> b[i] >> c[i];
    int dp[n + 2][3]; //前に何をしたか
    rep(i, n + 2) rep(j, 3) dp[i][j] = -INF;
    rep(i, 3) dp[0][i] = 0;

    rep(i, n) rep(j, 3) {
        dp[i + 1][0] = max({dp[i + 1][0], dp[i][1] + a[i], dp[i][2] + a[i]});
        dp[i + 1][1] = max({dp[i + 1][1], dp[i][0] + b[i], dp[i][2] + b[i]});
        dp[i + 1][2] = max({dp[i + 1][2], dp[i][0] + c[i], dp[i][1] + c[i]});
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
    return 0;
}



Measured memory_bytes: 2560
package main

import (
	"fmt"
)

func main() {
	var x int
	fmt.Scan(&x)
	for i := x; i >= 1; i-- {
		if isPow(i) {
			fmt.Println(i)
			break
		}
	}
}

func isPow(n int) bool {
	if n == 1 {
		return true
	}
	for i := 2; i <= n/2; i++ {
		pow := i * i
		for pow <= n {
			if pow == n {
				return true
			}
			pow *= i
		}
	}
	return false
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

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

ll chmin(ll &a, ll b){ return a = (a<b) ? a : b;}

int main(void) {
	string s;
	cin >> s;
	reverse(s.begin(), s.end());//s[i]がi桁目となるようにする
	ll n = s.size() + 1;
	s += '0';

	const ll MAX = 9 * n + 1;//すべての紙幣を9枚ずつ使う

	//dp[i][j]: (i-1)桁目まで見た時に必要な最小枚数
	//jは i-1桁目で繰り下がりが必要かどうか 1:必要 0:なし
	vector<vector<ll>> dp(n+1, vector<ll>(2, MAX));
	dp[0][0] = 0;
	//dp[0][1] = 0;
	for(int i=0; i<n; i++){
		for(int j=0; j<2; j++){
			//i桁目をs[i]にする場合
			int a = s[i] - '0' + j;//(i-1)桁目でa=0としたら，i桁目でaが繰り下がるので，+j(=1)しておく
			int b = 0;
			chmin(dp[i+1][0], dp[i][j] + a + b);

			//i桁目を0にする場合
			a = -j;// a=jじゃなくていいのか？　（よくわからん)
			b = 10 - (s[i] - '0');
			chmin(dp[i+1][1], dp[i][j] + a + b);			
		}

	}
	//cout << " dp: " << endl; print_vec2(dp);
	cout << dp[n][0] << endl;



	
}


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

int top=0;
int w[1000];

void push(int);
int pop(void);

int main()
{
  int a,b,c,temp=0;
  char p;
  top=0;
  while(scanf("%c",&p)==1){
    //printf("%d\n",p[0]);
    if(p=='+'){
      b=pop();
      a=pop();
      push(a+b);
      //printf("test2\n");
      //break;
    }
    else if(p=='-'){
      b=pop();
      a=pop();
      push(a-b);
      //break;
    }
    else if(p=='*'){
      b=pop();
      a=pop();
      push(a*b);
      //break;
    }
    else if(p==' ') {
      if(temp!=0){
	push(temp);
	temp=0;
      }
    }
    
    else if(p=='\n') break;
    else{
      temp=temp*10+p-'0';
      //push(p[0] - '0');
      //printf("test1\n");
    }
  }
  printf("%d\n",pop());
  return 0;
}


void push(int x)
{
  w[top]=x;
  top++;
}
int pop()
{
  top--;
  return w[top];
}

Measured memory_bytes: 536
x = input()
erl = int(x[:2])
lat = int(x[2:4])

def ymjudge(date):
    return date <= 12 and date != 0 

if ymjudge(erl):
    if not ymjudge(lat):
        print("MMYY")
    else:
        print("AMBIGUOUS")
elif ymjudge(lat):
    if not ymjudge(erl):
        print("YYMM")
    else:
        print("AMBIGUOS")
else:
    print("NA")

Measured memory_bytes: 3064
n = int(input())

ans=0
count=0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1==d2:
        count+=1
        if count==3:
            ans+=1
    else:
        count=0
if ans==0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9176
#include <stdio.h>

int main(){
  int alp[26] = {0};
  char ch;
  while(scanf("%c", &ch) != EOF){
    if(ch >= 65 && ch <= 90) alp[ch - 65]++;
    else if(ch >= 97 && ch <= 122) alp[ch - 97]++;
  }
  for(int i = 0; i < 26; i++) printf("%c : %d\n", i + 97, alp[i]);
}



Measured memory_bytes: 2752
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	String str=input.readLine();
	
	
		str=str.replaceAll("apple","tmp1");
		str=str.replaceAll("peach","tmp2");
		str=str.replaceAll("tmp1","peach");
		str=str.replaceAll("tmp2","apple");
	    
	    System.out.println(str);
	
    }
}

Measured memory_bytes: 16896