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

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

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll cc = b / c - (a - 1) / c;
    ll dd = b / d - (a - 1) / d;
    ll num = (c * d) / gcd(c, d);
    ll cd = b / num - (a - 1) / num;

    cout << b - a + 1 - (cc + dd - cd) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)

{
	char at[10];
	char s[150];
	char co[10];
	scanf("%s %s %s",at,s,co);
	
	printf("%c%c%c\n",at[0],s[0],co[0]);
	return 0;
}

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

int main() {

    int v[4], k;
    for (int i = 1; i <= 3; i++)
        cin >> v[i];
    cin >> k;
    int cnt = 0, maxSum = 0, con = 1;
    for (int i = 1; i <= 3 && k; i++) {
        maxSum += min(k, v[i]) * con;
        k -= min(k, v[i]);
        con--;
    }
    cout << maxSum;

    return 0;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) throws IOException {
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     
     
     // BufferedReader br=new BufferedReader(new FileReader("sample.txt"));
        int n=Integer.parseInt(br.readLine());
        Dice[] dice=new Dice[n];
        for(int i=0;i<n;i++){
        dice[i] =new Dice(br.readLine());
        }boolean con=false;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(con=dice[i].equals(dice[j]))break;
            }if(con)break;
        }System.out.println(con?"No":"Yes");
     
         
         
    }
    }
class Dice{
 
String top,front,right,left,back,bot;
 
    Dice(String str){
        String[] s=str.split(" ");
        top=s[0];
        front=s[1];
        right=s[2];
        left=s[3];
        back=s[4];
        bot=s[5];
    }
    boolean equals(Dice d){
        for(int i=0;i<6;i++){
            if(front.equals(d.front))break;
            if(i==3)roll('E');
            roll('N');
        }
        for(int i=0;i<3;i++){
            if(top.equals(d.top))break;
            roll('W');
        }
        return back.equals(d.back) && bot.equals(d.bot)&&top.equals(d.top)&&front.equals(d.front)
					&& left.equals(d.left) && right.equals(d.right);
    }
         
    void roll(char c){
        String top,bot,back,front,left,right;
         
        top=this.top;bot=this.bot;
        front=this.front;
        back=this.back;
        left=this.left;
        right=this.right;
         
        switch(c){
        case 'N':
            top=this.front;
            bot=this.back;
            front=this.bot;
            back=this.top;
            break;
         
        case 'S':
            top=this.back;
            bot=this.front;
            front=this.top;
            back=this.bot;
            break;
        case 'W':
            top=this.right;
            bot=this.left;
            right=this.bot;
            left=this.top;break;
         
        case 'E':
            top=this.left;
            bot=this.right;
            right=this.top;
            left=this.bot;
            break;
        }
        this.top=top;
        this.front=front;
        this.right=right;
        this.left=left;
        this.back=back;
        this.bot=bot;}}

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

int main() {
    int N; string s, t;
    cin >> N >> s >> t;
    int S = s.size(), T = t.size();
    for(int i=min(S, T); i>=1; i--) {
        if(s.substr(S-i, i) == t.substr(0, i)) return !printf("%d", S+T-i);
    }
    printf("%d", S+T);
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 10**9 + 7

if N == 1
  puts 1
  exit 0
end

i = N / 2

if N % 2 == 0
  n = Array.new(i) {0}
  A.each do |a|
    if a/2 < 0 || a/2 >= i || a % 2 != 1
      satisfied = false
      break
    end
    n[a/2] += 1
  end

  satisfied = n[1..-1].all? {|a| a == 2}
else
  n = Array.new(i + 1) {0}
  A.each do |a|
    if a/2 < 0 || a/2 >= i + 1 || a % 2 != 0
      satisfied = false
      break
    end
    n[a/2] += 1
  end

  satisfied = n[1..-1].all? {|a| a == 2} && n[0] == 1
end

if satisfied
  puts 2 ** i % MOD
else
  puts 0
end


Measured memory_bytes: 8596
#include<bits/stdc++.h>
using namespace std;
int n;
bool judge(int a)
{
	int i=0;
	while(a)
	{
		a/=10;
		i++;
	}
	if(i%2==1) return true;
	return false;
}
int ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		if(judge(i)) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define ll long long
#define PI 3.1415926535897932384626433832795l
#define MAX_NUM 1000000000
#define line printf("-----------------\n");
using namespace std;
int SET(int N, int pos) { return N = N | (1 << pos); }
int RESET(int N, int pos) { return N = N & ~(1 << pos); }
bool CHECK(int N, int pos) { return (bool)(N & (1 << pos)); }
template <typename T>
inline T __lcm(T a, T b)
{
    return (a * b) / __gcd(a, b);
}
struct node
{
    ll x, y, i;
};
int dx[] = {0, 1, 0, -1, -1, 1, -1, 1};
int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};

long long mark[1000005];
long long primes[1000005];
long long nprime = 0;

void sieve(long long n)
{
    int limit = sqrt(n);
    for (long long i = 4; i <= n; i += 2)
    {
        mark[i] = 1;
    }
    mark[0] = mark[1] = 1;
    primes[++nprime] = 2;

    for (long long i = 3; i <= n; i++)
    {
        if (!mark[i])
        {
            primes[++nprime] = i;
            if (i <= limit)
            {
                for (long long j = i * i; j <= n; j += 2 * i)
                {
                    mark[j] = 1;
                }
            }
        }
    }
}
vector<long long> primeFactorization(long long n)
{
    long long temp = n;
    vector<long long> r;
    if (n == 1)
    {
        //r.push_back(1);
    }
    for (long long i = 1; primes[i] * primes[i] <= n; i++)
    {
        while (temp % primes[i] == 0)
        {
            temp /= primes[i];
            r.push_back(primes[i]);
        }
    }
    if (temp != 1)
    {
        r.push_back(temp);
    }
    return r;
}

void solve()
{
    sieve(1000003);
    ll n;
    cin>>n;
    vector<ll> v = primeFactorization(n);
    map<ll,ll> mp;
    for(ll i=0;i<v.size();i++)
    {
        mp[v[i]]++;
    }
    ll ans=0;
    for(auto it : mp)
    {
        ll temp=it.second;
        for(ll i=1;;i++)
        {
            if(temp>=i)
            {
                ans++;
                temp-=i;
            }
            else
            {
                break;
            }
        }
    }
    cout<<ans<<endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
#endif // ONLINE_JUDGE
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 12072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll a,b;
    cin>>a>>b;
    cout<<(b*2)-a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
const int N=1e5+10,mod=1e9+7,OO=0x3f3f3f3f;
typedef long long ll;
ll n,x,y,dp[N][2];
vector<int>adj[N];
void dfs(int u=1,int p=-1){
    dp[u][0]=dp[u][1]=1;
    for(auto v:adj[u]){
        if(v==p)continue;
        dfs(v,u);
        dp[u][0]=(dp[u][0]*(dp[v][1]+dp[v][0]))%mod;
        dp[u][1]=(dp[u][1]*dp[v][0])%mod;
    }


}
int main()
{
    Elhabashy
    input();
    cin>>n;
    for(int i=1;i<n;i++){
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs();
    cout<<(dp[1][0]+dp[1][1])%mod<<endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, u, v;
    cin >> N >> u >> v;
    u--;
    v--;
    Graph graph(N);
    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    if (graph[u].size() == 1 && graph[u][0] == v) {
        cout << 0 << '\n';
        return;
    }
    vector<int> T(N, -1), S(N, -1);

    queue<P> que;
    que.push({v, 0});
    S[v] = 0;
    while (!que.empty()) {
        P p = que.front();
        que.pop();
        for (int to : graph[p.first]) {
            if (S[to] == -1) {
                S[to] = p.second + 1;
                que.push({to, S[to]});
            }
        }
    }

    que.push({u, 0});
    T[u] = 0;
    while (!que.empty()) {
        P p = que.front();
        que.pop();
        for (int to : graph[p.first]) {
            if (T[to] == -1) {
                T[to] = p.second + 1;
                que.push({to, T[to]});
            }
        }
    }
    int ans = 0;
    rep(i, N) {
        if (S[i] > T[i]) {
            ans = max(ans, S[i]);
        }
    }
    cout << ans - 1<< '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

#define ll long long

int main(){

    const int max_val = 499500;
    int a,b,i,j,k=0;

    cin >> a >> b;

    for(i=1;i<max_val;i++){
        k += i;
        if(b-a == i)cout << k - b << endl;
    }

    return 0;

}

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

using namespace std;

int last;
long long ans;
string s;
int a[1000000], b[1000000];

int main()
{
  cin >> s;
  for (int i = 1; i <= s.size(); i++)
    a[i] = ((s[i - 1] == '<') ? a[i - 1] + 1 : 0);
  for (int i = s.size() - 1; i >= 0; i--)
    b[i] = ((s[i] == '>') ? b[i + 1] + 1 : 0);
  for (int i = 0; i <= s.size(); i++)
    ans += max(a[i], b[i]);
  cout << ans;
  return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n, a, b; cin >> n >> a >> b;
    out(min(b,a*n));
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())

    check = set()
    for i in range(26):
        for j in range(15):
            temp = 4 * i + 7 * j
            if temp > 100:
                pass
            else:
                check.add(temp)

    check.remove(0)

    if n in check:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


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

int main(){
  int N,M;
  int64_t X;
  cin >> N >> M >> X;
  vector<int64_t> C(N);
  vector<vector<int64_t> > A(N,vector<int64_t> (M));
  for(int i=0;i<N;i++){
    cin >> C.at(i);
    for(int j=0;j<M;j++){
      cin >> A.at(i).at(j);
    }
  }
  int64_t ans=1e18;
  for(int i=0;i<(1<<N);i++){
    bitset<12> b(i);
    vector<int> sum(M,0);
    int64_t money=0;
    for(int j=0;j<N;j++){
      if(b.test(j)){
        money+=C.at(j);
        for(int k=0;k<M;k++){
          sum.at(k)+=A.at(j).at(k);
        }
      }
    }
    bool flag=true;
    for(int j=0;j<M;j++){
      if(sum.at(j)<X){
        flag=false;
        break;
      }
    }
    if(flag){
      if(ans>money){
        ans=money;
      }
    }
  }
  if(ans==1e18){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
import numpy as np
N, D = map(int, input().split())
cnt = 0
for i in range(N):
  x, y = map(int, input().split())
  x = abs(x)
  y = abs(y)
  if np.sqrt(x*x + y*y) <= D:
    cnt = cnt + 1

print(cnt)

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

int main(void){
    ll n; cin >> n;
    vector<ll> h(n);
    for(int i=0;i<n;i++) cin >> h[i];
    // for(int i=0;i<n+1;i++) cout <<  h[i];
    ll cnt=0,ans=0;
    for(int i=0;i<n;i++){
        if(i!=n-1 && h[i]>=h[i+1]){
            cnt++;
        }
        else{
            if(ans < cnt){
                ans = cnt;
            }
            cnt=0;
        }    
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 300000

int main(){
	vector<long long>a;
	int co[N];
	int n, k;
	set<int>s;
	map<long long, int>m;
	map<long long, int>m2;
	long long x, y, z;
	int ans;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%lld", &x);
		if (s.count(x) == 0){
			a.push_back(x);
			s.insert(x);
			m[x] = 1;
		}
		else{
			k = m[x];
			m[x] = k + 1;
		}
	}
	sort(a.begin(), a.end());
	f(i, a.size()){
		co[i] = m[a[i]];
		m2[a[i]] = i;
	}
	for (int i = a.size() - 1; i >= 0; i--){
		x = 1;
		while (x <= a[i])x = x * 2;
		x -= a[i];
		if (a[i] == x){
			ans += (co[i] / 2);
			co[i] = co[i] % 2;
		}
		else if (s.count(x) == 1){
			k = min(co[i], co[m2[x]]);
			ans += k;
			co[i] -= k;
			co[m2[x]] -= k;
		}
	}

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


	return 0;
}

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

using namespace std;
using ll = long long;


int main() {
    ll n,k,cnt=0,ans=1000000000;
    cin >> n >> k;
    vector<ll> x(n);
    for(ll i=0;i<n;i++){
         cin >> x[i];
    }
    for(ll i=0;i<=n-k;i++){
        if(x[i]<0&&x[i+k-1]<0) ans=min(ans,-1*x[i]);
        else if(x[i]<0&&x[i+k-1]>=0)  ans=min(ans, min(-1*x[i],x[i+k-1])*2+max(-1*x[i],x[i+k-1]) );
        else    ans=min(ans,x[i+k-1]);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
/////////////////////////////////////////////DEFALT19/////////////////////////////////////////////////////////////

#include<bits/stdc++.h>
#define sp ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define vec vector<ll>
#define all(a) a.begin(),a.end()
#define endl "\n"
#define ll long long int
#define MP make_pair
#define f(i,a,n) for(ll i=a;i<n;i++)
#define rf(i,a) for(ll i=a-1;i>=0;i--)
#define in(a) for(auto& i:a)cin>>i
#define ol(a) for(auto i:a)cout<<i<<" ";cout<<endl;
#define ov(a) cout<<a<<endl
#define ov2(a,b) cout<<a<<" "<<b<<endl
#define ov3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define ov4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl
#define pb push_back
#define sv(a) sort(a.begin(),a.end());
#define pp pop_back
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
using namespace std;

#define mod 100000007
#define MAX 300005

/*vector<vec> v(MAX), v2(MAX);
vector<bool> vis(MAX);

void dfs(ll root)
{
  vis[root] = true;
  for (auto i : v[root])
  {
    if (!vis[i])
    {
      dfs(i);
    }
  }
}

void bfs(ll u)
{
  queue<ll> q;

  q.push(u);
  vis[u] = true;

  while (!q.empty()) {

    ll f = q.front();
    q.pop();

    cout << f << " ";

    for (auto i : v[f])
    {
      if (!vis[i]) {
        q.push(i);
        vis[i] = true;
      }
    }
  }
}

pair<ll, ll> psum(vec a, ll s)
{
  ll i = 0, j = a.size() - 1;

  while (i < j)
  {
    if (a[i] + a[j] == s) return make_pair(i, j);
    if (a[i] + a[j] > s) j--;
    if (a[i] + a[j] < s) i++;
  }
  return make_pair(-1, -1);
}

int bin(vec a, ll l, ll r, ll x)
{
  if (r >= l)
  {
    ll mid  = l + (r - l) / 2;

    if (a[mid] == x) return mid;
    if (a[l] == x) return l;
    if (a[r] == x) return r;

    if (a[mid] > x)
      return bin(a, l, mid - 1, x);

    return bin(a, mid + 1, r, x);
  }
  return -1;
}*/

void solve()
{
  ll n; cin >> n;
  vec a(n); in(a);
  vec dp(n + 1, 0);
  dp[0] = 0;
  dp[1] = abs(a[1] - a[0]);
  f(i, 2, n + 1)
  {
    dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i]), dp[i - 2] + abs(a[i - 2] - a[i]));
  }
  // ol(dp);
  ov(dp[n - 1]);
}

int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  sp
  ll t = 1;
  //cin >> t;
  while (t--) solve();
}

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

int main()
{
  int K, S;
  cin >> K >> S;
  
  int ans = 0;
  for (int i = 0; i <= K; i++)
  {
    for (int j = 0; j <= K; j++)
    {
      int k = S - (i + j);
      if (0 <= k && k <= K) ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
def s()
  gets().chomp
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end
class Array
  def sum
    total = 0
    self.each do |item|
      total += item
    end
    total
  end
end

def eratosthenes(size)
  prime_list = []
  is_prime = Array.new(size, true)
  is_prime[0] = false
  is_prime[1] = false

  2.upto(size-1){|i|
    if is_prime[i]
      prime_list << i
      (2).upto((size.to_f/i).ceil-1){|j|
        is_prime[j*i] = false
      }
    end
  }
  [prime_list, is_prime]
end

def dijkstra(s, e, cost)
  size = cost.length
  if s==e
    return 0
  end
  dp = {}
  dp[s] = 0
  undefined_node = {}
  size.times{|i|
    if i != s
      undefined_node[i] = cost[s][i]
    end
  }
  while undefined_node.length != 0
    min = undefined_node.min_by{|_, v| v}
    stock = {}
    temp = undefined_node.clone
    temp.each{|k, v|
      if min[1] == v
        undefined_node.delete(k)
        if k == e
          return v
        end
        dp[k] = v
        stock[k] = v
      end
    }

    stock.each{|k, v|
      undefined_node.each{|k2, v2|
        undefined_node[k2] = v + cost[k][k2] < v2 ?  v + cost[k][k2] : v2
      }
    }
  end
end

def get_bits(len)
  res =  []
  (2**len).times{|i|
    res << i.to_s(2).rjust(len, '0')
  }
  res
end

def yakusu(n)
  count = 0
  1.upto(n){|i|
    if n%i == 0
      count +=1
    end
  }
  count
end
n=i()

res = 0
(1+n).times{|i|
  if yakusu(i)==8 && i%2 == 1
    res += 1
  end
}

puts res


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

int  bubleSort(int N, vector<int> &A) {
	int flag = 1;
	int cnt=0;
	while (flag) {
		flag = 0;
		for (int i = N-1; i>0; i--) {
			if (A[i] < A[i - 1]) {
				swap(A[i], A[i - 1]);
				flag = 1;
				cnt++;
			}
		}
	}
	return cnt;
}

int main() {
	int N; cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int ans = bubleSort(N, A);

	for (int i = 0;i < N - 1; i++) {
		cout << A[i] << " ";
	}
	cout << A[N - 1] << endl;
	cout << ans << endl;
}


Measured memory_bytes: 3088
<?php

$group = array_fill_keys(explode(',', 'A,B,AB,O'), 0);
while (($line = trim(fgets(STDIN))) !== '') {
    sscanf($line, '%d,%s', $n, $type);
    $group[$type]++;
}
printf("%d\n%d\n%d\n%d\n", $group['A'], $group['B'], $group['AB'], $group['O']);

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

int main() {
  int n;
  cin >> n;
  bool flag = false;
  for(int i = 0; i < 20; i++) {
    for (int j = 0; j < 30; j++) {
      if (i*7 + j*4 == n) flag = true;
      if (flag) break;
    }
    if (flag) break;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a,b,result=0;
        
        a = sc.nextInt();
        b = sc.nextInt();
        
        if(a < 10 && b < 10){
            result = a * b;
        }else{
            result = -1;
        }
        
        
        System.out.println(result);
    }
}


Measured memory_bytes: 23764
#include <iostream>
using namespace std;
int main(void){
    long long L,R;
    cin >> L >> R;
    if(R-L<=2019){
        long long ans=2018;
    for(long long i=L;i<R;i++){
        long long a=i%2019;
        for(long long j=i+1;j<=R;j++){
            long long b=j%2019;
            long long c=(a*b)%2019;
            ans=min (c,ans);
        }
    }
    cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
    
    
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		String tp = t.substring(0,t.length()-1);

		if ( s.equals(tp) ) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 35688
n = gets.chomp.to_i
array = Array.new
n.times do
  array << gets.chomp.split(" ").map(&:to_i)
end

array_a = array.sort do |a, b|
  (a[1] <=> b[1]).nonzero? || (a[0] <=> b[0])
end

result = "Yes"
sum = 0
array_a.each do |a|
  sum += a[0]
  if sum > a[1]
    result = "No"
    break
  end
end

puts result

Measured memory_bytes: 19320
#include <iostream>
#include <cmath>
using namespace std;
int D;
double V[16];
double interpolate(int n, int E){
	// L(n) を補間多項式により計算する
	// ただし点 (n,V[n]) と (E,V[E]) は使わない
	double sum = 0;
	for(int k=0; k<D+3; ++k){
		if(k==n||k==E)continue;
		double p = V[k];
		for(int i=0; i<D+3; ++i)
			if(i!=k&&i!=n&&i!=E)
				p=p*(n-i)/(k-i);
		sum += p;
	}
	return sum;
}

bool outlier(int E){
	for(int i=0; i<D+3; ++i){
		if(i==E)continue;
		double p = interpolate(i, E);
		if(abs(p-V[i])>0.1)return false;
	}
	return true;
}

int main(){
	for(;cin>>D,D;){
		for(int i=0; i<D+3; ++i)cin >> V[i];
		for(int i=0; i<D+3; ++i)if(outlier(i)){// i を無視すれば全て整合する
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 1240
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
list = [a, b, c, d, e, k]

b_1 = (b - a  <= k)
c_1 = (c - a <= k)
d_1 = (d - a <=k)
e_1 = (e - a <= k)

list_1 = [b_1, c_1, d_1, e_1]

count = 0
kotae = []
for i in range(len(list_1)):
    if list_1[i] == False:
        count = count + 1
if count > 0:
   kotae.append(0)

list_2 = []
for i in range(2, 5):
    list_2.append( list[i] - b <= k)
 

unko = 0
for i in range(len(list_2)):
    if list_2[i] == False:
        unko = unko + 1
if unko > 0:
    kotae.append(0)

list_3 = []
for i in range(3, 5):
    list_3.append( list[i] - c <= k)
    
count = 0
for i in range(len(list_3)):
    if list_3[i] == False:
        count = count + 1
if count > 0:
    kotae.append(0)

v = (e - d <= k)
if v == 0:
   kotae.append(0)

if (0 in kotae) == 1:
    print (':(')
else:
    print('Yay!')

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main(void) {
  int i, j, n, m;
  char s[100], t[100], ans[100];
  for(i = 0; i < 100; ++i) ans[i] = 127;
  ans[99] = 0;
  scanf("%s", s);
  scanf("%s", t);
  n = strlen(s), m = strlen(t);
  for(i = 0; i < n - m + 1; ++i) {
    bool b = true;
    char u[100];
    for(j = 0; j < 100; ++j) u[j] = s[j];
    for(j = 0; j < n; ++j) if(u[j] == '?') u[j] = 'a';
    for(j = 0; j < m; ++j) {
      if(s[i + j] != '?' && s[i + j] != t[j]) b = false;
      else u[i + j] = t[j];
    }
    if(b && strcmp(u, ans) < 0) for(j = 0; j < 100; ++j) ans[j] = u[j];
  }
  if(ans[0] == 127) printf("UNRESTORABLE");
  else printf("%s", ans);
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3

def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    k = gcd(n, m)
    if s[::n // k] == t[::m // k]:
        print(n * m // k)
    else:
        print(-1)

def gcd(x, y):
    if x < y:
        x, y = y, x  # x >= y
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

main()


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    double n;
    while (cin>>n){
        double t, y;
        t = n / 9.8;
        y = 4.9 * t * t;
        int N;
        N = y / 5 + 2;
        cout << N << endl;
    }
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

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

const ll MOD=1e9+7;
const ll MAX=5e6;

int main() {
  // 最大満足度
  // T分ちょうどにラストオーダー
  // Nつの料理ごとに、T-1分までにその料理以外で食べきれる最大と、料理の満足度の比較
  // dp1[i][j]を特定の皿iより前の全ての皿のうちjふんいないで食べれる最大満足
  int N,T;cin>>N>>T;
  vector<P> dishes(N);
  REP(i,N) {
    ll A,B;cin>>A>>B;
    dishes[i]={A,B};
  }

  // T-1分まで
  vector<vector<ll>> dp1(N,vector<ll>(T,0));
  vector<vector<ll>> dp2(N,vector<ll>(T,0));

  FOR(i,1,N) {
    P dish = dishes[i-1];
    REP(t,T) {
      if (t>=dish.first) {
        dp1[i][t] = max(dp1[i-1][t],dp1[i-1][t-dish.first]+dish.second);
      } else {
        dp1[i][t] = dp1[i-1][t];
      }
    }
  }

  reverse(ALL(dishes));
  FOR(i,1,N) {
    P dish = dishes[i-1];
    REP(t,T) {
      if (t>=dish.first) {
        dp2[i][t] = max(dp2[i-1][t],dp2[i-1][t-dish.first]+dish.second);
      } else {
        dp2[i][t] = dp2[i-1][t];
      }
    }
  }
  reverse(ALL(dishes));
  reverse(ALL(dp2));

  vector<ll> dp3(N,0);
  REP(i,N) {
    REP(t,T) {
      mmax(dp3[i],dp1[i][t]+dp2[i][T-1-t]);
    }
  }

  ll ans = 0;
  REP(i,N) {
    mmax(ans,dishes[i].second+dp3[i]);
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 141184
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, i) = nextIntList()
    println(N - i + 1)
}

Measured memory_bytes: 37720
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;


int main() {
 string s,t;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  string u;
  cin>>u;
  if(s==u) a--;
  else b--;
  cout<<a<<" "<<b<<endl;
}




Measured memory_bytes: 256
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
//#define =1e9 =(int)1e9
const ll mod = 1000000007;
const ll nmax=1000003;
#define int ll
int n, ans[100001];
string s;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>s;
    n=s.size();
    s='x'+s;
    for(int i=1; i<=n; i++){
        if(s[i-1]=='R' && s[i]=='L'){
            int lcnt=0, rcnt=0;
            for(int j=i; j<=n && s[j]=='L'; j++) lcnt++;
            for(int j=i-1; j>=1 && s[j]=='R'; j--) rcnt++;
            ans[i]=rcnt/2+(lcnt+1)/2;
            ans[i-1]=lcnt/2+(rcnt+1)/2;
        }
    }
    for(int i=1; i<=n; i++) cout<<ans[i]<<" ";
}


Measured memory_bytes: 1388
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const int INF = 1e9;


int n,ch=1,ans=1;
int p[200005],a[200005];
int main(){
  cin>>n;
 
  REP(i,n){
    cin>>p[i];
    a[p[i]-1]=i;
  }
  REP(i,n-1){
    if(a[i]<a[i+1]){
      ch++;
    }else{
      ans=max(ans,ch);
      ch=1;
    }
  }
  ans=max(ans,ch);
  cout<<n-ans<<endl;
  return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int a,b;cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define rep(i,n) for (int i =0;i < (n); ++i)
#define vi vector<ll>
const int N = 1e9 + 5;


void solve() {
	ll n, m; cin >> n >> m;
	if (m & 1) {
		for (int i = 1; i <= m / 2; i++) {
			cout << i << " " << m - i + 1 << endl;
		}
		for (int i = m + 1; i <= m + 1 + m / 2 ; i++) {
			cout << i << " " << 2 * m + 1 - i + m + 1 << endl;
		}
	} else {
		for (int i = 1; i <= m / 2; i++) {
			cout << i << " " << m + 1 - i + 1 << endl;
		}
		for (int i = m + 2; i <= m + 1 + m / 2; i++) {
			cout << i << " " << 2 * m + 1 - i + m + 2 << endl;
		}
	}
}
int main() {

	FASTIO;


	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
using namespace std;
#define MAX 10000
#define NIL -1

struct Node { int p, r, l; };
int n;

Node T[MAX];

void preParse(int u) {
	if (u == NIL)return;
	printf(" %d", u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u) {
	if (u == NIL)return;
	inParse(T[u].l);
	printf(" %d", u);
	inParse(T[u].r);
}

void postParse(int u) {
	if (u == NIL)return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d", u);
}

int main() {
	int i, v, l, r, root;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = NIL;
	}
	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if (l != NIL)T[l].p = v;
		if (r != NIL)T[r].p = v;
	}
	for (i = 0; i < n; i++)if (T[i].p == NIL)root = i;

	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");


	return 0;




}


Measured memory_bytes: 3224
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int gcd(int a, int b){return b ? gcd(b, a % b) : a;}

int main()
{
    int n;
    int a[100000];
    int dl[100000];
    int dr[100000];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    dl[0] = a[0];
    for (int i = 1; i < n; i++) {
        dl[i] = gcd(dl[i-1], a[i]);
    }

    dr[n-1] = a[n-1];
    for (int i = n - 2; i >= 0; i--) {
        dr[i] = gcd(a[i], dr[i+1]);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans = max(ans, dr[i+1]);
        }
        else if (i == n - 1) {
            ans = max(ans, dl[i-1]);
        }
        else {
            ans = max(ans, gcd(dl[i-1], dr[i+1]));
        }
    }
    cout << ans << endl;
    return 0;
}


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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define mp make_pair

int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double mx = 0, w = 0, s = 0;
  for (int i = 0; 100 * a * i <= f; i++) {
    int tmp = f - 100 * a * i;
    for (int j = 0; 100 * b * j <= tmp; j++) {
      int ttmp = tmp - 100 * b * j;
      for (int k = 0; (e * (i * a + j * b) >= k * c) && (k * c <= ttmp); k++) {
        int water = (i * a + j * b) * 100;
        int sugar = k * c;
        int tttmp = ttmp - k * c;
        int left_sugar = (i * a + j * b) * e - sugar;
        int p = min(left_sugar,tttmp) / d;
        sugar += p * d;
        if (water + sugar == 0) continue;
        double q = (double)sugar / (double)(water + sugar);
        if (q > mx) {
          mx = q;
          w = water;
          s = sugar;
        }
      }
    }
  }
  if (w + s == 0) cout << a * 100 << " " << 0 << endl;
  else cout << w + s << " " << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    std::string s;
    std::cin >> s;
    int count = 0;
    if (s[1] == 'S') {
        if (s[0] == 'R') {
            count++;
        } else if (s[2] == 'R') {
            count++;
        }
    } else {
        if (s[0] == 'R') {
            count += 2;
        }
        if (s[2] == 'R') {
            count += 2;
        }
        if (count == 0) count = 1;
    }

    if (count == 4) count = 3;
    std::cout << count;

    return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const long long INF = 1LL << 60;

int x;

int main()
{
  cin >> x;
  if(x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	char c;
	cin >> c;
	if ('A' <= c && c <= 'Z') {
		cout << "A";
	}
	else {
		cout << "a";
	}
}

Measured memory_bytes: 3640
//#include "pch.h"
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n;
	vector<int>list;
	vector<int>list2(200005, 0);


	cin >> n;

	int minn;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		list.push_back(num);
		if (i == 0) {
			minn = num;
			list2[0] = minn;
		}
		else {
			minn = min(minn, num);
			list2[i] = minn;
		}

	}

	ll sum = 0;

	for (int i = 0; i < n; i++) {
		if (i == 0) {
			sum++;
			continue;
		}

		if (list2[i - 1] >= list[i]) {
			sum++;
		}

	}

	cout << sum << endl;


	return 0;
}


Measured memory_bytes: 2168
N = int(input())
s = [input() for n in range(N)]
M = int(input())
t = [input() for m in range(M)]
a = 0
ans = 0

S = sorted(set(s))
for _ in S:
  a = s.count(_) - t.count(_)
  if ans < a:
    ans = a

print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		
		if (Math.abs(a - b) <= k && Math.abs(a-c) <= k && Math.abs(a-d) <= k && Math.abs(a-e) <=k
				&& Math.abs(b-c) <=k && Math.abs(b-d) <= k && Math.abs(b-e) <= k && Math.abs(c-d) <=k
				&& Math.abs(d-e) <= k) {
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}
		
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second

signed main()
{
    fast;
    int n;
    cin>>n;
    for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
        {
            if(i*j == n)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int x,max = 0;
    cin >> x;
    rep(i, (int)(sqrt((double)x)) + 1){
        rep(j, 100){
            if (pow(i, j) > x) {
                break;
            }else if(pow(i, j) > max){
                max = pow(i, j);
            }
        }
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
 
int main() {
    
    // 1. 入力情報取得.
    int N;
    cin >> N;
    LL A[N + 1];
    A[0] = 0;
    for(int i = 1; i < N + 1; i++) cin >> A[i];
    
    // 2. 解説通り.
    // L[0], L[1], L[2], ... , L[N + 1]
    // R[0], R[1], R[2], ... , R[N + 1]
    // を用意する.
    LL L[N + 2], R[N + 2];
    L[0] = 0, R[N + 1] = 0;
    for(int i = 0; i <= N; i++) L[i + 1] = __gcd(L[i], A[i]);
    for(int i = N; i >= 0; i--) R[i] = __gcd(R[i + 1], A[i]);
    
    // 3. 解説通り.
    LL ans = 0;
    for(int i = 0; i <= N; i++) ans = max(ans, __gcd(L[i], R[i + 1]));
    
    // 4. 後処理.
    cout << ans << endl;
}
    


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    if (b <= a + 2) {
        cout << 1 + k << endl;
        return 0;
    }

    if (k <= a) {
        cout << 1 + k << endl;
        return 0;
    }
    k = k - a + 1;
    i64 s = a;
    i64 d = b - a;
    if (k % 2) {
        cout << s + d * (k / 2) + 1 << endl;
    } else {
        cout << s + d * (k / 2) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 long long n,a,b,c,d,e,x;
  cin>>n;
  vector<long long>vec(5);
  x=5;
  for(int i=0;i<5;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  long long g=vec.at(0);
  if(x%g==0){
    cout<<x+(n-g)/g<<endl;
  }
  else{
    cout<<x+n/g<<endl;
  }
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int h = sc.nextInt(), w = sc.nextInt(), k = sc.nextInt(), x1 = sc.nextInt() - 1, y1 = sc.nextInt() - 1,
				x2 = sc.nextInt() - 1, y2 = sc.nextInt() - 1;
		char[][] grid = new char[h][];
		for (int i = 0; i < grid.length; i++) {
			grid[i] = sc.next().toCharArray();
		}
		int[][] dist = new int[h][w];
		for (int[] x : dist)
			Arrays.fill(x, -1);
		Queue<int[]> q = new LinkedList<int[]>();
		q.add(new int[] { x1, y1 });
		dist[x1][y1] = 0;
		int[] dx = { 0, 0, -1, 1 };
		int[] dy = { 1, -1, 0, 0 };
		while (!q.isEmpty()) {
			int[] cur = q.poll();
			int curdist = dist[cur[0]][cur[1]];
			for (int j = 0; j < 4; j++) {
				for (int i = 1; i <= k; i++) {
					int nxtx = cur[0] + i * dx[j];
					int nxty = cur[1] + i * dy[j];
					if (nxtx >= h || nxtx < 0 || nxty < 0 || nxty >= w || grid[nxtx][nxty] == '@')
						break;
					if (dist[nxtx][nxty] == curdist + 1)
						continue;
					if (dist[nxtx][nxty] != -1)
						break;
					dist[nxtx][nxty] = curdist + 1;
					q.add(new int[] { nxtx, nxty });
				}
			}
		}
		pw.println(dist[x2][y2]);
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}


Measured memory_bytes: 55824
/* Author: shriamrut
 * Language: C++17
 * Made on:22.08.2020
 * */
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ll long long
#define ss second
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(v) (v).begin(),(v).end()
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
using namespace std;
void ra(auto a[],int n) { for(int i=0;i<n;i++) cin>>a[i];}
void pa(auto a[],int n) { for(int i=0;i<n;i++) cout<<a[i]<<" ";}
void rv(vector<auto>&v,int n) {v.resize(n);for(int i=0;i<n;i++)	cin>>v[i]; }
void pv(vector<auto>&v) {for(size_t i=0;i<v.size();i++) cout<<v[i]<<" ";}
ll maxl(ll a,ll b) { if(a>b) return a; return b; }
ll minl(ll a,ll b) { if(a<b) return a; return b; }
/*auto i2=upper_bound(cind[i].rbegin(), cind[i].rend(), range[1],[](int a, int b){return a>=b;});
 * to obtain largest val <=x
 * */
int main() {
	IOS;	
	//freopen("input.txt","r",stdin);
	int n;
	cin>>n;
	vector<int> a(n);
	rv(a,n);
	ll ans=0;
	int max_v=a[0];
	for(int i=1;i<n;i++) {
		if(a[i]<max_v)
			ans+=(max_v-a[i]);
		max_v=max(max_v,a[i]);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3984
n, y = map(int,input().split())

for i in range(n+1):
  for j in range(n-i+1):
    k = n-i-j
    if 10000*i + 5000*j + 1000*k == y:
      print(i,j,k)
      exit()
      
print("-1 -1 -1")


Measured memory_bytes: 9056
a,b=map(int,input().split())
f=0
for i in range(1,100001):
    #print(int(25*0.08),int(25*0.1))
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        f=1
        break
if f==0:
    print(-1)

Measured memory_bytes: 39408