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

int main() {
    int n, s, e, sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s >> e;
        sum += e - s + 1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
paths = [list(map(int, input().split())) for _ in range(M)]

roads = {i : 0 for i in range(N)}
for path in paths:
  roads[path[0]-1] +=1
  roads[path[1]-1] +=1

for i in range(N):
  print(roads[i])
  

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

template<class T>
struct ModInt {
    T x;
    ModInt(T x = 0) :x(x% mod) {}
    ModInt& operator+=(const ModInt a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(const ModInt a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator*=(const ModInt a) {
        (x *= a.x) %= mod;
        return *this;
    }
    ModInt operator+(const ModInt a) const {
        ModInt res(*this);
        return res += a;
    }
    ModInt operator-(const ModInt a) const {
        ModInt res(*this);
        return res -= a;
    }
    ModInt operator*(const ModInt a) const {
        ModInt res(*this);
        return res *= a;
    }
    ModInt pow(T t) const {
        if (!t) return 1;
        ModInt a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    ModInt inv() const {
        return pow(mod - 2);
    }
    ModInt& operator/=(const ModInt a) {
        return (*this) *= a.inv();
    }
    ModInt operator/(const ModInt a) const {
        ModInt res(*this);
        return res /= a;
    }
};
using mint = ModInt<long long>;

int n;
ll x[100005];
mint s[100005];
void solve() {
    cin >> n;
    rep(i, n) cin >> x[i];
    reps(i, n - 1) s[i] += s[i - 1] + mint(i).inv();

    mint ans = 0;
    rep(i, n - 1) ans += mint(x[i + 1] - x[i]) * s[i + 1];
    reps(i, n - 1) ans *= i;

    cout << ans.x << endn;
}

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


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
    int a,j,i;
    scanf("%d", &a);
    for(i = 9; i > 0; i--){
        for(j = i; j > 0; j--){
            if (i*j == a)
            {
                i = -1;
                j = -1;
            }
            
        }
    }
    if (i == -2)
    {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
     return 0;
}

Measured memory_bytes: 128
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstring>
#include <unordered_map>
#include <sstream>
using namespace std;
std::string to_binString(unsigned int val)
{
    if( !val )
        return std::string("0");
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 ) 
            str.insert(str.begin(), '0');  
        else
            str.insert(str.begin(), '1');  
        val >>= 1;
    }
    return str;
}
std::string to_binString2(unsigned int val, int n)
{
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 )  
            str.insert(str.begin(), '0');
        else
            str.insert(str.begin(), '1');
        val >>= 1;
    };
    while (str.size() != n) {
      str.insert(str.begin(), '0');
    }
    return str;
}
int jpre(string a, string b) 
{
  if ((a.find(b) == 0) || (b.find(a) == 0)){
    return 1;
  }
  return 0;

}
void nodup_push(vector<string>&newspace, string &b) 
{
  for (auto p : newspace) {
    if (jpre(p,b)) {
      cout << "  --  nodup_push (skipped): " << b << ", (because of p: " << p << ")" << endl;
      return ;
    }   
  }

  newspace.push_back(b);
  //a.insert(b);


}
void nodup_insert(set<string> &a, string b) 
{
  for (auto p : a) {
    if (jpre(p,b)) {
      return ;
    }
  }

  //a.push_back(b);
  a.insert(b);


}
int getsum_dec(int i)
{
  int sum = 0;
  while (i != 0) {
    sum += i%10;
    i = int(i / 10);
  }
  return sum;
}

int main()
{
  long long  x, y;
  cin >> x >> y;
  int count = 1;
  long long  nownum = x;
  while (nownum<=y) {
    nownum += nownum;
    if (nownum <=y)
      count++;

  }
  cout << count << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    int mi = INF, ma = 0;
    REP(i,N){
        cin >> a[i];
        chmax(ma,a[i]);
        chmin(mi,a[i]);
    }
    if(ma == mi){
        if(ma == N - 1 || 2*ma <= N) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else if(ma - mi == 1){
        int x = count(a.begin(), a.end(), mi);
        int y = count(a.begin(), a.end(), ma);
        if(x < ma && 2*(ma-x) <= y) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else cout << "No" << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
    long long int l,r;
    cin >> l >> r;
    long long int ans = 2019;
 
    for(long long int i = l; i < r; ++i){
        for(long long int j = i+1; j<= r && j < l+2019; ++j){
            ans = min((i*j)%2019, ans);
            // if(ans == 0)break;
        }
    }
 
    cout << ans << endl;
 
 
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum[3300000], ans, a[330000], b[330000];
string str, ss;
bool f[5];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>vec,rvec;
vector<edge>ed;
vector<LL>v;
map<string, LL>ma;
set<LL>st;

void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int  par[10];  // リーダーの値を格納 

int find(int x) { if (par[x] == x)return x; par[x] = find(par[x]); return par[x]; }
void unite(int x, int y) { x = find(x); y = find(y); if (x == y)return; par[x] = y; }
bool same(int x, int y) { return find(x) == find(y); }
void dfs(int cur, int par) {
	LL num = 0;
	rep(i, vec[cur].size()) {
		if (vec[cur][i] == par)continue;
		dfs(vec[cur][i], cur);
		num++;
	}
	if (num == 1)f[cur] = 1;
}
int main() {
	vec.resize(4);
	rep(i, 3) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		vec[a[i]].push_back(b[i]);
		vec[b[i]].push_back(a[i]);
	}
	rep(i, 4) {
		rep(j, 4)f[j] = 0;
		dfs(i,-1);
		cnt = 0;
		rep(j, 4) {
			if (f[j] != 1)
				cnt++;
		}
		if (cnt==1)
			ans = 1;
	}
	if (ans)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 4352
#include "iostream"
#include "math.h"
using namespace std;

int N;
int num;

int main() {
	cin >> N;
	if (N == 2) {
		cout << "-1\n";
		return 0;
	}
	if (N % 2 == 1) {
		for (int i = 1; i <= N; i++) {
			for (int j = 0; j < N-1; j++) {
				num = i + j+1;
				if (num > N) {
					num %= N;
				}
				cout << num << " ";
			}
			cout << "\n";
		}
	}
	else {
		for (int i = 1; i <= N; i++) {
			for (int j = 0; j < N - 1; j++) {
				if (i *2<=N) {
					if ((j * 2 + 2) == N) {
						num = i + N - 1;
						if (num > N) {
							num %= N;
						}
						cout << num << " ";
					}
					else if (j == N - 2) {
						num = i + N / 2;
						if (num > N) {
							num %= N;
						}
						cout << num << " ";
					}
					else {
						num = i + j + 1;
						if (num > N) {
							num %= N;
						}
						cout << num << " ";
					}
				}
				else {
					num = i + j + 1;
					if (num > N) {
						num %= N;
					}
					cout << num << " ";
				}
			}
			cout << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
lst = [int(i) for i in input().split()]

for i in range(n-k+1):
    l = lst[i]
    r = lst[i+k-1]
    way1 = abs(l) + abs(r-l)
    way2 = abs(r) + abs(l-r)
    m = min(way1,way2)
    if i==0:
        ans = m
    elif m < ans:
        ans = m
    
print(ans)

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

signed main() {
  int N;
  cin >> N;

  vector<int> A(N);
  int x[20][20], y[20][20];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    for (int j = 0; j < A[i]; j++) {
      cin >> x[i][j] >> y[i][j];
      x[i][j]--;
    }
  }

  int Ans = 0;
  for (int bit = 0; bit < (1 << N); bit++) {
    vector<int> ans(N, 0);
    int cnt = 0;
    bool flag = true;

    for (int i = 0; i < N; i++) {
      if ((bit & (1 << i)) > 0) {
        cnt++;
        ans[i] = 1;
      }
    }

    for (int i = 0; i < N; i++) {
      if ((bit & (1 << i)) > 0) {
        for (int j = 0; j < A[i]; j++) {
          if (ans[x[i][j]] != y[i][j]) {
            flag = false;
          }
        }
      }
    }

    if (flag) {
      Ans = max(Ans, cnt);
    }
  }

  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if(-1000<=a && b<=1000){
        if(a<b){
            printf("a < b\n");
        }
        else if (a>b){
                printf("a > b\n");

            }
        else if (a==b){
            printf("a == b\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
#define ll long long
#define maxn 100005
using namespace std;
struct node {
	node *lch,*rch;
	int sum;
	node() {
		lch = rch = nullptr;
		sum = 0;
	}
	void modify(ll l,ll r,ll pos) {
		if(l == r)
			sum++;
		else {
			ll mid = (l+r)>>1;
			if(pos <= mid) {
				if(lch == nullptr)	lch = new node();
				lch->modify(l,mid,pos);
			}
			else {
				if(rch == nullptr)	rch = new node();
				rch->modify(mid+1,r,pos);
			}
			sum = (lch == nullptr ? 0 : lch->sum) + (rch == nullptr ? 0 : rch->sum);
		}
	}
	int query(ll l,ll r,ll ql,ll qr) {
		if(l == ql && r == qr)
			return sum;
		else {
			ll mid = (l+r)>>1;
			if(qr <= mid)
				return (lch == nullptr ? 0 : lch->query(l,mid,ql,qr));
			else if(ql > mid)
				return (rch == nullptr ? 0 : rch->query(mid+1,r,ql,qr));
			else
				return (lch == nullptr ? 0 : lch->query(l,mid,ql,mid)) + 
							(rch == nullptr ? 0 : rch->query(mid+1,r,mid+1,qr));
		}
	}
};
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	node *root = new node();
	int n,k;
	cin >> n >> k;
	ll sum = 0 , ans = 0;
	ll bound = 4ll * 1e14;
	root->modify(-bound,bound,0);
	for(int i=1,val;i<=n;i++) {
		cin >> val;
		sum += val;
		ans += root->query(-bound,bound,-bound,sum - (ll)k * i);
		root->modify(-bound,bound,sum - (ll)k * i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 187008
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
using namespace std;
typedef pair<int, int> pii;
const ll mod = 998244353;
const int sz = 2 * 1e5 + 50, mxn = 1e6 + 10;
bool isprime(int n)
{
	if (n == 0 or n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			return false; break;
		}
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	ll a, b, k;
	cin >> a >> b >> k;

	ll x = a - k;
	if (x >= 0)
	{
		cout << x << " " << b << "\n";
	}
	else {
		ll y = b - abs(k - a);
		if (y < 0)y = 0;
		cout << 0 << " " << y << "\n";
	}


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		// 入力読み込み
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		String S = scan.next();
		// 入力終わり
		scan.close();
		// 結果出力用変数
		String result = "No";
		// 文字列が偶数か奇数かで分岐
		if(N%2==0){
			// 文字列を半分まで切り出す
			String tmp = null;
			tmp = S.substring(0,N/2);
			// 文字が一致するか比較
			if(S.equals(tmp+tmp)){
				result = "Yes";
			}
		}
		// 結果出力
		System.out.println(result);
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
using namespace std;
struct X
{
  long long p,v;
}a[100010];
bool cmp(X x,X y)
{
 return x.p<y.p;
}
int main() 
{
 long long ans,c,aa[100010],bb[100010];
 int n,i,j,k;
 cin>>n>>c;
 for (i=1;i<=n;i++)
  scanf("%lld %lld",&a[i].p,&a[i].v);
 sort(a+1,a+n+1,cmp);
 aa[0]=0;
 for (i=1;i<=n;i++)
  aa[i]=aa[i-1]+a[i].v-a[i].p+a[i-1].p;
 a[n+1].p=c;
 bb[n+1]=0;
 for (i=n;i>=1;i--)
  bb[i]=bb[i+1]+a[i].v-a[i+1].p+a[i].p;
 for (i=2;i<=n;i++)
  aa[i]=max(aa[i-1],aa[i]);
 for (i=n-1;i>=1;i--)
  bb[i]=max(bb[i+1],bb[i]);  
 ans=0;
 for (i=1;i<=n;i++)
 {
  ans=max(ans,-a[i].p+aa[i]+bb[i+1]);
  ans=max(ans,a[i].p-c+bb[i]+aa[i-1]);
  ans=max(ans,aa[i]);
  ans=max(ans,bb[i]); 
 } 
 cout<<ans<<endl;
 return 0;   
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define r(i,n) for(int i=1;i<n;i++)
using namespace std;
int main(){
  long long n,p,a,b;
  while(cin>>n,n){
    long int s=0;
    while(n!=1){
      if(!(n%2))n/=2;
      else n=n*3+1;
      s++;
    }
    cout<<s<<endl;
  }
}

Measured memory_bytes: 2976
def gcd_(a,b):
    if a<b:    a,b=b,a
    if b==0:    return a
    return gcd_(b,a%b)
  
def gcd(l):
    ans=l[0]
    for i in l:
        ans=gcd_(ans,i)
    return ans


N=int(input())
A=list(map(int,input().split()))

gcd_list=[A[0]]
rev_gcd_list=[A[-1]]

for i in range(1,N):
    gcd_list.append(gcd([gcd_list[-1],A[i]]))
    rev_gcd_list.append(gcd([rev_gcd_list[-1],A[-i-1]]))
rev_gcd_list=rev_gcd_list[::-1]

ans=max(gcd_list[N-2],rev_gcd_list[1])
for i in range(1,N-1):
    ans=max(ans,gcd([gcd_list[i-1],rev_gcd_list[i+1]]))
print(ans)

Measured memory_bytes: 14436
#include "bits/stdc++.h"
using namespace std;

void fast() {
   ios_base::sync_with_stdio(0);
   cin.tie(0);
}

const int N = 200005;

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

   vector <int> dp(n);
   dp[1] = abs(h[1] - h[0]);
   
   for(int i = 2; i < n; i++) {
      dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
   }

   cout << dp[n - 1] << endl;
   return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int A[2][110];

int main() {
    int n; cin >> n;
    int undersum = 0;
    rep(i,2){
        rep(j,n){
            cin >> A[i][j];
            if(i == 1) undersum += A[i][j];
        }
    }

    int sum = A[0][0] + undersum;;
    int ans = A[0][0] + undersum;
    rep1(i,n){
        sum = sum + A[0][i] - A[1][i-1];
        ans = max(ans,sum);
    }

    cout << ans << endl;

}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  ll ans;
  if (n <= 599) {
    ans = 8;
  } else if (n <= 799) {
    ans = 7;
  } else if (n <= 999) {
    ans = 6;
  } else if (n <= 1199) {
    ans = 5;
  } else if (n <= 1399) {
    ans = 4;
  } else if (n <= 1599) {
    ans = 3;
  } else if (n <= 1799) {
    ans = 2;
  } else {
    ans = 1;
  }

  cout << ans << endl;

  return 0;
}


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

#define ll long long
#define setp setprecision
#define fix fixed
#define db double
#define pb push_back
int main() {
	int x,a;
	cin>>x>>a;
	if (x<a) {
		cout<<0;
	} else {
		cout<<10;
	}
	return 0;
}

Measured memory_bytes: 256
from itertools import product
S = list(input())
T = list(map(int, S))

for p in product([-1, 1], repeat=3):
    tmp = T[0]
    for i, s in zip(p, T[1:]):
        tmp += i * s
    if tmp == 7:
        break

ans = S[0]
for i, s in zip(p, S[1:]):
    q = "+" if i == 1 else "-"
    ans += q
    ans += s
ans += "=7"
print(ans)

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

tbl = [0] * n

cnt = 0
for i in range(1, n):
    if s[i - 1] == 'W':
        cnt += 1
    tbl[i] += cnt

cnt = 0
for i in range(n - 2, -1, -1):
    if s[i + 1] == 'E':
        cnt += 1
    tbl[i] += cnt

print(min(tbl))


Measured memory_bytes: 15264
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count=0
for a in range(A+1):
    moneya = 500*a
    for b in range(B+1):
        moneyb = moneya + 100*b
        for c in range(C+1):
            moneyc = moneyb + 50*c
            if moneyc == X:
                count+=1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

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);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int m,n;cin>>n>>m;
  vector<vector<int>> r(n+1);
  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;
    r[a].push_back(b);
    r[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    cout<<r[i+1].size()<<endl;
  }
  return 0;
}


Measured memory_bytes: 3632
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var N = o.getValue(0);
    var S = o.getValue(1);

    if (N % 2 === 1) {
        return "No";
    }
    var h = N / 2;

    var p = S.slice(0, h);
    var s = S.slice(h);

    if (p === s) {
        return "Yes";
    }

    return "No";
}

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

using namespace std;



int main() {
  
     string s;
     cin>>s;
     long int i,num1=0,num2=0;
     for(i=0;i<s.length();++i)
        {
            if(s[i]=='A')
               break;
        }
      
     num1=i;
     
     for(i=s.length()-1;i>=0;--i)
        {
            if(s[i]=='Z')
                break;
        }
        
      num2=i;
      
      printf("%ld",num2-num1+1);
        
    	return 0;
} 

Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> v(n,0);
    for(int i = 0; i < n*(n-1)/2; i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        a--,b--;
        if(c < d){//b
            v[b] += 3;
        }else if(c > d){//a
            v[a] += 3;
        }else{//draw
            v[a]++;
            v[b]++;
        }
    }
    int place = 1;
    vector<int> ans(n);
    for(int score = 3*n; score >= 0; score--){
        int cnt = 0;
        for(int i = 0; i < n; i++)if(v[i] == score){
            ans[i] = place;
            cnt++;
        }
        place += cnt;
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
}



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

typedef pair< int, int > P;

const int INF = 1.1e9;

int N, K, C[5000], R[5000];
vector< int > G[5000];
int d[5000];

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> C[i] >> R[i];
	for (int i = 0; i < K; i++) {
		int A, B;
		cin >> A >> B;
		A--, B--;
		G[A].push_back(B), G[B].push_back(A);
	}

	for (int i = 0; i < 5000; i++) d[i] = INF;
	d[0] = 0;
	priority_queue< P, vector<P>, greater<P> > pq;
	pq.push(P(0, 0));
	while(!pq.empty()) {
		P p = pq.top(); pq.pop();
		int cur = p.second, cost = p.first;
		if (d[cur] < cost) continue;
		queue<int> q;
		q.push(cur);
		bool used[5000] = {};
		for (int i = 0; i < R[cur]; i++) {
			int sz = q.size();
			for (int j = 0; j < sz; j++) {
				int tmp = q.front(); q.pop();
				for (int k = 0; k < (int)G[tmp].size(); k++) {
					int nxt = G[tmp][k];
					if (d[nxt] > cost + C[cur]) {
						d[nxt] = cost + C[cur];
						pq.push(P(d[nxt], nxt));
					}
					if (!used[nxt]) {
						used[nxt] = true;
						q.push(nxt);
					}
				}
			}
		}
	}
	cout << d[N - 1] << endl;
}



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

int main(){
  int m, maxi, mini;
  while(std::cin >> m >> mini >> maxi, m){
    vector<int> p(m);
    for (int i = 0; i < m; i++) std::cin >> p[i];
    sort(p.begin(), p.end());
    int gap = 0, ans = -1;
    for (int i = m - maxi; i <= m - mini; i++) {
      if(gap < p[i] - p[i - 1]){
        gap =  p[i] - p[i - 1];
        ans = m - i;
      }
    }
    std::cout << ans << std::endl;
    // std::cout << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3116
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, x: "List[int]"):
    def search(N, window_size, x):
        costs = []
        for i in range(N-window_size+1):
            right_end = x[i+window_size-1]
            left_end = x[i]
            dist = abs(right_end-left_end)
            costs.append(min(abs(right_end)+dist, abs(left_end)+dist))
        return min(costs)
    print(search(N, K, x))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    x = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, K, x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17140
n = int(input())
a = [n]
cnt = 1
while True:
    if a[-1] % 2 == 0:
        x = [a[-1] // 2]
        if set(x) & set(a) == set():
            a.append(x[0])
        else:
            cnt += 1
            break
    else:
        x = [a[-1] * 3 + 1]
        if set(x) & set(a) == set():
            a.append(x[0])
        else:
            cnt += 1
            break
    cnt += 1
print(cnt)


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

int main() {
	char a;
  	cin >> a;
  	if ( a == 'a' ) cout << "vowel" << endl;
    else if ( a == 'i' ) cout << "vowel" << endl;
   else if ( a == 'u' ) cout << "vowel" << endl;
   else if ( a == 'e' ) cout << "vowel" << endl;
   else if ( a == 'o' ) cout << "vowel" << endl;
  else  cout << "consonant" << endl;
}




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

using namespace std;

#define lp(i,n) for(ll (i) = (0);(i) < (n);++i)

typedef long long ll;

int main() {
    int n;
    cin>>n;
    int od=0,ev=0;
    lp(i,n){
        int a;
        cin>>a;
        if(a%2==0)od++;
        else ev++;
    }
    if(od==0||ev==0){
        cout<<0<<endl;
        return 0;
    }
    ev--;
    od+=ev/2;
    int ans=0;
    ans+=ev/2;
    ans+=od;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3092
#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;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;


#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef HOME
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
const int maxa = 1e6 + 1;

// stores smallest prime factor for every number
int spf[maxa];

// Calculating SPF (Smallest Prime Factor) for every
// number till maxa.
// Time Complexity : O(nloglogn)
void sieve()
{
	spf[1] = 1;
	for (int i = 2; i < maxa; i++)

		// marking smallest prime factor for every
		// number to be itself.
		spf[i] = i;

	// separately marking spf for every even
	// number as 2
	for (int i = 4; i < maxa; i += 2)
		spf[i] = 2;

	for (int i = 3; i * i < maxa; i++)
	{
		// checking if i is prime
		if (spf[i] == i)
		{
			// marking SPF for all numbers divisible by i
			for (int j = i * i; j < maxa; j += i)

				// marking spf[j] if it is not
				// previously marked
				if (spf[j] == j)
					spf[j] = i;
		}
	}
}

vector<bool> can(maxa + 1, true);

int main() {

	sieve();
	// for (int i = 1; i <= 10; i++) cerr << spf[i] << " ";
	// cerr << endl;
	long long n; cin >> n;
	long long gd = 0;
	vector<long long> a(n + 2, 0); for (long long i = 1; i <= n; i++) cin >> a[i], gd = gcd(gd, a[i]);

	bool is_setwise = (gd == 1);
	bool is_pairwise = true;

	for (int i = 1; i <= n; i++) {
		int x = a[i];
		set<int> v;
		while (x != 1) {
			int pfac = spf[x];
			v.insert(pfac);
			x /= spf[x];
		}
		for (auto pfac : v) {
			if (can[pfac] == false) {
				is_pairwise = false;
				break;
			}
			else can[pfac] = false;
		}
		if (is_pairwise == false) break;
	}


	if (is_pairwise) cout << "pairwise coprime";
	else if (is_setwise) cout << "setwise coprime";
	else cout << "not coprime";

	return 0;
}

Measured memory_bytes: 15056
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  pair<int,int> P;
  vector<vector<pair<int,int>>> vec(N);
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    for(int j=0; j<a; j++){
      int x,y;
      cin >> x >> y;
      P = make_pair(x,y);
      vec.at(i).push_back(P);
    }
  }
      
  int num = 0;
  for(int bit = 0; bit < (1 << N); bit++){
    map<int,bool> mp;
    bool flag = true;
    for(int i=0; i<N; i++){
      if(bit & (1 << i)){
        mp[i+1] = true;
      }
    }
    for(int j=0; j<N; j++){
      if(mp.count(j+1) == false){
        continue;
      }
      else{
        for(int k=0; k<vec.at(j).size(); k++){
          P = vec.at(j).at(k);
          if(P.second == 1){
            if(mp.count(P.first) == false){
              flag = false;
            }
          }
          else if(P.second == 0){
            if(mp.count(P.first) == true){
              flag = false;
            }
          }
        }
      }
    }
    if(flag){
      int y = mp.size();
      num = max(num,y);
    }
  }
  cout << num << endl;
}

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

int main() {
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<int> arr;
	int p[a], q[b], r[c];
	for(int i = 0; i < a; i++) cin >> p[i];
	for(int i = 0; i < b; i++) cin >> q[i];
	for(int i = 0; i < c; i++) cin >> r[i];
	sort(p, p + a);
	sort(q, q + b);
	for(int i = 0; i < x; i++) arr.push_back(p[a-1-i]);
	for(int i = 0; i < y; i++) arr.push_back(q[b-1-i]);
	for(int i = 0; i < c; i++) arr.push_back(r[i]);
	sort(arr.begin(), arr.end());
	long long ans = 0;
	for(int i = 0; i < x+y; i++) ans += arr[x+y+c-1 - i];
	cout << ans;
	return 0;
}

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

int n,m,x;
int c[12];
int mat[12][12];
int levels[12];
//vector<string> V;
int sol=INT_MAX;

void checkPrice(string s) {
    int price=0;
    for (int i=0;i<m;i++) {
        levels[i]=0;
    }
    for (int i=0;i<n;i++) {
        if (s[i]=='0') {continue;}
        for (int j=0;j<m;j++) {
            levels[j]+=mat[i][j];
        }
        price+=c[i];
    }

    for (int j=0;j<m;j++) {
        if (levels[j]<x) {
            return;
        }
    }

    sol=min(sol,price);

}

void rek(int i, string s) {
    if (i==n) {
        checkPrice(s);
        return;
    }
    s.push_back('0');
    rek(i+1,s);
    s.pop_back();
    s.push_back('1');
    rek(i+1,s);
    s.pop_back();

}

int main() {
    cin >> n >> m >> x;
    for (int i=0;i<n;i++) {
        cin >> c[i];
        for (int j=0;j<m;j++) {
            cin >> mat[i][j];
        }
    }

    rek(0,"");

    if (sol==INT_MAX) {
        cout << "-1" << endl;
    }
    else {
        cout << sol << endl;
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
    while (true) {
        int n, m; cin >> n >> m;
        if (n == 0 and m == 0) break;
        vector<int> a(n), b(m);
        for (int & x : a) cin >> x;
        for (int & x : b) cin >> x;
        int as = accumulate(a.begin(), a.end(), 0);
        int bs = accumulate(b.begin(), b.end(), 0);
        pair<int,int> p = { 10000, 10000 };
        for (int x : a) {
            for (int y : b) {
                if (as - x + y == bs - y + x) {
                    if (x + y < p.first + p.second) {
                        p = { x, y };
                    }
                }
            }
        }
        if (p.first == 10000) {
            cout << -1 << endl;
        } else {
            cout << p.first << ' ' << p.second << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
As = list(map(int, input().split()))

money = 1000
stock = 0
for i in range(N):
    if i == 0:
        if As[0] < As[1]:
            stock = money // As[0]
            money %= As[0]
    elif i == N - 1:
        money += As[i] * stock
        stock = 0
    else:
        if As[i-1] >= As[i] and As[i+1] >= As[i]:
            stock += money // As[i]
            money %= As[i]
        elif  As[i-1] <= As[i] and As[i+1] <= As[i]:
            money += As[i] * stock
            stock = 0

print(money)

Measured memory_bytes: 61960
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  long p[m];
  long y[m];
  int i;
  int city[n+1] = {};
  long tmp[m+1];
  string s;
  vector<pair<int,int>> pairs(m);
  for(i=0;i<m;i++){
    cin >> p[i] >> y[i];
    pairs[i]= make_pair(y[i],i);
  }

  sort(pairs.begin(),pairs.end());

  for(i=0;i<m;i++){
    tmp[pairs[i].second] = 1000000000000;
    city[p[pairs[i].second]]++;
    tmp[pairs[i].second]+=city[p[pairs[i].second]];
    tmp[pairs[i].second] += 1000000*p[pairs[i].second];
  }

  for(i=0;i<m;i++){
    s="";
    ostringstream oss;
    oss << tmp[i];
    s = oss.str();
    cout << s.substr(1) << endl;
  }
  


}

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

int main(){
  int i,N;
  cin>>N;
  int A[N];
  int count=0;

  for(i=0; i<N; i++){
    cin>>A[i];
  }

  while(true){
    for(i=0;i<N;i++){
      if(A[i]%2==1){
        break;
      }
      A[i]=A[i]/2;
    }
    if(i==N){
      count++;
    }else{
      break;
    }
  }

  cout<<count<<endl;

  return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    // freopen("inputf.txt","r",stdin);
    // freopen("outputf.txt","w",stdout);
    
    long long int n,d;
    cin>>n>>d;
  
    int ans=0;
    while(n--){
        long long int a,b;
        cin>>a>>b;
      
        if(sqrt((a*a)+(b*b))<=d)
          ans++;
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3652
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>


using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A & a, const B & b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A & a, const B & b) { a = max(a, (A)b); };


int main() {
	multimap<ll, ll> mp;
	priority_queue<ll, vector<ll>> q;
	ll N, M;
	cin >> N >> M;
	REP(i, 0, N) {
		ll a, b;
		cin >> a >> b;
		mp.insert(pair<ll, ll>{a, b});
	}
	ll ans = 0;
	for (int i = M - 1; i >= 0; --i) {
		auto range = mp.equal_range(M - i);
		for (auto itr = range.first; itr != range.second; ++itr) {
			q.push(itr->second);
		}
		if (q.empty())continue;
		ans += q.top();
		q.pop();
	}
	PRI(ans);
	return 0;
}

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

int main(){
  int n; cin>>n;
  vector<int> yaku(1000010,0);
  map<int,int> a;
  int ans=0;
  rep(i,n){
    int A;
    cin>>A;
    a[A]++;
  }
  for(auto x : a){
    for(int j=2; j*x.first<=1000010; j++){
      yaku[j*x.first]++;
    }
  }
  for(auto x : a){
    if(yaku[x.first]==0&&x.second==1){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 16348
// She is Pretty pretty!
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6 + 100;
int n, k, c;
string s;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k >> c >> s;
    int cnt = 0;
    vector<int> a(n + 10, 0), b(n + 10, 0);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'o') {
            a[cnt++] = i;
            i += c;
        }
    }
    int tp = k - 1;
    for (int i = n - 1; i >= 0 && tp >= 0; i--) {
        if (s[i] == 'o') {
            b[tp--] = i;
            i -= c;
        }
    }
    for (int i = 0; i < k; i++) {
            if (a[i] == b[i] ) {
                cout << a[i] + 1 << '\n';
            }
        }
    return 0;
}

Measured memory_bytes: 3348
#include <stdio.h>

int b[10010];
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int t;
		scanf("%d",&t);
		b[t]++;
	}
	int f=0;
	for(int i=0;i<10010;i++)if(b[i]--)printf(f++?" %d":"%d",i--);
	puts("");
}


Measured memory_bytes: 2056
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>

using namespace std;

long long a, b, c, d;

int main() {
    cin >> a >> b >> c >> d;
    cout << max(max(a * c, b * d), max(a * d, b * c)) << endl;
    return 0;
}

Measured memory_bytes: 3596
import sys
sys.setrecursionlimit(1000000)

n,m=map(int,input().split())

#初期値が0の辞書
from collections import defaultdict
xyz = defaultdict(lambda: set([]))
for _ in range(m):
    x,y,z=map(int,input().split())
    xyz[x].add(y)
    xyz[y].add(x)

no_checked=[0]*n

def DFS(x):
    global no_checked
    global xyz
    no_checked[x-1]=1
    for item in xyz[x]:
        if no_checked[item-1]==0:
            DFS(item)

cnt=0
for i in range(1,n+1):
    if no_checked[i-1]==0:
        cnt+=1
        DFS(i)

    #print(i,no_checked)
print(cnt)



Measured memory_bytes: 128696
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

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

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	ULL GCD(ULL a, ULL b) { return (b == 0) ? a : GCD(b, a % b); }

	void Solve() {
		ULL n, m; cin >> n >> m;
		ULL A[100000]; rep(i, n) cin >> A[i];
		ULL d = 1;
		while (A[0] % (d * 2) == 0) d *= 2;
		rep(i, n) {
			if (A[i] % d != 0) { cout << 0 << endl; return; }
			A[i] /= d;
			if (A[i] % 2 == 0) { cout << 0 << endl; return; }
		}
		ULL lcm = 1;
		rep(i, n) {
			lcm = lcm * A[i] / GCD(lcm, A[i]);
			if (lcm > m * 2) { cout << 0 << endl; return; }
		}
		cout << (m + lcm * d / 2) / (lcm * d) << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,M = map(int, readline().split())
    H = [int(i) for i in readline().split()]
    ab = map(int, read().split())

    E = [[] for _ in range(N+1)]
    for i, (a, b) in enumerate(zip(*[iter(ab)]*2)):
        E[a].append(b)
        E[b].append(a)
    
    ans = 0
    for i in range(1,N+1):
        flag = True
        for v in E[i]:
            if H[i-1] > H[v-1]:
                continue
            else:
                flag = False
                break
        if flag:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 44920
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    SN = sum(map(int, str(N)))

    if N % SN == 0:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)
#define	INF (1<<29)
//536870912

#define	MOD 1000000007

int	main() {
	int H, W;
	cin >>H >>W;
	vector<vector<int>> A(H+1, vector<int> (W+1, 0));
	int S=H+W-1;
	for (int i=0; i<H; i++)
		for (int j=0; j<W; j++) {
			char c;
			cin >>c;
			if ('#'==c) {
				A.at(i).at(j)=1;
				S--;
			}
		}
	if (0!=S) {
		cout <<"Impossible" <<endl;
		return 0;
	}
	vector<vector<int>> q;
	q.push_back({0, 0});
	int ix=0;
	while (ix<q.size()) {
		int x=q.at(ix).at(0);
		int y=q.at(ix).at(1);
		if ((x==H-1)&&(y==W-1)) {
			cout <<"Possible" <<endl;
			return 0;
		}
		if(1==A.at(x).at(y+1))
			q.push_back({x, y+1});
		if(1==A.at(x+1).at(y))
			q.push_back({x+1, y});
		ix++;
	}
	cout <<"Impossible" <<endl;
	return 0;
}



Measured memory_bytes: 256
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()

i = 0
res = 0
count = 1
while i<n:
    if a[i] == count:
        count += 1
    i += 1
if count == 1:
    print(-1)
else:
    print(n-count+1)


Measured memory_bytes: 97048
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
import numpy as np
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(a, b, c, d, e, k):
    arr = np.array([a, b, c, d, e])
    # print(arr)
    arr, arr2 = [a.flatten() for a in np.meshgrid(arr, arr)]
    # print(arr)
    arr = np.c_[arr, arr2]
    # print(arr)
    arr = np.array(list(map(lambda x: abs(x[0] - x[1]), arr)))
    # print(arr)
    print(':(' if arr.max() > k else 'Yay!')


if __name__ == '__main__':
    a, b, c, d, e, k = [int(input()) for _ in range(6)]
    # print(a, b, c, d, e, k)
    solve(a, b, c, d, e, k)

    # # test
    # from random import randint
    # from func import random_str
    # solve()



Measured memory_bytes: 27196
a = list(map(int,input().split()))
n = int(input())
d = a[3]
s = min(a[2],a[1]*2,a[0]*4)
mi = min(s*2,d)
if n%2 == 0:
    if mi == s*2:
        print(n//2*2*s)
    else:
        print(n//2*d)
else:
    if mi == s*2:
        print(n*s)
    else:
        print(n//2*d+s)

Measured memory_bytes: 61820
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}


		public static void main(String[] args) {
			Scanner scan=new Scanner(System.in);
			int a=scan.nextInt();
			long sum=0;
			long rui[]=new long[a];
			for(int i=0;i<a;i++) {
				int b=scan.nextInt();
				sum+=b;
				rui[i]=sum;
			}
			long min=1145123123123114191L;
			for(int i=0;i<a-1;i++) {
				long r=rui[i]*2-sum;
				long uo=Math.abs(r);
				min=min>uo?uo:min;
			}
			System.out.println(min);
		}
}

Measured memory_bytes: 64556
#include <iostream>
#include <list>
#include <algorithm>
#include <vector>
#include <memory>
#include <cmath>
#include <utility>


int main()
{
    int n, m;
    std::cin >> n >> m;
    int min = 1, max = n;
    for (int i = 0; i < m; i++) {
        int l, r;
        std::cin >> l >> r;
        min = std::max(l, min);
        max = std::min(r, max);
    }

    if (min > max) {
        std::cout << 0 << std::endl;
    } else {
        std::cout << max - min + 1 << std::endl;
    }

    return 0;
}


Measured memory_bytes: 888