akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// 別の書き方を使ってみる

// constexpr inline ll mod = 1'000'000'007;
constexpr int max_n = 200'000 + 5;

int n, q;
vector<int> p(max_n), x(max_n);
vector<int> cnts(max_n);

vector<int> hd(max_n); // n : 頂点数
vector<int> nxt(2*max_n), to(2*max_n); // 2*(n-1)+1 : 辺の個数+1
int edge_cnt;
void add_edge(int u, int v) { // u to v
    edge_cnt++; // 辺が1つ増える
    to[edge_cnt] = v; // edge_cnt本目の辺の行き先はv
    nxt[edge_cnt] = hd[u]; // edge_cnt本目の辺の次に見る(uから出る)辺は、はじめに見ていた(uから出る)辺であるhd[u]本目の辺
    hd[u] = edge_cnt; // 新しくはじめに見る(uから出る)辺はedge_cnt本目の辺
}

void dfs(int cur = 0, int parent = -1)
{
    for (int e = hd[cur]; e > 0; e = nxt[e]) {
       int child = to[e];
       if (child == parent) { continue; }
       cnts[child] += cnts[cur];
       dfs(child, cur);
   }
}

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(10); // 浮動小数の表示の精度

    cin >> n >> q;
    /*
    p.resize(q);
    x.resize(q);
    cnts.resize(n);
    hd.resize(n);
    nxt.resize(2*n);
    to.resize(2*n);
     */
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        add_edge(a,b);
        add_edge(b,a);
    }
    rep(j, q)
    {
        cin >> p[j] >> x[j];
        p[j]--;
    }

    // q回足す
    rep(j, q)
    {
        cnts[p[j]] += x[j];
    }

    // 集計
    dfs();

    rep(i, n)
    {
        cout << cnts[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 21956
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
using ll = long long;

long long fac(long long n){
  if(n>20){
    cout<<"over flow ";
    return -1;
  }
  if(n<0) return -1;
  long long ans = 1;
  for(long long i=1; i<=n; i++){
    ans *= i;
  }
  return ans;
}

/* 順列 */
//50P10程度が限界
long long nPr(long long n, long long r){
  long long ans = 1;
  for(long long i=0; i<r; i++){
    ans *= (n-i);
  }
  return ans;
}

/* 組み合わせ */
long long nCr(long long n, long long r){
  if(n<r) return 0;
  if(r > n/2) r = n-r;
  return nPr(n, r) / fac(r);
}

int main(){
  int N;cin>>N;
  map<string, int> smap;
  string s;
  for(int i=0; i<N; i++){
    cin>>s;
    sort(all(s));
    smap[s]++;
  }
  ll ans = 0;
  for(pair<string, int> x: smap){
    //cout<<x.first<<","<<x.second<<endl;
    ans += nCr(x.second, 2);
  }
  cout<<ans<<endl;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	while (H != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if ((i + j) % 2 == 0) {
					cout << "#";
				}
				else if ((i + j) % 2 == 1) {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;
	}
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

VEC<VEC<int>> G;
VEC<int> ans;
int main() {
  int N, M;
  cin >> N >> M;
  G = VEC<VEC<int>>(N, VEC<int>(0));
  REP(i, 0, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ans = VEC<int>(N, -1);
  ans[0] = 0;
  queue<pair<int, int>> q;
  q.push({0, 0});
  while (!q.empty()) {
    auto v = q.front();
    q.pop();
    int pos = v.first;
    int dist = v.second;
    REP(i, 0, G[pos].size()) {
      int cand = G[pos][i];
      if (ans[cand] == -1) {
        ans[cand] = pos;
        q.push({cand, dist + 1});
      }
    }
  }
  cout<<"Yes"<<endl;
  REP(i,1,ans.size()){
    cout<<ans[i]+1<<endl;
  }

  return 0;
}


Measured memory_bytes: 10500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll a;cin>>a;
    ll b;cin>>b;
    For(i,0,10000){
        double c=i;
        if(floor(i*0.08)==a&&floor(i*0.1)==b){
            cout<<i<<endl;
            return;
        }
    }
    cout<<-1<<endl;
}
int main(){
    Main();
    return 0;
}

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

int main()
{
    const long double pi = acos(-1);
    int r;
    cin >> r;

    cout << 2 * r * pi << endl;
}


Measured memory_bytes: 3792
X, N = map(int, input().split())
if N == 0:
  print(X)
  quit()

A = set(list(map(int, input().split())))
ans = 0
diff = 1000
for i in range(102):
  if i in A:
    continue
  d = abs(X - i)
  if d < diff:
    diff = d
    ans = i

print(ans)

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int n,h;
  cin >> n >> h;
  int at = 0;
  vector<int> v,b(n);
  REP(i,n){
    int x;cin >> x >> b[i];
    at = max(at,x);
  }
  priority_queue<int,vector<int>,less<int>> que;
  for(auto au : b)if(at < au)que.push(au);
  ll res = 0;
  while(h > 0){
    if(!que.empty()){
      h -= que.top();
      que.pop();
      res++;
    }else{
      res += (h+at-1)/at;
      h = 0;

    }
  }
  cout << res << endl;




  return 0;
}


Measured memory_bytes: 1276
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int n;
  cin >> n;
  int total = 0;
  vector<int> not_ten_times;
  REP(i, n) {
    int tmp;
    cin >> tmp;
    total += tmp;
    if(tmp % 10 != 0) {
      not_ten_times.push_back(tmp);
    }
  }

  if(total % 10 != 0) {
    cout << total << endl;
    return 0;
  }

  SORT(not_ten_times);

  REP(i, not_ten_times.size()) {
    total -= not_ten_times[i];
    if(total % 10 != 0) {
      cout << total << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;


int main()
{
	int n;
	cin >> n;
	cout << n * n*n << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	long long a,b;
	cin >> a >> b;
	if(a>0)
	{
		cout << "Positive" << endl;
		return 0;
	}
	if(a<=0 and b>=0)
	{
		cout << "Zero" << endl;
		return 0;
	}
	if((b-a)%2==1)
	{
		cout << "Positive" << endl;
		return 0;
	}
	else
	{
		cout << "Negative" << endl;
		return 0;
	}
}

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

int main(void){
  int A, B;
  cin >> A >> B; 
  if(A >= 13){
    cout <<  B << endl;
  }else if(A >= 6 && A <= 12 ){
    cout <<  B / 2 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H == W == 0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k) % 2 ==0:
                print("#",end="")
            else:
                print(".",end="")
        print()

    print()


Measured memory_bytes: 7004
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){

    int n,m;
    while(cin>>n>>m&&!(n==0&&m==0)){
        int sum=0;
        vector<pair<int,int> > vpii;
        for(int i = 0; i < n; i++){
            int d,p;
            cin>>d>>p;
            sum+=d;
            vpii.push_back(make_pair(p,d));
        }
        sort(vpii.begin(),vpii.end(),greater<pair<int,int> > ());
        if(sum<=m)
            cout<<0<<endl;
        else{
            int idx=0;
            while(1){
                if(vpii[idx].second<m){
                    m-=vpii[idx].second;
                    vpii[idx].second=0;
                    idx++;
                }
                else{
                    vpii[idx].second-=m;
                    break;
                }
            }
            int sumExp=0;
            for(int i = idx; i < vpii.size(); i++)
                sumExp+=vpii[i].first*vpii[i].second;
            cout<<sumExp<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1036
#include <stdio.h>
int main (){
  char s[6];
  scanf ("%s", &s);
  int goo=0;
  for (int i=0; i<=2;i++){
    if (s[i] == s[i+1])  {
      printf("Bad");
      break;
    }
    else goo++;
  }
  
  if(goo == 3) printf("Good");
  
  return 0;
}

Measured memory_bytes: 128
n=int(input())
A=list(map(int,input().split()))
Q=int(input())
BC=[list(map(int,input().split())) for _ in range(Q)]

cnt=[0]*(10**5+1)
for a in A:
  cnt[a]+=1
total=sum(A)
for b,c in BC:
  total+=(c-b)*cnt[b]
  cnt[c]+=cnt[b]
  cnt[b]=0
  print(total)

Measured memory_bytes: 32184
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

#define MAX_N 1000000
#define MAX_A 1000000001

using namespace std;
int main(){
    int n;
    int a[MAX_N];
    cin >> n;
    int colors[MAX_N];
    int color_min=MAX_A;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int num_color=0;
    for(int i=0; i<n; i++){
        if(a[i]<=color_min){
            colors[num_color]=a[i];
            num_color++;
            color_min=a[i];
        }else{
            for(int j=0;j<num_color;j++){
                if(a[i]>colors[j]){
                    colors[j]=a[i];
                    if(j==num_color-1){
                        color_min=a[i];
                    }
                    break;
                }
            }
        }
    }
    cout<<num_color<<endl;
    return 0;
}

Measured memory_bytes: 6528
/*
  Lower bound: first element that is greater-or-equal.
  int i=lower_bound(a,a+n,x)-a;
  Upper bound: first element that is strictly greater.
  #include<boost/multiprecision/cpp_int.hpp>
  namespace mp=boost::multiprecision;
  mp::cpp_int u=1; for(unsigned i=1;i<=n;i++) u*=i;
*/
#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
const int mod=(int)1e9+7;
const long long INF = 1000000000000000000LL;
const int WASTE=(int)2e5;
int power(int a,int b,int m=mod){
	if(b == 0) return 1;
	if(b == 1) return a;
	int x = power(a,b/2,m)%m;
	x = (x*x)%m;
	if(b%2) return (x*a)%m;
	return x;
}
//#define int long long
const int N=1e5+5;
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    int a,b;
    string s;
    cin>>a>>b>>s;
    bool f=0;
    if(s[a]!='-')
    	f=1;
   	for(int x=0;x<s.length();x++){
   		if(x==a)
   			continue;
   		if(s[x]=='-')
   			f=1;
   	}
   	if(f)
   		cout<<"No";
   	else
   		cout<<"Yes";
    return 0;	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	static int[][] a;
	static int[] v1 = {0, 1, 0, -1};
	static int[] v2 = {1, 0, -1, 0};
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			a = new int[14][14];
			int count=0;
			for(int i = 1; i <= 12; i++){
				String str = cin.next();
				for(int j = 0; j < str.length();j++){
					a[i][j+1] = Integer.parseInt(String.valueOf((char)(str.charAt(j)+1)));
				}
			}
			for(int i = 1 ; i <= 12; i++){
				for(int j = 1; j <= 12; j++){
					if(a[i][j]==2){
						dfs(i, j);
						count++;
					}
				}
			}
			System.out.println(count);
		}
	}
	static void dfs(int x, int y){
		a[x][y]=1;
		for(int i = 0; i < 4;i++){
			int xx = x+v1[i];
			int yy = y+v2[i];
			if(a[xx][yy]==2){
				dfs(xx, yy);
			}
		}
	}
}

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

int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0) {
		cout << (B - A) / 2 << endl;
		return 0;
	}
	long long ans = min(N - A, B - 1);
	long long tmp1 = (N - B) + (B - A) / 2 + 1, tmp2 = (A - 1) + (B - A) / 2 + 1;
	ans = min({ans, tmp1, tmp2});
	cout << ans << endl;
}

Measured memory_bytes: 256
N = list(map(int, input().split()))
B = list(map(int, input().split()))
A =[list(map(int,input().split())) for i in range(N[0])]
counter=0
amount=0
for i in range(N[0]):  #ソースコードの数
    for j in range(N[1]):  #Bの変数の数
        amount += A[i][j]*B[j]
    if (amount + N[2])>0:
        counter += 1
    amount = 0

print(counter)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

struct union_find {
    vector<int> par, sz;

    union_find(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i =0; i < n; i++)
            par[i] = i, sz[i] = 0;
    }

    int find(int x) {
        if (par[x] == x)
            return x;
        else 
            return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x), y = find(y);

        if (x == y) return ;

        else if (sz[x] < sz[y])
            par[x] = y;
        else {
            par[y] = x;
            if (sz[x] == sz[y])
                sz[x]++;
        }
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

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

ll minimum_spanning_tree(int n, vector<PP> &G) {
    ll ans = 0;
    union_find uf(n);
    sort(G.begin(), G.end());

    for (int i = 0; i < G.size(); i++) {
        int u = G[i].second.first;
        int v = G[i].second.second;
        ll cost = G[i].first;

        if (uf.same(u, v))
            continue;

        else  {
            uf.unite(u, v);
            ans += cost;
        }
    }
    
    return ans;
}

int main() {
    int n;  cin >> n;
    vector<pair<pair<ll, ll>, int > > x, y;
    for (int i = 0; i < n; i++) {
        int a, b;   cin >> a >> b;
        x.push_back(pair<pair<ll, ll>, int> (pair<ll, ll>(a, b), i));
        y.push_back(pair<pair<ll, ll>, int> (pair<ll, ll>(b, a), i));
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    vector<PP> G;
    for (int i = 0; i < n-1; i++) {
        pair<pair<ll, ll>, int> p, q, r, s;
        p = x[i], q = x[i+1], r = y[i], s = y[i+1];

        G.push_back(PP(q.first.first - p.first.first, P(p.second, q.second)));
        G.push_back(PP(s.first.first - r.first.first, P(r.second, s.second)));
    }

    cout << minimum_spanning_tree(n, G) << endl;
    return 0;
}

Measured memory_bytes: 13860
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(true){
			int N = in.nextInt();
			if(N == 0)break;
			int count = 0;
			for(int i = 0;i < N/4;i++){
				int c = in.nextInt();
				count = count + c;
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 18148
K,T = map(int,input().split())

a = list(map(int,input().split()))

a.sort()

if a[-1] * 2 <= (sum(a) - a[-1]) * 2  + 2:
    print (0)

else:
    print (a[-1] - (sum(a) - a[-1] + 1 ))


Measured memory_bytes: 38256
import java.util.Scanner;

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

    int H = scanner.nextInt();
    int N = scanner.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = scanner.nextInt();
    int sum = 0;
    for (int i = 0; i < N; i++) sum += A[i];

    if (sum >= H) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 48504
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f40;
const long long mod=1e9+7;
const long double PI = acos(0);
template <class T>void UNIQUE(vector<T> &x){
	sort(all(x));
	x.erase(unique(all(x)), x.end());
}

// }}} End Header
ll n;
ll dfs(string s){
	ll ans = 0;
	vector<char> list = {'3', '5', '7'};
	if((int)s.size() > 2){
		if(stoll(s) > n) return ans;
		else{
			bool ok = true;
			for(auto x : list){
				if(s.find(x) == string::npos) ok = false;
			}
			if(ok){
				//cout << s << endl;
				ans++;
			}
		}
	}
	for(auto x : list){
		s.push_back(x);
		ans+=dfs(s);
		s.pop_back();
	}
	return ans;
}


int main() {
	cin >> n;
	string s = "";
	cout << dfs(s) << endl;
	return 0;
}

Measured memory_bytes: 3596
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)



int main() {
	int r, g, b, k,h=0;
	cin >> r >> g >> b >> k;
	if (g > r && b > g) {
		cout << "Yes" << endl;
		return 0;
	}
	
	while (k>=h) {
		

		if (g > r) {
			if (b > g) {
				cout << "Yes" << endl;
				return 0;
			}
			break;
		}
		g = g * 2;
		h++;
	
	}
	while (k >= h) {
		
	
		if (g > r && b > g) {
			cout << "Yes" << endl;
			return 0;
		}
		b = b * 2;
		h++;
	}
	cout << "No" << endl;
	
	return 0;
}





Measured memory_bytes: 3608
i = int(input())
if 400 <= i < 600:
    print(8)
elif 600 <= i < 800:
    print(7)
elif 800 <= i < 1000:
    print(6)
elif 1000 <= i < 1200:
    print(5)
elif 1200 <= i < 1400:
    print(4)
elif 1400 <= i < 1600:
    print(3)
elif 1600 <= i < 1800:
    print(2)
elif 1800 <= i <= 1999:
    print(1)



Measured memory_bytes: 9184
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        
        int[] a = new int[n];
        a[0] = 0;
        int b = 0;
        for(int i = 0; i < n-1; i++){
            if(s.charAt(i) == 'W'){
                b++;
            }
            a[i+1] = b;
        }
        
        int[] c = new int[n];
        c[n-1] = 0;
        int d = 0;
        for(int i = n-1; i > 0; i--){
            if(s.charAt(i) == 'E'){
                d++;
            }
            c[i-1] = d;
        }
        
        int min = 1000000;
        int e;
        for(int i = 0; i < n; i++){
            e = a[i] + c[i];
            if(e < min){
                min = e;
            }
        }
        
        System.out.println(min);
    }
}

Measured memory_bytes: 30864
#include<iostream>

using namespace std;

int main(void) {
	int i = 1;
	int n;
	int x;
	cin >> n;
	while (i<=n) {
		x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else {
			while (x != 0) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				else {
					x /= 10;
				}
			}
		}
		i++;
	}
	cout << endl;

	return 0;
}

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

# define Size 1000000

inline int readInt ( )  {
    register int x, c ;
    static char buf [Size], *ss, *tt ;
    # define pick( ) ( (ss == tt) ? ( tt = buf + fread ( ss = buf, 1, Size, stdin ), ( ss == tt ) ? -1 : *ss ++ ) : *ss ++ )
    while ( ! isdigit ( c = pick ( ) ) ) ;
    for ( x = -48 + c ; isdigit ( c = pick ( ) ) ; x = x * 10 + c - 48 ) ;
    return x ;
    # undef pick
}

inline void smin ( long long& d, long long x )  {  ( d > x ) ? d = x : 0 ;  }

const long long inf = ( ~0ull >> 1 ) ;
const int N = 200010 ;

int q [N] ;
bool inq [N] ;
long long a [N] ;

struct edge  {
    int to, w ; edge* nxt ;
} g [N], *head [N], *NewEdge ;

int main ( )  {
    int h, w, n ;
    h = readInt ( ), w =  readInt ( ), n = readInt ( ) ;
    NewEdge = g ;
    for ( int i = 0 ; i < n ; ++ i )  {
        int x = readInt ( ), y = readInt ( ), z = readInt ( ) ;
        -- x, -- y ;
        *( ++ NewEdge ) = ( edge ) {  h + y, z, head [x]  } ; head [x] = NewEdge ;
        *( ++ NewEdge ) = ( edge ) {  x, z, head [h + y]  } ; head [h + y] = NewEdge ;
    }
    for ( int i = 0, l = h + w ; i < l ; ++ i )  {
        if ( ! inq [i] )  {
            register edge* it ;
            register int fr ( 0 ), tl ( 0 ) ;
            a [i] = 0 ;
            q [++ tl] = i ;
            inq [i] = true ;
            while ( fr ^ tl )  {
                int u = q [++ fr] ;
                for ( it = head [u] ; it ; it = it -> nxt )  {
                    int r = it -> to, v = it -> w ;
                    if ( inq [r] )  {
                        if ( a [u] + a [r] != v )  {
                            return puts ( "No" ), 0 ;
                        }
                        continue ;
                    }
                    q [++ tl] = r ;
                    inq [r] = true ;
                    a [r] = v - a [u] ;
                }
            }
            long long m1 = inf, m2 = inf ;
            while ( tl )  {
                ( q [tl] < h ) ? smin ( m1, a [q [tl --]] ) : smin ( m2, a [q [tl --]] ) ;
            }
            if ( m1 + m2 < 0 )  {
                return puts ( "No" ), 0 ;
            }
        }
    }
    return puts ( "Yes" ), 0 ;
}

Measured memory_bytes: 8448
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int N;
void dfs(int pos, int max_char, vector<char> ans, vector<char>& lowers) {
    if(pos==N) {
        for(char c: ans) cout << c;
        cout << endl;
        return;
    }

    for(int i=0; i<=max_char+1; i++) {
        ans.push_back(lowers[i]);
        dfs(pos+1, max(i, max_char), ans, lowers);
        ans.pop_back();
    }
}

int main() {
    cin >> N;
    vector<char> lowers = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
    vector<char> ans;
    dfs(0, -1, ans, lowers);

    return 0;
}

Measured memory_bytes: 1536
import sys

def solve():
    n,m = map(int, sys.stdin.readline().split())
    A = [sys.stdin.readline().rstrip() for _ in range(n)]
    B = [sys.stdin.readline().rstrip() for _ in range(m)]
    for r in range(n-m+1):
        for c in range(n-m+1):
            X = []
            for i,a in enumerate(A[r:r+m]):
                if a[c:c+m] != B[i]:
                    break
            else:
                print('Yes')
                exit()
    print('No')

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    while (true) {
      int m = stdin.nextInt();
      int f = stdin.nextInt();
      int r = stdin.nextInt();

      if (m == -1 && f == -1 && r == -1) {
        break;
      } else if (m == -1 || f == -1 || m + f < 30) {
        System.out.println("F");
      } else if (m + f >= 80) {
        System.out.println("A");
      } else if (m + f >= 65) {
        System.out.println("B");
      } else if (m + f >= 50) {
        System.out.println("C");
      } else {
        System.out.println(r >= 50 ? "C" : "D");
      }
    }
  }

}

Measured memory_bytes: 19108
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.close();
		
		int ans = 0;
		
		for(int i = 1;i <= N;i+=2) {
			int count = 0;
				for(int j = 1;j <= i/2;++j)
					if(i % j == 0)
						count++;
			if(count == 7)
				ans++;
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    vector<ll> F(N);
    for (int i = 0; i < N;i++)
        cin >> A[i];
    for (int i = 0; i < N;i++)
        cin >> F[i];

    sort(A.begin(), A.end());
    sort(F.begin(), F.end());
    reverse(F.begin(), F.end());

    vector<ll> B(N);
    for (int i = 0; i < N;i++)
        B[i] = A[i] * F[i];

    ll l = -1, r = 1e12+1;
    while(r - l > 1){
        ll mid = (r + l) / 2;
        ll cnt = 0;
        for (int i = 0;i < N;i++)
            cnt += max(0ll, A[i] - mid / F[i]);
        if(cnt <= K)
            r = mid;
        else{
            l = mid;
        }
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
 
int main(){
	string s;
	cin >> s;
	int c = -1, f = -1;
	for(int i = 0; i < s.length(); i++){
		if(s.at(i) == 'C' && c == -1) c = i;
		if(s.at(i) == 'F') f = i;
	}
	if(c == -1 | f == -1){
		cout << "No" << endl;
		return 0;
	}
	if(c < f) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,y;
	while(1){
	scanf("%d %d",&x,&y);
		if(x==0 && y==0){
			break;}
		if(x>y){
			printf("%d %d\n",y,x);}
		else{
				printf("%d %d\n",x,y);}
	}
return 0;
}

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

using namespace std;

int main(int argc,char* argv[]){
	string a,b;
	cin >> a;
	cin >> b;
	if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<vector>
#include<sstream>
#include<deque>
#include<algorithm>
#include<queue>
#include<set>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
		vector<pair<int,int> > bou;
	while(1){
		bou.clear();
		int n;
		scanf("%d",&n);
		if(n==0)break;
		
		rep(i,n){
			int a,b;
			scanf("%d%d",&a,&b);
			bou.push_back(make_pair(a,b));
		}
		sort(bou.begin(),bou.end());
		
		/*
		rep(i,bou.size()){
			printf("a %d %d\n",bou[i].first,bou[i].second);
		}*/
		
		int maxi=0;
		
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				int dx=bou[i].first - bou[j].first;
				int dy=bou[i].second - bou[j].second;
				/*
				printf("%d %d (%d %d) (%d %d)\n",i,j,bou[i].first,bou[i].second,bou[j].first,bou[j].second);
				printf("%2d %2d & %2d %2d\n",i,j,bou[i].first+dx,bou[i].second-dy,bou[j].first+dx,bou[j].second-dy);
				printf("%2d %2d & %2d %2d\n",i,j,bou[i].first-dx,bou[i].second+dy,bou[j].first-dx,bou[j].second+dy);
				*/
				int an1,an2;
				if(binary_search(bou.begin(),bou.end(),make_pair(bou[i].first+dy,bou[i].second-dx))&&
				binary_search(bou.begin(),bou.end(),make_pair(bou[j].first+dy,bou[j].second-dx))){
				
				//if(an1==1 && an2==1){
					maxi=max(maxi,dx*dx+dy*dy);
				}
				if(binary_search(bou.begin(),bou.end(),make_pair(bou[i].first-dy,bou[i].second+dx))
				&&binary_search(bou.begin(),bou.end(),make_pair(bou[j].first-dy,bou[j].second+dx))){
				
				//if(an1==1 && an2==1){
					maxi=max(maxi,dx*dx+dy*dy);
				}
			}
		}
		
		printf("%d\n",maxi);
	}
}

Measured memory_bytes: 876
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
int main()
{
ios_base::sync_with_stdio(false);
int n,c;
cin>>n>>c;
int d[c][c],co[n][n];
for(int i=0;i<c;++i)
{
    for(int j=0;j<c;++j)
    {
        cin>>d[i][j];
    }
}
for(int i=0;i<n;++i)
{
    for(int j=0;j<n;++j)
    {
        cin>>co[i][j];
    }
}
ll col1[c+1]={0};
for(int k=1;k<=c;++k){
ll coun=0;
for(int i=0;i<n;++i)
{
    for(int j=(3-i%3)%3;j<n;j+=3)
    {
        if(co[i][j]!=k)
        {
            coun+=d[co[i][j]-1][k-1];
        }
    }
}
col1[k]=coun;
}
ll col2[c+1]={0};
for(int k=1;k<=c;++k){
ll coun=0;
for(int i=0;i<n;++i)
{
    for(int j=(3-i%3+1)%3;j<n;j+=3)
    {
        if(co[i][j]!=k)
        {
            coun+=d[co[i][j]-1][k-1];
        }
    }
}
col2[k]=coun;
}
ll col3[c+1]={0};
for(int k=1;k<=c;++k){
ll coun=0;
for(int i=0;i<n;++i)
{
    for(int j=(3-i%3+2)%3;j<n;j+=3)
    {
        if(co[i][j]!=k)
        {
            coun+=d[co[i][j]-1][k-1];
        }
    }
}
col3[k]=coun;
}
ll ans=1000000000000;
for(int i=1;i<c+1;++i)
{
    for(int j=1;j<c+1;++j)
    {
        for(int k=1;k<c+1;++k)
        {
            if(j!=k&&i!=k&&i!=j)
            {
                if(col1[i]+col2[j]+col3[k]<ans)
                    ans=col1[i]+col2[j]+col3[k];
            }
        }
    }
}
if(ans==1000000000000)
    cout<<"0";
else
cout<<ans;
}

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

using namespace std;

typedef long long ll;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

struct ev {
    int x, c;
};

bool operator < (const ev &a, const ev &b) {
    return a.c < b.c || (a.c == b.c && a.x < b.x);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector <int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector <ev> e;
    for (int i = 0; i < m; i++) {
        int x, c;
        cin >> x >> c;
        e.push_back({x, c});
    }
    sort(e.begin(), e.end());
    reverse(e.begin(), e.end());
    int st = 0;
    for (int i = 0; i < m; i++) {
        int pos = lower_bound(a.begin() + st, a.end(), e[i].c) - a.begin() - 1;
        if (pos < st) {
            continue;
        }
        int len = pos - st + 1;
        for (int j = 0; j < min(len, e[i].x); j++) {
            a[j + st] = e[i].c;
        }
        st = min(pos, st + e[i].x - 1) + 1;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans += a[i];
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1784
x=[]
u=[]
sum=0
n=int(input())
for i in range(n):
    tmp=input().split()
    x.append(float(tmp[0]))
    u.append(tmp[1])

for i in range(n):
    if u[i]=="BTC":
        x[i]=x[i]*380000.0
    sum+=x[i]

print(sum)


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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;

int main (){
    ll d, g;
    cin >> d >> g;
    vector<int> p(d);
    vector<int> c(d);
    REP(i,d){
        cin >> p.at(i) >> c.at(i);
    }
    int ans = 1e9;
    for(int bit = 0; bit < (1<<d); bit++){
        int sum = 0, num = 0, rest_max = 0;
        for(int i = 0; i < d; i++){
            if(bit & (1<<i)){
                sum += 100*(i+1)*p.at(i) + c.at(i);
                num += p.at(i);

            }else rest_max = i;

        }
        if(g-sum>0)
        {
            int rest = 100*(rest_max+1);
            if(g - sum - rest*(p.at(rest_max)-1)> 0){
                continue;
            }else{
                int need = (g - sum + rest - 1) / rest;
                num += need;
            }
        }
        ans = min(ans,num);





    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Buffer(make([]byte, 500000), 500000)
	sc.Split(bufio.ScanWords)

	n := nextInt()
	m := nextInt()

	pq := make(PriorityQueue, n)
	for i := 0; i < n; i++ {
		v := nextInt()
		pq[i] = &Item{
			value:    v,
			priority: v,
			index:    i,
		}
	}
	heap.Init(&pq)

	for i := 0; i < m; i++ {
		item := heap.Pop(&pq).(*Item)
		item.value = item.value / 2
		item.priority = item.priority / 2
		heap.Push(&pq, item)
	}

	res := int64(0)
	for pq.Len() > 0 {
		item := heap.Pop(&pq).(*Item)
		res += int64(item.value)
	}

	fmt.Println(res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    int // The value of the item; arbitrary.
	priority int // The priority of the item in the queue.
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority > pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value int, priority int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}


Measured memory_bytes: 7936
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int a, b; cin >> a >> b;
    cout << (a+b)%24 << endl;
}

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

int main(){
	int i,n;
	int blood[4];
	char str[3];

	memset(blood,0,sizeof(blood));

	while(scanf("%d,%s",&n,str) != EOF){
		if(strcmp(str,"A") == 0){
			blood[0]++;
		}else if(strcmp(str,"B") == 0){
			blood[1]++;
		}else if(strcmp(str,"AB") == 0){
			blood[2]++;
		}else if(strcmp(str,"O") == 0){
			blood[3]++;
		}
	}

	for(i = 0;i < 4;i++){
		printf("%d\n",blood[i]);
	}

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll K, T;
    cin >> K >> T;
    vector<ll> a(T);
    REP(i, T) cin >> a[i];

    sort(a.rbegin(), a.rend());

    if(T==1){
        cout << a[0]-1 << endl;
    }else{
        ll p = a[0];
        ll q = K - a[0];
        cout << max(p - q -1, 0ll) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main ()
{
  int i,j,h,w,shahen,min,h1,w1;

while(1){
  cin >> h >> w;
  if(h==0 && w==0){
    return 0;
  }
  shahen=h*h+w*w;
  min=150*150;
for(i=1;i<150;i++){
 for (j=1;j<150;j++){
  if(shahen <= i * i + j * j && min > i*i+j*j && i<j){
    if(shahen==i*i+j*j && h<i ){
      /* code */
      h1=i;
      w1=j;
      min=i*i+j*j;
    }else if(shahen<i*i+j*j){
        min=i*i+j*j;
        h1=i;
        w1=j;
      }
    }else if(shahen < i*i+j*j && min == i*i+j*j && i<j){
        if(i<h1){
          h1 =i;
          w1=j;
          min=i*i+j*j;
        }
      }
    }
  }
    cout << h1 << " " <<  w1 << endl;
  }
  }


Measured memory_bytes: 3044
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while n % (div := pow(fac, e)) == 0:
        n //= div
        ans += 1
        e += 1

    while n % fac == 0:
        n //= fac

    fac = 3
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac
        e = 1
        fac += 2

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll A = 0,B = 0,C = 0,X = 0,ans = 0;
  cin >> A >> B >> C >> X;
  rep(i,A+1){
    rep(j,B+1){
      rep(k,C+1){
        if(500*i+100*j+50*k == X){
          ans++;
        }
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#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()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


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

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(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 << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100000  //check the limits, man
ll ans=0;
int sum(int a)
{
    return (a/10)+(a%10);
}
int combine(int a,int b)
{
    ans++;
    int x=a+b;
    if(x>=10)
        ans++,x=sum(x);
    return x;
}
int fun(int d,ll m)
{
    if(m==1)
        return d;
    int x=(2*d);
    ans+=(m/2);
    if(x>=10)
        ans+=(m/2),x=sum(x);
    if(m&1)
        return combine(fun(x,m/2),d);
    return fun(x,m/2);
}
int main()
{
    int i,n,d;
    ll m;
    in(n);
    int last;
    rep(i,n)
    {
        in(d);
        cin >> m;
        d=fun(d,m);
        if(i)
            last=combine(last,d);
        else
            last=d;
    }
    llout(ans);
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
 
using namespace std;
 
const int MAX_V=1000;
const int INF=1e9;
 
int dist[MAX_V][MAX_V];
int n,m;
 
void warshall_floyd(int V){
    for(int k=0;k<V;k++){
        for(int i=0;i<V;i++){
            for(int j=0;j<V;j++){
                dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
}
 
 
int main(){
    
    cin>>n>>m;
 
    int a[10000];
    int b[10000];
    int c[10000];
 
//init
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j==i)dist[i][j]=0;
            else dist[i][j]=INF;
        }
    }
 
    for(int i=0;i<m;i++){
 
        cin>>a[i]>>b[i]>>c[i];
        
        a[i]--;
        b[i]--;
        
        dist[a[i]][b[i]]=c[i];
        dist[b[i]][a[i]]=c[i];
    
    }
 
    warshall_floyd(n);
    
    int ans=0;
    
    for(int i=0;i<m;i++){
        if(dist[a[i]][b[i]]<c[i])ans++;
    }
    
    cout<<ans<<endl;
      
    return 0;
}

Measured memory_bytes: 640
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    count = 0

    for i in range(2,a[0]+1):
        for j in range(2,a[1]+1):
            if j > 9:
                k = str(j)
                if i == int(k[0])*int(k[1]) and int(k[0]) > 1 and int(k[1]) >1:
                    count+=1

    print(count)

Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
 
const int maxN = 1 << 18;

vector <int> G[maxN];
pair <int, int> E[maxN];
int col[maxN], k;

void dfs(int v, int ec)
{
	int c = 0;
	for (int e : G[v])
	{
		if (c == ec)
			c = (c+1) % k;
		col[e] = c;
		
		int u = E[e].st ^ E[e].nd ^ v;
		
		dfs(u, c);
		c = (c+1) % k;
	} 
}

void solve()
{
	int n;
	scanf ("%d", &n);
	FOR(i, 0, n-1)
	{
		int a, b;
		scanf ("%d%d", &a, &b);
		G[a].pb(i);
		E[i] = {a, b};
	}
	
	k = G[1].size();
	
	FOR(i, 2, n+1)
		k = max(k, (int)G[i].size() + 1);
	
	dfs(1, -1);
	printf("%d\n", k);
	
	FOR(i, 0, n-1)
		printf("%d\n", col[i] + 1);
}
 
int main()
{
	int t;
	t=1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}


Measured memory_bytes: 11904
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define files_ds(name) name!=""?freopen(name".dat","r",stdin),freopen(name".sol","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

main()
{
    #ifdef I_love_Maria_Ivanova
        files("barik");
        freopen("debug.txt","w",stderr);
    #else
        files("");
        files_ds("");
    #endif


    map<int,int> cnt;
    int n;
    cin>>n;
    while (n--){
        int a;
        cin>>a;
        cnt[a]++;
    }
    int ans=0;
    for (int i=-2;i<=arr;i++){
        ans=max(ans,cnt[i-1]+cnt[i]+cnt[i+1]);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 12800