akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<double> v(N);
  rep(i, N) cin >> v[i];

  priority_queue<double, vector<double>, greater<double>> que;
  rep(i, N) que.push(v[i]);
  rep(i, N - 1){
    double a = que.top(); que.pop();
    double b = que.top(); que.pop();
    que.push((a + b) / 2);
  }
  double ans = que.top();
  cout << ans << endl;
}


Measured memory_bytes: 256
def e_strings_of_inpurity():
    from bisect import bisect
    S = input()
    T = input()

    char_appear = {ch: [] for ch in 'abcdefghijklmnopqrstuvwxyz'}
    for i, ch in enumerate(S):
        char_appear[ch].append(i)

    # editorial における二分探索を使うやり方
    p = -1  # 文字 t は S' の p (mod |S|) 番目に現れた
    loop = 0
    for t in T:
        if not char_appear[t]:
            return -1  # 文字tが存在しなかった
        idx = bisect(char_appear[t], p)
        # idx がリストの末尾を指す場合、次のSを指しているということ
        loop += 1 if idx == len(char_appear[t]) else 0
        p = char_appear[t][idx % len(char_appear[t])]
    return loop * len(S) + p + 1

print(e_strings_of_inpurity())

Measured memory_bytes: 7796
//101a.cpp
#include<iostream>
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0;i<s.size();i++){
            if(s[i] == '+'){
                ans ++;
            }else{
                ans --;
            }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
"
パナソニックプログラミングコンテスト2020 C問題
https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
"

a, b, c = gets.split.map(&:to_i)

if 4*a*b < (c-a-b)**2 and c-a-b > 0
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
import sys
input = sys.stdin.readline
n=int(input())

ans=0
if n<=104:
    print(0)
else:
    ans=0
    for i in range(105,n+1,2):
        c=0
        for j in range(1,i+1):
            if i%j==0:
                c+=1
        if c==8:
            ans+=1
    print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
#define lll __int128
const int inf=1e9+7;
const int mod=1e9+7;

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int n;
	
	cin>>n;
	
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			if(i*j==n)
				return cout<<"Yes"<<endl,0;
		}
	}
	
	return cout<<"No"<<endl,0;
	
	return 0;
}

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

using namespace std;

int main() {
    long long n;

    cin >> n;

    vector<long long> prime;
    prime.push_back(2);
    for(long long i=3; i<1000000; i+=2) {
        bool flg = true;
        for(long long j=3; j*j<=i;j+=2) {
            if(i % j==0) {
                flg = false;
                break;
            }
        }
        if(flg) prime.push_back(i);
    }

    int count = 0;
    for(long long p: prime) {
        if(p > n) break;

        int c = 0;
        while(n % p == 0) {
            c += 1;
            n /= p;
        }
        if(c != 0) {
            int d = 1;
            while((d+1)*(d+2)/2 <= c) d++;
            count += d;
        }

    }

    if(n != 1) count++;

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 4324
N,M=map(int,input().split())
A=[]
B=[]
for i in range(N):
    A.append(list(map(int,input().split())))
for j in range(M):
    B.append(int(input()))
for k in range(N):
    p=0
    for z in range(M):
        p+=A[k][z]*B[z]
    print(p)
          


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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

const int maxn = 200005;
struct edge {
    int v,w;
};
vector<edge> g[maxn];
int dis[maxn], vis[maxn], lst[maxn];
priority_queue<pii,vector<pii>,greater<pii>> q;
void dijkstra(int u) {
    memset(dis,0x3f,sizeof(dis));
    dis[u] = 0;
    q.push({0, u});
    while(!q.empty()) {
        pii cur = q.top(); q.pop();
        if(vis[cur.second]) continue;
        vis[cur.second] = 1;
        for(edge e : g[cur.second]) {
            if(dis[e.v] > dis[cur.second] + e.w) {
                dis[e.v] = dis[cur.second] + e.w;
                lst[e.v] = cur.second;
                q.push({dis[e.v], e.v});
            }
        }
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    for(int i=1;i<=m;++i) {
        int u,v;
        cin>>u>>v;
        g[u].pb({v,1});
        g[v].pb({u,1});
    }
    dijkstra(1);
    for(int i=2;i<=n;++i) if(dis[i] > 1e9) return cout<<"No"<<endl,0;
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;++i) cout<<lst[i]<<endl;
}

Measured memory_bytes: 16228
s = input()
t = input()


ns = len(s)
nt = len(t)

nux = 0
for i in range(1000):
    count = 0
    if i+nt-1 >= ns:
        break
    for j in range(nt):
        if s[i+j] == t[j]:
            count += 1

    nux = max(nux, count)

print(nt-nux)


Measured memory_bytes: 9048
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int n, x, y;
ll m, dp[100005];
vector <int> edge[100005];

void dfs(int cur, int par) {
    dp[cur] = 1LL;
    for (int child : edge[cur]) {
        if (child == par) continue;
        dfs(child, cur);
        (dp[cur] *= (dp[child] + 1LL)) %= m;
    }
}

void dfs2(int cur, int par, ll par_value) {
    int sz = edge[cur].size();
    vector <ll> left(sz+1, 1LL), right(sz+1, 1LL);
    for (int i = 0; i < sz; i++) {
        int child = edge[cur][i];
        if (child == par) left[i+1] = right[i] = par_value + 1LL;
        else left[i+1] = right[i] = dp[child] + 1LL;
    }

    for (int i = 0; i < sz; i++) {
        (left[i+1] *= left[i]) %= m;
        (right[sz - i - 1] *= right[sz - i]) %= m;
    }

    dp[cur] = right[0];
    for (int i = 0; i < sz; i++) {
        int child = edge[cur][i];
        if (child == par) continue;
        dfs2(child, cur, left[i] * right[i+1] % m);
    }
}

int main() {
    cin >> n >> m;
    for (int i = 1; i < n; i++) {
        cin >> x >> y;
        x--; y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    dfs(0, -1);
    dfs2(0, -1, 0.0);
    for (int i = 0; i < n; i++) cout << dp[i] << "\n";
    return 0;
}

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

int bubblesort(int N, int A[]){
    int frag=1;
    int count=0;
    while (frag){
        frag = 0;
        for (int i=N-1; i>0; i--){
            if (A[i] < A[i-1]){
                int v = A[i];
                A[i] = A[i-1];
                A[i-1] = v;
                count += 1;
                frag = 1;
            }
        }
    }
    return count;
}

int main(){
    int N;
    cin >> N;
    int A[N];
    for (int i=0; i<N; i++) cin >> A[i];
    int count = bubblesort(N,A);
    for (int j=0; j<N; j++){
        if (j==N-1) cout << A[j] << "\n";
        else cout << A[j] << " ";
    }
    cout << count << "\n";
    
    return 0;
}


Measured memory_bytes: 3088
import java.util.Scanner;
public class Main{
     
    public void solve(){
		Scanner sc = new Scanner(System.in);
		
        int a,b,c;
		
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		if(a < b && b <c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
    }			
       public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
     }
}

Measured memory_bytes: 17340
#include<cstdio>
//binary search on minimun value
long long a[100005];
long long cnt[100005];
long long sum[100005];
long long valueSum[100005];

long long getCount(int u,int n){
    long long res = 0;
    for(int i = 1; i <= n; i++){
        int need = u-a[i];
        if(need<1) need = 1;
        if(need>100000) continue;
        long long count = n - sum[need-1];
        res += count;
    }
    return res;
}

long long getSum(int lower,long long n){
    long long res = 0;
    for(int i = 1; i <= n; i++){
        int need = lower - a[i];
        if(need<1) need = 1;
        if(need>100000) continue;
        long long add = (n-sum[need-1])*a[i];
        add += valueSum[100000]-valueSum[need-1];
        res += add;
    }
    return res;
}

int main(){
    int n; long long m;
    scanf("%d%lld",&n,&m);
    for(int i = 1; i <= n; i++){ 
        scanf("%lld",&a[i]);
        cnt[a[i]]++;
    }
    //cntSum
    sum[0] = 0;
    for(int i = 1; i <= 100000; i++) sum[i] = sum[i-1] + cnt[i];
    //valueSum
    valueSum[0] = 0;
    for(int i = 1; i <= 100000; i++){
        long long add = (long long)i*cnt[i];
        valueSum[i] = valueSum[i-1] + add;
    }
    int L = 1, R = 200000;
    long long res = -1;
    while(L<=R){
        int M = (L+R)/2;
        long long count = getCount(M,n);
        if(count>=m){
            res = M;
            L = M + 1;
        }
        else R = M - 1;
    }
    long long lack = m - getCount(res+1,n);
    //printf("Minimum = %lld\n",res);
    //printf("lack = %lld\n",lack);
    long long ans = res*lack + getSum(res+1,n);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3328
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	ans := 0
	for i := 0; i < n; i++ {
		if 0 < i && 0 < a[i] && a[i-1] == 1 {
			a[i-1]--
			a[i]--
			ans++
		}

		cnt := a[i] / 2
		ans += cnt
		a[i] = a[i] % 2
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

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

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

const int lim = 200010;
int bit[lim];

void add(int i,int x){
	i += lim / 2;
	while(i < lim){
		bit[i] += x;
		i += i & -i;
	}
}

int sum(int i){
	i += lim / 2;
	int s = 0;
	while(i){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

int n,a[100010];

int calc(int x){
	int res = 0,tmp = 0;
	//cout << x << endl;
	for(int i = 0;i < lim;i++) bit[i] = 0;
	add(0,1);
	for(int i = 0;i < n;i++){
		//cout << tmp << " " << res << endl;
		if(a[i] <= x) tmp++;
		else tmp--;
		res += sum(tmp - 1);
		add(tmp,1);
	}
	return res;
}

signed main(){
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	int low = 0,up = 2e9;
	while(up - low > 1){
		int mid = (up + low) / 2;
		if(calc(mid) >= n * (n + 1) / 4 + 1) up = mid;
		else low = mid;
	}
	cout << up << endl;
	return 0;
}

Measured memory_bytes: 2560
<?php
  $expections = fgets(STDIN);
  $results = fgets(STDIN);
  $expection = str_split($expections);
  $result = str_split($results);

  $count = 0;

  for($i=0; $i<3; $i++){
      if($expection[$i] === $result[$i]){
          $count+=1;
      }
  }

  echo $count;

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,Int k){
    Mint num(1),dom(1);
    for(Int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;

  vector<Int> ds(n);
  for(Int i=0;i<n;i++) cin>>ds[i];

  if(ds[0]!=0) drop(0);
  if(*min_element(ds.begin()+1,ds.end())==0) drop(0);

  map<Int, Int> cnt;
  for(Int d:ds) cnt[d]++;

  using M = Mint<Int, 998244353>;
  M ans{1};
  for(Int d:ds)
    if(d) ans*=M(cnt[d-1]);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 7296
#include<stdio.h>
    #include<string.h>
    int main(void){
       int A,B,sum,kake,hiku;
       scanf("%d %d",&A,&B);
       sum=A+B;
       kake=A*B;
       hiku=A-B;
       if((sum>=kake)&&(sum>=hiku)){
          printf("%d",sum);
       }else if((sum<=kake)&&(kake>=hiku)){
          printf("%d",kake);
       }else if((hiku>=kake)&&(sum<=hiku)){
          printf("%d",hiku);
       }


       return 0;
    }

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

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

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

ll f (ll x, ll c, ll d)
{
    ll res = x;
    res -= x/c;
    res -= x/d;
    res += x/lcm(c,d);
    return res;
}

int main()
{
    ll a,b,c,d;
    vector<ll> nums;
    cin >> a >> b >> c >> d;

    ll cnt(f(b,c,d) - f(a-1, c, d));

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   string s,p;
   cin>>s>>p;
     
   string ans="No";
   for(int i=0;i<(int)s.length();i++){
       bool flag=true;
       for(int j=0; j<(int)p.length();j++){
           if(s[(i+j)%(int)s.length()]!=p[j]){
               flag=false;
               break;
           }
       }
       if(flag){
           ans="Yes";
           break;
       }
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 3228
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        s = s.replaceAll("/", "");
        if(s.compareTo("20190430") <= 0) System.out.println("Heisei");
        else System.out.println("TBD");
    }
}

Measured memory_bytes: 35764
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
	string s;
	cin >> s;
	int N = s.size();

	for(int i=0;i<N;i++){
		if(i%2==0) cout << s[i];
	}
	cout <<endl;
    
	return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 100000 + 10;
int A[MAX_N];
int B[MAX_N];
int C[MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  REP(i, N) B[i] = nextInt();
  REP(i, N) C[i] = nextInt();
  sort(A, A + N);
  sort(B, B + N);
  sort(C, C + N);
  ll ans = 0;
  REP(i, N) {
    ll x = (ll)(lower_bound(A, A + N, B[i]) - A);
    ll y = N - (ll)(upper_bound(C, C + N, B[i]) - C);
    ans += x * y;
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	int ans = 1;

	for(int i = 2; i*i <= N; i++){

		ans = i;
	}

	printf("%d\n",ans*ans);

	return 0;
}


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

int main(){
    int n,m,a,b,t,count=0;
    int d[1000];
    
    for(int i=0;i<1000;i++) d[i]=0;
    
    cin >> n >> m >> a >> b;
    for (int i=0;i<n;i++){
        cin >> t;
        if (t >= a) d[count++] = t;
        else break;
    }
    if ((n-count) >= m) {
        cout << count << endl;
        return 0;
    }
    for (int i=count-1;i>=0;i--){
        if (d[i]<=b) count--;
        else break;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

void solve()
{
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0; i<n; i++){
        cin>>h[i];
    }
    int dp[n];
    dp[0]=0;
    for(int i=1; i<n; i++){
        int c=INT_MAX;
        for(int j=1; j<=k; j++){
            if(i-j>=0){
                c=min(c,dp[i-j]+abs(h[i]-h[i-j]));
            }
        }
        dp[i]=c;
    }
    cout<<dp[n-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
}


Measured memory_bytes: 4372
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  (n, k) = InputLine.to_ia
  a = InputLine.to_ia

  (n - k).times do |offset|
    i = k + offset
    puts ((a[offset] < a[i]) ? 'Yes' : 'No')
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

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

int main(){
	int n, t;
	cin >> n >> t;
	pair <int, int> a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i].first >> a[i].second;
	}
	sort(a, a+n);
	int dp[t];
	memset(dp, 0, sizeof(dp));
	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = t-1; j >= 0; j--){
			if(a[i].first + j < t)
				dp[j + a[i].first] = max(dp[j + a[i].first], dp[j] + a[i].second);
			ans = max(ans, dp[j] + a[i].second);
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 764
//17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
#define ff  first
#define ss  second
#define pb  push_back
#define ll  long long
#define ld  long double
#define eb  emplace_back
#define ull unsigned long long
#define all(v) v.begin(), v.end()
#define rep(i,x,n)  for(int i=x;i<n;i++)
#define repr(i,x,n) for(int i=x;i>=n;i--)
#define bolt ios::sync_with_stdio(false)
using namespace std;

void IoI() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

int32_t main() {
	//IoI();
	bolt;
	cin.tie(nullptr);
	cout.tie(nullptr);
	string s; cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
def main():
  s = int(input())
  
  a = s // 100
  b = s % 100
  
  if 1 <= a and a <= 12:
    if 1 <= b and b <= 12:
      print("AMBIGUOUS")
    else:
      print("MMYY")
  
  else:
    if 1 <= b and b <= 12:
      print("YYMM")
    else:
      print("NA")
  
main()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    char a='$',b='$';
    int acnt = 0,bcnt = 0;
    cin>>str;
    for(auto c:str){
        if(c == a)
            acnt++;
        else if(c == b)
            bcnt++;
        else if(a == '$')
            a = c;
        else
            b = c;
    }
    if(acnt == 1 && bcnt == 1)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
nk = input().split()
d = input().split()


def hantei(int_siraverukazu):
    lst_siraverukazu = list(str(int_siraverukazu))
    onazi_t_tigau_f = []
    for i in range(int(nk[1])):
        for j in range(len(lst_siraverukazu)):
            if d[i] != lst_siraverukazu[j]:
                onazi_t_tigau_f.append(False)
            else:
                onazi_t_tigau_f.append(True)
    return onazi_t_tigau_f

serch_num  = int(nk[0])
kekka = hantei(serch_num)

while True:
    kekka = hantei(serch_num)
    if True in kekka:
        serch_num += 1
        continue
    if True not in kekka:
        result = serch_num
        break
print(result)


Measured memory_bytes: 3064
import numpy as np

N,M=map(int,input().split())
# N,M=4,4
A = list(map(int,input().split()))
#dymmy
A.append(-1)
# A=[1,9,3,5]
# print(np.argmax(A))

# print(N,M,A)
Val = sorted(A,reverse=True)
# print("割引前",Val)

#Ｍ枚の商品券を持っているため
hoge =Val[0]

if N==1:
    print(Val[0]//(2**M))
    exit(0)
if M==1:
    Val[0]//=2
    print(sum(Val)+1)
    exit(0)
# for i in range(M):
#     # A[np.argmax(A)]= A[np.argmax(A)]//2
#     Val[0]//=2
#     for i in range(1,M):
#         if Val[0]<Val[i]:
#             Val[0],Val[i] = Val[i],Val[0]
#             break
#         else:
#             pass
i=0
while i<M:
    # A[np.argmax(A)]= A[np.argmax(A)]//2
    i+=1
    Val[0]//=2
    if i>=M:
        break
    for j in range(1,M):
        if i<M and Val[0]<Val[j]:
            Val[j]//=2
            i+=1
        else:
            Val = sorted(Val,reverse=True)
            break
    

# print(Val)
print(sum(Val)+1)

Measured memory_bytes: 23104
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main () {
    double n, x[100], y[100];
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> x[i];
    for (int i = 0; i < n; i++)
        cin >> y[i];

    cout <<fixed << setprecision(8);
    for (int j = 1; j <= 3; j++) {
        double sum = 0;
        for (int i = 0; i < n; i++)
            sum += pow(abs(x[i] - y[i]), j);
        cout << pow(sum, 1.0 / j) << '\n';
    }

    double max = abs(x[0] - y[0]);
    for(int i = 1; i < n; i++)
        if (abs(x[i] - y[i]) > max)
            max = abs(x[i] - y[i]);
    cout << max << '\n';
}


Measured memory_bytes: 3428
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi; 




int32_t main()
{
	IOS
	int r,c;cin>>r>>c;
	vector<string>s(r);
	for(int i=0;i<r;i++)cin>>s[i];
	vector<vector<int>>dp(r,vector<int>(c));
	dp[0][0]=1;
	for(int i=1;i<r;i++)
	{
		if(s[i][0]!='#')dp[i][0]=dp[i-1][0];
	}
	for(int i=1;i<c;i++)
	{
		if(s[0][i]!='#')dp[0][i]=dp[0][i-1];
	}
	for(int i=1;i<r;i++)
	for(int j=1;j<c;j++)
	{
		if(s[i][j]!='#')dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
	}
	cout<<dp[r-1][c-1]<<endl;
	
	
}
		


Measured memory_bytes: 9216
/**
 *    author:  tourist
 *    created: 04.01.2020 02:11:27       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, d;
  cin >> n >> d;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> pref(n + 1);
  pref[0] = d;
  for (int i = 0; i < n; i++) {
    pref[i + 1] = min(pref[i], abs(pref[i] - a[i]));
  }
  vector<long long> suf(n + 1);
  suf[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    suf[i] = (a[i] <= 2 * suf[i + 1] + 1 ? a[i] : 0) + suf[i + 1];
  }
  int tt;
  cin >> tt;
  while (tt--) {
    int id;
    cin >> id;
    --id;
    cout << (pref[id] <= suf[id + 1] ? "NO" : "YES") << '\n';
  }
  return 0;
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

const long long MOD = 1000000007LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long mult_mod(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

long long arr[400005];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n; cin >> n;

    int tot = 0;
    for(int i = 1; i <= n; ++i)
        if(((int) log10(i)) % 2 == 0)
            ++tot;
    cout << tot;

    return 0;
}


Measured memory_bytes: 640
/**
  * author : thegeniushead
**/
#include <bits/stdc++.h>
 
/*.....DEFINITIONS...... */
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T() int tt; cin>>tt; while(tt--)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define lchild (2*node+1)
#define rchild (2*node+2)
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define eps (1e-6)
#define sll(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define what_is(x) cerr << #x << " is " << x << "\n";
#define infll 9e18
#define inf 1e9
#define int unsigned long long int
#define pi (double)3.14159

using namespace std;
 
/*.....TYPEDEFS ....*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long double ld;
 
/*....USEFUL FUNCTIONS....*/
ll pwr(ll base, ll exp, ll mod=MOD){ll res=1; while(exp>0){if(exp%2){res=(res*base)%mod;}base=(base*base)%mod;exp/=2;}return res;}
ll gcd(ll a, ll b){ if(b==0)return a; else gcd(b, a%b);}
bool isPrime(ll n){if(n<=1)return false;if(n<=3)return true;if (n%2==0||n%3==0)return false;for(int i=5; i*i<=n; i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
 
/*....I/O Functions...*/
inline string rs(){char x[1234567];scanf("%s", x);string s = x; return s;}
inline int ri(){int x; scanf("%d", &x);return x;}
inline long long rl(){long long x; scanf("%lld", &x); return x;}
 
/*---------Solution below this line --------*/
 
const int N = 1234567;

int n, m, k;

int32_t main()
{
	FIO
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	cin >> n >> m >> k;
	
	rep1(a,0,n){
		rep1(b,0,m){
			if(m*a + n*b - 2*(a*b) == k){
				cout << "Yes";
				return 0;
			}
		}
	}
	
	cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 16;
#define L(i) (1LL<<(i))

int n, a[N][N], dp[L(N)];
std::vector<int> v;

int solve(int mask){
   if(mask == 0)
      return 0;
   int &ans = dp[mask];
   if(ans != -1)
      return ans;
   ans = -inf;
   for (int submask = mask ; submask > 0; submask = (submask-1)&mask)
      smax(ans, v[submask] + solve(submask^mask));  
   return ans;
}

int32_t main(){_

   cin>>n;
   v.resize(L(n));

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

   for (int mask = 0; mask < L(n); ++mask)
   {
      std::vector<int> tmp;
      for (int i = 0; i < n; ++i)
         if(mask&(L(i)))
            tmp.pb(i);

      for (int i = 0; i < sz(tmp); ++i)
      {
         for (int j = i+1; j < sz(tmp); ++j)
         {
            int t1 = tmp[i], t2 = tmp[j];
            v[mask] += a[t1][t2];
         }
      }
   }   

   memset(dp, -1, sizeof dp);
   cout<<solve((L(n))-1);
   return 0;
}

Measured memory_bytes: 1280
//#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod = 1e9 + 7;
const ll infll = 1e18 + 9;
const int infint = 1e9 + 7;
const int MAXN = 3e5 + 7;
const double eps = 1e-9;
const long double pi = 3.1415926535897932384626433832795;
const long double e = 2.71828182845904523536028747135266;
inline ll read()
{
    ll kr = 1, xs = 0;char ls;ls = getchar();
    while (!isdigit(ls)){
        if (!(ls ^ 45)) kr = -1;
        ls = getchar();
    }
    while (isdigit(ls)){
        xs = (xs << 1) + (xs << 3) + (ls ^ 48);ls = getchar();
    }return xs * kr;
}
// inline __int128 read128()
// {
//     __int128 kr=1,xs=0;char ls;ls=getchar();
//     while(!isdigit(ls)){
//         if(!(ls^45)) kr=-1;ls=getchar();
//     }
//     while(isdigit(ls)){
//         xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
//     }
//     return xs*kr;
// }
inline ull readull()
{
    ull xs = 0;char ls;ls = getchar();
    while (!isdigit(ls))ls = getchar();
    while (isdigit(ls)){
        xs = (xs << 1) + (xs << 3) + (ls ^ 48);ls = getchar();
    }return xs;
}
inline void writeull(ull x)
{
    if (x < 0){
        x *= -1;putchar('-');
    }
    if (x >= 10) writeull(x / 10);
    putchar('0' + x % 10);
}
inline void write(ll x)
{
    if (x < 0){
        x *= -1;putchar('-');
    }
    if (x >= 10) write(x / 10);
    putchar('0' + x % 10);
}
// inline void write(__int128 x){
//     if(x<0){x*=-1;putchar('-');}
//     if(x>=10) write(x/10);
//     putchar('0'+x%10);
// }
///////////////////////////////////////////////////////////////////////////////////////
ll dp[2009];
int dfs(int n){
    if(n==1||n==2||n==0) return 0;
    if(dp[n]) return dp[n];
    ll ans=1;
    for (int i=1;i<=n;i++){
        ans=(ans+dp[i]*dp[n-i]);
    }
}
int main()
{
    // ios_base::sync_with_stdio(0);
    // cin.tie(0),cout.tie(0);
    int t = 1;
    // t = read();
    while (t--)
    {   
        int n=read();dp[0]=0;dp[1]=0;dp[2]=0;dp[3]=1;dp[4]=1;dp[5]=1;
        for (int i=6;i<=2000;i++) dp[i]=(dp[i-1]+dp[i-3])%mod;
        cout << dp[n] << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq


setrecursionlimit(10**6)
s=stdin.readline().rstrip()
lens=len(s)
loop1=1
loop2=lens-2
t2=list(s[-1])
t1=list(s[0])
now=0
z=""
while loop1<lens:
    z=str(s[loop1])
    ch=False
    while loop1<lens:
        if z!=t1[now]:
            t1.append(z)
            ch=True
            now+=1
            break
        else:
            loop1+=1
            if loop1<lens:
                z+=s[loop1]
    if not ch:
        t1[-1]+=z
    loop1+=1
z=""
now=0
while loop2>-1:
    z=str(s[loop2])
    ch=False
    while loop2>-1:
        if z!=t2[now]:
            t2.append(z)
            ch=True
            now+=1
            break
        else:
            loop2-=1
            if loop2>-1:
                z+=s[loop2]
    if not ch:
        t2[-1]+=z
    loop2-=1
print(max(len(t1),len(t2)))

Measured memory_bytes: 62964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

int main()
{
	int n;
	int a[200];
	cin >> n;

	rep(i, n) cin >> a[i];

	int num = 0;

	while(1){
		rep(i, n){
			if(a[i] % 2 == 1){
				cout << num << endl;
				return 0;
			}
			a[i] = a[i] / 2;
		}
		num++;
	}
}



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

#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0) break;
    int a[1000];
    lpin(a,i,n);
    int ans=1000001,b;
    for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
	if(a[i]>a[j]) b=a[i]-a[j];
	else b=a[j]-a[i];
	if(ans>b) ans=b;
      }
      if(b==0) break;
    }
    cout<<ans<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 3056
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_list_of_float():
    return [float(f) for f in input().split()]


def get_list_of_char():
    return list(input().strip())


def get_data(n, order=None, **kwargs):
    if not order:
        order = range(len(kwargs))
    it = iter(order)
    var, fn = zip(*sorted(sorted(kwargs.items()), key=lambda _: next(it)))

    rows = []
    for _ in range(n):
        rows.append(input().split())
    columns = zip(*rows)
    exec("global "+", ".join(var)+"\n"+"\n".join(
        v+"=list(map(fn[{}], data[{}]))".format(i, i)
        for i, v in enumerate(var)),
        globals(),
        {"fn": list(fn), "data": list(columns)}
    )
    return


# inputs
N, Y = 0, 0


def set_inputs():
    global N, Y
    N, Y = get_list_of_int()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    for i, j in itertools.combinations(range(N+2), 2):
        x, y, z = i, j - i - 1, N - j + 1
        if x * 10000 + y * 5000 + z * 1000 == Y:
            print(x, y, z)
            break
    else:
        print(-1, -1, -1)
    return


if __name__ == '__main__':
    main()


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


int main()
{
    ll x, t;
    cin >> x >> t;
    cout << max((ll)0, x - t) << endl;
    return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

#define LOCAL
#ifdef LOCAL
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else 
#define dump(x) true
#endif

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

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

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

int main() {
	int N; cin >> N;
	V<pii> vec;
	rep(i, N) {
		int X, L;
		cin >> X >> L;
		vec.eb(X + L, X - L);
	}
	sort(ALL(vec));

	int la = -TEN(9);
	int cnt = 0;
	rep(i, N) {
		if (la <= vec[i].se) {
			++cnt;
			la = vec[i].fi;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1400
object Main extends App {

  import scala.io.StdIn._


  val n = readLine.trim.toInt
  val nodes = Array.tabulate(n){_ ⇒ new Node()}
  val isVisit = Array.tabulate(n){_ ⇒ false}
  for (_ ← 0 until n){
    val Array(v, u) = readLine.trim.split(' ').map(_.toInt)
    nodes(v - 1).addNode(u - 1)
    nodes(u - 1).addNode(v - 1)
  }
  markLoop(0, nodes, isVisit)
  for (_ ← 0 until readLine.trim.toInt){
    val Array(a, b) = readLine.trim.split(' ').map(_.toInt)
    println(
      if (nodes(a - 1).isOnLoop && nodes(b - 1).isOnLoop) 2 else 1
    )
  }
  def markLoop(root: Int, nodes: Array[Node], isVisited: Array[Boolean]): Unit = {
    isVisited(root) = true
    nodes(root).edges.flatMap(p ⇒ markLoop(p, root, nodes, isVisited)).headOption match {
      case Some(_) ⇒ nodes(root).isOnLoop = true
      case _ ⇒
    }
  }
  def markLoop(current: Int, parent: Int, nodes: Array[Node], isVisited: Array[Boolean]): Option[Int] = {
    isVisited(current) = true
    nodes(current).edges.find(p ⇒ p != parent && isVisited(p)) match {
      case None ⇒
        nodes(current).edges.filterNot(p ⇒ isVisited(p)).flatMap(p ⇒ markLoop(p, current, nodes, isVisited)).headOption match {
          case None ⇒ None
          case Some(p) if p == current ⇒
            nodes(current).isOnLoop = true
            None
          case Some(p) ⇒
            nodes(current).isOnLoop = true
            Some(p)
        }
      case Some(l) ⇒
        nodes(current).isOnLoop = true
        Some(l)
    }
  }
  class Node{
    private var mEdges: List[Int] = Nil
    def addNode(to: Int): Unit = mEdges ::= to
    def edges: List[Int] = mEdges
    var isOnLoop: Boolean = false
  }
  implicit class Extenion[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 320480
x = int(input())

# 6 5 6 5 ...
# ex) 23
# (x // 11 * 2) + 1
# ex) 29
# (x // 11 * 2) + 2

p, m = divmod(x, 11)
p *= 2

if m > 6:
    print(p + 2)
elif m == 0:
    print(p)
else:
    print(p + 1)


Measured memory_bytes: 2940
let () =
  let n = read_int () in
  let rec doit i m ans =
    if i = n then ans
    else
      let r = read_int () in
      doit (i + 1) (min m r) (max ans (r - m)) in
  Printf.printf "%d\n" (doit 1 (read_int ()) min_int)

Measured memory_bytes: 4440
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
inline int read()
{
    int X=0; bool flag=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
    while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
    if(flag) return X;
    return ~(X-1);
}
 
int n;

int main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	n=read();
	if(n==1) puts("0");
	else puts("1");


    return 0;
}

Measured memory_bytes: 3636
N = int(input())

ans = [0 for _ in range(10**4+50)]

for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if tmp < 10**4+50:
                ans[tmp] += 1

for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 9332
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

Asort = sorted(A)

from collections import Counter
c = Counter(A)
keys, values = zip(*c.most_common())

ans = 0
N = len(keys)

for i in range(K,N):
    ans += values[i]
    
print(ans)

Measured memory_bytes: 55348
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);
	switch (N) {
	case 1:
	case 2:
	case 3:
	case 5:
	case 6:
	case 9:
	case 10:
	case 13:
	case 17:
		printf("No\n");
		break;
	default:
		printf("Yes\n");
		break;
	}
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1636
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cassert>
#include <random>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#include "./Lib/Timer.hpp"
#include "./Lib/sample.hpp"
#else
#define dump(...)
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;
template<class T>
using V = std::vector<T>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* Remove the source of the bug */
signed pow(signed, signed) { assert(false); return -1; }

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================



signed main() {
	ll n;
	cin >> n;
	REP(i, 60000) {
		ll val = i * 1.08;
		if (val == n) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;
    for(ll i=2; i*i<=n; i++) {
        if(n % i != 0) continue;
        ll num = 0;
        while(n % i == 0)  {num++; n /= i;}
        res.push_back(make_pair(i, num));
    }
    if(n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    ll n; cin >> n;
    ll ans = 0;
    Rep(i, 1, n) {
        vector<pair<ll, ll>> p = prime_factorize(n - i);
        ll c = 1;
        for(auto x : p) c *= x.second+1;
        ans += c;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628