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

int main() {
  int N, K, R, S, P;
  string T;
  cin >> N >> K >> R >> S >> P >> T;

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i >= K && T.at(i) == T.at(i - K)) T.at(i) = ' ';
    else ans += (T.at(i) == 'r') ? P : (T.at(i) == 's') ? R : S;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    int total = abs(0 - A[0]);
    for (int i = 1; i < N; ++i) {
        total += abs(A[i - 1] - A[i]);
    }
    total += abs(A[N - 1] - 0);

    for (int i = 0; i < N; ++i) {
        if (i == 0) {
            cout << total - abs(A[i] - 0) - abs(A[i] - A[i + 1]) + abs(0 - A[i + 1]) << endl;
        }
        else if (i == N - 1) {
            cout << total - abs(A[i] - A[i - 1]) - abs(A[i] - 0) + abs(A[i - 1] - 0) << endl;
        }
        else {
            cout << total - abs(A[i] - A[i - 1]) - abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i + 1]) << endl;
        }
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a=0,b=0;
  cin>>a>>b;
  int count=0;
  int poket=1;
  while(poket<b){
    poket--;
    poket+=a;
    count++;
  }
  cout<<count<<endl;
}


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

int main() {
  int K, X;
  cin >> K >> X;

  int s = X - K + 1;
  int e = X + K - 1;
  if(s < -1000000) {
    s = -1000000;
  }
  if(e > 1000000) {
    e = 1000000;
  }

  cout << s;
  for(int i = s + 1; i <= e; i++) {
    cout << " " << i;
  }
  cout << endl;
}


Measured memory_bytes: 256
using System;

class Atcoder82
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int x = int.Parse(input[2]);

        if (x >= a && x <= (a + b))
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");
    }
}

Measured memory_bytes: 11092
N=int(input())
C=list(map(int,input().split()))
mod=10**9+7
C.sort(reverse=True)
C=[0]+C
ans=0
for k in range(1,N+1):
    num=(C[k]*pow(2,2*N-2,mod)%mod)*(k+1)%mod
    ans=(ans+num)%mod 
print(ans)

Measured memory_bytes: 89292
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<ll> factorization(ll a) {
    vector<ll> ret;
    for (ll i = 1; i * i <= a; i++) {
        if (a % i == 0) {
            ret.push_back(i);
            if (i * i != a) ret.push_back(a / i);
        }
    }
    return ret;
}
/* function */
/* main */
int main(){
    ll a;
    cin >> a;
    vector<ll> f = factorization(a);
    sort(f.rbegin(), f.rend());
    ll ans = 0;
    int l = f.size();
    for (int i = 0; i < l/2; i++) {
        int j = l - 1 - i;
        if (f[i] - 1 != f[j]) ans += f[i] - 1;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3484
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (k, s) = (v[0], v[1]);
    let mut ans = 0;
    for x in 0..k + 1 {
        for y in 0..k + 1 {
            let z = s - x - y;
            if z < 0 || z > k {
                continue;
            }
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++){
    cin >> v[i];
  }
  vector<int> c(n);
  for(int i=0; i<n; i++){
    cin >> c[i];
  }
  
  int sum=0;
  
  for(int i=0; i<n; i++){
    if(v[i] >= c[i]){
      sum += v[i] - c[i];
    }
  }
  
  cout << sum << endl;
	return 0;
}


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 10001
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define int long long
const double PI = acos(-1);
typedef pair<int, int> P;

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

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) //bit計算
{
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) //素数判定
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}
vector<int> divisor(int n) //約数列挙
{
    vector<int> ret;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i - 1);
            if (i * i != n)
            {
                ret.push_back((n / i) - 1);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return (ret);
}

signed main()
{
  int A,B;
  cin >> A >> B;
  if(A == 1){
  	A = 14;
  }
  if(B == 1){
  	B = 14;
  }
  if(A > B){
    cout << "Alice" << endl;
  }else if(A < B){
  	cout << "Bob" << endl;
  }else{
  	cout << "Draw" << endl;
  }
}


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

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

  int ans = 0;

  for (int i = 0; i < N; i++) {
    if (i == 0 && (i + L) > 0) continue;
    else if (i == N - 1 && (i + L) < 0) continue;
    else ans += i + L;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

const int N = 3030;
const int MOD = 998244353;

int n,s;
int a[N];
int dp[N][N];

signed main(){
   IOS;
   cin >> n >> s;
   for(int i = 0; i < n; ++i){
      cin >> a[i+1];
   }
   dp[0][0] = 1;
   for(int i = 1; i <= n; ++i) { 
      for(int j = 0; j < N; ++j) {
         if(dp[i-1][j]) {
            if(j + a[i] < N) {
               dp[i][j+a[i]] = (dp[i][j+a[i]] + dp[i-1][j]) % MOD;
            }
            dp[i][j] = (2*dp[i-1][j] + dp[i][j])%MOD;
         }
      }
   }
   cout << dp[n][s] << '\n';
}

Measured memory_bytes: 74636
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    s = input()
    print('Yes' if s[2] == s[3] and s[4] == s[5] else 'No')
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var N = Console.ReadLine();
        var K = int.Parse(Console.ReadLine());

        var dp0 = Enumerable.Range(0, N.Length + 1).Select(_ => new long[K + 1]).ToArray();
        var dp1 = Enumerable.Range(0, N.Length + 1).Select(_ => new long[K + 1]).ToArray();
        var first = int.Parse(N[0].ToString());

        dp0[0][0] = 1;
        dp0[0][1] = first - 1;
        dp1[0][1] = 1;
        for (int i = 1; i < N.Length; i++)
        {
            var v = int.Parse(N[i].ToString());
            if (v == 0)
            {
                for (int k = 0; k <= K; k++)
                {
                    // uxxx -> uvxx
                    dp1[i][k] += dp1[i - 1][k];
                }
            }
            else
            {
                for (int k = 1; k <= K; k++)
                {
                    // uxxx -> uvxx
                    dp1[i][k] += dp1[i - 1][k - 1];
                }
            }

            // uxxx -> u(1~v-1)xx
            for (int k = 1; k <= K; k++)
            {
                dp0[i][k] += dp1[i - 1][k - 1] * Math.Max(0, v - 1);
            }
            // uxxx -> u0xx
            for (int k = 0; k <= K; k++)
            {
                if (v != 0)
                {
                    dp0[i][k] += dp1[i - 1][k];
                }
            }
            // duxxx->du1~9xx
            for (int k = 1; k <= K; k++)
            {
                dp0[i][k] += dp0[i - 1][k - 1] * 9;
            }
            // duxxx->du0xx
            for (int k = 0; k <= K; k++)
            {
                dp0[i][k] += dp0[i - 1][k];
            }
        }

        var pattern = dp0[N.Length - 1][K] + dp1[N.Length - 1][K];
        Console.WriteLine(pattern);
    }
}

Measured memory_bytes: 13396
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main() {
	int n;
	int k;
	cin>>n>>k;
	REP(i,k){
		int a,b;
		cin>>a>>b;
		int color=0;
		if(a>n/2)a=n-a+1;
		if(b>n/2)b=n-b+1;
		if(a+1<=b&&b<=n-a){
			color=a%3;
			if(color==0)color=3;
		}else{
			color=b%3;
			if(color==0)color=3;
		}
		assert(color!=0);
		cout<<color<<endl;
	}
}

Measured memory_bytes: 1160
n=int(input())
for i in range(n):
    x,y=map(int,input().split())
    lista=[[0 for i in range(y+1)] for j in range(x+1)]
    m=int(input())
    listb=[]
    if m!=0:
        for j in range(m):
            listc=list(map(int,input().split()))
            listb.append(listc)
    for i in range(1,x+1):
        if [i,0,i-1,0] in listb or [i-1,0,i,0] in listb:
          break
        lista[i][0]=1
    for i in range(1,y+1):
        if [0,i,0,i-1] in listb or [0,i-1,0,i] in listb:
          break
        lista[0][i]=1
    for i in range(1,y+1):
        for j in range(1,x+1):
            if ([j,i,j,i-1] in listb or [j,i-1,j,i] in listb) and ([j,i,j-1,i] in listb or [j-1,i,j,i] in listb):
                lista[j][i]=0
            elif ([j-1,i,j,i] in listb or [j,i,j-1,i] in listb):
                lista[j][i]=lista[j][i-1]
            elif ([j,i-1,j,i] in listb or [j,i,j,i-1] in listb):
                lista[j][i]=lista[j-1][i]
            else:
                lista[j][i]=lista[j-1][i]+lista[j][i-1]
    if lista[x][y]==0:
      print("Miserable Hokusai!")
    else:
      print(lista[x][y])


Measured memory_bytes: 5620
N=int(input())
X_List=list(map(int,input().split()))

#print(X_List)


Power_list = []
SUM = 0
for i in range(N):
    SUM += X_List[i]

Ave = round(SUM / N)


Consume = 0
for j in range(N):
    diff = (X_List[j] - Ave)
    Consume += diff * diff
    

print(Consume)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		scan.close();
		int n = Integer.parseInt(s);
		if(n==25){
			System.out.println("Christmas");
		}else if(n==24){
			System.out.println("Christmas Eve");
		}else if(n==23){
			System.out.println("Christmas Eve Eve");
		}else if(n==22){
			System.out.println("Christmas Eve Eve Eve");
		}else{
			System.out.println("Invalid input");
		}
	}
}

Measured memory_bytes: 21076
#include<iostream>
using namespace std;
int main()
{
    string str1,str2;
    unsigned int len_1,len_2,i,phase_1=0,phase_2=1;
    cin>>str1>>str2;
    for(len_1=0;str1[len_1]!='\0';len_1++)
    for(len_2=0;str2[len_2]!='\0';len_2++)
    if(len_1+1 == len_2) phase_1=1;
    for(i=0;i<len_1;i++){
        if(str1[i]!=str2[i]){
            phase_2=0;
            break;
        }
    }
    if(phase_1==1 && phase_2==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3572
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;

const int maxn = 2020;

int n,m,tr;
ll d[maxn],d1,d2;

struct E{
	int from,to;
	ll cost;
}e[maxn]; 

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
	memset(d,0x3f,sizeof(d)); 
	tr=1;
	n=read(),m=read(); 
	for(int i=1;i<=m;i++){
		e[i].from = read();
		e[i].to = read();
		e[i].cost = read();
		e[i].cost *= -1;
	}
	
	d[1] = 0 ;
//	for(int i=1;i<=m;i++) printf("%lld ",e[i].cost); printf("\n");
	
	for(int i=1;i<=n-1;i++){
		for(int j=1;j<=m;j++){
			if(d[e[j].from] + e[j].cost < d[e[j].to]) 
				d[e[j].to] = d[e[j].from] + e[j].cost;
		}
	}
	d1 = d[n];
	
	for(int i=1;i<=n-1;i++){
		for(int j=1;j<=m;j++){
			if(d[e[j].from] + e[j].cost < d[e[j].to]) 
				d[e[j].to] = d[e[j].from] + e[j].cost;
		}
	}
	
	d2 = d[n];

	if(d1 == d2){
		printf("%lld\n",d[n]*(-1));
	}else{
		printf("inf\n");
	}
	
	return 0;
}

Measured memory_bytes: 3744
N = int(input())
a = list(map(int, input().split()))
fac0 = 0
fac2 = 0
for x in a:
    if x % 2 == 1:
        fac0 += 1
    elif x % 4 == 0:
        fac2 += 1
if fac0 <= fac2 or fac0 == fac2 + 1 and 2 * fac2 + 1 == N:
    result = "Yes"
else:
    result = "No"
print(result)

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

int main(){

    int N,M;cin >> N >> M;
    int p[M];
    string S[M];
    for(int i = 0; i < M; i++){cin >> p[i] >> S[i]; p[i]--;}

    bool Q[N]; fill(Q, Q+N, 0);
    int AC = 0;
    int PE = 0;
    int tmp_PE[N]; fill(tmp_PE, tmp_PE+N, 0);

    for(int i = 0; i < M; i++){

        if(!Q[p[i]] && S[i] == "AC"){Q[p[i]] = 1; PE += tmp_PE[p[i]]; AC++;}
        else if(!Q[p[i]] && S[i] == "WA"){tmp_PE[p[i]]++;}
    }

    cout << AC << " " << PE << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  string s;
  cin >> s;
  bool b = 1;
  if(s.size() % 2 == 1) b = 0;
  else {
    rep(i, s.size()){
      if(i % 2 == 0 && s[i] != 'h'){
        b = 0;
        break;
      }
      if(i % 2 == 1 && s[i] != 'i'){
        b = 0;
        break;
      }
    }
  }
  if(b) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
/*
int c = (int)(S[i] - '0');
AA.push_back(c);
*/
using namespace std;
int main()
{
	int N;
	cin >> N;

	double NN=N;

	if(N%2==0){
		cout << (N/2)/NN << endl;
	}
	else{
		cout << ((N/2)+1)/NN << endl;
	}

	
}

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

int main() {
int n,k;
  int seki=1;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    if(i==0){
      seki*=k;}
    else{
    seki*=k-1;}
  }
  
    cout << seki<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++){
    cin>>arr[i];
  }
  int k=0;
  for(int i=0;i<n;i++){
    if(arr[i]!=i+1)
      k++;
  }
  if(k<=2)
    cout<<"YES\n";
  else
    cout<<"NO\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int calc_nod(long long n) {
	if (n == 0) {
		return 1;
	}
	int res = 0;
	while (n != 0) {
		n /= 10;
		++res;
	}
	return res;
}

int main(void) {
	long long N;
	cin >> N;
	bool find = false;
	for (int i = sqrt(N); !find && i > 0; --i) {
		if (N%i == 0) {
			cout << calc_nod(N/i) << endl;
			find = true;
		}
	}
	return 0;
}


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

int main() {
	int H, W, N; cin >> H >> W >> N;
	int r, c; cin >> r >> c;
	string S, T; cin >> S >> T;
	int uj=1, dj=H, lj=1, rj=W;
	bool flag=true;
	for(int i=N-1; i>=0; --i){
	    if(T[i]=='U') if(dj<H) ++dj;
	    if(T[i]=='D') if(uj>1) --uj;
	    if(T[i]=='L') if(rj<W) ++rj;
	    if(T[i]=='R') if(lj>1) --lj;
	    if(S[i]=='U') ++uj;
	    if(S[i]=='D') --dj;
	    if(S[i]=='L') ++lj;
	    if(S[i]=='R') --rj;
	    flag=(flag && uj<=dj && lj<=rj);
	    // cout << uj << ' ' << dj << ' ' << lj << ' ' << rj << endl;
	}
	if(uj<=r && r<=dj && lj<=c && c<=rj && flag) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 900
public class Main {
	public static void main(String[] args){
		
		int i;
		int j;
		int result;


		for (i=1; i<=9 ; i++){
			for ( j =1; j <= 9; j++){
			result=	i * j;
			System.out.println(+i+ "x" +j+"=" + result );

			}
		}

	}

}

Measured memory_bytes: 24100
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
using namespace std;
#define MAXH 101
#define MAXW 101
#define INF 1000
#define MAXN 100001

long long N, M;
int A[MAXN];

int main(){
    cin >> N >> M;
    printf("%lld\n", min(N % M, abs(N % M - M)));
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
long long int gcd(long long int l, long long int r) {
	if (l > r)return gcd(r, l);
	else {
		if (r%l) {
			return gcd(l, r%l);

		}
		else {
			return l;
		}
	}
}

map<long long int, int>soinnsuu(long long int a) {
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;


	return ans;
}

int main(){
	long long int p,q;cin>>p>>q;
	long long int num=q/(gcd(p,q));
	auto mp=soinnsuu(num);

	long long int ans=1;
	for (auto m: mp) {
		int k=1;
		for(int j=0;j<k;++j)ans*=m.first;
	}
	cout<<ans<<endl;
	return 0;
}




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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = k; i < (int)(n); i++)

#define vi vector<int>
#define pb push_back
#define mp make_pair

typedef long long ll;

int main() {
    int n;
    cin >> n;
    int a[110];
    rep(i, n) cin >> a[i];
    int ans = 0;
    int b = 1;
    rep(i, n - 1) {
        if (a[i] == a[i + 1]) {
            b++;
        } else {
            ans += b / 2;
            b = 1;
        }
    }
    ans += b / 2;
    cout << ans << endl;
    return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 998244353;
const ll LINF = 1e18;

// 参考: https://atcoder.jp/contests/agc037/submissions/6955850

void add(ll& a, ll b){
  a = (a+b) % MOD;
}

void mul(ll& a, ll b){
  a = (a*b) % MOD;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  string s; cin>>s;
  
  ll ans=1;
  ll r=0,g=0,b=0;
  rep(i,n*3){
    if(s[i]=='R'){
      if(g==0 && b==0){
        r++;
      }else if(g!=0 && b==0){
        if(g>r) mul(ans,g-r);
        r++;
      }else if(g==0 && b!=0){
        if(b>r) mul(ans,b-r);
        r++;
      }else{
        mul(ans,min(g,b));
        g--,b--;
      }
    }else if(s[i]=='G'){
      if(r==0 && b==0){
        g++;
      }else if(r!=0 && b==0){
        if(r>g) mul(ans,r-g);
        g++;
      }else if(r==0 && b!=0){
        if(b>g) mul(ans,b-g);
        g++;
      }else{
        mul(ans,min(r,b));
        r--,b--;
      }
    }else{
      if(r==0 && g==0){
        b++;
      }else if(r!=0 && g==0){
        if(r>b) mul(ans,r-b);
        b++;
      }else if(r==0 && g!=0){
        if(g>b) mul(ans,g-b);
        b++;
      }else{
        mul(ans,min(r,g));
        r--,g--;
      }
    }
  }
  
  // 2つのボールの分配方法が異なるとは、ある人が存在して、その人が受け取ったボールの集合が異なることを指します
  // 上記の制約から、求めるのはn個の区間への分割ではなく、区別あるn人への分配の仕方である
  // よって求めたn分割の仕方の通り数に n! を掛ける必要がある
  reps(i,n){
    mul(ans,i);
  }
  
  cout<<ans<<endl;
  
}

Measured memory_bytes: 720
from math import ceil

n, a, b = map(int, input().rstrip("\n").split(" "))

h = []
total = 0
for i in range(n):
  value = int(input()) 
  h.append(value)
def solve(a, b):
  diff = a - b
  total = sum(h)

  h.sort()

  right = ceil(total // b)  + len(h)
  center = right // 2
  left = 0

  def check(b_count, h):
     b_total = b * b_count
     #print("b_total",b_total)
     #print("diff",diff)
     count = 0
     for value in h:
       remain = value - b_total
       #print("remain",remain)
       if remain > 0:
         count += ceil( remain  /  diff)
     return count - b_count

  result = 0
  while left < right:

     center = (left + right) // 2
     result = check(center, h)
     #print(left,right, result)
     if result < 0:
       right = center 
     elif result > 0:
       left= center + 1
     if result == 0:
       break
  center = (left + right) // 2
  #print(left,center,right)
  return center

print(solve(a, b))
#for b in range(1,a):
#  print(a, b ,"=", solve(a, b))


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

const int MOD=1000000007;

int main(){
  int i,j,cnt=0;
  int n,m;
  cin>>n>>m;
  int a[m];
  for(i=0;i<m;i++)cin>>a[i];
  ll p[n+1];
  for(i=0;i<=n;i++)p[i]=1;
  for(i=0;i<m;i++)p[a[i]]=0;
  for(i=1;i<=n;i++){
    if(p[i]!=0){
      if(i!=1)p[i]=(p[i-1]+p[i-2])%MOD;
      else p[i]=p[i-1];
    }
  }
  cout<<p[n];
}

Measured memory_bytes: 1408
#include <stdio.h>

int main()
{
	const int N = 100000;

	int n;
	long long a[N];
	long long x[N];

	scanf("%d", &n);

	for(int i = 0; i < n; ++i)
	{
		scanf("%lld", &a[i]);
	}

	int sign = 1;
	x[0] = 0;
	for(int i = 0; i < n; ++i)
	{
		x[0] += a[i] * sign;
		sign *= -1;
	}

	for(int i = n - 1; i > 0; --i)
	{
		x[i] = 2 * a[i] - x[(i + 1) % n];
	}

	printf("%lld", x[0]);
	for(int i = 1; i < n; ++i)
	{
		printf(" %lld", x[i]);
	}
	printf("\n");
}

Measured memory_bytes: 2816
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int b[N];
int a[N];
int par[N];
vector < int > g[N];
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	shuffle(permutation.begin(), permutation.end(), rng);

ll dp[N];
ll ndp[N];

ll inv[N];
int sz[N];
ll f[N];

ll bpow (ll a, ll b) {
	ll res = 1;
	while(b > 0) {
		if (b&1) res = (res*a) % mod;
		a = (a*a) %mod;
		b/=2;
	}
	return res;
}

ll C (int n, int k) {
	return (f[n] * inv[k] % mod) * inv[n-k] % mod;
}

void dfs (int v, int pr = 0) {
	sz[v] = 1;
	dp[v] = 1;

	for (auto to : g[v]) {
		if(to != pr) {
			par[to] = v;
			dfs(to, v);
			dp[v] *= dp[to];
			dp[v] %= mod;

			dp[v] *= inv[sz[to]];
			dp[v] %= mod;
			sz[v] += sz[to];
		}
	}
	ndp[v] = 1;
	dp[v] *= f[sz[v]-1];
	dp[v] %= mod;
}

void calc (int v, int pr = 0) {
	if (pr) {
		dp[v] = (dp[pr] * sz[v] % mod) * bpow(n-sz[v], mod-2) % mod;
	}
	for (auto to : g[v]) {
		if (to != pr) {
			calc(to, v);
		}
	}
}

int main () {
	SpeedForce;
	cin >> n;
	for (int i = 1; i < n; ++i) {
		cin >> a[i] >> b[i];
		g[a[i]].pb(b[i]);
		g[b[i]].pb(a[i]);
	}
	f[0] = 1;
	for (int i = 1; i <= n; ++i) {
		f[i] = (f[i-1] * (ll)i) % mod;
	}
	inv[0] = inv[1] = 1;
	for (int i = 2; i <= n; ++i) {
		inv[i] = ((mod - mod/i) * (ll)inv[mod%i]) % mod;
	}
	for (int i = 2; i <= n; ++i) {
		inv[i] = (inv[i-1] * inv[i]) % mod;
	}

	dfs(1);
	calc(1);

	for (int i = 1; i <= n; ++i) {
		cout << dp[i] << '\n';	
	}

	return Accepted;
}

// B...a

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

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*Combination set*/
#define mod 1000000007
#define maxcomb 3000/*大きいものを求めるときはここを変える*/
vector<long long> fc(maxcomb+1);
vector<long long> ifc(maxcomb+1);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}
void Conb(){
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<maxcomb;i++){
        fc[i+1] = fc[i]*(i+1)%mod;//n!(mod)
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;//k!^{M-2} (mod)
    }
}
unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    Conb();
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}
/*Combination set ここまで*/

/*ここから*/
int main() {
    int N;
    cin >> N;
    ll count=0;
    vector<ll> seq(N,0);
    unordered_map<string,int> mp;
    ull index=0;
    for(int i=0;i<N;i++){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        auto itr = mp.find(s);
        if(itr!=mp.end()){

            int in = mp[s];
            count+=seq[in];
            seq[in]++;        
        }else{
            mp[s] = index;
            seq[index]++;
            index++;        
        }
        //cout << seq[i] << endl;
    }
    //cout << index << endl;
    /*for(int i=0;i<index;i++){
        cout << sl[i] << ":" << seq[i] << endl;
    }*/
    cout << count << endl;
    return 0;
}

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

int N, M;
vector<int> G[8];

int dfs(int s, int sum, vector<bool> v) {
    v[s] = true;
    int cnt = 0;
    sum++;
    if (sum == N) {
        return 1;
    }
    for (int i = 0; i < G[s].size(); i++) {
        int next = G[s][i];
        if (!v[next]) cnt += dfs(next, sum, v);
    }
    return cnt;
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<bool> v(N, false);
    cout << dfs(0, 0, v) << endl;
}

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

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

   if (a[a.length()-1] == b[0] && b[b.length()-1] == c[0]) {
       cout << "YES" << endl;
   } else {
       cout << "NO" << endl;
   }

}

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

typedef long long ll;

vector<ll> v[33];
string s, t;

int main(void)
{
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	ll i, next = 0, cnt = 0;

	cin >> s >> t;

	for (i = 0; i < s.size(); i++)
		v[s[i] - 'a'].push_back(i);

	for (i = 0; i < t.size(); i++)
	{
		ll what = t[i] - 'a';

		if (v[what].empty())
		{
			cout << -1;
			return 0;
		}

		int point = lower_bound(v[what].begin(), v[what].end(), next) - v[what].begin();

		if (point == v[what].size())
		{
			++cnt;
			next = v[what][0] + 1;
		}
		else
			next = v[what][point] + 1;
	}

	cout << cnt * (ll)s.size() + next;
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1'000'000'007;
// const ll MOD = 998244353;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

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

    string S;
    cin >> S;
    int ans = 0;
    if(S == "RRR")ans = 3;
    else if(S == "RRS" || S == "SRR"){
        ans = 2;
    }
    else if(S == "SSS"){
        ans = 0;
    }
    else{
        ans = 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n, m;
    cin(n);
    cin(m);

    vector<vector<ll>> to(n);
    rep2(i, m) {
        ll a, b;
        cin(a); cin(b);
        --a; --b;

        to[a].push_back(b);
        to[b].push_back(a);
    }

    queue<ll> q;
    q.push(0);

    vector<ll> reached(n);
    vector<ll> prev(n);

    while (!q.empty()) {
        ll f = q.front(); q.pop();

        for (ll i: to[f]) {
            if (reached[i]) continue;

            prev[i] = f + 1;
            reached[i] = true;
            q.push(i);
        }
    }

    print("Yes");
    rep3(i, 1, n) {
        print(prev[i]);
    }
    return 0;
}

Measured memory_bytes: 13572
#include <algorithm>
#include <iostream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

int __gcd(int x, int y) { if(!y) return x; return __gcd(y, x % y); }

#define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++)
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)

#define sag (k + k + 1)
#define sol (k + k)

#define type(x) __typeof(x.begin())

#define orta ((bas + son) >> 1)
#define sag (k + k + 1)
#define sol (k + k)

#define pb push_back
#define mp make_pair


#define nd second
#define st first

#define endl '\n'

typedef pair < int ,int > pii;

typedef long long ll;

const long long linf = 1e18+5;
int mod = (int) 1e9;
const int logN = 18;
const int inf = 1e9 + 9;

const int N = 1e5 + 5;

int k, n, t, x, y, dp[4005][4005][2], ans;
char c;

int get(int pipi, int x, int y, int x2, int y2) {
	return dp[x2][y2][pipi] - (y == 0 ? 0 : dp[x2][y - 1][pipi]) - (x == 0 ? 0 : dp[x - 1][y2][pipi]) + ((x == 0 || y == 0) ? 0 :  dp[x - 1][y - 1][pipi]);
}

int main(){
	scanf("%d %d", &n, &k);
	FOR(i, 1, n) {
		scanf("%d %d %c", &x, &y, &c);
		x %= k + k;
		y %= k + k;
		dp[x][y][c == 'B']++;
		dp[(x + 2*k) % (4*k)][(y + 2*k) % (4*k)][c == 'B']++;
		dp[(x + 2*k) % (4*k)][(y) % (4*k)][c == 'B']++;
		dp[(x) % (4*k)][(y + 2*k) % (4*k)][c == 'B']++;
	
	}

	FOR(pipi, 0, 1)
		FOR(x, 0, k + k + k + k - 1)
			FOR(y, 0, k + k + k + k - 1) {
				if(x + y == 0) continue;
				if(!x) dp[x][y][pipi] += dp[x][y - 1][pipi];
				else if(!y) dp[x][y][pipi] += dp[x - 1][y][pipi];
				else dp[x][y][pipi] += dp[x - 1][y][pipi] + dp[x][y - 1][pipi] - dp[x - 1][y - 1][pipi];
			}

	int ans = 0;

	FOR(i, 0, k + k - 1){//k + k - 1) {
		FOR(j, 0, k + k - 1){//k + k - 1) {
			ans = max(ans, get(0, i, j, i + k  - 1, j + k - 1) + get(0, i + k, j + k, i + k + k - 1, j + k + k - 1) + get(1, i + k, j, i + k + k  - 1, j + k - 1) + get(1, i, j + k, i + k - 1, j + k + k - 1));
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 125440
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int count(int a) {
  int res = 0;
  if (5 < a) {
    res += a / 5;
    if (a % 5 != 0) res += 1;
    return res;
  } else {
    return 1;
  }
}
int main() {
  int x; cin >> x;
  int save = x / 100;
  x %= 100;

  if (x == 0 || count(x) <= save) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
// 1 bubbleSort(A, N) // N ??????????´?????????? 0-????????????????????? A
// 2   flag = 1 // ????????£??\????´?????????¨??????
// 3   while flag
// 4     flag = 0
// 5     for j ??? N-1 ?????? 1 ?????§
// 6       if A[j] < A[j-1]
// 7         A[j] ??¨ A[j-1] ?????????
// 8         flag = 1

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int bubble_sort(vector<int>& a,int N) {
  int cnt = 0;
  int flag = 1;
  while(flag) {
    flag = 0;
    for(int j=N-1;j>0;j--) {
      if(a[j-1] > a[j]) {
        swap(a[j-1],a[j]);
        flag = 1;
        cnt++;
      }
    }
  }
  return cnt;
}

int main(void) {
  int N;
  vector<int> a;

  /* input */
  cin >> N;
  for(int i=0;i<N;i++) {
    int _t;
    cin >> _t;
    a.push_back(_t);
  }

  int cnt = bubble_sort(a,N);
  for(int i=0;i<N;i++) {
    cout << a[i] << (i+1==N ? "" : " ");
  }
  cout << endl;
  cout << cnt << endl;
}

Measured memory_bytes: 1224
//=================================
// Created on: 2018/09/21 23:10:49
//=================================
#include <iostream>
int main()
{
    constexpr int c[] = {-1, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;
    std::cin >> x >> y;
    std::cout << (c[x] == c[y] ? "Yes" : "No") << std::endl;
    return 0;
}


Measured memory_bytes: 256
/*

import "core"
import "procon"

fn main() {
  a := read_int()
  b := read_int()
  x := read_int()
  if (a > x) {
    println("NO")
  } elif (a + b >= x) {
    println("YES")
  } else {
    println("NO")
  }
}

main()

*/
#include "stdbool.h"
#include "stdint.h"
bool core_prelude_true;
bool core_prelude_false;
bool core_definitions_is_windows;
bool core_definitions_is_compiletime;
bool core_definitions_is_runtime;
bool core_definitions_is_jscodegen;
#include "math.h"
float core_math_M_PI;
#include "stdio.h"
void* core_pointer_nullGG_() {
void* core_pointer_tmpid39 = ((void*)(0));
return core_pointer_tmpid39;
}
void* core_pointer_null;
char* core_pointer_plusexclGcore_prelude_CharG_core_pointer_Ptr_core_prelude_Char__core_prelude_Int(char* core_pointer_p, int64_t core_pointer_i) {
char* core_pointer_tmpid40 = ((char*)((((int64_t)(core_pointer_p)) + core_pointer_i)));
return core_pointer_tmpid40;
}
char core_string_getGG_core_prelude_CString_core_prelude_Int(char* core_string_cs, int64_t core_string_i) {
char core_string_tmpid41 = (*(core_pointer_plusexclGcore_prelude_CharG_core_pointer_Ptr_core_prelude_Char__core_prelude_Int(((char*)(core_string_cs)), core_string_i)));
return core_string_tmpid41;
}
#include "string.h"
struct core_string_String {
char* p;
int64_t len;
};
char core_string_charGG_core_prelude_Int(int64_t core_string_c) {
char core_string_tmpid44 = ((char)(core_string_c));
return core_string_tmpid44;
}
char core_string_cr;
char core_string_lf;
#include "inttypes.h"
int64_t procon_read_intGG_() {
int64_t procon_ret;
scanf("%" PRId64, &procon_ret);
int64_t procon_tmpid65 = procon_ret;
return procon_tmpid65;
}
struct Array1024_core_prelude_Char { char data[1024]; };
bool procon_is_debug;
void a_mainGG_() {
int64_t a_a = procon_read_intGG_();
int64_t a_b = procon_read_intGG_();
int64_t a_x = procon_read_intGG_();
if ((a_a > a_x)) {
printf("%s", "NO");
;
;
printf("%s", "\n");
;
;
;
} else {if (((a_a + a_b) >= a_x)) {
printf("%s", "YES");
;
;
printf("%s", "\n");
;
;
;
} else {printf("%s", "NO");
;
;
printf("%s", "\n");
;
;
;
}}}

void flori_main() {
core_prelude_true = 1;
core_prelude_false = 0;
core_definitions_is_windows = 
#ifdef _WIN32
#define is_windows true
#elif _WIN64
#define is_windows true
#else
#define is_windows false
#endif
  is_windows;
core_definitions_is_compiletime = 
#ifdef FLORI_COMPILETIME
#define is_compiletime true
#else
#define is_compiletime false
#endif
  is_compiletime;
core_definitions_is_runtime = !(core_definitions_is_compiletime);
core_definitions_is_jscodegen = 
#ifdef FLORI_JSCODEGEN
#define is_jscodegen true
#else
#define is_jscodegen false
#endif
  is_jscodegen;
core_math_M_PI = M_PI;
core_pointer_null = core_pointer_nullGG_();
core_string_cr = core_string_charGG_core_prelude_Int(13);
core_string_lf = core_string_charGG_core_prelude_Int(10);
procon_is_debug = core_prelude_true;
a_mainGG_();
}
int main(int argc, char** argv) { flori_main(); }


Measured memory_bytes: 128
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode('utf8')
print('Yes' if N[1] == N[2] and (N[0] == N[1] or N[2] == N[3]) else 'No')


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

bitset <5000000> bt;
int a[2333],sum,n;

int main(){
  scanf("%d",&n);
  for (int i=1;i<=n;i++){
  	scanf("%d",&a[i]);
  	sum+=a[i];
  }
  bt[0]=1;
  for (int i=1;i<=n;i++)
    bt|=bt<<a[i];
  for (int i=sum/2;i>=0;i--)
    if (bt[i]){
      printf("%d\n",sum-i);
      return(0);
	}
}


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

    int count = 0;
    for (int i = 0; i < 3; i++){
        if (S[i] == 'o'){
            count++;
        }
    }
    cout << 700 + count * 100 << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut s = read::<String>()
        .chars()
        .map(|x| x.to_digit(36).unwrap() as usize - 10)
        .collect::<Vec<_>>();
    let q = read::<usize>();
    let mut queries = vec![];
    for i in 0..q {
        let v = read_vec::<String>();
        queries.push(v);
    }
    let mut counts = vec![SegTree::new(n, 0i64); 26];
    for i in 0..n {
        counts[s[i]].update(i, 1);
    }

    for query in queries {
        if query[0] == "1" {
            let i = usize::from_str_radix(&query[1], 10).unwrap() - 1;
            let c = usize::from_str_radix(&query[2], 36).unwrap() - 10;
            let cur = counts[s[i]].query(i, i + 1);
            counts[s[i]].update(i, cur - 1);
            let cur = counts[c].query(i, i + 1);
            counts[c].update(i, cur + 1);
            s[i] = c;
        } else {
            let l = usize::from_str_radix(&query[1], 10).unwrap() - 1;
            let r = usize::from_str_radix(&query[2], 10).unwrap() - 1;
            let mut ans = 0;
            for ref count in counts.iter() {
                if count.query(l, r + 1) >= 1 {
                    ans += 1;
                }
            }
            println!("{}", ans);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(Debug, Clone)]
struct SegTree {
    n: usize,
    dat: Vec<i64>,
    init: i64,
}

impl SegTree {
    fn new(n: usize, init: i64) -> SegTree {
        let mut m = 1;
        // For simplicity, we use 2 ** n sized SegTree.
        while m < n {
            m *= 2;
        }
        SegTree {
            n: m,
            dat: vec![init; 2 * m - 1],
            init: init,
        }
    }

    // dat[k] = a;
    fn update(&mut self, k: usize, a: i64) {
        let mut k = k;
        k += self.n - 1;
        self.dat[k] = a;
        while k > 0 {
            k = (k - 1) / 2;
            self.dat[k] = self.dat[k * 2 + 1] + self.dat[k * 2 + 2];
        }
    }

    // [a, b)
    fn query(&self, a: usize, b: usize) -> i64 {
        self.query_inner(a, b, 0, 0, self.n)
    }

    fn query_inner(&self, a: usize, b: usize, k: usize, l: usize, r: usize) -> i64 {
        if r <= a || b <= l {
            return self.init;
        }
        if a <= l && r <= b {
            return self.dat[k];
        }

        let vl = self.query_inner(a, b, k * 2 + 1, l, (l + r) / 2);
        let vr = self.query_inner(a, b, k * 2 + 2, (l + r) / 2, r);
        vl + vr
    }
}


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

using namespace std;

int a[200010];

int main() {
    int k, n;
    cin >> k >> n;
    int maxx = 0;
    cin >> a[1];
    for (int i = 2; i <= n; i++) {
        cin >> a[i];
        maxx = max(maxx, a[i] - a[i - 1]);
    }
    maxx = max(maxx, k + a[1] - a[n]);
    cout << k - maxx << endl;
    return 0;
}

Measured memory_bytes: 4416