akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, K; cin >> N >> K;
	map<int, int>mp;
	rep(i, 0, K) {
		int d; cin >> d;
		rep(j, 0, d) {
			int a; cin >> a;
			mp[a]++;
		}
	}
	cout << N - mp.size() << "\n";

	return 0;
}


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


int main() {

	int N;
	std::cin >> N;

	std::vector<int> p(N);
	std::vector<int> q(N);
	for (int i = 0; i < N; i++) std::cin >> p[i];

	q = p;

	std::sort(p.begin(), p.end());

	int count = 0;

	for (int i = 0; i < N; i++) {
		if (p[i] != q[i])count++;
	}

	if (count > 2)std::cout << "NO" << std::endl;
	else std::cout << "YES" << std::endl;
}

Measured memory_bytes: 256
#A問題
N, K = map(int, input().split())
S = input()
S_lst = list(S)
if S_lst[K-1] == "A":
    S_lst[K-1] = "a"
    print("".join(S_lst))
elif S_lst[K-1] == "B":
    S_lst[K-1] = "b"
    print("".join(S_lst))
else:
    S_lst[K-1] = "c"
    print("".join(S_lst))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
struct segment_tree {
  public:
    int n, N;
    vector<long long> tr;
    segment_tree (vector<long long> v) {
      n = v.size();
      N = 1;
      while (N < n) {
        N <<= 1;
      }
      tr.resize(2 * N, 0);
      for (int i = 0; i < n; i++) {
        tr[N + i] = v[i];
      }
      for (int i = N - 1; i >= 1; i--) {
        tr[i] = max(tr[2 * i], tr[2 * i + 1]);
      }
    }
    void update (int i, long long x) {
      i += N;
      tr[i] = x;
      i >>= 1;
      for (; i; i >>= 1) {
        tr[i] = max(tr[2 * i], tr[2 * i + 1]);
      }
    }
    long long getMax (int l, int r, int k = 1, int L = 0, int R = -1) {
      if (R == -1) R = N;
      if (l <= L && R <= r) {
        return tr[k];
      } else if (r <= L || R <= l) {
        return 0;
      } else {
        int C = (L + R) >> 1;
        return max(getMax(l, r, 2 * k, L, C), getMax(l, r, 2 * k + 1, C, R));
      }
    }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long k;
  cin >> n >> k;
  vector<long long> x(n + 2, 0), v(n + 2, 0);
  for (int i = 1; i <= n; i++) cin >> x[i] >> v[i];
  x[n + 1] = k;
  vector<long long> c(n + 1, 0), C(n + 1, 0), d(n + 1, 0), D(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    c[i] = c[i - 1] + v[n + 1 - i] - (x[n + 2 - i] - x[n + 1 - i]);
    C[i] = C[i - 1] + v[n + 1 - i] - ((x[n + 2 - i] - x[n + 1 - i]) << 1);
    d[i] = d[i - 1] + v[i] - (x[i] - x[i - 1]);
    D[i] = D[i - 1] + v[i] - ((x[i] - x[i - 1]) << 1);
  }
  segment_tree cs(c), Cs(C), ds(d), Ds(D);
  long long ret = 0;
  for (int i = 0; i <= n; i++) {
    ret = max(ret, cs.getMax(0, i + 1) + Ds.getMax(0, n + 1 - i));
    ret = max(ret, Cs.getMax(0, i + 1) + ds.getMax(0, n + 1 - i));
  }
  cout << ret << '\n';
  return 0;
}

Measured memory_bytes: 13936
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, M;
	cin >> N >> M;
	auto sum = 0ll;
	for (auto i = 0; i < M; ++i)
	{
		ll A;
		cin >> A;
		sum += A;
	}

	if (sum <= N)
	{
		cout << N - sum << endl;
	}
	else
	{
		cout << -1 << endl;
	}

	return 0;
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {

    ll x;
    cin >> x;

    ll now = 0;
    ll count = 0;
    while (now < x) {
        count++;
        now += count;
    }

    cout << count << endl;

}



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

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin>>n;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
    }
    sort(d.begin(),d.end());

    cout<<d.at(n/2)-d.at(n/2-1)<<endl;





    return 0;
}


Measured memory_bytes: 640
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N,K = II()
a = III()

cuma = [a[0]]
for i in range(1,N):
    cuma.append(cuma[-1]+a[i])

val = []
for i in range(N):
    for j in range(i,N):
        if i==0:
            val.append(cuma[j])
        else:
            val.append(cuma[j]-cuma[i-1])

val.sort(reverse=True)

ans = 0
use = [True]*len(val)
for i in range(val[0].bit_length())[::-1]:
    ok_num = 0
    ng_list = []
    for j in range(len(val)):
        if not use[j]:
            continue
        else:
            if val[j]>>i&1:
                ok_num += 1
            else:
                ng_list.append(j)
    if ok_num>=K:
        ans += 2**i
        for n in ng_list:
            val[n] = False

print(ans)

Measured memory_bytes: 154944
#include <iostream>
#include <string>
using namespace std;
int main(void){
   long L[1010][1010]={{0}}, Z; 
   string X, Y; 
   int q;  
    cin >> q; 
  for(int k=0; k<q; k++){ 
      cin >> X;  
      cin >> Y;
      X = ' ' + X;
      Y = ' ' + Y;
      for(int i=1;i<=X.size();i++) L[i][0]=0;
      for(int j=1;j<=Y.size();j++) L[0][j]=0;
      for(int i=1; i<X.size(); i++){
       for(int j=1; j<Y.size(); j++){
           if(X[i] == Y[j])
                L[i][j]=1+L[i-1][j-1];
           else L[i][j]=max(L[i][j-1], L[i-1][j]); 
          Z=L[i][j];
       } 
     } 
     cout << Z << endl;
  }
   return 0;
}


Measured memory_bytes: 11152
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;

LL n,m,tmp = 2,ans = 0;
LL a[2000005];
char ch;
map <LL,LL> mp;

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(LL i = 1;i <= n;i ++){
		cin >> ch;
		a[i] = ch - '0' - 1;
		if(a[i] == 1) tmp = 1;
	}
	if(tmp == 2){
		for(LL i = 1;i <= n;i ++){
			if(a[i] == 2) a[i] = 1;
		}
	}
	else{
		for(LL i = 1;i <= n;i ++){
			if(a[i] == 2) a[i] = 0;
		}
	}
	for(LL i = 1;i <= n;i ++) if(((n - 1) & (i - 1)) == i - 1) ans ^= a[i]; 
	cout << (ans ? tmp : 0) << endl;
	return 0;
}
//

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int main(void){
    // Your code here!
    int N,D;
    cin >> N >> D;
    if(N % (2*D+1)){
        cout << N / (2*D+1) + 1 << endl;
    }else{
        cout << N / (2*D+1)  << endl;
    }

}
    

Measured memory_bytes: 256
m,k = map(int,input().split())
if m == 1:
    if k == 0:
        print(0,0,1,1)
    else:
        print(-1)
elif 2**m <= k:
    print(-1)
else:
    remain = set(range(2**m))
    use = set()
    count = 0
    while k:
        if k & 1:
            remain.remove(2**count)
            use.add(2**count)
        k >>= 1
        count += 1
    ans = []
    remain = list(remain)
    use = list(use)
    for i in remain:
        ans.append(str(i))
    for i in use:
        ans.append(str(i))
    for i in remain[::-1]:
        ans.append(str(i))
    for i in use[::-1]:
        ans.append(str(i))
    print(" ".join(ans))

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, k, sum, ans;

int main() {
	cin.tie(0)->sync_with_stdio(0);
    cin >> n >> k;
    vi a(n);
    for (auto& i : a) {
        cin >> i;
        sum += i;
    }

    for (int i = 1; i * i <= sum; ++i) {
        if (!(sum % i)) {
            // First check for i as GCD then sum / i
            ll moves = 0, cur = 0;
            vi delta;
            rep(j, 0, n) {
                if (!(a[j] % i)) continue;

                int change = i - a[j] % i;
                delta.push_back(change);
                cur += change;
            }
            sort(all(delta), greater<int>());
            
            for (auto j : delta) {
                if (!cur) break;
                moves += i - j;
                cur -= i;
            }

            if (moves <= k) ans = max(ans, i);

            moves = 0, cur = 0;
            int other = sum / i;
            delta.clear();

            rep(j, 0, n) {
                if (!(a[j] % other)) continue;

                int change = other - a[j] % other;
                delta.push_back(change);
                cur += change;
            }
            sort(all(delta), greater<int>());

            for (auto j : delta) {
                if (!cur) break;
                moves += other - j;
                cur -= other;
            }

            if (moves <= k) ans = max(ans, other);
        }
    }

    cout << ans;
}


Measured memory_bytes: 3680
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
	int n, l[100];
	int i,max=0,sum=0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> l[i];
		if (l[i] > max) {
			sum += max;
			max = l[i];
		}
		else {
			sum += l[i];
		}
	}

	if (sum > max) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
 
#define rp(i, k, n) for (int i = k; i < n; i++)
using ll = long long;
using ld = double;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

ll mypow(ll X, ll n) {  // 繰り返し２乗法　計算量log(n)
    if(n == 0) return 1ll;
    ll Y = mypow(X, n/2);
    if(n % 2 == 1) return X * Y % MOD * Y % MOD;
    else return Y * Y % MOD;
}


int main() {
    ll n; cin >> n;
    ll res = mypow(10, n);
    res = (((res - 2 * mypow(9, n))%MOD)+MOD)%MOD;
    res = (res + mypow(8, n))%MOD;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            int MIN = 0, MAX = 44;
            if (n < MIN || n > MAX) {
                System.out.println("Condition is invalid.");
                return;
            }
            int[] fs = new int[MAX + 1];
            System.out.println(fibonacci(n, fs));
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static int fibonacci(int n, int[] fs) {
        if (n == 0 || n == 1) {
            return 1;
        }
        if (fs[n] != 0) {
            return fs[n];
        }
        fs[n] = fibonacci(n - 1, fs) + fibonacci(n - 2, fs);
        return fs[n];
    }
}



Measured memory_bytes: 26308
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl

int main() {
    string s; cin >> s;

    if(s>"2019/04/30"){
        cout << "TBD" << endl;
    }
    else{
        cout << "Heisei" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
const int M = 1e9 + 7;
const int N = 2e5 + 10;
const int MAX = 1e9 + 1;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

int n;
int a, b;
int mp[26];

int main() {
    int i, j;
    string s;
    cin >> s;
    string ans;
    for (i = 0; i < s.size() - 8; ++i)
        ans += s[i];
    cout << ans << endl;
    return 0;
}


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if ((A+B) > (C+D)) cout << "Left" << endl;
    else if ((A+B) == (C+D)) cout << "Balanced" << endl;
    else cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define mod 998244353
const int N=200005;

vector <int> adj[N];

int main() {
	/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	#endif
*/
    int a;
    string s;
    cin>>a;
    cin>>s;
    if(a<3200) cout<<"red";
    else cout<<s;
	return 0;
}

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

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; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll R, G, B, N;
    cin >> R >> G >> B >> N;

    ll count = 0;
    FOR(r, 0, N/R + 1){
        FOR(g, 0, N/G + 1){
            ll rest =  N - r*R - g*G;
            if(rest<0 || rest%B!=0) continue;
            ll b = rest / B;
            count++;
        }
    }
    p(count);
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int t=0;
    while(n--){
        int a,b;
        cin>>a>>b;
        if(a==b){
            t++;
            if(t==3){
                break;
            }
        }else{
            t=0;
        }
    }
    if(t==3){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

#define MOD 1000000007
using namespace std;

int n, m,l;
string s;

int main() {
	cin >> n;
	vector<int> w(n);
	int up = 0;
	int down = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> w[i];
		down += w[i];
	}
	int ans = 999999999;
	for (int i = 0; i < n-1; i++)
	{
		up += w[i];
		down -= w[i];
		ans = min(abs(up - down),ans);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
def Binary_Search_Count(A,x,sort=True,equal=False):
    """2分探索によって,x未満の要素の個数を調べる.

    A:リスト
    x:調べる要素
    sort:ソートをする必要があるかどうか(Trueで必要)
    equal:Trueのときはx"未満"がx"以下"になる
    """
    if sort:
        A.sort()
        
    N=len(A)
    if A[-1]<=x:
        return N
    elif x<A[0] or (not equal and x==A[0]):
        return 0

    L,R=0,N
    while R-L>1:
        C=L+(R-L)//2
        if x<A[C] or (not equal and x==A[C]):
            R=C
        else:
            L=C
    return R

N,M,K=map(int,input().split())


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

X=[0]*N
U=0
for i in range(N):
    U+=A[i]
    X[i]=U

Y=[0]*M
U=0
for i in range(M):
    U+=B[i]
    Y[i]=U    

R=Binary_Search_Count(Y,K,False,True)
for i in range(N):
    if K-X[i]>=0:
        R=max(R,i+1+Binary_Search_Count(Y,K-X[i],False,True))
print(R)


Measured memory_bytes: 111236
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
	int n,k;
	cin >> n >> k;
	ll zero = 0, half = 0;
	for(int i = 1;i<=n;i++){
		if(i%k == 0)zero++;
		if(i%k == k/2 and k%2 == 0)half++;
	} 
	ll ans = powl(zero,3) + powl(half,3);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

ll x, y;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> x >> y;
    ll g = x;
    int cnt = 1;
    while (1) {
        g *= 2;
        if (g <= y) cnt++;
        else break;
    }
    cout << cnt;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int a, b;
    cin >> a >> b;

    cout << 6 - a - b << 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 ii=0; ii<N; ii++){
    int a;
    cin >> a;
    sum += a;
  }
  cout << (sum>=H?"Yes":"No") << endl;
  return 0;
}

Measured memory_bytes: 256
t = input()

stack = ''
for i in range(len(t)):
    word = t[i]
    if word == '?':
        next_word = t[i+1] if i < len(t)-1 else None
        if next_word is None:
            word = 'D'
        else:
            if len(stack) <= 0 and next_word == 'P':
                word = 'D'
            elif len(stack) <= 0 and (next_word == 'D' or next_word == '?'):
                word = 'P'
            elif stack[-1] == 'D' and (next_word == '?' or next_word == 'D'):
                word = 'P'
            else:
                word = 'D'

    stack += word
print(stack)


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

int main()
{
  int h, w;
  cin >> h >> w;

  int move_count = 0;
  string s;
  int a[h][w];
  for (auto i = 0; i < h; i++) {
    cin >> a[i][0];
    for (auto j = 1; j < w; j++) {
      cin >> a[i][j];
      if (a[i][j - 1] % 2 != 0) {
	s += to_string(i + 1) + " " + to_string(j) + " " +
	  to_string(i + 1) + " " + to_string(j + 1) + "\n";
	a[i][j]++;
	move_count++;
      }
    }
  }
  for (auto i = 1; i < h; i++) {
    if (a[i - 1][w - 1] % 2 != 0) {
      s += to_string(i) + " " + to_string(w) + " " +
	to_string(i + 1) + " " + to_string(w) + "\n";
      a[i][w - 1]++;
      move_count++;
    }
  }
  cout << move_count << endl;
  cout << s;
}


Measured memory_bytes: 5124
n = int(input())
A = [int(input()) for _ in range(n)]
cnt = 0
G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1]
G = [v for v in G if v <= n]
m = len(G)
def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
for g in G:
    insertionSort(A, n, g)
print(m)
print(*G)
print(cnt)
print(*A, sep='\n')


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

int main() {
	int n;
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			int pm, pe, pj;
			cin >> pm >> pe >> pj;
			int avg = (pm + pe + pj) / 3;
			if (pm == 100 || pe == 100 || pj == 100 || ((pm + pe) / 2 >= 90) || (avg >= 80)) {
				cout << 'A' << endl;
			}
			else if (avg >= 70 || ((avg >= 50) && (pe >= 80 || pm >= 80))) {
				cout << 'B' << endl;
			}
			else {
				cout<< 'C' << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		String message = "NO";
		int n = 0;
		int i = 0;
		for(i = 0; i < b; i++) {
			n = n + a;
			if(n % b == c) {
				message = "YES";
				break;
			}
		}
		System.out.println(message);
	}
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
#define size 3000
#define ll long long
using namespace std;
ll dp[size+1][size+1];
ll a[size+1];

ll solve(int i,int j,int n)
{
    if(i>n || j<=0)
    return 0;
    if(dp[i][j]!=-1)
    return dp[i][j];

    dp[i][j]=max(a[i]-solve(i+1,j,n),a[j]-solve(i,j-1,n));
    
    return dp[i][j];
}

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


Measured memory_bytes: 74244
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

int main() {

    LL a, b;
    cin >> a >> b;

    if (a > 0) {
        cout << "Positive";
        return 0;
    }

    if (a * b <= 0) {
        cout << "Zero";
        return 0;
    }

    LL len = b - a + 1;
    if (len % 2 == 0) cout << "Positive";
    else cout << "Negative";

    return 0;
}



























Measured memory_bytes: 256
<?php
    $str = "";
    $cnt = 0;
    $s=rtrim(fgets(STDIN));
    $st = array();
    while($s=rtrim(fgets(STDIN))) {
        $st[$cnt]=$s;
        $cnt++;
    }
    sort($st);
    for($i=0;$i<sizeof($st);$i++) {
        echo "$st[$i]";
    }
    echo "\n";

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

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '+') ++counter;
    if (s[0] == '-') counter = counter - 1;
    if (s[1] == '+') ++counter;
    if (s[1] == '-') counter = counter - 1;
    if (s[2] == '+') ++counter;
    if (s[2] == '-') counter = counter - 1;
    if (s[3] == '+') ++counter;
    if (s[3] == '-') counter = counter - 1;
    cout << counter << endl;
}

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

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            int[] nums = Console.ReadLine()
                .Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(x => int.Parse(x))
                .ToArray();
            var lists = new List<int>();
            int sum = nums[1];
            for (int i = 0; i < num; i++)
            {
                var x = int.Parse(Console.ReadLine());
                var let = (nums[0] - 1 )/ x;
                sum += let + 1;
            }
            Console.WriteLine(sum);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13396
import pprint

inp = int(input())
N = 8
board = [ [0]*8 for _ in range(8) ]
defined = []
dic = {}
for _ in range(inp):
  x,y = map(int,input().split())
  board[x][y] = 1
  defined.append(x)
  dic[x] = y

def check(board, row, col):
  for i in range(8):
    if i==col: continue
    if board[row][i] == 1:
      return False

  for i in range(8):
    if i==row: continue
    if board[i][col] == 1:
      return False

  # left upper
  for i,j in zip(range(row, -1, -1), range(col, -1, -1)):
    if i==row and j==col: continue
    if board[i][j] == 1:
      return False

  # left lower
  for i,j in zip(range(row, N), range(col, -1, -1)):
    if i==row and j==col: continue
    if board[i][j] == 1:
      return False

  # right upper
  for i,j in zip(range(row, -1, -1), range(col, N)):
    if i==row and j==col: continue
    if board[i][j] == 1:
      return False

  # right lower
  for i,j in zip(range(row, N), range(col, N)):
    if i==row and j==col: continue
    if board[i][j] == 1:
      return False

  return True

def solve(board, row):
  if row >= 8:
    return True

  if row in defined:
    col = dic[row]
    if check(board, row, col):
      if solve(board, row+1):
        return True
  else:
    for col in range(8):
      if check(board, row, col):
        board[row][col] = 1
        if solve(board, row+1):
          return True
        board[row][col] = 0

  return False

solve(board, 0)

for row in board:
  print("".join(["Q" if r==1 else "." for r in row ]))


Measured memory_bytes: 6568
#include<bits/stdc++.h>
using namespace std;
long long a, b, c, k, cnt;
int main() {
	cin >> a >> b >> c >> k;
	cnt += min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	cnt -= min(c, k);
	k -= min(c, k);
	cout << cnt << "\n";
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n ;
  cin >> n ;
  int ans[n] = {0} ;
  int joushi[n] ;
  for(int i=1;i<n;i++){
    cin >> joushi[i] ;
    ans[joushi[i]-1] ++ ;
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << endl ;
  }
  return 0 ;
}

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

using namespace std;

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

main(){
    string str;
    cin >> str;
    if((str[0]==str[1] and str[1]==str[2]) or (str[1]==str[2] and str[2]==str[3])) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define _USE_MATH_DEFINES
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define INF 1000000000000000
#define MAXN (int)(1e5)+1
#define MOD 1000000007

using namespace std;

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pwi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector< vector<pair<int,lli > > > wGraph;
//typedef vector<vector<int> > graph;
typedef vector<vector<lli> > matrix;

/*double knap(int i,int est,int qtd){

	if(i>=n || qtd>=n){
		return 1;
	}

	if(dp[i][est][qtd]!=-1) return dp[i][est][qtd];
	
	dp[i][0][qtd] = knap(i+1,0,qtd+1)*prob[i];
	dp[i][1][qtd] = knap(i+1,1,qtd)*(1-prob[i]);

	if(est == 0) return dp[i][1][qtd];
	else return dp[i][0][qtd];

}*/

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<std::fixed;
    cout<<std::setprecision(10);

    vector<double> p;
    int n;
    cin>>n;
    for(int i = 0;i<n;++i){
    	double d;
    	cin>>d;
    	p.pb(d);
    }

    double dp[n+1][n+1];

    for(int i = 0;i<=n;++i){
    	for(int k = 0;k<=n;++k){
    		dp[i][k] = 0;
		}
    }

	dp[0][0] = 1;

    for(int i = 1;i<=n;++i){

    	for(int k = 0;k<=i;++k){
    		if(k == 0){
				dp[i][k] = dp[i-1][k]*(1-p[i-1]);
			}else{
				dp[i][k] = dp[i-1][k]*(1-p[i-1])+dp[i-1][k-1]*p[i-1];
			}
		}
    }

    double res = 0;
    for(int i = (n/2)+1;i<=n;++i){
    	res+=dp[n][i];
    }

    cout<<res<<endl;

    return 0;

}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n;cin >> n;
    vector<int> v(n);
    rep(i,n)cin >> v[i];
    sort(ALL(v));
    double ans = (v[0] + v[1]) / 2.0;
    for(int i=2;i<n;i++){
        ans = (ans + v[i]) / 2.0;
    }
    cout << fixed;
    cout << setprecision(6) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#最大公約数
def gcd(a,b):
    if a==b:
        return b
    elif a%b== 0:
        return b
    else:
        return gcd(b,a%b)

import math

def func(a,b):
    if a<=b :
        if b%a != 0:
            return 2*math.floor(b/a)*a+func(a,b%a)
        else:
            return 2*(math.floor(b/a))*a-a
    else:
        return func(b,a)
N,X = map(int,input().split())

dis =N 
dis += func(N-X,X)
dis1 = 3*(N-gcd(N,X))
print(dis)

Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, a:[i64;n]};
    let mut map = HashMap::new();

    for i in 0..n {
        let count = map.entry(a[i]).or_insert(0);
        *count += 1;
    }

    let mut ans = 0i64;
    for (_k,v) in map {
        if v%2!=0 {
            ans += 1;
        }
    }

    println!("{}", ans);

}

Measured memory_bytes: 12540
#include <stdio.h>

int main(void) {
  int n, ans = 0;
  scanf("%d", &n);
  int a[n];
  
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  
  for (int i = 0; i < n-1; i++) {
    for (int j = i+1; j < n; j++) {
      ans += a[i] * a[j];
    }
  }
  
  printf("%d\n", ans);
  return 0;
}

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

int main(void)
{
    int a,b,c,d,start,end,ans;
    cin >> a >> b >> c >> d;
    start = max(a,c);
    end = min(b,d);

    ans = end-start;

    if(end-start < 0) ans = 0;

    cout << ans << endl;

    return 0;
}

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

int N, A, B, C, D[100];

int main(){
	cin >> N >> A >> B >> C;
	for(int i = 0;i < N;i++) cin >> D[i];
	sort(D, D + N);
	int ans = C / A, c = C;
	for(int k = 0;k < N;k++){
		c += D[N - k - 1];
		ans = max(ans, c / (A + (k + 1) * B));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;

ll f(int a,int b)
{
	return b?f(b,a%b):a;
}

int main() {
	int n;cin>>n;ll a,b;cin>>a;
	for(int i=0;i<n-1;i++)
	{
		cin>>b;
		a=a*b/f(max(a,b),min(a,b));
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 3092
#include<queue>
#include<cstdio>

#define	mp			make_pair
#define	rep(i,n)	for(int i=0;i<n;i++)

using namespace std;

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

struct P{
	int x,y;
	P(){}
	P(int X,int Y):x(X),y(Y){}
	bool operator<(const P &p)const{ return true; }
	bool operator==(const P &p)const{ return x==p.x && y==p.y; }
};

int main(){
	for(int w,h;scanf("%d%d",&w,&h),w;){
		int grid[7][7];
		P man,cgo,goal;
		rep(i,h)rep(j,w){
			scanf("%d",grid[i]+j);
			if(grid[i][j]==4)	grid[i][j]=0,man=P(j,i);
			if(grid[i][j]==2)	grid[i][j]=0,cgo=P(j,i);
			if(grid[i][j]==3)	grid[i][j]=0,goal=P(j,i);
		}

		int cmin[7][7][7][7];
		rep(i,h)rep(j,w)rep(k,h)rep(l,w)	cmin[i][j][k][l]=1<<30;
		cmin[man.y][man.x][cgo.y][cgo.x]=0;

		int ans=-1;
		priority_queue< pair< int,pair<P,P> > > pq;
		pq.push(mp(0,mp(man,cgo)));
		while(!pq.empty()){
			pair<int,pair<P,P> > a=pq.top();	pq.pop();
			int cnt=-a.first;
			man=a.second.first;
			cgo=a.second.second;
			if(cgo==goal){ ans=cnt; break; }

			rep(i,4){
				int mx=man.x+dx[i],my=man.y+dy[i];
				if(0<=mx && mx<w && 0<=my && my<h && grid[my][mx]!=1){
					int nextcnt=cnt;
					P nextman(mx,my),nextcgo;
					if(nextman==cgo){
						int cx=cgo.x+dx[i],cy=cgo.y+dy[i];
						if(0<=cx && cx<w && 0<=cy && cy<h && grid[cy][cx]!=1){
							nextcgo=P(cx,cy);
							nextcnt++;
						}
						else	continue;
					}
					else	nextcgo=cgo;

					if(nextcnt<cmin[nextman.y][nextman.x][nextcgo.y][nextcgo.x]){
						pq.push(mp(-nextcnt,mp(nextman,nextcgo)));
						cmin[nextman.y][nextman.x][nextcgo.y][nextcgo.x]=nextcnt;
					}
				}
			}
		}

		printf("%d\n",ans);
	}

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0;i < n;i++){
    cin >> p.at(i);
  }
  
  int x = p.at(0);
  int ans = 1;
  
  for (int i = 0;i < n;i++){
    if (x > p.at(i)){
      x = p.at(i);
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4048
//おまじない
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  int f=0;
  for(int i=1;i<=9;i++){
    if(n%i==0){
      if(1<=n/i&&n/i<=9){
        f++;
        break;
      }
    }
  }
  
  if(f==1){
    cout<<"Yes"<<endl;
  }
  
  else{
    cout<<"No"<<endl;
  }
}
     

      

Measured memory_bytes: 256
/*
g++ --std=c++17 B.cpp
*/

#include <iostream>
#include <iomanip> //! for setprecision(20)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < int(n); ++i)
template<class T> inline bool chmax(T& a, T b) { bool ret = (a < b); if (ret) { a = b; } return ret; }
template<class T> inline bool chmin(T& a, T b) { bool ret = (b < a); if (ret) { a = b; } return ret; }
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int INF = 1000000000;
const int MOD = 1000000007;


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

  int n;
  cin >> n;
  int streak = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      ++streak;
      if (streak == 3) {
        cout << "Yes" << endl;
        return 0;
      }
    } else {
      streak = 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

LL N, M, V, P;
vector<LL>A;
vector<LL>imos;

int main() {
	cin >> N >> M >> V >> P;
	for (int i = 0; i < N; i++) {
		LL a; cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());
	imos.push_back(0);
	for (int i = 0; i < N; ++i) {
		imos.push_back(imos.back() + A[i]);
	}
	LL ans = 0;
	vector<int>tag(N);
	tag[N - 1] = N - 1;
	for (int i = N - 2; i >= 0; i--) {
		if (A[i] == A[i + 1]) {
			tag[i] = tag[i + 1];
		}
		else {
			tag[i] = i;
		}
	}
	for (int iii = 0; iii < N; ++iii) {
		int i = tag[iii];
		LL num = upper_bound(A.begin(), A.end(), A[i] + M) - A.begin();
		LL risou = N - num + 1;
		LL margin = P - risou;
		int L = i + 1;
		int R = max(L, int(num - margin));
		int len = R - L;
		if (margin < 0) {
			continue;
		}
		if (M * (N - len) + (A[i] + M) * len - (imos[R] - imos[L]) >= M * V) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2676
time = []
b = 0
for i in range(5):
    a = int(input())
    if a % 10 == 0:
        pass
    else:
        b = max(b, 10 - a % 10)
        a = (a // 10) * 10 + 10
    time.append(a)
print(sum(time) - b)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<queue>
#include<functional>
#include<algorithm>
using namespace std;

#define INF 1LL<<60
#define MAX_N 2000
#define MAX_COMB 750
#define MAX_K 7
#define BLACK 2
#define GRAY 1
#define WHITE 0

vector<pair<long long, long long>>x[MAX_N];

long long n, m, K, p, a, b, c;
long long A[MAX_N], B[MAX_N];
long long power[16] = { 1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969,14348907 };
long long dist[MAX_N][MAX_COMB], color[MAX_N][MAX_COMB];
long long pattern[MAX_K], pattern2[MAX_K];
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> Q[MAX_COMB];

void _memset() {
	for (int i = 0; i < MAX_COMB; i++) {
		while (!Q[i].empty()) { Q[i].pop(); }
	}
	for (int i = 0; i < MAX_N; i++) {
		A[i] = 0;
		B[i] = 0;
	}
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_COMB; j++) {
			dist[i][j] = 0;
			color[i][j] = WHITE;
		}
	}
	for (int i = 0; i < MAX_N; i++) {
		x[i].clear();
	}
	for (int i = 0; i < MAX_K; i++) {
		pattern[i] = 0;
		pattern2[i] = 0;
	}
}

long long dijkstra(int V, int W) {

	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_COMB; j++) {
			dist[i][j] = INF;
			color[i][j] = BLACK;
		}
	}
	dist[V][0] = 0;
	color[V][0] = GRAY;
	Q[0].push(make_pair(0, V));

	while (true) {
		long long sumcnt = 0;
		for (int i = 0; i < power[W]; i++) {
			sumcnt += Q[i].size();
		}
		if (sumcnt == 0) {
			long long minx = INF;
			for (int i = 0; i < MAX_N; i++) {
				minx = min(minx, dist[i][power[W] - 1]);
			}
			return minx;
		}

		for (int i = 0; i < power[W]; i++) {
			if (!Q[i].empty()) {
				pair<long long, long long>query = Q[i].top();
				Q[i].pop();
				for (int j = 0; j < W; j++) {
					pattern[j] = (i / power[j]) % 3;
					pattern2[j] = pattern[j];
				}

				for (int j = 0; j < x[query.second].size(); j++)
				{
					for (int k = 0; k < W; k++) {
						pattern2[k] = pattern[k];
					}
					for (int k = 0; k < W; k++) {
						if (x[query.second][j].first == A[k] && pattern2[k] == 0) {
							pattern2[k] = 1;
						}
						if (x[query.second][j].first == B[k] && pattern2[k] == 1) {
							pattern2[k] = 2;
						}
					}

					long long cnt2 = 0;
					for (int k = 0; k < W; k++) {
						cnt2 += pattern2[k] * power[k];
					}
					if (dist[x[query.second][j].first][cnt2] > dist[query.second][i] + x[query.second][j].second) {
						dist[x[query.second][j].first][cnt2] = dist[query.second][i] + x[query.second][j].second;
						Q[cnt2].push(make_pair(dist[x[query.second][j].first][cnt2], x[query.second][j].first));
					}
				}

			}

		}
	}
}

int main() {
	_memset();
	cin >> n >> m >> p >> K;
	for (int i = 0; i < m; i++) {
		cin >> a >> b >> c;
		x[a].push_back(make_pair(b, c));
		x[b].push_back(make_pair(a, c));
	}
	for (int i = 0; i < p; i++) {
		cin >> A[i] >> B[i];
	}
	long long answer = dijkstra(K, p);
	if (answer >= INF) {
		cout << "Cannot deliver" << endl;
	}
	else {
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 43220
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << " " <<  (a+b)*2 << endl;
}



Measured memory_bytes: 3008
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N;
  cin>>N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  vector<int> app(100000);
  for(int i=0;i<N;i++){
    app[A[i]]++;
  }
  
  int ans=0;
  
  
  for(int X=1;X<=99999;X++){
    int sum=app[X-1]+app[X]+app[X+1];
    ans=max(ans,sum);
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3992