akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(n) for(int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define el cout << endl
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int r, c, n;
    cin >> r >> c >> n;
    
    struct P {int idx, x, y;};
    
    auto on_edge = [&r, &c](const P& p) {
        return (p.x == 0 || p.x == r) || (p.y == 0 || p.y == c);
    };
   
    vector<P> v;
    
    repeat(i, n) {
        P a, b;
        cin >> a.x >> a.y >> b.x >> b.y;
        a.idx = b.idx = i;
        if (on_edge(a) && on_edge(b)) {
            v.emplace_back(a);
            v.emplace_back(b);
        }
    }
    
    auto get_distance = [&r, &c](const P &a) {
        int ret;
        if (a.y == 0) ret = a.x;
        else if (a.x == r) ret = r + a.y;
        else if (a.y == c) ret = r + c + (r-a.x);
        else ret = r + c + r + (c-a.y);
        return ret;
    };
    
    sort(v.begin(), v.end(), [&get_distance](const P &a, const P &b) {
        return get_distance(a) < get_distance(b);
    });
    
    stack<int> s;
    repeat(i, (int)v.size()) {
        if (s.empty()) {
            s.push(v[i].idx);
        }
        else {
            if (s.top() == v[i].idx) {
                s.pop();
            }
            else {
                s.push(v[i].idx);
            }
        }
    }
    
    if (s.empty()) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;   
}   

Measured memory_bytes: 4468
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX_N=100000;
const int INF = 0x3f3f3f3f;
int n,m,k;
char map[1010][1010];
bool vis[1010][1010];

struct p{
	int x;
	int y;
	int step;
};
int ans=0;

bool yesorno(p x){
	if(x.x<1||x.x>m||x.y<1||x.y>n||map[x.y][x.x]=='X'||vis[x.y][x.x]==1)
		return 0;
	return 1;
}

int sx[4]={0,0,1,-1};
int sy[4]={1,-1,0,0};
void bfs(p st,int ww){
	memset(vis,0,sizeof(vis));
	if(ww==k)
		return;
	int temp=0;
	queue<p> q;
	q.push(st);
//	cout<<st.step<<" "<<ww<<" "<<k<<endl;
	while(!q.empty()){
		
		p ne=q.front();
		q.pop();
		if(map[ne.y][ne.x]==(char)'0'+ww+1){
			ans=ne.step;
			bfs(ne,ww+1);
			return;
		}
		for(int i=0;i<4;i++){
			p tem=ne;
			tem.x=tem.x+sx[i];
			tem.y=tem.y+sy[i];
			tem.step++;
			if(yesorno(tem)){
				q.push(tem);
				vis[tem.y][tem.x]=1;
			}
				
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	while(cin>>n>>m>>k){
		memset(vis,0,sizeof(vis));
		p st;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				cin>>map[i][j];
				if(map[i][j]=='S'){
					st.x=j;
					st.y=i;
					st.step=0;
				}
			}
		}
		bfs(st,0);
		cout<<ans<<endl;
	}


	return 0;
}




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

int main(){
	int x,y;
	cin >> x >> y;
	while(!(x==0&&y==0)){
		if(x<y) cout << x << " " << y << endl;
		else cout << y << " " << x << endl;
		cin >> x >> y;
	}
	return 0;
}



Measured memory_bytes: 2980
user = input()
a = []
b = []
b = user.split()
for i in range(5):
    a.append(int(b[i]))
for j in range(4):
    for k in range(j+1, 5):  # j<k
        if a[j] < a[k]:
            tmp = a[j]
            a[j] = a[k]
            a[k] = tmp

for j in range(5):
    if j == 4:
        print(a[j])
    else:
        print(str(a[j]), end=" ")

Measured memory_bytes: 7600
#include <stdio.h>
#include <stdlib.h>




typedef struct{
    int value;
    int done;
}data;


    

int BinarySearch(int n, int key, data *A){
    int Left = 0;
    int Right = n;
    int mid;
    while(Left < Right){
        mid = (Left + Right)/2;
        if(A[mid].value == key)return mid;
        if(key < A[mid].value){
            Right = mid;
        }
        else if(key > A[mid].value){
            Left = mid + 1;
        }
    }
    return -1;
    
}

int main() {

    int n;
    int m;
    scanf("%d",&n);
    data *input = (data*)malloc(n * sizeof(data));
    for (int i = 0; i < n; i++){
        scanf("%d",&input[i].value);
        
    }
    
    scanf("%d",&m);
    int key, track = 0, Pos = 0;
    for(int i = 0; i < m; i++){
        scanf("%d",&key);
         Pos = BinarySearch(n,key,input);
       if(Pos == -1)continue;
        if(input[Pos].done != 1){
        input[Pos].done = 1;
        track++;
        }
    }

    printf("%d",track);
    printf("\n");
    return 0;
}



Measured memory_bytes: 2480
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

// 最大公約数
template<typename T> T gcd(T a, T b)
{
	return b ? gcd(b, a % b) : a;
}

int main()
{
	int n;
	cin >> n;

	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}

	vector<int> l(n + 1), r(n + 1);
	for (int i = 0; i < n; i++)
	{
		l.at(i + 1) = gcd(l.at(i), a.at(i));
	}
	for (int i = n - 1; i >= 0; i--)
	{
		r.at(i) = gcd(r.at(i + 1), a.at(i));
	}

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans = max(ans, gcd(l.at(i), r.at(i + 1)));
	}

	cout << ans << endl;
}


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

int main(){
    int H, W;
    cin >> H >> W;

    vector<vector<int>> A(H, vector<int>(W));
    for(int i = 0;i < H;i++){
        for (int j = 0; j < W; j++){
            cin >> A[i][j];
        }
    }

    vector<vector<int>> B(H, vector<int>(W));
    vector<vector<int>> C(H, vector<int>(W));
    for(int i = 0;i < H;i++){
        for (int j = 0; j < W; j++){
            cin >> B[i][j];
            C[i][j] = abs(A[i][j] - B[i][j]);
        }
    }


    int M = 8000;
    vector<vector<vector<bool>>> d(H, vector<vector<bool>>(W, vector<bool>(M + 1)));
    d[0][0][C[0][0]] = 1;
    for(int yoko = 1;yoko < W;yoko++){
        for(int i = 0;i < M + 1;i++){
            if(i + C[0][yoko] <= M && d[0][yoko - 1][i + C[0][yoko]] == 1){
                d[0][yoko][i] = 1;
            }
            if(abs(i - C[0][yoko]) <= M && d[0][yoko - 1][abs(i - C[0][yoko])] == 1){
                d[0][yoko][i] = 1;
            }
        }
    }

    for(int tate = 1;tate < H;tate++){
        for(int yoko = 0;yoko < W;yoko++){
            for(int i = 0;i < M + 1;i++){
                if(abs(C[tate][yoko] - i) <= M && d[tate-1][yoko][abs(C[tate][yoko] - i)] == 1){
                    d[tate][yoko][i] = 1;
                }
                if(0 <= i + C[tate][yoko] && i + C[tate][yoko] <= M && d[tate-1][yoko][i + C[tate][yoko]] == 1){
                    d[tate][yoko][i] = 1;
                }
            }

            

            if(yoko >= 1){
                for(int i = 0;i < M + 1;i++){
                    if(abs(C[tate][yoko] - i) <= M && d[tate][yoko-1][abs(C[tate][yoko] - i)] == 1){
                        d[tate][yoko][i] = 1;
                    }
                    if(0 <= i + C[tate][yoko] && i + C[tate][yoko] <= M && d[tate][yoko-1][i + C[tate][yoko]] == 1){
                        d[tate][yoko][i] = 1;
                    }

                }
            }
        }
    }

    for(int i = 0;i < M + 1;i++){
        if(d[H-1][W-1][i] == 1){
            cout << i << endl;
            break;
        }
    }

}

Measured memory_bytes: 8960
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

string pic(string s){
	while(s[0] == '0') s.erase(s.begin());
	return (s.size()!=0?s:"0");
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	LL N;
	cin >> N;
	string ans = "";
	for(LL i=36; i>=0; i--){
		if(abs(N) >= ((LL)1<<i)){
			if(N > 0 && i % 2 == 0){
				ans += "1";
				N -= (1<<i);
			}
			else if(N < 0 && i % 2 == 1){
				ans += "1";
				N += (1<<i);
			}
			else if(N < 0 && i % 2 == 0){
				ans[ans.size()-1]++;
				ans += "1";
				N += (1<<i);
			}
			else if(N > 0 && i % 2 == 1){
				ans[ans.size()-1]++;
				ans += "1";
				N -= (1<<i);
			}
		}
		else{
			ans += "0";
		}
	}
	for(int q=0; q<100; q++){
		//cout << ans << endl;
	for(int i=0; i<ans.size(); i++){
		if(i+1 < ans.size() && ans[i] >= '1' && ans[i+1] >= '2'){
			ans[i] -= 1;
			ans[i+1] -= 2;
		}
		if(ans[i] >= '2'){
			ans[i] -= 2;
			ans[i-1] += 1;
			ans[i-2] += 1;
		}
	}
	}
	cout << pic(ans) << endl;

	return 0;
}



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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
#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 SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define MIN(x) *min_element(all(x))
#define MAX(x) *max_element(all(x))
#define in(x) cin >> x
#define co(x) cout << x
#define el  cout << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

const int INF = 1e9;
const int MOD = 1e9 + 7;


int main() {
    LL a, b, c;
    cin >> a >> b >> c;
    LL right = c - a - b;
    LL left = a * b * 4;
    if (right < 0){
        right = 0;
    }
    right = right * right;
    if (left < right)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<int>data(n);
    int d = 10;
    ll cnt = 0;
    data[n-1] = s[n-1]-'0';
    for(int i = n-2;i >= 0;i--){
        
        
            data[i] = (data[i+1]+(s[i]-'0')*d)%2019;
            d*=10;
            d%=2019;
        
    }
    vector<int>mod(2019);
    rep(i,n)mod[data[i]]++;
    cnt+=mod[0];
    rep(i,2019)cnt+=mod[i]*(mod[i]-1)/2;
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 4388
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String X = sc.next();
		int one = 0;
		for(int i = 0; i < N; i++)
			if(X.charAt(i) == '1')
				one++;
		if(one == 1) {
			for(int i = 0; i < N; i++) {
				if(X.charAt(i) == '1')
					System.out.println(0);
				else {
					if(X.charAt(N-1) == '1')
						System.out.println(2);
					else {
						if(i == N-1)
							System.out.println(2);
						else
							System.out.println(1);
					}
				}
			}
			return;
		}
		long[] modmi = new long[N];
		long[] modpl = new long[N];
		modmi[0] = modpl[0] = 1;
		for(int i = 1; i < N; i++) {
			modmi[i] = modmi[i-1] * 2 % (one - 1);
			modpl[i] = modpl[i-1] * 2 % (one + 1);
		}
		long totmi = 0, totpl = 0;
		for(int i = 0; i < N; i++)
			if(X.charAt(i) == '1') {
				totmi += modmi[N-1-i];
				totpl += modpl[N-1-i];
			}
		for(int i = 0; i < N; i++) {
			int ans = 1;
			long t;
			if(X.charAt(i) == '1')
				t = (totmi - modmi[N-1-i] + one - 1) % (one - 1);
			else
				t = (totpl + modpl[N-1-i] + one + 1) % (one + 1);
			while(t > 0) {
				t %= Long.bitCount(t);
				ans++;
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 71136
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a = string_to_vec_char(read());
    let b = string_to_vec_char(read());
    let c = string_to_vec_char(read());
    println!(
        "{}",
        if a.last() == b.first() && b.last() == c.first() {
            "YES"
        } else {
            "NO"
        }
    );
}

fn string_to_vec_char(s: String) -> Vec<char> {
    s.chars().collect()
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
template<class T> inline bool chmax(int a, int b, T c, T d) { return c > d ? a : b; }
template<class T> inline bool chmin(int a, int b, T c, T d) { return c > d ? a : b; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<ut, VI, greater<LL> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 3e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 7 + 1e9;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
typedef pair<ld, ut> pld;
ut N, M, K, L, Q, D, H, W, R;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL maps[SIZE2][SIZE2];
LL A[SIZE];
LL solve() {
	string s;
	cin >> s;
	LL ans = INF;
	EFOR(i, 'a', 'z') {
		int last = -1;
		LL maxim = 0;
		REP(j, s.size()+1) {
			if (j==s.size() or s[j] == i) {
				MX(maxim, j-last-1);
				last = j;
			}
		}
		MN(ans, maxim);
	}
	cout << ans << endl;
	return 0;
}




//!!!!!!!!!!!!!!!!!!!実装を詰める!!!!!!!!!!!!!!!!!!!!!!!!!
signed main() {

	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(0);
	solve();


	//cin >> N;
	return 0;

}

Measured memory_bytes: 8832
#include <stdio.h>
#define MAX_LENGTH 500001
void maxHeapify(int arr[], int index, int num)
{
    int largest;int temp;
    int left = 2 * index;
    int right = 2 * index + 1;
    if(left<=num&&arr[left]>arr[index]){largest = left;}
    else{largest = index;}
    if(right<=num&&arr[right]>arr[largest]){largest = right;}
    if(largest!=index)
    {
        temp = arr[index];
        arr[index] = arr[largest];
        arr[largest] = temp;
        maxHeapify(arr, largest, num);
    }
    
}
int main() {
    int num;
    int arr[MAX_LENGTH];
    scanf("%d", &num);
    for(int i = 1;i<num+1;i++){scanf("%d",&arr[i]);}
    for(int i = num/2;i>0;i--){maxHeapify(arr, i, num);}
    for(int j = 1;j<num+1;j++){printf(" %d", arr[j]);}printf("\n");
    return 0;
}



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

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

    string x = "dream";
    string y = "dreamer";
    string z = "erase";
    string w = "eraser";

    int len = S.length();
    int lin = len;

    string a;

    for(int i = 1; i < lin; i++){
        len = S.length();
        if(len == 0){
            cout << "YES" << endl;
            break;
        }else if(len < 5){
            cout << "NO" << endl;
            break;
        }else{
            a = S.substr(len - 5, 5);
            if (a == x){
                S.erase(len - 5, 5);
            }else if(a == y.substr(2, 5)){
                if(S.substr(len - 7, 2) == "dr"){
                    S.erase(len - 7, 7);
                }else{
                    cout << "NO" << endl;
                    break;
                }
            }else if(a == z){
                S.erase(len - 5, 5);
            }else if(a == w.substr(1, 5)){
                if(S.substr(len - 6, 1) == "e"){
                    S.erase(len - 6, 6);
                }else{
                    cout << "NO" << endl;
                    break;
                }
            }else{
                cout << "NO" << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int n,m;
  while(1){
    cin>>n>>m;
    if(n+m==0)break;
    vi a(n+m+1);
    a[0]=0;
    rep(i,n)cin>>a[i+1];
    rep(i,m)cin>>a[n+i+1];
    sort(all(a));
    int ans=0;
    rep(i,n+m)ans=max(ans,a[i+1]-a[i]);
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3216
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 3; i++) {
    int num = a * b * i;
    if (num % 2 != 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<int> a(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
    }

    std::vector<int> value(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (value[i] < std::abs(a[i]-a[j])) {
                value[i] = std::abs(a[i]-a[j]);
            }
        }
    }

    int max = 0;
    for (int i = 0; i < N; i++) {
        if (max < value[i]) {
            max = value[i];
        }
    }

    std::cout << max << std::endl;

    return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

d = collections.Counter(prime_factorize(n))

r = 0
for v in d.values():
    _v = v
    e = 1
    while _v > 0:
        _v -= e
        if _v >= 0:
            r += 1
        e += 1

print(r)


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



int main(){
    int H,W;
    cin >> H >> W;
    using vi = vector<char>;
    using vii = vector<vi>;
    vii data(H,vi(W));
    for(int i = 0;i<H;i++){
        for(int j = 0;j < W;j++){
            cin >> data.at(i).at(j);
        }
    }
//    int num = 0;
    vii ans(H,vi(W));
    for(int i = 0;i<H;i++){
        for(int j = 0;j < W;j++){
            ans.at(i).at(j) = '0';
        }
    }
    
    for(int i = 0;i<H;i++){
        for(int j = 0;j < W;j++){
//            if(data.at(i).at(j) == '.'){
//                ans.at(i).at(j) = '0' + 0;
//            }
            if(data.at(i).at(j) == '#'){
                ans.at(i).at(j) = '#';
                if(i - 1 > -1 && ans.at(i - 1).at(j) != '#')ans.at(i - 1).at(j) += 1;
                if(i - 1 > -1 && j - 1 > -1 && ans.at(i - 1).at(j - 1) != '#')ans.at(i - 1).at(j - 1) += 1;
                if(i - 1 > -1 && j + 1 < W && ans.at(i - 1).at(j + 1) != '#')ans.at(i - 1).at(j + 1) += 1;
                if(i + 1 < H && ans.at(i + 1).at(j) != '#')ans.at(i + 1).at(j) += 1;
                if(i + 1 < H && j - 1 > -1 && ans.at(i + 1).at(j - 1) != '#')ans.at(i + 1).at(j - 1) += 1;
                if(i + 1 < H && j + 1 < W && ans.at(i + 1).at(j + 1) != '#')ans.at(i + 1).at(j + 1) += 1;
                if(j - 1 > -1 && ans.at(i).at(j - 1) != '#')ans.at(i).at(j - 1) += 1;
                if(j + 1 < W && ans.at(i).at(j + 1) != '#')ans.at(i).at(j + 1) += 1;
            }
        }
    }
    
    for(int i = 0;i<H;i++){
        for(int j = 0;j<W;j++){
            cout << ans.at(i).at(j);
        }
        cout << endl;
    }
}

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

//角度(degree)からラジアン(radian)に変換
//double radian = degree * PI / 180.0;

//ラジアン(radian)から角度(degree)に変換
//double degree = radian * 180.0 / PI;

int main(void){
    double a, b, x;
    cin >> a >> b >> x;
    
    double tantheta = 0.0;
    
    if (x > (a*a*b)/2.0) {
        tantheta = a/(2.0 * (b - (x / (a * a))));
    } else {
        tantheta = (2.0 * x) / (a * b * b);
        //cout << "hoge" << endl;
    }
    double theta = atan(tantheta);
    double degree = 90.0 - (theta * 180.0 / PI);
    cout << setprecision(11) << degree << endl;
    return 0;
}

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

//create arrays outside of main()
int a[3] = {};

stack<char> s;


int main() {

    for(int i=0; i<3; i++){
        cin >> a[i];
    }

    sort(a, a+3, greater<int>());

    if(a[0] == a[1]+a[2]){
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const ll INF = 1001001001001001000;

vector<ll> divisor(ll N) {
    vector<ll> RES;
    for (ll I = 1; I*I <= N; I++) {
        if (N%I == 0) {
            RES.push_back(I);
            if (I != N/I) RES.push_back(N/I);
        }
    }
    return RES;
}

int main() {
    ll n; cin >> n;
    vector<ll> div = divisor(n);
    ll ans = INF;
    for (auto x : div) {
        ans = min(ans, x + n/x - 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<pr> vp;
typedef vector<vp> vpp;
typedef vector<vector<ll> > graph;
#define pb push_back
#define mp make_pair
#define endl '\n'
void set_val(vector<ll>& v, ll val){for(ll i=0;i<v.size();i++) v[i]=val;}

ll mod = pow(10,9) + 7;
ll modulo = 998244353;
double pi = 3.141592653589793238;
ll i_mov[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
ll j_mov[8] = {1, 1, 1, 0, -1, -1, -1, 0};


ll power(ll a, ll n)
{
    if(n==0)
    return 1;
    ll temp = power(a,n/2);
    if(n%2==0)
    return (temp*temp)%mod;
    return (((temp*temp)%mod)*a)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout<<setprecision(10);
    ll n, k;
    cin>>k>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    ll sum = 0;
    ll m = 0;
    for(int i=1;i<n;i++)
    {
        sum += a[i]-a[i-1];
        m = max(m, a[i]-a[i-1]);
    }
    sum += k-a[n-1] + a[0];
    m = max(m, k-a[n-1] + a[0]);
    cout<<sum - m;
    
    
    
    
} 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define mod1 1000000009
#define line cout<<"----------------------"<<endl
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
using namespace std;
const ll   mx=100009;
int  main()
{
    string str;
    cin>>str;
    string a=str;
    reverse(a.begin(),a.end());
    if(a!=str)
    {
        cout<<"No"<<endl;
    }
    else
    {
        a=str.substr(0,(str.size()-1)/2);
        string b=a;
        reverse(b.begin(),b.end());
        if(b!=a)
        {
            cout<<"No"<<endl;
            return 0;
        }
        a=str.substr((str.size()+3)/2-1,str.size());
         b=a;
        reverse(b.begin(),b.end());
        if(b!=a)
        {
            cout<<"No"<<endl;
            return 0;
        }
        cout<<"Yes"<<endl;

    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N,a[105]={0},ans;
	cin>>N;
	for(int i=0;i<N;i++)
		cin>>a[i];
	sort(a,a+N,greater<int>());
	ans=a[0]-a[N-1];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[200010];
int n,m;
map<int,int>MAP;
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>a[i];
        MAP[a[i]]++;
    }
    sort(a,a+n);
    cin>>m;
    int k;
    for(int i=0;i<m;++i)
    {
        cin>>k;
        if(binary_search(a,a+n,k)&&MAP[k]>0)
        {
            MAP[k]--;
        }
        else
        {
            cout <<"NO"<<endl;
            return 0;
        }
    }
    cout <<"YES"<<endl;
    return 0;
}


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

int main(void) {
    int input, ans = 0, flag;
    cin >> input;

    vector<int> side(input);
    for (int i = 0; i < input; i++) {
        cin >> side.at(i);
    }

    sort(side.begin(), side.end());
    reverse(side.begin(), side.end());

    vector<int> num;
    num.push_back(0);
    num.push_back(1);
    for (int i = 0; i < input; i++) {
        flag = 0;
        for (int j = i + 1; j < input; j++) {
            for (int k = j + 1; k < input; k++) {
                if (side.at(i) < side.at(j) + side.at(k) && side.at(j) < side.at(k) + side.at(i) && side.at(k) < side.at(i) + side.at(j)) {
                    ans++;
                    int temp = num[0];
                    int temp2 = num[1];
                }
                else {
                    break;
                    flag++;
                }
            }
            if (flag != 0) {
                break;
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3452
#include<stdio.h>
int main()
{
    int b,c,d,e,f,g,h;
    char a[200][200];
    while(scanf("%d%d",&b,&c)!=EOF)
    {
        getchar();
        for(d=0;d<b;d++)
        {
            for(e=0;e<c;e++)
            {
            scanf("%c",&a[d][e]);
            }
            
            getchar();
        }
        
        for(f=0;f<c+2;f++)
        printf("#");
        printf("\n");
        for(g=0;g<b;g++)
        {
            printf("#");
            for(h=0;h<c;h++)
            {
            printf("%c",a[g][h]);
            }
            printf("#\n");
        }
        for(f=0;f<c+2;f++)
        printf("#");
        printf("\n");
    }
    return 0;
}

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

long long calcGCD(long long x, long long y)
{
    if (x < y)
    {
        swap(x, y);
    }
    long long remainder = x % y;
    while (remainder != 0)
    {
        x = y;
        y = remainder;
        remainder = x % y;
    }
    return y;
}

long long calcLCM(long long x, long long y)
{
    if (x < y)
    {
        swap(x, y);
    }
    long long ret = x / calcGCD(x, y);
    return ret * y;
}

long long f(long long a, long long b, long long x)
{
    long long minimum = a / x;
    if (a % x != 0)
    {
        minimum++;
    }

    long long maximum = b / x;
    return maximum - minimum + 1;
}

int main()
{
    long long A, B;
    cin >> A >> B;

    long long C, D;
    cin >> C >> D;

    long long n_C = f(A, B, C);
    long long n_D = f(A, B, D);
    long long n_CD = f(A, B, calcLCM(C, D));
    cout << (B - A + 1) - (n_C + n_D - n_CD) << endl;
}


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

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int x; cin >> x;
    cout << (x >= 30 ? "Yes" : "No") << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Stirbul
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAXBC solver = new CAXBC();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAXBC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();

            int count = 0;

            for (int i = 1; i < n; ++i) {
                for (int j = 1; j < n; ++j) {
                    if (i * j >= n) {
                        break;
                    }
                    count++;
                }
            }

            out.println(count);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

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

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

    }
}



Measured memory_bytes: 26136
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main()
{
int n,c=0;
cin>>n;
vector<int>a(n);

for(int i=0;i<n;i++)
{
    cin>>a[i];
}
for(int i=0;i<n;i++)
{
    for(int j=i+1;j<n;j++)
        {
    for(int k=j+1;k<n;k++)
    {
        if(a[i]+a[j]<=a[k] || a[i]+a[k]<=a[j] || a[j]+a[k]<=a[i])
        continue;
        else if(a[i]==a[j] || a[j]==a[k] || a[k]==a[i]) continue;
        else c++;
    }
        }
}
cout<<c;
   return 0;
 }



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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}

lli pow1(lli x, lli y) {
  lli ans = 1;
  while(y>0) {
    if(y&1LL) ans = (ans * x) % MOD;
    x = (x*x) % MOD;
    y = y>>1;
  }
  return ans;
}

lli inv(lli x) {
  return pow1(x, MOD-2);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  preprocess();
  int n, k; cin>>n>>k;
  vi ar(n);
  rep(i,0,n) cin>>ar[i];
  vi l(n), r(n);
  lli ans = 0;
  rep(i,0,n) {
    rep(j,i+1,n) {
      if(ar[i]>ar[j]) ans++;
    }
    rep(j,0,n) {
      if(ar[i]>ar[j]) l[i]++;
      else if(ar[i]<ar[j]) r[i]++;
    }
  }
  ans = ans * k;
  debug(l, r);
  lli fans = 0;
  rep(i,0,n) {
    fans += (l[i] * 1LL * ((((k-1)*1LL*k)/2) % MOD)) %MOD;
    fans %= MOD;
    fans += (r[i] * 1LL * ((((k-1)*1LL*k)/2) % MOD)) % MOD;
    fans %= MOD;
  }
  ans %= MOD;
  ans += fans*inv(2);
  ans %= MOD;
  cout<<ans<<endl;
}



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

int main(){

  int A1, A2, A3, sum=0;
  cin >> A1 >> A2 >> A3;

  sum = A1+A2+A3;

  if (sum>=22){
    cout << "bust" << endl;
  }
  else {
    cout << "win" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
namespace IO
{
    const int __S=(1<<20)+5;char __buf[__S],*__H,*__T;
    inline char getc()
    {
        if(__H==__T) __T=(__H=__buf)+fread(__buf,1,__S,stdin);
        if(__H==__T) return -1;return *__H++;
    }
    template <class __I>inline void read(__I &__x)
    {
        __x=0;int __fg=1;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1,__c=getc();
        while(isdigit(__c)) __x=__x*10+__c-'0',__c=getc();
        __x*=__fg;
    }
    inline void readd(double &__x)
    {
        __x=0;double __fg=1.0;char __c=getc();
        while(!isdigit(__c)&&__c!='-') __c=getc();
        if(__c=='-') __fg=-1.0,__c=getc();
        while(isdigit(__c)) __x=__x*10.0+__c-'0',__c=getc();
        if(__c!='.'){__x=__x*__fg;return;}else __c=getc();
        double __t=1e-1;while(isdigit(__c)) __x=__x+1.0*(__c-'0')*__t,__t=__t*0.1,__c=getc();
        __x=__x*__fg;
    }
    inline void reads(char *__s,int __x)
    {
        char __c=getc();int __tot=__x-1;
        while(__c<'a'||__c>'z') __c=getc();
        while(__c>='a'&&__c<='z') __s[++__tot]=__c,__c=getc();
        __s[++__tot]='\0';
    }
    char __obuf[__S],*__oS=__obuf,*__oT=__oS+__S-1,__c,__qu[55];int __qr;
    inline void flush(){fwrite(__obuf,1,__oS-__obuf,stdout);__oS=__obuf;}
    inline void putc(char __x){*__oS++ =__x;if(__oS==__oT) flush();}
    template <class __I>inline void print(__I __x)
    {
        if(!__x) putc('0');
        if(__x<0) putc('-'),__x=-__x;
        while(__x) __qu[++__qr]=__x%10+'0',__x/=10;
        while(__qr) putc(__qu[__qr--]);
    }
    inline void prints(const char *__s,const int __x)
    {
        int __len=strlen(__s+__x);
        for(int __i=__x;__i<__len+__x;__i++) putc(__s[__i]);
    }
    inline void printd(long double __x,int __d)
    {
        long long __t=(long long)floor(__x);print(__t);putc('.');__x-=(double)__t;
        while(__d--)
        {
            long double __y=__x*10.0;__x*=10.0;
            int __c=(int)floor(__y+1e-9);if(__c==10) __c--;
            putc(__c+'0');__x-=floor(__y);
        }
    }
    inline void el(){putc('\n');}inline void sp(){putc(' ');}
}using namespace IO;
int n,a[100005],b[100005],c[100005],mx1,mx2;
vector<pair<int,int> >f,g;
bool cmp(pair<int,int> a,pair<int,int> b){return a.first>b.first;
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	for(int i=1;i<=n;i+=2) b[a[i]]++;
	for(int i=2;i<=n;i+=2) c[a[i]]++;
	for(int i=1;i<=100000;i++) if(b[i]) f.push_back(make_pair(b[i],i));
	for(int i=1;i<=100000;i++) if(c[i]) g.push_back(make_pair(c[i],i));
	f.push_back(make_pair(0,0));g.push_back(make_pair(0,0));
	sort(f.begin(),f.end(),cmp);sort(g.begin(),g.end(),cmp);
	if(f[0].second==g[0].second)
	{
		int ans;
		ans=max(f[0].first+g[1].first,f[1].first+f[0].first);
		cout<<n-ans;
	}
	else cout<<n-f[0].first-g[0].first;
}


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

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

        if(N == 0)
        {
                cout << '0' << endl;
                return 0;
        }

        vector<char> ans;

        while(N != 0)
        {
                int r = N % 2;
                if(r == -1) r = 1;

                char c = (char)('0' + r);
                ans.push_back(c);

                N = (N - r) / (-2);
        }

        reverse(ans.begin(), ans.end());

        for(int i = 0; i < ans.size(); i++)
        {
                cout << ans[i];
        }
        cout << endl;

        return 0;
}

Measured memory_bytes: 256
//                                               KEEP GRINDING
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>   new_data_set;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define int long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define precise(i) fixed << setprecision(10) << i
#define f(i,a,b) for(int i=a;i<b;++i)

#define endl '\n'
#define debug cout<<"\n========================================\n";
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;

#define all(a) a.begin(),a.end()
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define PQ priority_queue
#define mx(a) *max_element(a)
#define mn(a) *min_element(a) 
#define LB lower_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS >= OUR VALUE 
#define UB upper_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS > OUR VALUE 

#define fr first
#define sc second

#define MAXN 500000
#define INF 9223372036854775807
signed main(){
    fastio;
    int N,sum=0;
    cin>>N;
    map<int,int> map;
    f(i,0,N){
    	int x;
    	cin>>x;
    	map[x]++;
    	sum+=x;
	}
	int Q;
	cin>>Q;
	while(Q--){
		int B,C;
		cin>>B>>C;
		if(map.count(B)){
			sum+=map[B]*(C-B);
			map[C]+=map[B];
			map.erase(B);
		}
		cout<<sum<<endl;
	}
}

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

int main() {
  int N; cin >> N;
  using P = pair<string, int>;
  vector<P> A;
  map<P,int> mp;
  rep(i, 0, N) {
    string S;
    int P;
    cin >> S >> P;
    A.push_back({S, -P});
    mp[{S, -P}] = i + 1;
  }
  sort(A.begin(), A.end());
  rep(i, 0, N) {
    cout << mp[A[i]] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;

class Process {
public:
    string name;
    int time;
};

int main() {
    int n, q, t = 0;
    cin >> n >> q;
    string name[n];
    int time[n];
    queue<Process> P;
    Process p;
    for (int i = 0; i < n; i++) {
        cin >> name[i] >> time[i];
        p.name = name[i];
        p.time = time[i];
        P.push(p);
    }

    while (!P.empty()) {
        p = P.front();
        if (p.time > q) {
            t += q;
            p.time -= q;
            P.pop();
            P.push(p);
        } else {
            t += p.time;
            P.pop();
            cout << p.name << " " << t << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 6768
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N){
  for (int i = 1; i <= 9; i++) {
    if (N%i == 0 && N/i <= 9) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1001;
int dp[MAX_N];
//int h[MAX_N * 2], r[MAX_N * 2];
// ???????????????

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	while(cin >> n && n != 0){
	//cin >> n;
	vector<P> vec;
	
	for(int i = 0; i < n; ++i){
		int h, r;
		cin >> h >> r;
		vec.push_back(P(h, r));
		//cin >> h[i] >> r[i];
	}
	
	int m;
	cin >> m;
	
	for(int i = n; i < n + m; ++i){
		int h, r;
		cin >> h >> r;
		vec.push_back(P(h, r));
		//cin >> h[i] >> r[i];
	}
	
	sort(vec.begin(), vec.end());
	
	for(int i = 0; i < n + m; ++i){
		//cout << vec[i].first << " " << vec[i].second << endl;
		dp[i] = 1;
	}
	
	int ans = 0;
	for(int i = 0; i < n + m; ++i){
		for(int j = 0; j < n + m; ++j){
			if(vec[i].first > vec[j].first && vec[i].second > vec[j].second){
				dp[i] = max(dp[i], dp[j] + 1);
			}
			ans = max(ans, dp[i]);
		}
	}
	
	cout << ans << endl;
	}
}

Measured memory_bytes: 1212
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
N = ir()
A = np.array(lr(), np.int64)
answer = 0
limit = int(A.max()).bit_length()
for i in range(limit):
    B = (A >> i) & 1
    x = np.count_nonzero(B)
    y = N - x
    add = (x*y) * 2 ** i % MOD
    answer += add

print(answer%MOD)


Measured memory_bytes: 48784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int d,t,s,time;
  cin >> d >> t >> s;
  string ans;
  if(d%s != 0){
    time = d/s+1;
  }else{
    time = d/s;
  }
  if(time <= t){
    ans = "Yes";
  }else{
    ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
//
//  station_bus.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <math.h>
typedef long long ll;
int main(int argc, const char* argv[]) {
  std::string s;
  std::cin >> s;

  if (s[0]!=s[1] || s[0]!=s[2]) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }


}

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

int main() {
    int N;
    cin >> N;
    if (N < 105) {
        cout << 0 << endl;
    }
    else if(N < 135) {
        cout << 1 << endl;
    }
    else if (N < 165) {
        cout << 2 << endl;
    }
    else if (N < 189) {
        cout << 3 << endl;
    }
    else if (N < 195) {
        cout << 4 << endl;
    }
    else {
        cout << 5 << endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Console.WriteLine(Solve() ? "Yes" : "No");
		Out.Flush();
	}
	bool Solve()
	{
		List<int[]> c = new List<int[]>();
		for (var i = 0; i < 3; i++) c.Add(G);
		int[] a = new int[3], b = new int[3];
		a[1] = c[1][0] - c[0][0];
		a[2] = c[2][0] - c[0][0];
		for (var i = 0; i < 3; i++) b[i] = c[0][i];
		for (var x = 0; x < 3; x++) for (var y = 0; y < 3; y++) if (c[x][y] != a[x] + b[y]) return false;
		return true;
	}
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;
int n,k,a,amax,key;
inline int gcm(int a, int b) {
	int result = a;
	int k = 0;
	int n = b;
	do {
		k = result % n;
		result = n;
		n = k;
	} while(k != 0);
	return result;
}
main(){
    cin>>n>>k;
    bool p=1,pp=1;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>amax)amax=a;
        if(a==k){
          cout<<"POSSIBLE"<<endl;
          return 0;
        }
        if(i==0){
            key=a;
            continue;
        }
        key=gcm(key,a);
    }
    if(k%key!=0)p=0;
    if(amax<=k)pp=0;
    if(p and pp)cout<<"POSSIBLE"<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

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

int main()
{
  ll N;
  cin >> N;
  vector<P> A(N);
  REP(i,N) cin >> A[i].first >> A[i].second;
  vector<ll> f0(N);
  vector<ll> f1(N);
  ll MAX0=-INF,MAX1=-INF,MIN0=INF,MIN1=INF;
  REP(i,N){
    f0[i]=A[i].fi-A[i].se;
    MAX0=max(MAX0,f0[i]);
    MIN0=min(MIN0,f0[i]);
    f1[i]=A[i].fi+A[i].se;
    MAX1=max(MAX1,f1[i]);
    MIN1=min(MIN1,f1[i]);
  }

  cout << max(MAX0-MIN0,MAX1-MIN1) << endl;
}


Measured memory_bytes: 9536
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
ll mod = 1e9+7;
ll dp[2001][2001];
void add(ll &x,ll y){
	x+=y;
	x%=mod;
}
int N,M,K;
int main(){
	cin>>N>>M>>K;
	int D=(N+M-1)/(K-1);
	dp[0][0]=1;
	ll ans=0;
	rep(d,D){
		rep(a,N+1){
			int b=(K-1)*d-a;
			if(!(0<=b&&b<=M)) continue;
			rep(k,K){			//K-1 (continue)
				int na=a+k,nb=b+(K-1-k);
				if(na>N||nb>M) continue;
				add(dp[na][nb],dp[a][b]);
			}
			rep1(k,K-1){			//K (end)
				int na=a+k,nb=b+(K-k);
				if(na<=N&&nb<=M&&(N-na)%(K-1)==0&&(M-nb)%(K-1)==0) add(ans,dp[a][b]);
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 31488