akhauriyash/Code-Regression huggingface dataset:
// import java.lang.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    static List<Integer> al = new ArrayList<>();
    static int[] a;

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static Set<String> se = new HashSet<>();

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        StringBuffer sb = new StringBuffer();
        // ArrayList<Integer> al=new ArrayList<>();

       int d=sc.nextInt();
       int t=sc.nextInt();
       int s=sc.nextInt();
       float k=((float)d/(float)s);
      

       if((k)<=(float)t)
       System.out.println("Yes");
       else
       System.out.println("No");

     
    }


}

Measured memory_bytes: 32636
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;

#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll n,a[100005];
        cin>>n;
        for(int i=1;i<=n;i++)
        	cin>>a[i];
        ll ans=0;
        ll c=0;
        ll x=hell;
        for(int i=n;i>=1;i--)
        {
        	if(a[i]>=x)
        	{
        		c++;
        		ans=max(ans,c);
        		x=a[i];
        	}
        	else
        	{
        		c=0;x=a[i];
        	}
        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

/**
 * TITLE : Remaining Balls
 * URL : https://atcoder.jp/contests/abc154/tasks/abc154_a
 */
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        int A = sc.nextInt();
        int B = sc.nextInt();
        String U = sc.next();
		if (S.equals(U)) {
			System.out.println((A - 1) + " " + B);
		} else {
			System.out.println(A + " " + (B - 1));
		}
        sc.close();
    }
}

Measured memory_bytes: 22996
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int main()
{
	int total=0;
	string a, b;
	cin >> a >> b;
	for(int i=0; i<a.length(); i++)
	{
		if(a[i] != b[i])
		{
			total ++;
		}
	}
	cout << total;
}



Measured memory_bytes: 3928
#include <iostream>

using namespace std;

// Using while loop to solve this time

int main(int argc, char const *argv[])
{
    long long base = 100;
    // Other people don't include this interest variable
    float interest = 0.01;
    long long years = 0;

    long long target; //103
    cin >> target;

    // How many years it take to get to or above target;

    while (true)
    {
        if (base >= target)
        {
            cout << years << "\n";
            return 0;
        }
        base += base / 100;
        ++years;
    }
    return 0;
}


Measured memory_bytes: 3148
import java.util.*;
import java.util.regex.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = scanner.nextInt();
    scanner.nextLine();
    for (int ii = 0; ii < n; ii++) {
      String str = scanner.nextLine();
      Pattern pa = Pattern.compile("^>'(=+)#\\1~$");
      Pattern pb = Pattern.compile("^>\\^(?:Q=)+~~$");
      Matcher ma = pa.matcher(str);
      Matcher mb = pb.matcher(str);
      if (ma.matches()) {
        System.out.println("A");
      } else if (mb.matches()) {
        System.out.println("B");
      } else {
        System.out.println("NA");
      }
    }
  }
}

Measured memory_bytes: 31256
'use strict'

function main(input) {

    input = input.split(/\n|\s/).map(v => ~~v)

    const ans = Math.min(input[0], input[1]) + Math.min(input[2], input[3])

    console.log(ans)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 8648
n = input()
if n[0] == n[1] and n[1] == n[2]:
    print(n)
elif (n[0] == n[1] and n[1] < n[2]) or n[0] < n[1]:
    b = int(n[0])+1
    print(str(b) + str(b) + str(b))
else:
    print(n[0] + n[0] + n[0])

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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

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

int main() {
	ios_base::sync_with_stdio(false);

	ll v[4];
	fori(i, 0, 4) {
		cin >> v[i];
	}

	ll n;
	cin >> n;
	n *= 100;
	fori(i, 1, 4) {
		if(2 * v[i - 1] < v[i]) {
			v[i] = 2 * v[i - 1];
		}
	}

	vector<ll> price {25, 50, 100, 200};
	ll ans = 0;
	ford(i, 3, 0) {
		if(n >= price[i]) {
			ll to_rem = n / price[i];
			ans += to_rem * v[i];
			n -= to_rem * price[i];
		}
	}
	cout << ans << '\n';

	return 0;
}



Measured memory_bytes: 256
x,y=map(int,input().split())
l=[1,2,3]
z=[300000,200000,100000]
if x==1 and y==1:
    print(1000000)
else:
    ans=0
    if x in [1,2,3]:
        ans+=z[l.index(x)]
    if y in [1,2,3]:
        ans+=z[l.index(y)]
    print(ans)

Measured memory_bytes: 61660
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int x=0; char c=getchar();
    while(c<'0'||c>'9')c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x;
}
int a[25],n,ans;
int main(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=2;i<=n-1;i++){
		if(a[i]>=a[i-1]&&a[i]<=a[i+1])ans++;
		else if(a[i]<=a[i-1]&&a[i]>=a[i+1])ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <stack>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int N=10005;
const int LGN=20;
const int S=N<<3;
const int V=S+(N<<1);
const int E=V+((N<<2)*LGN);

struct data
{
	int key,id;
	bool tp;

	bool operator<(data const d)const{return key<d.key||key==d.key&&id<d.id;}
}srt[N<<1];

int last[V],DFN[V],low[V],bid[V];
int nxt[E],tov[E];
int x[N],y[N];
bool exist[V];
int id[N<<1];
int n,tot,ans,idx,bcnt;

stack<int> st;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void build(int x,int l,int r)
{
	if (l==r)
	{
		id[l]=x;
		return;
	}
	int mid=l+r>>1;
	build(x<<1,l,mid),build(x<<1|1,mid+1,r),insert(x+n*2,(x<<1)+n*2),insert(x+n*2,(x<<1|1)+n*2);
}

void addedge(int x,int st,int en,int l,int r,int p)
{
	if (st==l&&en==r)
	{
		insert(p,x+n*2);
		return;
	}
	int mid=l+r>>1;
	if (en<=mid) addedge(x<<1,st,en,l,mid,p);
	else if (mid+1<=st) addedge(x<<1|1,st,en,mid+1,r,p);
	else addedge(x<<1,st,mid,l,mid,p),addedge(x<<1|1,mid+1,en,mid+1,r,p);
}

void tarjan(int x)
{
	DFN[x]=low[x]=++idx,st.push(x),exist[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if (!DFN[y=tov[i]]) tarjan(y),low[x]=min(low[x],low[y]);
		else if (exist[y]) low[x]=min(low[x],DFN[y]);
	if (DFN[x]==low[x])
	{
		int y;++bcnt;
		do
		{
			exist[y=st.top()]=0,st.pop(),bid[y]=bcnt;
		}while (x!=y);
	}
}

bool judge(int dis)
{
	--dis,memset(last,0,sizeof last),memset(tov,0,sizeof tov),memset(nxt,0,sizeof nxt),tot=0;
	build(1,1,n<<1);
	for (int i=1;i<=n<<1;++i)
		if (srt[i].tp) insert(id[i]+n*2,srt[i].id*2-1);
		else insert(id[i]+n*2,srt[i].id*2);
	for (int i=1;i<=n<<1;++i)
	{
		int l=1,r=i,st=i,en=i;
		for (int mid;l<=r;)
		{
			mid=l+r>>1;
			if (srt[mid].key>=srt[i].key-dis) r=(st=mid)-1;
			else l=mid+1;
		}
		for (;en>=st&&srt[en].id==srt[i].id;--en);
		if (st<=en) addedge(1,st,en,1,n<<1,srt[i].id*2-(srt[i].tp^1));
		//for (int j=st;j<=en;++j) insert(srt[i].id*2-(srt[i].tp^1),srt[j].id*2-srt[j].tp);
		l=i,r=n<<1,st=i,en=i;
		for (int mid;l<=r;)
		{
			mid=l+r>>1;
			if (srt[mid].key<=srt[i].key+dis) l=(en=mid)+1;
			else r=mid-1;
		}
		for (;st<=en&&srt[st].id==srt[i].id;++st);
		if (st<=en) addedge(1,st,en,1,n<<1,srt[i].id*2-(srt[i].tp^1));
		//for (int j=st;j<=en;++j) insert(srt[i].id*2-(srt[i].tp^1),srt[j].id*2-srt[j].tp);
	}
	memset(DFN,0,sizeof DFN),bcnt=idx=0;
	for (int x=1;x<=(n<<1)+id[n<<1];++x) if (!DFN[x]) tarjan(x);
	for (int i=1;i<=n;++i) if (bid[i*2-1]==bid[i*2]) return 0;
	return 1;
}

void binary_search()
{
	int l=0,r=1000000000;
	for (int mid;l<=r;)
	{
		mid=l+r>>1;
		if (judge(mid)) l=(ans=mid)+1;
		else r=mid-1;
	}
}

int main()
{
	//freopen("a.in","r",stdin),freopen("a.out","w",stdout);
	n=read();
	for (int i=1;i<=n;++i) srt[i*2-1].key=x[i]=read(),srt[i*2-1].tp=0,srt[i*2].key=y[i]=read(),srt[i*2].tp=1,srt[i*2-1].id=srt[i*2].id=i;
	sort(srt+1,srt+1+n*2);
	binary_search(),printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

Measured memory_bytes: 11776
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	vector<int> a(n + 1, 0);

	for (int i = 1; i <= n; i++) {
		int d1, d2; cin >> d1 >> d2;
		a[i] = (d1 == d2);
	}

	vector<int> pref(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		if (a[i] == 0) continue;
		pref[i] = 1 + pref[i - 1];
	}

	if (*max_element(pref.begin(), pref.end()) >= 3) cout << "Yes";
	else cout << "No";

	return 0;
}

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

using namespace std;

int main() {
  int N, Y;
  cin >> N >> Y;
  for (int i = 0; i * 1000 <= Y; ++i) {
    for (int j = 0; j * 5000 <= Y; ++j) {
      int total = i * 1000 + j * 5000;
      int z = (Y - total) / 10000;      
      if (z * 10000 + total== Y && j + i + z == N && z >= 0) {
	printf("%d %d %d\n", z, j, i);
	return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}



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

ll tonum(string s)
{
    ll ans=0;
    for(int i=0;i<s.size();i++)
        ans=ans*10+s[i]-'0';
    return ans;
}

int main()
{
    vector<vector<string>> v1(10,vector<string>());
    vector<vector<string>> v2(10,vector<string>());
     ll kx=1;
    cin>>kx;
    if(kx<=9)
    {
        cout<<kx<<endl;
        return 0;
    }
        
    for(int i=0;i<10;i++)
    {
        string x = to_string(i);
        v1[i].push_back(to_string(i));
    }
    // cout<<tonum("1234567890")<<endl;
    ll cnt=10;
    ll dig=1;
    while(++dig<=10)
    {
        vector<ll> ans;
        for(int i=0;i<10;i++)
        {
            //cout<<cnt<<endl;
            ll mind = pow(10,dig-1);
            for(int j=0;j<v1[i].size();j++)
            {
                string s = v1[i][j];
                for(int k=-1;k<=1;k++)
                {
                    int u = s[0]+k-'0';
                    if(u<0||u>9)
                        continue;
                    string s1 = to_string(int(s[0]+k-'0'))+s;
                    //cout<<s1<<endl;
                    if(tonum(s1)/mind>0 && tonum(s1)/(mind*10)==0 && s1[0]!='0')
                    {
                        ans.push_back(tonum(s1));
                       // cnt++;
                        /*if(cnt==kx)
                        {
                            cout<<tonum(s1)<<endl;
                            return 0;
                        }
                        cout<<cnt<< " "<<s1<<endl;*/
                    }
                    v2[u].push_back(s1);
                }

            }
            v1[i].clear();
        }
        if(cnt+ans.size()<=kx)
            cnt+=ans.size();
        else
        {
            sort(ans.begin(),ans.end());
            //for(int i=0;i<ans.size();i++)
               // cout<<ans[i]<<" ";
            //cout<<endl;
            //cout<<cnt<<" "<<ans.size()<<endl;
            cout<<ans[kx-cnt]<<endl;
            return 0;
        }
        v2.swap(v1);
    }
    
    return 0;
}


Measured memory_bytes: 9376
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main()
{
    int n;
    cin >> n;
    int a[n];
    rep(i, n)
    {
        cin >> a[i];
    }
    int cc = 0;
    rep(i,n)
    {
        if (a[i] == a[i + 1])
        {
            continue;
        }
        if (a[i] < a[i + 1])
        {
            while (a[i] < a[i + 1] || a[i] == a[i + 1])
            {
                i++;
            }
            cc++;
            continue;
        }
        if (a[i] > a[i + 1])
        {

            while (a[i] > a[i + 1] || a[i] == a[i + 1])
            {
                i++;
            }
            cc++;
            continue;
        }
    }
    cout << cc << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  
  int n,k;
  cin>>n>>k;
  set<int> s;
  for(int i=0;i<k;i++)
  {
    int c1;
    cin>>c1;
    while(c1--)
    {
      int a;
      cin>>a;
      s.insert(a);
    }
  }
  cout<<n-s.size()<<"\n";
  
  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int A,B,K;
    cin>>A>>B>>K;
    for(int i=0;i<K;i++){
        if(i==0||i%2==0){
            if(A%2!=0) A--;
            A=A/2;
            B+=A;
        }
        if(i%2!=0){
            if(B%2!=0) B--;
            B=B/2;
            A+=B;
        }
    }
    cout<<A<<" "<<B;
}




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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 10000000

int main()
{
  int n,x,y;cin>>n>>x>>y;
  //n bfs
  int i,j;
  vector<vector<int>> g(n);
  rep(i,n-1)
  {
    g[i].emplace_back(i+1);
    g[i+1].emplace_back(i);
  }
  x--;y--;
  g[x].emplace_back(y);
  g[y].emplace_back(x);
  vector<vector<int>> dist(n,vector<int>(n,INF));
  rep(i,n)dist[i][i]=0;
  rep(i,n)
  {
    queue<int> q;
    queue<int> q2;
    q.push(i);
    while(!q.empty())
    {
      while(!q.empty())
      {
        int now=q.front();
        q.pop();
        rep(j,g[now].size())
        {
          if(dist[i][g[now][j]]==INF)
          {
            dist[i][g[now][j]]=dist[i][now]+1;
            q2.push(g[now][j]);
          }
        }
      }
      while(!q2.empty())
      {
        q.push(q2.front());
        q2.pop();
      }
    }
  }
  vector<int> counts(n,0);
  rep(i,n)
  {
    for(j=i+1;j<n;j++)
    {
      counts[dist[i][j]]++;
    }
  }
  for(i=1;i<n;i++)
  {
    cout<<counts[i]<<endl;
  }
}


Measured memory_bytes: 16128
#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 n,m;
    cin>>n;
    map<string,int> mp;
    string s,t;
    rep(i,n){
        cin >>s;
        mp[s]++;
    }
    cin>>m;
    rep(i,m){
        cin >>t;
        mp[t]--;
    }
    int ans = 0;
    for(auto x:mp){
        ans = max(ans,x.second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = a; i <b; i++)
#define forn(i,a,b) for (int i = a; i >b; i--)
#define mod 1000000007
#define multiple_testcases_t int t;cin>>t;while(t--){solve();}
#define single_testcase_t solve();
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


ll fact(ll n)
{
  if(n==0 || n==1)
  return 1;
  else
  return (n*fact(n-1)%mod)%mod;
}

int prime(ll n)
{
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      return 0;
    }
  }
  return 1;
}

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

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

int check_palin(string s)
{
  string str=s;
  reverse(str.begin(),str.end());
  if(str==s)
  return 1;
  else 
  return 0;
}

vector<ll> divisors(ll n)
{
  vector<ll> v;
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(i==n/i)
      v.PB(i);
      else
      v.PB(i),v.PB(n/i);
    }
  }
return v;
}

ll bin_expo(int x,int n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_expo(x*x,n/2);
    else                             //n is odd
        return x*bin_expo(x*x,(n-1)/2);
}

ll modular_expo(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modular_expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modular_expo((x*x)%M,(n-1)/2,M))%M;
}

// <----- Actual solve() function to print output -----> //
void solve()
{
  ll n,ans=0,z=0;
char c;
cin>>c;
if(c>=65 && c<=92)
cout<<"A";
else
cout<<"a";
  
        //if t>1 uncomment this
}

// MAIN function --------------------------------------------------------------------------//
int main()
{
    fast_io
    single_testcase_t   //Uncomment this if only single testcase & single answer to print
   // multiple_testcases_t  //Uncomment this if t>1(t is given in question)(multiple testcases)      
return 0;
}
            
            
            
            

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

const int mod = 1e9+7;

int main() {
    
    ll y = 6,x;
    cin >> x;
    ll ans;
    ll a = x/11;
    int b = x%11;
    if(b <=6 && b>=1) ans = a*2+1;
    else if(b >= 7) ans = a*2+2;
    else ans = a*2;
    cout << ans << endl;

}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD

N = INT()
A = LIST()

# 大きい数ほど少なく使うのが最適なので降順ソートしておく
A.sort(reverse=1)
# 各要素が変更のために何回使われるか数える
cnts = [0] * N
cnts[0] = pow(4, N-1, MOD)
add = fermat(cnts[0], 2, MOD)
for i in range(1, N):
    cnts[i] = cnts[i-1] + add
    cnts[i] %= MOD

ans = 0
for i in range(N):
    ans += A[i] * cnts[i]
    ans %= MOD
print(ans * 2 % MOD)


Measured memory_bytes: 27404
<?php
class Dice
{
    private $top;
    private $south;
    private $east;
    private $west;
    private $north;
    private $bottom;
    
    public function __construct ($dice_values) {
        $this->top = $dice_values[0];
        $this->south = $dice_values[1];
        $this->east = $dice_values[2];
        $this->west = $dice_values[3];
        $this->north = $dice_values[4];
        $this->bottom = $dice_values[5];
    }
    
    public function move($directions) {
        for ($i = 0; $i < strlen($directions); $i++) {
            $this->change_value($directions[$i]);
        }
        echo $this->top."\n";
    }
    
    public function change_value($direction) {
        $top = $this->top;
        if ($direction == 'N') {
            $this->top = $this->south;
            $this->south = $this->bottom;
            $this->bottom = $this->north;
            $this->north = $top;
        } elseif ($direction == 'E') {
            $this->top = $this->west;
            $this->west = $this->bottom;
            $this->bottom = $this->east;
            $this->east = $top;
        } elseif ($direction == 'S') {
            $this->top = $this->north;
            $this->north = $this->bottom;
            $this->bottom = $this->south;
            $this->south = $top;
        } elseif ($direction == 'W') {
            $this->top = $this->east;
            $this->east = $this->bottom;
            $this->bottom = $this->west;
            $this->west = $top;
        }
    }
}


$dice_values = array_map("intval", explode(" ", trim(fgets(STDIN))));
$directions = trim(fgets(STDIN));

$dice = new Dice($dice_values);
$dice->move($directions);


Measured memory_bytes: 9316
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		ArrayList<ArrayList<Integer>> graph = new ArrayList<ArrayList<Integer>>() {
			{
				for (int i = 0; i < n; i++) {
					add(new ArrayList<>());
				}
			}
		};
		for (int i = 0; i < m; i++) {
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;
			graph.get(a).add(b);
			graph.get(b).add(a);
		}
		for (int i = 0; i < graph.size(); i++) {
			System.out.println(graph.get(i).size());
		}
		in.close();
	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define next Next
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
#define N 100005
char a[N << 1], b[N];
int n, m, nx[N << 1][26];
int main(){
	scanf("%s%s", a + 1, b + 1);
	n = strlen(a + 1), m = strlen(b + 1);
	for (register int i = 1; i <= n; ++i) a[n + i] = a[i];
	for (register int i = 0; i < 26; ++i) nx[n << 1][i] = -1;
	for (register int i = (n << 1) - 1; ~i; --i){
		for (register int j = 0; j < 26; ++j) nx[i][j] = nx[i + 1][j];
		nx[i][a[i + 1] - 'a'] = i % n + 1;
	}
	int k = 0, s = 0;
	for (register int i = 1; i <= m; ++i)
		if (~nx[k][b[i] - 'a']){
			if (nx[k][b[i] - 'a'] <= k) ++s;
			k = nx[k][b[i] - 'a'];
		}
		else return printf("-1\n"), 0;
	printf("%lld\n", 1ll * s * n + k);
}

Measured memory_bytes: 20864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    int m,d;cin>>m>>d;int ans=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=d;j++){
            if((j/10)*(j%10)==i&&j/10>=2&&j%10>=2){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1
print(ans)


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

using namespace std;

int main(){

  int n;

  while(cin>>n,n){
	int sum=0;
	int temp;
	for(int i=0;i<n/4;++i){
	  cin>>temp;
	  sum+=temp;
	}
	cout<<sum<<endl;
  }

}



Measured memory_bytes: 3100
N = int(input())
A = [int(x) for x in input().split(" ")]
flag = True
swap_count = 0
i = 0
while flag:
    flag = False
    for j in range(N-1, i, -1):
        if A[j] < A[j-1]:
            A[j], A[j-1] = A[j-1], A[j]
            flag = True
            swap_count += 1
    i += 1

print(*A)
print(swap_count)

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


int main(){
	int n, m;
	cin >> n >> m;
	vector<int> city(n);
	rep(i,m){
		int x, y;
		cin >> x >> y;
		x--; y--;
		city.at(x)++;
		city.at(y)++;
	}
	rep(i,n){
		cout << city.at(i) << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;

int main(){
    long long N,A,B;
    cin >> N >> A >> B;
    long long c=N/(A+B);
    long long d=N%(A+B);
    if(d<=A) cout << c*A+d << endl;
    else cout << c*A+A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = 1e9+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > pq;
// cout << fixed << setprecision(5) << sum << endl;

template<typename T> //最大公約数
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T> //最小公倍数
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}

long long nCr(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


// a^n mod を計算する
long long modpow(long long a, long long n, long long MOD) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long Mod) {
    return modpow(a, Mod - 2, Mod);
}


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

vector<pair<ll, ll> > PrimeFactor(ll N){
    vector<pair<ll, ll> > prime;
    for (int i = 2; i*i <= N; i++){
        if (N % i != 0) continue;
        int cnt = 0;
        while (N % i == 0){
            cnt++;
            N /= i;
        }
        prime.push_back({i, cnt});
    }
    if (N > 1){
        prime.push_back({N, 1});
    }
    return prime;
}

vector<pair<ll, ll> > CountPrime(ll N){
    vector<pair<ll, ll> > prime;
    for (ll i = 2; i * i <= N; i++){
        if (N % i != 0) continue;
        ll cnt = 0, n = N;
        while (n % i == 0){
            cnt++;
            n /= i;
        }
        prime.push_back({i, cnt});
    }
    prime.push_back({N, 1});
    return prime;
}

// 試行回数、表の数
bool dp[100100];

int main(){
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    fill(dp, dp+100010, false);
    for (int i = 0; i <= K; i++){
        for (int j = 0; j < N; j++){
            if (i < a[j]) continue;
            dp[i] = (dp[i] || !dp[i-a[j]]);
        }
    }
    if (dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  int a = S.size(),count = 0;
  for(int i = 0; i < a; i++){
    if(S.at(i) != T.at(i)) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3816
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int K = in.i();
        long ans = K == 0 ? K - N : 0;
        for (int i = K + 1; i <= N; i++) {
            int j = (N - K) / i;
            ans += (i - K) * j + Math.min(N - i * j + 1, i) - K;
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

ll minar=1e18;
int main(){
	startTime=clock();
	int n;
	bool flag=false;
	int count=0;
	ll sum=0;
	cin >> n;
	int ar[n];
	FOR(i,n){
		cin >> ar[i];
		if(ar[i]==0) flag=true;
		if(!flag && ar[i] < 0) count++;
		ar[i]=abs(ar[i]);
		minar=min((ll) ar[i],minar);
		sum+=ar[i];
	}
	if(!flag){
		if(count % 2) sum-=2*minar;
	}
	cout << sum;
	return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, k, q;
    cin >> n>> k >> q;
    vector<int> b(n);
    for(int i = 0; i < q; ++i){
        int a;
        cin >> a;
        --a;
        ++b[a];
    }
    for(int i = 0; i < n; ++i){
        cout << (k - q + b[i] > 0 ? "Yes\n" : "No\n");
    }
    return 0;
}

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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 1e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;



signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   string s;
   cin >> s;
   bool W = 0, N = 0, S = 0, E = 0;
   for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'N') N = 1;
      if (s[i] == 'E') E = 1;
      if (s[i] == 'S') S = 1;
      if (s[i] == 'W') W = 1;
   }
   if (N == S && W == E) {
      cout << "Yes";
   }
   else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n,Q; cin >> n >> Q;
    vvl v(n, vl(3));
    rep(i,n){
        ll s,t,x; cin >> s >> t >> x;
        v[i][0] = x;
        v[i][1] = s - x;
        v[i][2] = t - x;
    }
    set<ll> se;
    map<ll, ll> mp;
    rep(i,Q){
        ll q; cin >> q;
        se.insert(q);
        mp[q] = i;
    }
    vl ans(Q, -1);
    sort(all(v));
    rep(i,n){
        
        ll x = v[i][0];
        ll s = v[i][1];
        ll t = v[i][2];
        while(1){
            auto itr = se.lower_bound(s);
            if(itr == se.end()) break;
            ll q = *itr;
            if(q >= t) break;
            ans[mp[q]] = x;
            se.erase(itr);
        }
        
    }
    rep(i,Q) cout << ans[i] << endl;
}


Measured memory_bytes: 36224
#include <stdio.h>

int main(){
	int i,j,k;
	int N,s,a;
	
	scanf("%d",&N);

	for(i=1;i<10;i++){
		
		s = N/i;
		a = N%i;
		if(s<10 && a==0){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	
  return 0;

}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

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

int main() {
    cin >> A >> B;
    cout << max(0ll, A-2*B);
}

Measured memory_bytes: 256
while true do
  num=Array.new
  str=gets.chomp
  number=str.split
  num[0]=number[0].to_i
  num[1]=number[1].to_i
  if num[0]==0 && num[1]==0 then
    break
  end
  for i in 1..num[0] do
    for j in 1..num[1] do
      if i==1 || i==num[0] || j==1 || j==num[1] then
        print "#"
      else
        print "."
      end
    end
    print "\n"
  end
  print "\n"
end

Measured memory_bytes: 8692
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    int[]a = new int[N];
 
    int all = 0;		
    for(int i=0; i<N; i++) {
    	a[i] = L+i;
    	all += a[i];
    a[i] = Math.abs(a[i]); 
    }
    Arrays.sort(a);

    	
    	
    if(L+N-1<0) {
    	System.out.println(all+a[0]);
    }else {
    	System.out.println(all-a[0]);
    }
}
}

Measured memory_bytes: 35920
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll dp[100005];
int main()
{
    _fast_
    ll t = 1;
   // cin>>t;
    while(t--){
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    
    f(n)
    {
        cin>>arr[i];
    }
    memset(dp,0,sizeof(dp));
    for(ll i = 0;i<=k;i++)
    {
        for(ll j = 1;j<=n;j++)
        {
            if(i-arr[j-1]>=0 && dp[i-arr[j-1]] == 0)
            {
                dp[i] = 1;
            }
        }
    }
    if(dp[k])
    {
        cout<<"First\n";
    }
    else
    {
        cout<<"Second\n";
    }
    
    }
    return 0;
}

Measured memory_bytes: 1024
prime = [True for i in range(1000001)]
prime[0] = prime[1] = False
for i in range(1001):
    if prime[i]:
        for j in range(2, 1000000 // i + 1):
            prime[i * j] = False

while True:
    a, d, n = map(int, input().split())
    if a == d == n == 0:
        break

    k = -1
    while n:
        k += 1
        if prime[a + k * d]:
            n -= 1
    
    print(a + k * d)


Measured memory_bytes: 13512
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int main()
{
	int n,a[103],b[103],c[103],d[103],ans=0,big[100],small[100];
	cin>>n;
	for(int i=0;i<n;i++){
	  cin>>a[i]>>b[i];
   	  big[i]=0;
	} 
	for(int i=0;i<n;i++){
		cin>>c[i]>>d[i];
		small[i]=0;
		for(int j=0;j<n;j++){
		  if((a[j]<c[i]) and (b[j]<d[i])){
     		small[i]++;
			big[j]++;
		}
 	  }
	} 
	for (;;){
		int k=-1;
		int count=101;
		for(int i=0;i<n;i++){
		  if(small[i] > 0)
			if(small[i]<count){
			  k=i;
			  count=small[i];
			}
		}
		if(count>100) break;
		small[k]=0;
		count=0;
		int x=-1;
		int count1=101;
		for(int j=0;j<n;j++)
		  if(big[j] > 0)
		    if((a[j]<c[k] and b[j]<d[k])){
			  big[j]--;
			  if(big[j]<count1){
			    count1=big[j];
			    x=j;
		   	}
			count++;
		  }
		if(count>0) ans++;
		if(x>=0) {
			big[x]=0;
			for(int i=0;i<n;i++)
				if((a[x]<c[i]) and (b[x]<d[i])) small[i]--;
         }
  }
  cout<<ans;
  system ("pause");
  return 0;
}

Measured memory_bytes: 504
def wari(x):
    x=x/2
    if x%1==0:
        return x
    else:
        return -1
n=int(input())
a=list(map(int,input().split()))
s=0
while True:
    a=list(map(wari,a))
    if -1 in a:break
    else:
      s+=1
      
print(s)

Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	int a,b,x;
	
	scanf("%d %d",&a,&b);
	
	while(1){
		
		if(a > b){
			x = a;
			a = b;
			b = x;
		}
		if ( a == 0 && b == 0 ) break;  
		printf("%d %d\n",a,b);
		scanf("%d %d",&a,&b);
	}
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
 
int main()
{
    int n, i;
    double x1, x2, x3, x4, y1, y2, y3, y4, eps = 1e-10;
     
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        if((x1 == x2) && (x3 == x4)) printf("YES\n");
        else if((x1 == x2) || (x3 == x4)) printf("NO\n");
        else if(fabs((y1-y2)/(x1-x2) - (y3-y4)/(x3-x4)) < eps) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

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

map<vector<int>, int> hash;

vector<int> graph[700000];
int cntH = 0;

int assign_hash(vector<int> ret) {
	
	int k = hash[ret];
	if(k == 0) {
		cntH++;
		k = hash[ret] = cntH;
	}
	return k;
}

int dfs2(int prev, int cur) {
	vector<int> ret;
	for(int i=0; i<graph[cur].size(); i++) {
		int v = graph[cur][i];
		if(v == prev) continue;
		int a = dfs2(cur, v);
		ret.push_back(a);
	}
	sort(ret.begin(), ret.end());
	
	int ans = assign_hash(ret);
	return ans;
}
int Nbase;
  
int calc(int hikaku, int start, vector<int> &used_base) {
	
	vector<int> vs;
	map<int,int> used;
	
	queue<int> qu;
	qu.push(start);
	used[start] = 1;
	used_base[start] = 1;
	
	while(!qu.empty()) {
		int v = qu.front(); qu.pop();
		vs.push_back(v);
		for(int i=0; i<graph[v].size(); i++) {
			int u = graph[v][i];
			if(used[u] == 1) continue;
			used[u] = 1;
			used_base[u] = 1;
			qu.push(u);
			
		}
		
	}
	if(Nbase != vs.size()) return -1;
	
	
	queue<int> search;
	for(int i=0; i<vs.size(); i++) {
		int v = vs[i];
		used[v] = 0;
		if(graph[v].size() == 1) {
			search.push(v);
			used[v] = true;
		}

		
	}
	vector<int> nums;
	
	map<int,int> hoge;
	for(int i=0; i<vs.size(); i++) {
		int v = vs[i];
		hoge[v] = graph[v].size();
		}
	
	while(!search.empty()) {
		int v = search.front(); search.pop();
		nums.push_back(v);
		for(int i=0; i<graph[v].size(); i++) {
			int u = graph[v][i];
			hoge[v]--;
			hoge[u]--;
			if(used[u]) continue;
			if(hoge[u] > 1) continue;
			search.push(u); 
			used[u] = 1;
		}
	}
	int ret = dfs2(-1, nums.back());
	if(hikaku == -1) return ret;
	if(hikaku == ret) return ret;
	nums.pop_back();
	ret = dfs2(-1, nums.back());
	return ret;
	
}


int main() {
	int N,M;
	cin >> N >> M;
	for(int i=0; i<M; i++) {
		int u,v;
		cin >> u >> v;
		u--;v--;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	cin >> Nbase;
	
	for(int i=0; i<Nbase-1; i++) {
		int u,v;
		cin >> u >> v;
		u--;v--;
		u += N; v += N;
		graph[v].push_back(u);
		graph[u].push_back(v);
	}
	
	int ans = 0;
	if(Nbase == 1) {
		for(int i=0; i<N; i++ ) {
			if(graph[i].size() == 0) ans++;
		}
		cout << ans << endl;
		return 0;
	}
	vector<int> used(N + Nbase, 0);
	int hikaku = calc(-1, N, used);
	for(int i=0; i<N; i++) {
		if(!used[i]) {
			int res = calc(hikaku, i , used);
			if(res == hikaku) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 49320
#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 Set(a, v) memset(a, v, sizeof(a))
using namespace std;

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

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

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

typedef long long ll;
typedef pair<ll, ll> pll;
#define fir first
#define sec second
#define mp make_pair
const ll Mod = 1e9 + 7;
const int N = 201000;

ll ans = 0;
ll fpm(ll x, ll power) {
	ll res = 1;
	for (; power; power >>= 1, (x *= x) %= Mod)
		if (power & 1) (res *= x) %= Mod;
	return res;
}

int fa[N], n, tot[N];
vector<int> G[N];

int id[N], num = 0, d[N];
vector<pll> dp[N];

ll All[N], Zero[N], One[N];

void Dfs(int u) {
	int son = n + 1;
	for (int v : G[u]) { 
		Dfs(v); if (d[v] > d[son]) son = v;}
	if (son != n + 1) id[u] = id[son], d[u] = d[son] + 1;
	else id[u] = ++num;

	dp[id[u]].push_back(mp(1, 1));
	bool flag = false;

	int nowdep;
	for (int v : G[u])
		if (v != son) {
			if (!flag) {
				For (i, 0, d[u])
					All[i] = 1, Zero[i] = 1, One[i] = 0;
				flag = true;
			}

			For (i, 0, d[v]) {
				nowdep = (d[son] - d[v]) + i;
				pll sta = dp[id[v]][i];
				(All[nowdep] *= (sta.fir + sta.sec)) %= Mod;
				(Zero[nowdep] *= sta.fir) %= Mod;
			}
		}
	if (!flag) return ;

	For (i, 0, d[u] - 1) {
		pll sta = dp[id[u]][i];
		(All[i] *= (sta.fir + sta.sec)) %= Mod;
		(Zero[i] *= sta.fir) %= Mod;
	}

	for (int v : G[u]) {
		For (i, 0, d[v]) {
			nowdep = (d[son] - d[v]) + i;
			pll sta = dp[id[v]][i];
			(One[nowdep] += Zero[nowdep] * fpm(sta.fir, Mod - 2) % Mod * sta.sec % Mod) %= Mod;
		}
	}

	For (i, 0, d[u] - 1) {
		dp[id[u]][i].fir = (All[i] - One[i] + Mod) % Mod;
		dp[id[u]][i].sec = One[i];
	}
}

int dep[N];

int main () {
	File();
	n = read();
	For (i, 1, n) {
		fa[i] = read();
		G[fa[i]].push_back(i);
		dep[i] = dep[fa[i]] + 1;
		++ tot[dep[i]];
	}
	++ tot[0];
	d[n + 1] = -1;

	Dfs(0);

	For (i, 0, d[0]) {
		pll sta = dp[id[0]][i];
		(ans += sta.sec * fpm(2, n + 1 - tot[d[0] - i]) % Mod) %= Mod;
	}
	printf ("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 52852
#include <iostream>
#include <vector>

using namespace std;

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

	int x, a, b;
	cin >> x >> a >> b;

	if(abs(x - a) > abs(x - b))
	{
		cout << "B" << endl;
	}
	else
	{
		cout << "A" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  if(N%2==0) {
cout<<N/2<<endl;
  }
  else {
cout<<N/2+1<<endl;
  }
}


Measured memory_bytes: 3552