akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
from itertools import chain

# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N: int, P: "List[int]"):
    min_p = P[0]
    count = 0
    for p in P:
        if p <= min_p:
            min_p = p
            count += 1

    return count


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, P)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31636
N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2+1)]
if M%2==0:
  for m in range(M//2):
    a=src[m]
    b=src[M-m]
    print('{} {}'.format(a,b))
  for m in range(M//2):
    a=src[M+1+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))
else:
  for m in range(M//2):
    a=src[m]
    b=src[M-1-m]
    print('{} {}'.format(a,b))
  for m in range(M-(M//2)):
    a=src[M+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))

Measured memory_bytes: 16064
/**
 * @author pr4shan7 (प्रशांत)
 */
// everything has a cost!

#ifdef _MAVERICK
#define _DEBUG
#else
#pragma GCC optimize("O2", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx,avx2,fma")
// #pragma GCC reset_options
#endif

#ifndef _DEBUG
#define NDEBUG
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'
// #define cerr cout
// #define int long long
// #define double long double

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_set;
typedef unordered_set<int> usi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef set<int> si;
typedef long long ll;
#define pb push_back
#define x first
#define y second
#define cai static_cast<int>
#define cad static_cast<double>
#define cal static_cast<long long>
#define all(z) z.begin(), z.end()
#define tr(cont, itm) for (auto&& itm : cont)
#define rep(in, beg, sz) for (int in = beg; in < sz; in++)
#define rrep(in, sz, beg) for (int in = sz - 1; in >= beg; in--)
#define rtr(cont, itr) for (auto itr = cont.end() - 1; itr >= cont.begin(); itr--)

#ifdef _DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

template <typename... T> inline void debug_out(const T&...);
#else
#define debug(...) 42
#endif

template <typename T> inline istream& operator>>(istream& in, vector<T>& ar);
template <typename T> inline ostream& operator<<(ostream& out, const vector<T>& ar);
template <typename T> constexpr inline T pow(long long, long long, const T);

const int N = 1e5 + 5;
const int INF = 1e9;
const int MV = 1e9 + 7;

// beautiful things don't ask for attention



int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifdef _MAVERICK
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif

	ll n,a,b; cin >> n>>a>>b;
	ll ans = (n/(a+b))*a;
	ll rem = n%(a+b);
	debug(ans,rem);
	ans+=min(a,rem);
	cout << ans;

	return 0;
}


#ifdef _DEBUG
template <typename... T>
inline void debug_out(const T&... args) { ((cerr << ' ' << args), ...); cerr << endl; }
#endif

template <typename T>
inline istream& operator>>(istream& in, vector<T>& ar) {
	for (auto& i : ar) in >> i;
	return in;
}

template <typename T>
inline ostream& operator<<(ostream& out, const vector<T>& ar) {
	for (int i = 0; i < ar.size() - 1; i++) out << ar[i] << ' ';
	out << ar[ar.size() - 1];
	return out;
}

template <typename T>
constexpr inline T pow(long long a, long long b, const T mv) {
	long long res = 1;
	a %= mv;
	while (b) {
		if (b & 1)
			res = (res * a) % mv;
		b >>= 1;
		a = (a * a) % mv;
	}
	return res;
}

// get busy living or get busy dying


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pb push_back
#define mp make_pair
 #define mod 1000000007
 const int N=100005;
 const int inf=1e18;
int pow(int a,int b){
    int res=1;
    while(b>0){
        if(b&1){
        	res=res*a;
		}
        a=a*a;
        b>>=1;
    }
    return res;
}
bool compare(const pair<int,int>p1,const pair<int,int>p2){
   
    if(p1.first==p2.first){
        return p1.second<p2.second;
    }
     return p1.first>p2.first;
}
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n,m1;
    cin>>n>>m1;
    pair<int,int>p[n];
    map<int,int>m;
    map<int,int>::iterator itr;
    for(int x=0;x<n;x++){
        cin>>p[x].second>>p[x].first;
    }
    for(int x=1;x<=m1;x++){
        m[x]=1;
    }
    sort(p,p+n,compare);
    int used[m1+1]={0};
    used[0]=1;
    int ans=0;
	for(int x=0;x<n;x++){
      //  cout<<p[x].first<<" "<<p[x].second<<"\n";
        if(p[x].second<=m1){
            itr=m.lower_bound(p[x].second);
            if(itr==m.end())
                continue;
            if(used[itr->first]==0){
                ans+=p[x].first;
                used[itr->first]=1;
                m.erase(itr->first);
            }
            
            if(m.size()==0){
                cout<<ans;
                return 0;
            }
        }
    }
    cout<<ans;
return 0;
}


Measured memory_bytes: 8832
import Data.List

main = do
  getLine
  [t,b] <- lines <$> getContents
  let domino = map length . group $ t
  print $ paint domino 0

paint :: [Int] -> Int -> Int
paint [] _ = 1
paint (x:xs) pre
  | x == 1 && pre == 0 = (flip mod 1000000007) . (*3) $ paint xs 1
  | x == 2 && pre == 0 = (flip mod 1000000007) . (*6) $ paint xs 2
  | x == 1 && pre == 1 = (flip mod 1000000007) . (*2) $ paint xs 1
  | x == 2 && pre == 1 = (flip mod 1000000007) . (*2) $ paint xs 2
  | x == 1 && pre == 2 = (flip mod 1000000007) $ paint xs 1
  | otherwise          = (flip mod 1000000007) . (*3) $ paint xs 2


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

int main(){
  int r,c,q,a[50000],b[50000],o[50000];
  int nr,nc;
  bool row[50000],col[50000];
  long long int ans;

  while(1){
    cin >> r >> c >> q;
    if(!r && !c && !q)break;

    for(int i=0;i<r;i++)row[i] = false;
    for(int i=0;i<c;i++)col[i] = false;

    ans = nr = nc = 0;
    for(int i=0;i<q;i++)cin >> a[i] >> b[i] >> o[i];

    for(int i=q-1;i>=0;i--){
      if(a[i]){
	if(!col[b[i]]){
	  if(o[i])ans += r-nr;
	  col[b[i]] = true;
	  nc++;
	}
      }else{
	if(!row[b[i]]){
	  if(o[i])ans += c-nc;
	  row[b[i]] = true;
	  nr++;
	}
      }
    }
    cout << ans << endl;
  }
}

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

int main(){
    char b;
    cin >> b;
    if(b == 'A'){
        cout << 'T' << endl;
    }
    if(b == 'T'){
        cout << 'A' << endl;
    }
    if(b == 'G'){
        cout << 'C' << endl;
    }
    if(b == 'C'){
        cout << 'G' << endl;
    }
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  string s;
  cin >> k >> s;
  if(s.size() > k) {
    s = s.substr(0, k);
    s += "...";
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define N 200005
#define mo 1000000007
using namespace std;
int n,m,cnt,num,a[N],b[N],d[N],f[N];
struct OAO{int l,r;bool operator == (OAO k){return l==k.l&&r==k.r;}}c[N];
bool cmp(OAO x,OAO y){if(x.l==y.l)return x.r>y.r;return x.l<y.l;}
void add(int x,int y){while(x<=num)f[x]=(f[x]+y)%mo,x+=x&-x;}
int query(int x){int y=0;while(x)y=(y+f[x])%mo,x-=x&-x;return y;}
int main()
{
	scanf("%d%d",&n,&m);
	fo(i,1,n)scanf("%d",&a[i]);
	fo(i,1,m)scanf("%d",&b[i]);
	sort(a+1,a+n+1),sort(b+1,b+m+1);
	n=unique(a+1,a+n+1)-a-1;
	m=unique(b+1,b+m+1)-b-1;
	fo(i,1,n)
	{
		if(a[i]<b[1]||a[i]>b[m])continue;
		int k=lower_bound(b+1,b+m+1,a[i])-b;
		if(b[k]==a[i])continue;
		c[++cnt].l=a[i]-b[k-1];
		d[cnt]=c[cnt].r=b[k]-a[i];
	}
	d[cnt+1]=0;
	sort(d+1,d+cnt+2);
	sort(c+1,c+cnt+1,cmp);
	num=unique(d+1,d+cnt+2)-d-1;
	add(1,1);
	fo(i,1,n)
	{
		if(c[i]==c[i-1])continue;
		int k=lower_bound(d+1,d+num+1,c[i].r)-d;
		add(k,query(k-1));
	}
	printf("%d\n",query(num));
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}
template<typename T1,typename T2> inline T1 gmax(T1 &a,T2 b){return a=a<b?b:a;}
template<typename T1,typename T2> inline T1 gmin(T1 &a,T2 b){return a=a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 5007;

int n,val[_];
lint f[_][_],sl=0,sr=0;

int main()
{
	n=ty(),sr=ty(),sl=ty();
	for(int i=1;i<=n;i++)val[i]=ty();
	memset(f,63,sizeof(f)),f[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=val[i];j++)gmin(f[i][val[i]],f[i-1][j]),gmin(f[i][j],f[i-1][j]+sr);
		for(int j=val[i]+1;j<=n;j++)gmin(f[i][j],f[i-1][j]+sl);
	}

	lint ans=1e18;
	for(int i=0;i<=n;i++)ans=min(ans,f[n][i]);
	printf("%lld\n",ans);
	
	return 0;
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};




int main(){
	int n, k;
	vector<int> kind;
	map<int, int> many;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		int in;
		cin >> in;
		many[in]++;
	}
	for(auto it = many.begin(); it != many.end(); it++){
		kind.pb(it->second);
	}
	sort(kind.begin(), kind.end());
	int ans = 0;
	for(int i = 0; i < max(0, (int)many.size()-k); i++){
		ans += kind[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 10748
int main(int argc, char *argv[])
{
	for (;;)
	{
		int a;
		int b;
		scanf("%d %d\n", &a, &b);
		if ((a == 0) && (b == 0))
		{
			break;
		}
		if (a > b)
		{
			int t;

			t = a;
			a = b;
			b = t;	
		}
		printf("%d %d\n", a, b);
	}
	return 0;
}

Measured memory_bytes: 604
/*---------------------------------
 *File name: asd.cpp
 *Team: 这题太简单啦
 *Author: Snpilola
 *Creation date: 2019-11-09 16:48
 *-------------------------------*/
#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define LL long long
#define mkp make_pair
#define PLL pair<LL, LL>
#define lowbit(x) x & (-x)
#define PII pair<int, int>
#define Pque priority_queue 
using namespace std;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int EPS = 1e-6;

LL dp[maxn];
LL v[maxn], w[maxn];
LL ans = 0;

int main(){
	LL n, W;
	memset(dp, inf, sizeof dp);
	dp[0] = 0;
	scanf("%lld %lld", &n, &W);
	for(int i = 1; i <= n; ++i) scanf("%lld %lld", &w[i], &v[i]);
	for(int i = 1; i <= n; ++i){
		for(int j = 1e5; j >= v[i]; --j){
			dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
		}
	}
	for(int i = 1; i <= 1e5; ++i) if(dp[i] <= W) ans = max(ans, (LL)i);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 11392
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

long long A,B,Q;

vector<long long> s,t,x;

int main()
{
  cin >> A >> B >> Q;
  
  long long i,j,k;
  
  for(i=0;i<A;i++)
  {
    cin >> j;
    s.push_back(j);
  }
  for(i=0;i<B;i++)
  {
    cin >> j;
    t.push_back(j);
  }
  for(i=0;i<Q;i++)
  {
    cin >> j;
    x.push_back(j);
  }
 
  s.push_back(30000000000);
  t.push_back(30000000000);
  s.push_back(-30000000000);
  t.push_back(-30000000000);
  
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());

  vector<long long>::iterator s1,s2,t1,t2;
  
  for(i=0;i<Q;i++)
  {
    s1=lower_bound(s.begin(),s.end(),x[i]);
    t1=lower_bound(t.begin(),t.end(),x[i]);
    s2=s1--;
    t2=t1--;
    
    k=abs(*s1-x[i])+abs(*s1-*t1);
    k=min(k,abs(*s1-x[i])+abs(*s1-*t2));
    k=min(k,abs(*s2-x[i])+abs(*s2-*t1));
    k=min(k,abs(*s2-x[i])+abs(*s2-*t2));
    k=min(k,abs(*t1-x[i])+abs(*t1-*s1));
    k=min(k,abs(*t1-x[i])+abs(*t1-*s2));
    k=min(k,abs(*t2-x[i])+abs(*t2-*s1));
    k=min(k,abs(*t2-x[i])+abs(*t2-*s2));

    cout << k << endl;
  }
  

  
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n;
  int ans = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    if (i%2==0 && a[i]%2==1) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3144
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        
        int n = sc.nextInt();
        int[] t = new int[n];
        int ruiseki = 0;
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
            ruiseki+= t[i];
        }
        int m = sc.nextInt();
        int[] p = new int[m];
        int[] x = new int[m];
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt();
            x[i] = sc.nextInt();
        }
        for (int i = 0; i < m; i++) {
            System.out.println(ruiseki - t[p[i]-1] + x[i]);
        }


        

        sc.close();
    }

}





Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;
typedef vector <ld> vld;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef set <ld> sld;
typedef set <ll> sll;
typedef set <pll> spll;
typedef char ch;
typedef string str;
typedef tree <int, null_type, greater<int>, rb_tree_tag,
tree_order_statistics_node_update> super_set;
#define DIM 10006
#define MODULO 1000
#define INF 10000000007
#define epc 0.000000001
#define pi  3.14159265358979323846
#define e   2.71828182845904523536
#define gr  1.61803398874989484820
str s;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cout << "ops" << endl;

    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') {
            s[i] = '9';
            continue;
        }

        if (s[i] == '9')
            s[i] = '1';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class53
    {
        static void Main()
        {
            var I = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double N = I[0];
            int K = I[1];
            double count = N;
            double ans = 0;
            for(int i = 1; i <= N; i++)
            {
                for(int k = 0;; k++)
                {
                    count = i * (int)Math.Pow(2, k);
                    if (count >= K)
                    {
                        ans += (1 / N) * Math.Pow(0.5, k);
                        break;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11220
import java.io.*;
public class Main{
		  public static void main(String[]args){
		    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		    try{
		    	int i = 1;
		    	while(true) {
		          String line = reader.readLine();
		          int x = Integer.parseInt(line);
		          if(x == 0) break;
		          System.out.println("Case " +i+": " +x);
		          ++i;
		          
		          }
		    	reader.close();
		    }catch(IOException e) {
		    	
		    }
		  }
		}


Measured memory_bytes: 32156
public class Main {
	public static void main(String[] a){
        int i=1, j=1, m=1;
		for(i=1; i<=9; i++) {
			for(j=1; j<=9; j++) {
				m = i*j;
				System.out.println(i + "x" + j + "=" + m);
			}
		}
    }
}

Measured memory_bytes: 24140
#include<bits/stdc++.h>
char s[1000001];
int ans;
int main()
{
    scanf("%s",s);
    for(int i=1;i<strlen(s);i++)
    {
        if(s[i]!=s[i-1])
        {
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    long long num,b,fin=0;
    cin >> num;
    for (long long i=1; i<=num; i++){
      string a = to_string(i);
      b = a.length();
      if (b%2!=0) {
        fin++;}}
    cout << fin;}

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

using namespace std;

const int N = 200000 + 7;

int main() {
  double n, k;
  cin >> n >> k;
  double ans = 0.00;
  for(int i = 1; i < n + 0.5; ++i) {
    int cur = i;
    double score = 1.0 / n;
    while(cur < k) {
      score *= 0.5;
      cur *= 2;
    }
    //cout << score << endl;
    ans += score;
  }
  printf("%.12lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define endl "\n"
#define loop(i,s,e) for(int i=s;i<e;i++)
#define int long long
#define mp make_pair
#define pii pair<int,int>
#define mset(a,f)  memset(a , f , sizeof(a))
#define pb push_back
const int N = 2e5 + 6;
const int M = 1e9 + 7;
int A[N];
int n;

void solve()
{
	long double a , b, c;
	cin >> a >> b >> c;
	c -= (a+b);
	if(c < 0)c = 0;
	c *= c;
	long double d1 = c/4;
	long double d2 = a*b;

	if(d2 < d1)
	{
		cout << "Yes";
	}
	else cout << "No";
}
 
int32_t main()
{
 
ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
    
 	
 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	int n;
	cin >> n;
	int M = 0;
	int z = 0;
	int pH=0;
	rep(i, n) {
		int h;
		cin >> h;
		if (i == 0) {
			pH = h;
		}
		else {
			if (pH == -1) {
				pH = h;
			}
			if (pH >= h) {
				z++;
				pH = h;
			}
			else {
				M = max(M, z);

				z = 0;
				pH = h;
			}
		}
	}
	M = max(M, z);
	cout << M << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define N 200005
 

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int s,ans=0;
	for(int i=1;i<=5;i++){
		scanf("%d",&s);
		if(!s)
			ans=i;
	}

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

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

// 累積和をとっておいてs[i] == s[j]なる(i, j)（i < j）の組み合わせを数えれば良い

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

    vector<long long> s(N+1);
    for (int i = 0; i < N; i++) {
        s[i+1] = s[i] + a[i];
    }

    // s[i]と等しいiが何個あるかをnumsに記録しておく
    map<long long, long long> nums;
    for (int i = 0; i < N+1; i++) {
        nums[s[i]]++;
    }

    long long res = 0;
    for (auto iter : nums) {
        long long num = iter.second;
        res += num * (num-1) / 2; // nC2
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 15872
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, A, B, C, D = LI_()
    S = SI()
    ans = True
    # AC
    for i in range(A, C):
        if S[i: i + 2] == '##':
            ans = False
            break
    # BD
    if ans:
        for i in range(B, D):
            if S[i: i + 2] == '##':
                ans = False
                break
    # if A BD C
    if ans and D < C:
        tmp = False
        for i in range(B - 1, D):
            if S[i: i + 3] == '...':
                tmp = True
                break
        ans = ans and tmp

    ans = 'Yes' if ans else 'No'
    return ans

print(main())

Measured memory_bytes: 3572
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String args[]) {
		Integer n = new Integer(sc.nextLine());
		for(int i = 0; i < n; i++) {
			System.out.println(sc.nextLine().replaceAll("Hoshino", "Hoshina"));
		}
	}
}

Measured memory_bytes: 12000
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] s = scanner.next().toCharArray();
        char[] t = scanner.next().toCharArray();
        int count = 0;
        
        for (int i = 0; i < 3; i++) {
            if(s[i] == t[i]){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23252
N, M, K = map(int, input().split())
ppp = 10**9 + 7

#def expo_div_p(a: int,n: int,p: int):
#    if n == 1:
#        d = a
#    elif n % 2 == 0:
#        d = expo_div_p(a, n//2, p)**2 % p
#    else:
#        d = a * expo_div_p(a, n//2, p)**2 % p
#    return d
#
def combi(x, y, p):
    c = 1
    for i in range(1,y+1):
        c *= (x-i+1) * pow(i, p-2, p)
        c %= p
    return c


ans = 0
C = combi(N*M-2, K-2, ppp)

for i in range(1,N):
    ans += C * i * (N-i) * M**2
for j in range(1,M):
    ans += C * j * (M-j) * N**2

#print(C)
print(ans % ppp)


Measured memory_bytes: 3064
def primelist( pmax )

	primes = Array.new( pmax + 1 )
	primes[ 0 ] = 0 
	primes[ 1 ] = 0 
	2.upto( pmax ){ |i|
		primes[ i ] = 1
	}

	max = Math.sqrt( pmax ).to_i

	prime = 0
	while true
		(prime+1).upto( pmax ){ |t|
			if primes[ t ] != 0
				prime = t 
				break
			end
		}
		break if prime > max 

		n = 2
		while prime * n <= pmax
			primes[ prime * n ] = 0
			n += 1
		end
	end

	plist = Array.new
	0.upto( pmax ).each{ |n|
		plist << n if primes[ n ] == 1
	}
	plist	
end

def main
	answers = Array.new
	plist = primelist( 1000000 )

	while (n = $stdin.gets.chomp.to_i) != 0

		sum = 0
		0.upto( n - 1 ){ |n|
			sum += plist[ n ]
		}
		answers << sum
	end

	answers.each{ |a|
		puts a
	}
end

main


Measured memory_bytes: 14680
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

class Card {
public:
    uint8_t suit;
    int32_t num;

    Card() {
        suit = 'S';
        num = 1;
    }

    Card(uint8_t suit, int32_t num) : suit(suit), num(num) {}

    Card& operator= (int n) {
        num = n;
        return *this;
    }
};


bool operator< (const Card &c1, const Card &c2) {
    return c1.num < c2.num;
}

bool operator<= (const Card &c1, const Card &c2) {
    return c1.num <= c2.num;
}

ostream& operator<< (ostream& os, const Card& c) {
    os << c.suit << " " << c.num;
    return os;
}

template<typename T>
int32_t partition(vector<T> &A, int32_t p, int32_t r) {
    T x = A[r];
    int32_t i = p - 1;

    for (int32_t j = p; j < r; j++) {
        if (A[j] <= x) {
            i++;
            swap(A[i], A[j]);
        }
    }

    swap(A[i+1], A[r]);

    return i+1;
}

template<typename T>
void quick_sort(vector<T> &A, int32_t p, int32_t r) {
    if (p < r) {
        int32_t q = partition(A, p, r);
        quick_sort(A, p, q-1);
        quick_sort(A, q+1, r);
    }

    return;
}

template<typename T>
int32_t merge(vector<T> &A, int32_t left, int32_t mid, int32_t right) {
    int32_t n1 = mid - left;
    int32_t n2 = right - mid;

    vector<T> L(n1+1);
    vector<T> R(n2+1);
    for (int32_t i = 0; i < n1; i++) {
        L[i] = A[left+i];
    }
    for (int32_t i = 0; i < n2; i++) {
        R[i] = A[mid+i];
    }
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;

    int32_t i = 0, j = 0, count = 0;
    for (int32_t k = left; k < right; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
        count++;
    }

    return count;
}

template<typename T>
int32_t merge_sort(vector<T> &A, int32_t left, int32_t right) {
    if (left + 1 < right) {
        int32_t mid = left + (right - left) / 2;
        int32_t count1 = merge_sort(A, left, mid);
        int32_t count2 = merge_sort(A, mid, right);
        int32_t count3 = merge(A, left, mid, right);
        return count1 + count2 + count3;
    }

    return 0;
}

int main() {
    int32_t n;

    cin >> n;
    vector<Card> deck_q(n);
    for (int32_t i = 0; i < n; i++) {
        cin >> deck_q[i].suit >> deck_q[i].num;
    }
    vector<Card> deck_m(deck_q);

    quick_sort(deck_q, 0, n-1);
    merge_sort(deck_m, 0, n);

    bool is_stable = true;
    for (int32_t i = 0; i < n; i++) {
        if (deck_q[i].suit != deck_m[i].suit) {
            is_stable = false;
            break;
        }
    }

    cout << (is_stable ? "Stable" : "Not stable") << endl;

    for (Card c : deck_q) {
        cout << c << endl;
    }

    return 0;
}

Measured memory_bytes: 5092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

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

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define max 10000000
int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= (t * s))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 3604
#17 ABC131B
n,l=map(int,input().split())
x=[l+i for i in range(n)]
y=[abs(x[i]) for i in range(n)]
a,b=sum(x)-min(y), sum(x)+min(y)
if abs(a)<abs(b):
    print(a)
else:
    print(b)

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

 
int main(){
   int H, W; cin >> H >> W;
   int ans =0;
  vector<vector <int>> c(10, vector<int> (10));
  vector<vector <int>> A(H, vector<int> (W));
  
  rep(i,10){rep(j,10){
    cin >> c[i][j];}}
   rep(i,H){rep(j,W){
    cin >> A[i][j];}}
  
   rep(k,10) rep(i,10) rep(j,10) c[i][j] = min(c[i][j] , c[i][k] +c[k][j]);
  
  rep(i,H){rep(j,W){
    if(A[i][j] == -1) continue;
    else {ans += c[A[i][j]][1];}
  }}
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,x;
    cin>>n>>x;
    x-=n-1;
    rep(i,2*n-1)cout<<x+i<<" ";
    cout<<endl;

    return 0;
}

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

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

using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  int s[1000] = {};
  while (true) {
    cin >> n;
    if (n == 0) break;
    double m = 0, a = 0;
    rep(i, n) {
      cin >> s[i]; 
      m += s[i];
    }
    m /= n;
    rep(i, n) a += pow(s[i] - m, 2);
    cout << fixed << setprecision(8) << sqrt(a / n) << endl;
  }
  return 0;
}



Measured memory_bytes: 3220
import numpy as np
import math
import sys
import bisect
sys.setrecursionlimit(10000000)
INF = 1e11

def main():
    # 入力処理
    A, B, Q = [int(c) for c in input().split()]
    S = []
    T = []
    X = []
    for i in range(A):
        S.append(int(input()))
    for i in range(B):
        T.append(int(input()))
    for i in range(Q):
        X.append(int(input()))
    S.append(INF)
    T.append(INF)

    for i, x in enumerate(X):
        # s -> t
        sa = bisect.bisect_left(S, x) - 1
        sb = sa + 1

        # t -> s
        tc = bisect.bisect_left(T, x) - 1
        td = tc + 1
        distance = INF
        for s in [sa, sb]:
            for t in [tc, td]:
                dis1 = abs(x - S[s]) + abs(S[s] - T[t])
                dis2 = abs(x - T[t]) + abs(T[t] - S[s])
                distance = min(dis1, dis2, distance)
        print(distance)



if __name__ == '__main__':
    main()

Measured memory_bytes: 25340
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	int n = s.size();
	constexpr ll mod = 998244353ll;
	vvl dp(2 * n + 1, vl(2 * n + 1, 0));
	vi cnt(n + 1, 0);
	REP(i, n) {
		cnt[i + 1] = cnt[i] + s[i] - '0';
	}
	dp[0][0] = 1;
	REP(i, dp.size() - 1) {
		REP(j, dp[i].size()) {
			if (j + 1 < dp[i].size() && cnt[min(ll(n), i + 1)] >= j + 1) {
				dp[i + 1][j + 1] += dp[i][j];
				dp[i + 1][j + 1] %= mod;
			}
			if (2 * (min(ll(n), i + 1)) - cnt[min(ll(n), i + 1)] >= i + 1 - j) {
				dp[i + 1][j] += dp[i][j];
				dp[i + 1][j] %= mod;
			}
		}
	}
	ll ans = 0;
	REP(i, dp.back().size()) {
		ans += dp.back()[i];
		ans %= mod;
	}
	cout << ans << endl;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int I,O,J,L,hoge;
    cin>>I>>O>>hoge>>J>>L>>hoge>>hoge;

    int ans=0;

    for(int i=0;i<2;i++){
        int II=I-i;
        int JJ=J-i;
        int LL=L-i;
        if(II<0||JJ<0||LL<0)continue;
        chmax(ans,II/2*2+JJ/2*2+LL/2*2+i*3+O);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    int N, k = 1, NN = 1;
    cin >> N;
    k = N;
    vector<int> x(N), y(N);
    while(k > 1)
    {
        NN *= k;
        k--;
    }
    double len=0.0;
    for(int i = 0; i < N; ++i)
    {
        cin >> x.at(i) >> y.at(i);
    }
    for(int i = 1; i < N; ++i)
    {
        for(int j = 0; j < i; ++j)
        {
            len += sqrt((x.at(i)-x.at(j))*(x.at(i)-x.at(j))+(y.at(i)-y.at(j))*(y.at(i)-y.at(j)));
        }
    }
    cout << fixed << setprecision(7);
    cout << len * 2 / N << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int par[MAXN],pr[MAXN],prime[MAXN];
int main(){
    //~ freopen("file.in", "r", stdin);
    for(int i=2;i<MAXN;i++){
		if(pr[i])
			continue;
		prime[i]=1;
		for(int j=i;j<MAXN;j+=i)
			pr[j]=1;
	}
    for(int i=3;i<MAXN;i++)
		if(prime[i] and prime[(i+1)/2])
			par[i]++;
	for(int i=1;i<MAXN;i++)
		par[i]+=par[i-1];
	int q;
	scanf("%d",&q);
	while(q--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%d\n",par[r]-par[l-1]);
	}			
	return 0;
}


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

int n, dp[100005], a[100005];

int solve(int x)
{
  if (x == n - 1)
    return 0;
  if (dp[x] != -1)
    return dp[x];
  int c = solve(x + 1) + abs(a[x] - a[x + 1]); 
  if (x < n - 2)
    c = min(c, solve(x + 2) + abs(a[x] - a[x + 2]));
  return dp[x] = c;
}

int main()
{
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  cout << solve(0);
  return 0;
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 2010, Mod = 1e9 + 7;

int Comb[N][N], sum[N][N];

void Math_Init(int maxn) {
	For (i, 0, maxn) {
		Comb[i][0] = sum[i][0] = 1;
		For (j, 1, i) 
			Comb[i][j] = (Comb[i - 1][j - 1] + Comb[i - 1][j]) % Mod;
		For (j, 1, maxn)
            sum[i][j] = (sum[i][j-1] + Comb[i][j]) % Mod;
		For (j, 1, maxn)
            sum[i][j] = (sum[i][j-1] + sum[i][j]) % Mod;
	}
}

int Solve(int t, int b) {
	int ans = 1;
	For (i, 1, min(t - 1, b)) {
		ans = (ans + 1ll * sum[i - 1][t - i - 1] * Comb[b][i]) % Mod;
	}
	return ans;
}

int main () {

	File();
	
	int a = read(), b = read();

	Math_Init(max(a, b));

	if (!a || !b) return puts("1"), 0;

	int ans = 0;
	For (t, 1, a + 1)
		ans = (ans + Solve(t, b - 1)) % Mod;
	printf ("%d\n", ans);

    return 0;

}


Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        int t = p[i - 1] + p[i] + p[i + 1];
        int u = min({p[i - 1], p[i], p[i + 1]}) + max({p[i - 1], p[i], p[i + 1]});
        if (p[i] == t - u) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

int n;

int main()
{
	cin >> n;
	if (n / 100 == n % 10)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i, j;
    int x, y, n;
    static int map[1001][1001], dp[1001][1001];
    
    while (1){
        scanf("%d%d%d", &y, &x, &n);
        
        if (x + y + n == 0){
            break;
        }
        
        for (i = 1; i <= y; i++){
            for (j = 1; j <= x; j++){
                scanf("%d", &map[i][j]); //1 -> (i, j + 1) 0 -> (i + 1, j)
            }
        }
        
        memset(dp, 0, sizeof(dp));
        
        dp[1][1] = n;
        for (i = 2; i <= x; i++){
            dp[1][i] += (dp[1][i - 1] / 2);
            if (dp[1][i - 1] % 2 == 1 && map[1][i - 1] == 1){
                dp[1][i]++;
            }
        }
        
        for (i = 2; i <= y; i++){
            dp[i][1] += (dp[i - 1][1] / 2);
            if (dp[i - 1][1] % 2 == 1 && map[i - 1][1] == 0){
                dp[i][1]++;
            }
        }
        
        for (i = 2; i <= y; i++){
            for (j = 2; j <= x; j++){
                dp[i][j] = (dp[i][j - 1] / 2) + (dp[i - 1][j] / 2);
                if (dp[i][j - 1] % 2 == 1 && map[i][j - 1] == 1){
                    dp[i][j]++;
                }
                if (dp[i - 1][j] % 2 == 1 && map[i - 1][j] == 0){
                    dp[i][j]++;
                }
            }
        }
        
        i = j = 1;
        while (i != y + 1 && j != x + 1){
            if (dp[i][j] % 2 == 1){
                if (map[i][j] == 1){
                    j += 1;
                }
                else {
                    i += 1;
                }
            }
            else {
                if (map[i][j] == 1){
                    i += 1;
                }
                else {
                    j += 1;
                }
            }
        }
        
        printf("%d %d\n", i, j);
    }
    
    return (0);
}

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

int main(){
  int N, M;
  cin >> N >> M;
  int K, A;
  vector<int> L(M);
  for(int i=0; i<N; i++){
    cin >> K;
    for(int j=0; j<K; j++){
      cin >> A;
      L.at(A-1)++;
    }
  }
  int Ans=0;
  for(int i=0; i<M; i++){
    if(L.at(i)==N){
      Ans++;
    }
  }
  cout << Ans << endl;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair

using namespace std;


void run(){
	ll h,n;
	cin>>h>>n;
	ll inf=100000000000000000;
	ll a[n],b[n];
	for(ll i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	ll m=10001;
	ll dp[h+m+1]={0};
	dp[0]=0;
	for(ll i=1;i<=h+m;i++)dp[i]=inf;
	for(ll i=0;i<=h+m;i++){
		for(ll j=0;j<n;j++){
			if(i+a[j]<=h+m)dp[i+a[j]]=min(dp[i+a[j]],dp[i]+b[j]);
		}
	}
	for(ll i=h;i<=h+m;i++)dp[h]=min(dp[h],dp[i]);
	cout<<dp[h]<<endl;
	
	
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++)run();
	// your code goes here
	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();

    int ans = 0;

    ans = Math.max(x, Math.max(y, z)) - Math.min(x, Math.min(y, z));

    System.out.println(ans);
  }
}


Measured memory_bytes: 23124
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] p = new int[N];
        for (int i=0; i<N; i++) {
            p[i] = sc.nextInt();
        }

        System.out.println(solve(N, K, p));
    }

    private static int solve(int N, int K, int[] p) {
        int count = 0;

        Arrays.sort(p);
        for (int i=0; i<K; i++) {
            count += p[i];
        }

        return count;
    }
}

Measured memory_bytes: 38920
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;

template<const long long mod = 1000000007>
struct mint{ //modint
    long long x;
    mint(long long x = 0): x(((x % mod) + mod) % mod) {}
    friend istream& operator >> (istream &s, mint& m){ return s >> m.x; }
    friend ostream& operator << (ostream &s, mint m){ return s << m.x; }
    inline mint& operator += (mint a){ if((x += a.x) >= mod)x -= mod; return *this; }
    inline mint& operator -= (mint a){ if((x += mod - a.x) >= mod)x -= mod; return *this; }
    inline mint& operator *= (mint a){ (x *= a.x) %= mod; return *this; }
    inline mint& operator /= (mint a){ return (*this) *= a.inv(); }
    inline mint operator + (mint a){ mint res(*this); return res += a; }
    inline mint operator - (mint a){ mint res(*this); return res -= a; }
    inline mint operator * (mint a){ mint res(*this); return res *= a; }
    inline mint operator / (mint a){ mint res(*this); return res /= a; }
    inline void takemod(){ x = ((x % mod) + mod) % mod; }
    mint inv(){ return pow(mod - 2); }
    mint pow(long long p){
        mint res(1), tmp(x);
        for(; p; p >>= 1){ if(p & 1)res *= tmp; tmp *= tmp; }
        return res;
    }
};

ll L, R;
mint<> dp[61][2][2][2];

int main(){

    cin >> L >> R;
    dp[60][0][0][0] = mint<>(1);

    for(int bit = 59; bit >= 0; bit--){
        int lbit = bool((1ll << bit) & L);
        int rbit = bool((1ll << bit) & R);
        rep(i, 2)rep(j, 2)rep(k, 2){
            mint<> now = dp[bit + 1][i][j][k];
            rep(x, 2)rep(y, 2){
                if(x == 1 and y == 0)continue;
                if(k == 0 and x != y)continue;
                if(i == 0 and lbit == 1 and x == 0)continue;
                if(j == 0 and rbit == 0 and y == 1)continue;
                int ni = i, nj = j, nk = k;
                if(x == 1 and y == 1)nk = 1;
                if(lbit == 0 and x == 1)ni = 1;
                if(rbit == 1 and y == 0)nj = 1;
                dp[bit][ni][nj][nk] += now;
            }
        }
    }

    mint<> ans(0);
    rep(i, 2)rep(j, 2)rep(k, 2){
        ans += dp[0][i][j][k];
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int n,m,i;
  int sum = 0;
  int re = 0;

  scanf("%d %d", &n, &m);
  
  int a[n];

  for(i=0;i<n;i++) {
     scanf("%d",&a[i]);
     sum = sum + a[i];
  }

  for(i=0;i<n;i++) {
     if(a[i]*4*m >= sum)
        re++;
  }
  
  if(re >= m)
    printf("Yes");
  else
    printf("No");

  return 0;
}

Measured memory_bytes: 1736
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/abc150/tasks/abc150_d
# D - Semi Common Multiple
"""

"""


def gcd(a, b):
    h = max(a, b)
    l = min(a, b)
    if h % l:
        return gcd(l, h % l)
    else:
        return l


N = gi()
M = gi()
A = [0] * N
g = 0
for i in range(N):
    A[i] = gi()
    if i:
        g = gcd(g, A[i])
    else:
        g = A[i]

lcm = g

for a in A:  #catch!!!
    lcm = (lcm * a) // gcd(lcm, a)

hl = lcm // 2
all_good = 1
for a in A:
    q = lcm // a
    if (q % 2 == 0 or lcm % a):
        all_good = 0
        break

if all_good:
    ans = M // hl - M // lcm  #cleaner
else:
    ans = 0
print(ans)


Measured memory_bytes: 24660
import re
S = input()
num = []
l = []

answer = S.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")
if len(answer) == 0:
	print("YES")
else:
	print("NO")



"""
if ("eraser" in S)  == True:
	S.replace("eraser", "")

if ("erase" in S)   == True:
	S.replace("erase", "")

if ("dreamer" in S) == True:
	S.replace("dreamer", "")

if ("dream" in S)   == True:
	S.replace("dreamer", "")
"""

"""
if ("eraser" in S)  == True:
	num.append(S.count("eraser"))
	for i in range(S.count("eraser")):
		a.append(S.find("eraser"))
		S[S.find("eraser"):6]

if ("erase" in S)   == True:
	num.append(S.count("erase"))
	for i in range(S.count("erase")):
		a.append(S.find("erase"))
		S[S.find("erase"):5]

if ("dreamer" in S) == True:
	num.append(S.count("dreamer"))
	for i in range(S.count("dreamer")):
		a.append(S.find("dreamer"))
		S[S.find("dreamer"):7]

if ("dream" in S)   == True:
	num.append(S.count("dream"))
	for i in range(S.count("dream")):
		a.append(S.find("dream"))
		S[S.find("dream"):5]
"""

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

int main(void){
	int x;
	cin >> x;
	if(400 <= x && x < 600) cout << "8" << endl;
	else if(600 <= x && x < 800) cout << "7" << endl;
	else if(800 <= x && x < 1000) cout << "6" << endl;
	else if(1000 <= x && x < 1200) cout << "5" << endl;
	else if(1200 <= x && x < 1400) cout << "4" << endl;
	else if(1400 <= x && x < 1600) cout << "3" << endl;
	else if(1600 <= x && x < 1800) cout << "2" << endl;
	else cout << "1" << endl;
	return 0;
}


Measured memory_bytes: 3628