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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int H,W;
string S[12];
int p[12];
bool q[12];

bool check(){
	bool b[12] = {};
	bool c = H&1;
	repp(i,0,H) if(!b[i]){
		repp(j,i+1,H) if(!b[j]){
			repp(k,0,W){
				if(S[i][p[k]] != S[j][p[W-1-k]]) break;
				if(k+1 == W) b[i] = b[j] = 1;
			}
			if(b[j]) break;
		}
		if(!b[i]){
			if(c){
				repp(k,0,W) if(S[i][p[k]] != S[i][p[W-1-k]]) return 0;
				c = 0;
			} else return 0;
		}
	}
	return 1;
}

bool solve(int a , int n , bool b){
	if(a == W) return check();
	if(q[a]) return solve(a+1,n,b);
	if(b){
		p[W/2] = a; q[a] = 1;
		if(solve(a+1,n,0)) return 1;
		q[a] = 0;
	}
	repp(i,a+1,W) if(!q[i]){
		p[n] = a; p[W-1-n] = i;
		q[a] = q[i] = 1;
		if(solve(a+1,n+1,b)) return 1;
		q[a] = q[i] = 0;
	}
	return 0;
}

int main(){
	cin >> H >> W;
	repp(i,0,H) cin >> S[i];
	cout << (solve(0,0,W&1)?"YES":"NO") << endl;
	return 0;
}


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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
//#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))



/* constant */
//const int inf = 100100100100100100;
const int mod = 998244353;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};


/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
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 (b<a) { a=b; return 1; } return 0; }
vector<int> cs(vector<int> arr){vector<int> tmp;if(arr.size() == 0) return tmp;tmp.push_back(arr[0]);rep(i,1,arr.size()){tmp.push_back(tmp.back() + arr[i]);}return tmp;}

/* math_library */
int gcd(int a, int b){ if(b == 0) return a; return gcd(b, a % b);}
int lcm(int a, int b){ return a * b / gcd(a,b);}
int ceil(int a, int b){ if(a % b == 0) return a/b; else return a/b + 1;}
int digitlen(int n){int t = n;int cnt = 0;while(t){cnt++;t /= 10;}return cnt;}
bool isprime(int n){if(n < 2) return false;if(n % 2 == 0 || n % 3 == 0 || n % 5 == 0) return false;for(int i = 7; i * i < n + 1; i += 2){if(n % i == 0) return false;}return true;}
int mod_pow(int x, int n, int m){if(n== 0) return 1;int res = mod_pow(x*x%m,n/2,m);if(n&1) res = res*x%m;return res;}
int digitsum(int n){int ret = 0;while(n){ret += n % 10;n /= 10;}return ret;}



/* main */


signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, a, b; cin >> n >> a >> b;

    vector<int> arr; rep(i,0,n) arr.push_back(input());

    if(n == 1){
        print(abs(arr[0] - b));
        return 0;
    }

    print(max(abs(arr[n - 2] - arr[n-1]), abs(arr[n - 1] - b)));



}






    










    




    










Measured memory_bytes: 256
n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for i in range(n)]
print(max([sum(sorted([i*l[0]+j*l[1]+k*l[2] for l in xyz],reverse=True)[:m]) for i in [-1,1] for j in [-1,1] for k in [-1,1]]))

Measured memory_bytes: 3316
S = list(input())
T = list(input())
O = list()
a = 0
for i in range (len(S) - len(T) + 1):
    b = 0
    m = 0
    for i in range (len(T)):
        if S[b + a] != T[b]:
            m = m + 1
        b = b + 1
    O.append(m)
    a = a + 1
O.sort()
print(O[0])

Measured memory_bytes: 9040
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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 (b<a) { a=b; return 1; } return 0; }

int main() {
	int n;
	int m;
	cin >> n >> m;
	vector<int> a(n);
	int sum=0;
	rep(i,n){
		cin >> a[i];
		sum += a[i];
	}
	sort(a.begin(),a.end(),std::greater<int>());
	if((double)a[m-1] >= (double)sum*1.0 / (double)(4*m)) cout << "Yes" << endl;
	else cout << "No" << endl;


  return 0;
}


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

  long long N,A,B,C,blue;

  cin >> N >> A >> B;

  C=A+B;

  blue=(N/C)*A;

  if(N%C>A){
    blue+=A;
  }

  else{
    blue+=(N%C);
  }

  cout << blue <<endl;

  return 0;
}

Measured memory_bytes: 256
import collections

N, X, Y = map(int, input().split())

L = []
for i in range(1, N+1):
    for j in range(i+1, N+1):
        L.append(min(j-i, abs(X-i)+abs(Y-j)+1))

c = collections.Counter(L)

for i in range(1, N):
    print(c[i])

Measured memory_bytes: 67784
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

bool check_small(char& a) {
	if ('a' <= a && a <= 'z')
		return true;
	return false;
}

int main(){
	std::string s; std::cin >> s;
	if (s[0] != 'A') {
		std::cout << "WA" << std::endl;
		return 0;
	}
	int count = 0;
	int p = 0;
	for (int i = 2; i < s.size() - 1; ++i) {
		if (s[i] == 'C') {
			++count;
			p = i;
		}
	}
	if (count != 1) {
		std::cout << "WA" << std::endl;
		return 0;
	}

	for (int i = 0; i < s.size(); ++i) {
		if (i == 0) continue;
		else if(i == p) continue;
		else {
			if (check_small(s[i]) == false) {
				std::cout << "WA" << std::endl;
				return 0;
			}
		}
	}
	std::cout << "AC" << std::endl;
	return 0;
}

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

import sys
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd

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

class SegTree:
    """
    以下のクエリを処理する
    1.update:  i番目の値をxに更新する
    2.get_val: 区間[l, r)の値を得る
    """
 
    def __init__(self, n, func, init):
        """
        :param n: 要素数
        :param func: 値の操作に使う関数(min, max, addなど)
        :param init: 要素の初期値
        """
        n += 1
        self.n = n
        self.func = func
        self.init = init
        # nより大きい2の冪数
        n2 = 1
        while n2 < n:
            n2 <<= 1
        self.n2 = n2
        self.tree = [self.init] * (n2 << 1)
 
    def update(self, i, x):
        """
        i番目の値をxに更新
        :param i: index(0-indexed)
        :param x: update value
        """
        i += self.n2
        self.tree[i] = x
        while i > 1:
            self.tree[i >> 1] = x = self.func(x, self.tree[i ^ 1])
            i >>= 1
 
    def get_val(self, a, b):
        """
        [a, b)の値を得る
        :param a: index(0-indexed)
        :param b: index(0-indexed)
        """
        return self._get_val(a, b, 1, 0, self.n2)
 
    def _get_val(self, a, b, k, l, r):
        """
        [a, b)の値を得る内部関数
        :param k: 現在調べている区間のtree内index
        :param l, r: kが表す区間の左右端index [l, r)
        :return: kが表す区間と[a, b)の共通区間内での最小値。共通区間を持たない場合は初期値
        """
        # 範囲外なら初期値
        if r <= a or b <= l:
            return self.init
        # [a,b)が完全に[l,r)を包含するならtree[k]の値を採用
        if a <= l and r <= b:
            return self.tree[k]
        # 一部だけ範囲内なら2つに分けて再帰的に調査
        m = (l + r) // 2
        return self.func(
            self._get_val(a, b, k << 1, l, m),
            self._get_val(a, b, (k << 1) + 1, m, r)
        )

N=INT()
A=LIST()

st=SegTree(N+2, gcd, 0)
for i in range(N):
    st.update(i+1, A[i])

ans=0
for i in range(1, N+1):
    ans=max(ans, gcd(st.get_val(0, i), st.get_val(i+1, N+2)))
print(ans)


Measured memory_bytes: 117028
L=int(input());S=str(bin(L))[2:][::-1];N=len(S);print(N,2*N+S.count("1")-3)
for i in range(N-1):
 print(i+1,i+2,0);print(i+1,i+2,2**i)
 if S[i]=="1":L-=2**i;print(i+1,N,L)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<int> p(a), q(b);
  vector<vector<int>> r(c, vector<int>(2, 0));
  for(int i = 0; i < a; i++) {
    cin >> p[i];
  }
  sort(p.rbegin(), p.rend());
  for(int i = 0; i < b; i++) {
    cin >> q[i];
  }
  sort(q.rbegin(), q.rend());
  for(int i = 0; i < c; i++){
    cin >> r[i][0];
  }
  sort(r.rbegin(), r.rend());
  vector<int> eat;
  for(int i = 0; i < x; i++) {
    eat.push_back(p[i]);
  }
  for(int i = 0; i < y; i++){
    eat.push_back(q[i]);
  }
  sort(eat.begin(), eat.end());
  int count = 0;
  for(int i = 0; i < c; i++) {
    while(count < min(x + y, c) && (eat[i] > r[count][0] || r[count][1] == 1)){
      count++;
    }
    if(count < min(x + y, c) && r[count][1] == 0){
      eat[i] = r[count][0];
      r[count][1] = 1;
    }
    if(count >= min(x + y, c)){
      break;
    }
  }
  ll ans = 0;
  for(int i = 0; i < x + y; i++) {
    ans += eat[i];
  }
  cout << ans << '\n';

  return 0;
}

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

int main(){
    int n=0,ans=0;
    bool check=true;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    while(true){
        for(int i=0;i<n;i++){
            if(a.at(i)%2==0)a.at(i) /= 2;
            else check=false;
        }
        if(check)ans++;
        else break;
    }
    cout << ans << endl;
    return 0;
}

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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */
signed main() 
{
  int n=in();
  vi b(n);
  cin >> b;
  sort(ALL(b));
  print(b[n-1]-b[0]);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(), x.end()

int main() {
  ll h, a;
  cin >> h >> a;
  ll x = h / a;
  if (h == x * a)
    cout << x << endl;
  else
    cout << x + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,a[N],pre[N],bk[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    pre[1]=a[1];
    bk[n]=a[n];
    for(int i=2;i<=n;i++) pre[i]=max(pre[i-1],a[i]);
    for(int i=n-1;i>=1;i--) bk[i]=min(bk[i+1],a[i]);
    bool flag=true;
    for(int i=1;i<=n;i++)
        if((a[i]&1)^(i&1)) flag=false;
    for(int i=2;i<n;i++)
        if(a[i]!=i&&a[i-1]!=i-1&&a[i+1]!=i+1) flag=false;
    //for(int i=2;i<n;i++)
    //    if(a[i]==i&&a[i-1]!=i-1&&a[i+1]!=i+1&&(pre[i-1]<i||bk[i+1]>i)) flag=false;
    for(int i=1;i<n;i++)
        if(a[i]==i&&a[i+1]==i+1&&pre[i]!=i) flag=false;
    for(int i=2;i<n;i++)
        if(a[i]!=i&&pre[i-1]>a[i]&&bk[i+1]<a[i]) flag=false;
    for(int i=2;i<=n;i++) pre[i]=min(pre[i-1],a[i]);
    for(int i=n-1;i>=1;i--) bk[i]=max(bk[i+1],a[i]);
    for(int i=1;i<=n;i++)
        if(i<a[i]&&pre[i-1]>a[i]) flag=false;
    for(int i=n-1;i>=1;i--)
        if(i>a[i]&&bk[i+1]<a[i]) flag=false;
    printf(flag?"Yes\n":"No\n");
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    ll l,r;
    cin>>l>>r;
    ll mod =2019;
    ll i=0;
    ll j=0;
    ll min=2019;
    ll mi=2019;
    ll mj=2019;


    for(int i=l;i<r && i<l+2*mod;i++){
        for(int j=i+1;j<=r && j<i+mod+mod+1 ;j++){
            if(((i%mod)*(j%mod))%mod<min){
                min=((i%mod)*(j%mod))%mod;
            }
        }
        if(min==0)break;
    }

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

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

using namespace std;

int main(){
  int H, N;
  cin >> H >> N;
  
  int sum = 0;
  for(int i = 0; i < N; i++){
    int A;
    cin >> A;
    sum += A;
  }
  
  string ret = (sum >= H) ? "Yes" : "No";
  cout << ret;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){
  int N, C; cin >> N >> C;

  vector < vector < pair<int, int> > > time(C);
  for (int i = 0; i < N; i++){
    int s, t, c; cin >> s >> t >> c;
    time[c - 1].push_back(make_pair(s,t));
  }
  for (int i = 0; i < C; i++){
    sort(time[i].begin(), time[i].end());
  }

  vector <int> cnt(1e5 + 1);
  for (int i = 0; i < C; i++){
    bool flag = false;
    for (int j = 0; j < time[i].size(); j++){
      int S = time[i][j].first;
      if (flag == false){
        cnt[S]++;
      }

      int T = time[i][j].second;
      if (j == time[i].size() - 1){
          flag = false;
      }else{
        int nextS = time[i][j + 1].first;
        if (T == nextS){
          flag = true;
        }else{
          flag = false;
        }
      }
      if (flag == false){
        cnt[T + 1]--;
      }
    }
  }

  int ans = 0;
  for (int i = 1; i < 1e5 + 1; i++){
    cnt[i] += cnt[i - 1];
    if (cnt[i] > ans){
      ans = cnt[i];
    }
  }
  cout << ans << endl;
  
  

  return 0;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
mat graph;

int N;
const int MAX_N = 1001;
const int MAX_X = 5001;

int p[MAX_N],x[MAX_N],y[MAX_N];
bool dp[MAX_N][MAX_X];

int a[MAX_N],b[MAX_N];

bool dfs(int v){
	bool isLeaf=true;
	for(int u:graph[v]){
		if(u==p[v])continue;
		if(!dfs(u))return false;
		isLeaf=false;
	}

	if(isLeaf)return true;

	int j=1,sum=0,M=-1;
	dp[0][0]=1;
	for(int u:graph[v]){
		if(u==p[v])continue;
		sum+=x[u]+y[u];
		for(int i=0;i<=x[v];i++){
			if(i>=x[u])dp[j][i]|=dp[j-1][i-x[u]];
			if(i>=y[u])dp[j][i]|=dp[j-1][i-y[u]];
		}
		j++;
	}

	for(int i=0;i<=x[v];i++){
		if(dp[j-1][i])M=i;
	}

	if(M<0){
		puts("IMPOSSIBLE");
		return false;
	}
	y[v]=sum-M;

	j=1;
	for(int u:graph[v]){
		if(u==p[v])continue;
		for(int i=0;i<=x[v];i++)
			dp[j][i]=0;
		j++;
	}

	// printf("%d: %d %d\n",v,x[v],y[v]);

	return true;
}

int main(){

	dp[0][0]=1;

	scanf("%d",&N);
	graph.assign(N+1,vec());

	for(int i=2;i<=N;i++){
		scanf("%d",&p[i]);
		graph[i].push_back(p[i]);
		graph[p[i]].push_back(i);
	}
	for(int i=1;i<=N;i++){
		scanf("%d",&x[i]);
	}

	if(dfs(1))
		puts("POSSIBLE");

	return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define nl '\n'
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cerr << #x << " = " << (x) << endl;

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	string str;
	cin >> str;
	
	//cout << str.back() << endl;
	if(str.back() != 's') str.pb('s');
	else str += "es";
	cout <<str << endl;
}

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	//startTime = clock();
	
	int T;
	//cin >> T;
	T = 1;
	while(T--){
		solve();
	}
	
	//cout << getCurrentTime() << endl;
	return 0;
}


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	int count = 0;
	for(int i=0;i<4;i++){
	    if(S.charAt(i) == '+') count++;
	    else count--;
	}
	System.out.print(count);
    }
}


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

int main()
{

        long long H;
        cin >> H;

        int num = 0;
        long long monster_num = 1;
        while (1) {
                if (H <= 1) {
                        break;
                }



                H /= 2;
                num++;
                monster_num += pow(2, num);



        }
        cout << monster_num << endl;

}


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

using namespace std;
#define ll long long

const int N = 1e5 + 5;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;

    cout<<1-n<<endl;
}


Measured memory_bytes: 3636
n, m, q = 0, 0, 0
ABCD = []
ans = 0


def dfs(ns):
    global ans

    A = [int(c) for c in ns.split()]
    if len(A) == n:
        s = 0
        for qi in range(q):
            a, b, c, d = ABCD[qi]
            if A[b - 1] - A[a - 1] == c:
                s += d

        ans = max(s, ans)
        return

    for i in range(A[-1], m + 1):
        dfs('{} {}'.format(ns, str(i)))


def main():
    global n, m, q, ABCD
    n, m, q = [int(e) for e in input().split()]
    ABCD = [[int(e) for e in input().split()] for i in range(q)]

    for mi in range(1, m + 1):
        dfs(str(mi))

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 75208
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
#include<regex>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

vector<vector<LL> > dp(5010, vector<LL>(5010));

int main(void) {
	LL N, K;
	cin >> N >> K;

	vector<LL> A(N);
	rep(i, N) cin >> A[i];
	sort(ALL(A));

	//1を生成できるかどうかがキモ
	//全部ある数の倍数だったら？
	//[gcd,max]間のどれかがKならOK違うなら無理
	//一つでも例外があるなら最終的に1を生成できるのでOK

	//N = 1のとき
	if (N == 1) {
		string ans = (A[0] == K) ? "POSSIBLE" : "IMPOSSIBLE";
		cout << ans << endl;
		return 0;
	}

	//N≠1のとき
	LL all_gcd = gcd(A[0],A[1]);
	for (int i = 2; i < N; i++) {
		all_gcd = gcd(all_gcd, A[i]);
	}
	
	if (all_gcd == 1 or (all_gcd <= K and K <= *max_element(ALL(A)) and K%all_gcd == 0)) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 197376
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <math.h>
#include <functional>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
int main(){
    int s;
    cin >> s;
    int y = s / 100;
    int m = s % 100;
    if(1 <= y && y <= 12){
        if(1 <= m && m <= 12) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    } else{
        if(1 <= m && m <= 12) cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int main(){
  int n;
  while(cin>>n && n){
    int id[1000], p[1000], q[1000], r[1000];
    REP(i, n) cin>>id[i]>>p[i]>>q[i]>>r[i];
    int P, Q, R, C;
    cin>>P>>Q>>R>>C;
    vector<int> ans;
    REP(i, n){
      if(p[i] <= P && q[i] <= Q && r[i] <= R && (p[i]+r[i]) * 4 + q[i] * 9 <= C)
        ans.push_back(id[i]);
    }
    if(ans.empty()) cout<<"NA"<<endl;
    else REP(i, ans.size()) cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
import bisect
prime_check=[True for i in range(100000)]
prime_check[0]=False
prime_check[1]=False

prime_num=[]

for i in range(2,100000):
    if(prime_check[i]):
        prime_num.append(i)
        for j in range(2*i,100000,i):
            prime_check[j]=False

like_num=[]
for pi in prime_num:
    if(prime_check[(pi+1)//2]):
        like_num.append(pi)

q=int(input())
for i in range(q):
    l,r=map(int,input().split())
    l_ind=bisect.bisect_left(like_num, l)
    r_ind=bisect.bisect_right(like_num, r)
    print(r_ind - l_ind)


Measured memory_bytes: 4612
"use strict";
function I(s,f){this._s=s;this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s.split("\n")[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s.split("\n")[this._l];this._c=0;this._l++;return l.split(" ").map(this._f)};

// TODO test and remove comment
function main(input) {
  const o = new I(input);

  const N = o.a();
  const K = o.a();

  console.log(N + 1 >= 2 * K ? "YES" : "NO")
}


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


Measured memory_bytes: 21064
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<char> deq;
//vector<ll> vll;
ll num[ten52];

int main(void)
{
    long long int m,n,i,k;
    for(i=1;i<=5;i++)
    {
        cin>>m;
        if(m==0)
        {
            cout<<i;
            return 0;
        }
    }


    return 0;
}





Measured memory_bytes: 3580
#include<stdio.h>
 
int main(){
 
    int n,i,a=100000;
 
    scanf("%d",&n);
    for(i=0;i<n;i++){
        a=a*1.05;
        if(a%1000>0)
        a=a/1000*1000+1000;
    }
    printf("%d\n",a);
        return 0;
}


Measured memory_bytes: 1924
T[15],F[15];
ans;
main(N){
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		int A;scanf("%d",&A);
		for(;A--;)
		{
			int x,y;scanf("%d%d",&x,&y);
			i[y?T:F]|=1<<x-1;
		}
	}
	for(int i=0;i<1<<N;i++)
	{
		int t=i,f=0;
		for(int c=2;c--;)for(int j=0;j<N;j++)if(t>>j&1)t|=T[j],f|=F[j];
		ans=fmax(ans,t&f?0:__builtin_popcount(i));
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 128
//曜日を当てる
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	string name[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int mond[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int month,day,m,c;
	int i;	//ループカウンタ

	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)break;
		m=1;	//月の始めの一月
		c=3;	//始まりは木曜日
		while(1){
			for(i=1;i<=mond[m-1];i++,c++)
				if(month==m && i==day) break;
			if(month==m && i==day) break;
			m++;
		}
		printf("%s\n",name[c%7].c_str());
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
	int d;
	int i;
	int sum;

	while (~scanf("%d", &d)){
		sum = 0;
		for (i = d; i < 600; i += d){
			sum += d * i * i;
		}
		printf("%d\n", sum);
	}

	return (0);
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

vector<string>sts;
vector<int>indnums;
int a = 0;
struct yaml {
	bool is_dir;
	map<string, yaml>mp;
	string prop;
	void operator =(const yaml yaml_) {
		is_dir = yaml_.is_dir;
		mp = yaml_.mp;
		prop = yaml_.prop;
	}
};
yaml getmap(const int ind);
pair<string,yaml> getmapitem(const int ind) {
	yaml ayaml;
	
	const int n = sts[a].find(':');
	string key = sts[a].substr(indnums[a], n-indnums[a]);
	if (n == sts[a].size()-1) {
		ayaml.is_dir = true;
		a++;
		ayaml = getmap(indnums[a]);
	}
	else {
		ayaml.is_dir = false;
		string name = sts[a].substr(n + 2);
		ayaml.prop = name;
		a++;
	}
	return make_pair(key,ayaml);
}
yaml getmap(const int ind) {
	yaml ayaml;
	ayaml.is_dir = true;
	ayaml.mp.emplace(getmapitem(ind));
	while (1) {
		if (a == sts.size() || indnums[a] != ind)break;
		ayaml.mp.emplace(getmapitem(ind));
	}
	return ayaml;
}

int main() {
	string st; cin >> st;
	int now = 1;
	vector<string>keys;
	while (1) {
		int n = st.find('.',now);
		if (n == string::npos) {
			break;
		}
		else {
			keys.emplace_back(st.substr(now, n-now));
		}
		now = n+1;
	}
	keys.emplace_back(st.substr(now));
	string ast;
	getline(cin, ast);
	while (getline(cin,ast)) {
		int n = ast.find_first_not_of(' ');
		sts.push_back(ast);
		indnums.emplace_back(n);
	}
	yaml y=getmap(0);
	int anstype=0;
	string ans;
	yaml nyaml = y;
	
	for (int i = 0; i < keys.size(); ++i) {
		auto it = nyaml.mp.find(keys[i]);
		if (it == nyaml.mp.end()) {
			anstype = -1;
			break;
		}
		else {
			nyaml = it->second;
		}
	}
	if (anstype == -1) {
		cout << "no such property" << endl;
	}
	else {
		if (nyaml.is_dir) {
			cout << "object" << endl;
		}
		else {
			cout << "string \"" << nyaml.prop << "\"" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3536
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    final int A, P;

    AtCoder(FastScanner sc) {
        A = sc.nextInt();
        P = sc.nextInt();
    }

    void solve(PrintWriter out) {
        out.println((A * 3 + P) / 2);
    }

}

class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

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


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

using Graph=vector<vector<int>>;

int main()
{
   int N,T,A; cin>>N>>T>>A;
   T--; A--;
   Graph G(N);
   for(int i=0;i<N-1;i++){
      int a,b; cin>>a>>b;
      a--; b--;
      G[a].push_back(b);
      G[b].push_back(a);
   }
   vector<int> dist(N);
   function<void(int,int)> dfs=[&](int v,int p)
   {
      for(int u:G[v]) if(u!=p){
         dist[u]=dist[v]+1;
         dfs(u,v);
      }
   };

   vector<int> distT(N);
   dist[T]=0;
   dfs(T,-1);
   distT=dist;
   vector<int> distA(N);
   dist[A]=0;
   dfs(A,-1);
   distA=dist;
   // for(int i=0;i<N;i++) cout<<distT[i]<<' '<<distA[i]<<endl;
   int ans=-1;
   for(int i=0;i<N;i++) if(distT[i]<distA[i]){
      ans=max(ans,distA[i]-1);
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 13312
import sys
import math as mas

def sieve(n):
	p=[True for i in range(n+1)]
	p[0]=p[1]=False
	end=int(n**0.5)
	for i in range(2,end+1):
		if p[i]:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p
	
sosu=sieve(1000010)
for i in sys.stdin:
	print(sum(sosu[t] for t in range(int(i)+1)))

#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Measured memory_bytes: 15148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) begin(v), end(v)
#define allg(v) begin(v), end(v), greater<int>()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  stack<int> stc;
  string s;
  int a, b;
  
  while(cin >> s) {
    if(s == "+") {
      a = stc.top();
      stc.pop();
      b = stc.top();
      stc.pop();
      stc.push(b+a);
    } 
    else if(s == "-") {
      a = stc.top();
      stc.pop();
      b = stc.top();
      stc.pop();
      stc.push(b-a);
    }
    else if(s == "*") {
      a = stc.top();
      stc.pop();
      b = stc.top();
      stc.pop();
      stc.push(b*a);
    }
    else {
      a = atoi(s.c_str());
      stc.push(a);
    }
  } 
  
  cout << stc.top() << "\n";

}



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

long long a[200010] = {0};
long long sum[200010]= {0};
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        sum[i] = sum[i-1] + a[i];
    }
    long long Imin = abs(2*sum[1]-sum[n]);
    for(int i = 1;i < n;i++)
    {
        long long a = abs(2*sum[i] - sum[n]);
        if(a < Imin)
            Imin = a;
    }
    cout << Imin;
    return 0;
}


Measured memory_bytes: 3328
// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector <ll> vec;
typedef pair <ll, ll> pr;
typedef pair <ll, pr> pr2;
typedef map <ll, vector<ll> > mv;

const int MX = 2e6+10;
const int mod = 1e9 + 7;
const ll inf = 1LL << 62;

int dx4[] = { 0, 0, -1, 1 };
int dy4[] = { 1, -1, 0, 0 };

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

// TOOLS
#define LCM(a,b)        (a / __gcd(a,b) ) *b
#define gcd(a,b)        __gcd(a,b)
#define all(x)          (x).begin(), (x).end()
#define mem(a, n)       memset(a, n, sizeof(a))
#define for1(i, n)      for(int i=1; i<=n; i++)
#define for0(i, n)      for(int i=0; i<n; i++)
#define rof0(i, n)      for(int i=n-1; i>=0; i--)
#define rof1(i, n)      for(int i=n; i>=1; i--)
#define forab(i, a, b)  for(int i=a; i<=b; i++)
#define rofab(i, a, b)  for(int i=b; i>=a; i--)
#define pb              push_back
#define pbb             pop_back

// CIN/COUT
#define sin(s)          getline(cin, s)
#define case(a)              cout << "Case "<<(a)<<": "

// SCANF/PRINTF
#define fYES            printf("YES\n")
#define fNO             printf("NO\n")
#define Scf(a)          scanf("%lld", &a)
#define Scf2(a, b)      scanf("%lld %lld", &a, &b)
#define Scf3(a, b, c)   scanf("%lld %lld %lld", &a, &b, &c)
#define Scf4(a,b,c,d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define Pnf(a)          printf("%lld\n", a)
#define Pnf2(a, b)      printf("%lld %lld\n", a, b)
#define Pnf3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define Bug(n)          printf(">> %lld <<\n", n)

// OTHERS
#define sz(n)          n.size()
#define clr(v)          v.clear()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define in              freopen("input.txt", "r", stdin)
#define out             freopen("output.txt", "w", stdout)
#define FastIO          { ios_base::sync_with_stdio(false); cin.tie(0); }
#define F               first
#define S               second
#define mpp             make_pair
//End
vector<int> v;
map<ll,vector<ll> > mp;
priority_queue<ll> PQ;
//priority_queue<pair<ll,ll> >PQ;
int main()
{

    ll n, m, k, q, t, cnt = 0, sum = 0,ans=0, mx = -inf, mn = inf, a, b, c,d,e,f,g,h,i,j ,x, y, z,temp, temp1;
    string s, s1, s2, s3;
    cin>>n;
    for(i=1;i<=n;i+=2)
    {
        cnt=0;
        for(j=1;j<=i;j++)
        {
            if(i%j==0)
            {
                cnt++;
            }
        }
        if(i%2==1&&cnt==8)
            ans++;
    }
    cout<<ans<<endl;


    return 0;
}


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

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

A.sort()
num = len(list(set(A)))
c = [0] * A[-1]
for a in A:
    c[a - 1] += 1
c.sort()
ans = 0
if num > K:
    i = 0
    diff = 0
    while diff != num - K:
        if c[i] != 0:
            ans += c[i]
            i += 1
            diff += 1
        else:
            i += 1

print(ans)


Measured memory_bytes: 25276
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;


/*
ll gcd(ll x, ll y) {
if (y == 0) return x;
return gcd(y, x%y);
}
/*
ll lcm(ll x, ll y) {
ll g = gcd(x, y);
return x / g * y;
}
ll pw(int x, int n) {
	ll y = 1;
	ll p = x;
	while (n != 0) {
		if (n % 2) {
			y = y*p%mod;
			n = n - 1;
		}
		else {
			p = p*p%mod;
			n = n / 2;
		}
	}
	return y;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}*/
int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
from math import sqrt

# Function to return count of Ordered pairs
# whose product are less than N
def countOrderedPairs(N):
    # Initialize count to 0
    count_pairs = int(0)

    # count total pairs
    p = int(sqrt(N - 1)) + 1
    q = N
    # q = int(sqrt(N)) + 2
    for i in range(1, p, 1):
        for j in range(i, q, 1):
            if i * j > N-1:
                break
            # print(i,j)
            count_pairs += 1
    #print(count_pairs)
    # multiply by 2 to get ordered_pairs
    count_pairs *= 2

    #print(count_pairs)
    # subtract redundant pairs (a, b) where a==b.
    count_pairs -= int(sqrt(N - 1))

    # return answer
    return count_pairs

    # Driver code

N = int(input())
print(countOrderedPairs(N))
# ans=prime_factorize(N)
# print(ans)

Measured memory_bytes: 9012
n=int(input())
a=list(map(int,input().split()))
d=dict()
for i in a:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
p=0
k=0
for i in d.values():
    p+=i//2
    k-=i%2-1
print(n-(p-k//2)*2)

Measured memory_bytes: 18080
import java.util.Scanner;

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

		String[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 27988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ll num[3];
    cin >> num[0] >> num[1] >> num[2];
    sort(num, num + 3);
    ll a, b, c;
    a = num[0];
    b = num[1];
    c = num[2];
    ll cnt = 0;
    while (true) {
        int oddCnt = 3;
        for (int i = 0; i < 3; i++) {
            if (num[i] % 2 == 1) {
                oddCnt--;
            }
        }
        if (oddCnt < 3) {
            cout << cnt << endl;
            return 0;
        }
        if (a == b && b == c) {
            cout << -1 << endl;
            return 0;
        }
        c = (num[1] + num[2]) / 2;
        b = (num[0] + num[2]) / 2;
        a = (num[0] + num[1]) / 2;
        num[0] = a;
        num[1] = b;
        num[2] = c;
        cnt++;
    }

    return 0;
}


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

public class Main {
    static int mod = (int) 1e9 + 7;

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int rows = in.nextInt();
        int cols = in.nextInt();
        int[][] dp = new int[rows + 1][cols + 1];
        dp[1][1] = 1;

        for (int i = 1; i <= rows; i++) {
            String line = in.nextLine();
            for (int j = 1; j <= cols; j++) {
                if (line.charAt(j - 1) == '#') continue;
                dp[i][j] += (dp[i][j - 1] + dp[i - 1][j]) % mod;
            }
        }
        out.println(dp[rows][cols]);
        out.close();

    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream i) {
            br = new BufferedReader(new InputStreamReader(i));
            st = new StringTokenizer("");
        }
        public String next() throws IOException {
            if (st.hasMoreTokens()) {
                return st.nextToken();
            }
            else
                st = new StringTokenizer(br.readLine());
            return next();
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public String nextLine() throws IOException {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
                return nextLine();
            }

            String ret = "";
            while (st.hasMoreTokens()) {
                ret += st.nextToken();
            }
            return ret;
        }
        public int[] nextIntArr(int size) throws IOException {
            int[] arr = new int[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        public long[] nextLongArr(int size) throws IOException {
            long[] arr = new long[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
        public double[] nextDoubleArr(int size) throws IOException {
            double[] arr = new double[size];
            for (int i = 0; i < arr.length; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }
    }
}

Measured memory_bytes: 44984
import math

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

o = math.factorial(n)
p = math.factorial(m)

if abs(n-m) > 1:
  print(0)
elif abs(n-m) == 1:  
  print((o*p)%(int(1e9)+7))
elif n-m == 0:  
  print((2*o*p)%(int(1e9)+7))


Measured memory_bytes: 5312
#include <bits/stdc++.h>
using namespace std;
int l[10];
int main(int argc, const char * argv[])
{
    int n,t,sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>l[i];
    t=l[0];
    for(int i=0;i<n;i++)
    {
        t=max(l[i],t);
        sum=l[i]+sum;
    }
    if(sum-t>t)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << 

int x, a;

signed main()
{
    cin >> x >> a;

    if (x < a){
        cout << 0 << endl;
    }else {
        cout << 10 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,k;
    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&k);
    if((e-a)<=k)
    {
        printf("Yay!\n");
    }
    else
    {
        printf(":(\n");
    }
    return 0;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,s;
    cin>>n>>s;
    vector<int> a(n);
    for(auto & b: a) cin>>b;
    vector<ll> dp(s+1);
    ll ret = 0;
    for(int i=0;i<n;++i){
        for(int j=s-a[i];j>=0;--j){
            if(j == 0)(dp[a[i]] += i+1)%=mo2;
            else (dp[a[i]+j] += dp[j])%=mo2;
        }
        ret += dp[s]%mo;
    }
    cout << ret%mo2 << endl;
    return 0;
}

Measured memory_bytes: 256