akhauriyash/Code-Regression huggingface dataset:
n = list(map(str,input()))

flg = 0

if ''.join(n) == 'keyence':
    print('YES')
    flg = 1
else:
    for i in range(8):
        arr = list(''.join(n)) 
        del arr[i:i+len(n)-7]
        tmp = ''.join(arr)
        if tmp == 'keyence':
            print('YES')
            flg = 1
            break

if flg == 0:
    print('NO')


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

string s,s2,t,mem;
int f=0;
int main(){
	cin>>s2;
	cin>>t;
	for(int i=s2.length()-t.length();i>=0;i--){
		for(int j=i;j<=i+t.length()-1;j++){
			if(s2[j]!=t[j-i]&&s2[j]!='?'){
				break;
			}
			if(j==i+t.length()-1&&f==0){
				for(int k=i;k<=i+t.length()-1;k++){
					s2[k]=t[k-i];	
				}
				f=1;
			}
		}
	}
	for(int i=0;i<s2.length();i++){
		if(s2[i]=='?') s2[i]='a';
	}
	if(f==1){
		cout<<s2<<endl;
	}
	else cout<<"UNRESTORABLE"<<endl;
	return 0;
}

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

int main()
{     int i,k;
	string ss;
	cin >> ss;
	for ( i = 0; i < ss.size(); i++)
	{
		if (ss[i] == 'C')
		{
			for ( k = i + 1; k < ss.size(); k++)
			{
				if (ss[k] == 'F')
				{
					cout << "Yes";
					break;
				}
			}

			if (k == ss.size()) cout << "No";
			break;

		}

		if (i == ss.size()-1) cout << "No";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;

/*
    if you have any question about any part of my code,
    please don't shy to ask anytime :)
*/



void solve()
{
    ll n,m;
    cin>>n>>m;
    unordered_map<ll,ll>h;
    for(int i=0;i<n;i++)
    {
        ll a;
        cin>>a;
        h[i+1] = a;
    }

    vector<vector<ll>>x(n+5);
    for(int i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        x[a].push_back(b);
        x[b].push_back(a);
    }

    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        bool f = true;
        for(auto it:x[i])
        {
            if(h[it]>=h[i])
            {
                f = false;
                break;
            }
        }

        if(f)
        {
            ans++;
        }
    }

    cout<<ans<<endl;
}

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

    // ll t;
    // cin >> t;

    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 13164
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();
		
		// 計算
		int result = 0;
		result = (n+x-1)/x*t;
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 25384
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

num_r = s.count('R')
num_g = s.count('G')
num_b = s.count('B')

num_ng = 0
for i in range(n):
    for j in range(i+1,n):
        k = j+(j-i)

        if k < n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            num_ng += 1

print(num_r*num_g*num_b-num_ng)

Measured memory_bytes: 9572
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define forn(b) for(int i = 0; i < b; i++)
#define rforn(b) for(int i = b - 1 ;i >= 0; i--)
#define It(m) for(auto it = m.begin(); it != m.end(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main(){
    speed;
    string s, t; cin >> s >> t;
    vector<int> v1(27);
    vector<int> v2(27);
    for(int i = 0; i < s.size(); i++) {
        v1[s[i] - 'a']++;
    }   
    for(int i = 0; i < t.size(); i++) {
        v2[t[i] - 'a']++;
    }
    bool yes = true;
    for(int i = 0; i < 27; i++) {
        if(v2[i] != 0 && v1[i] == 0) {
            yes = false;
            break;
        }
    }
    if(yes) {
        vector<vector<int>> loc(27);
        vector<int> data(27);
        for(int i = 0; i < 27; i++) {
            vector<int> a(v1[i]);
            loc[i] = a;
        }
        for(int i = 0; i < s.size(); i++) {
            int j = data[s[i] - 'a'];
            data[s[i] - 'a'] = j + 1;
            loc[s[i] - 'a'][j] = i;
        }
        long long answer = 0;
        int n = s.size();
        int current = 0;
        for(int i = 0; i < t.size(); i++) {
            auto k = lower_bound(loc[t[i] - 'a'].begin(), loc[t[i] - 'a'].end(), current) - loc[t[i] - 'a'].begin();
            if(k == loc[t[i] - 'a'].size()) {
                answer += n;
                current = 0;
                i--;
            }
            else {
                current = loc[t[i] - 'a'][k] + 1;
            }
        }
        answer += current;
        cout << answer;
    }
    else {
        cout << -1;
    }
    return 0;
}

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

using namespace std;

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

	string s; cin >> s;

	for(int i = 0; i < s.size()-1; i++) {
		if(s[i] == s[i+1]) {
			cout << i+1 << " " << i + 2 << '\n';
			return 0;
		}
	}

	if(s.size() >= 3) {

		for(int i = 0; i < s.size()-1; i++) {
			if(s[i] == s[i+2]) {
				cout << i + 1 << " " << i + 3 << '\n';

				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << '\n';

	return 0;
}

Measured memory_bytes: 512
N,M,X,Y = map(int,input().split())
xlist = list(map(int,input().split()))
ylist = list(map(int,input().split()))

ans = 'War'
for z in range(X+1,Y+1):
    war = False
    for x in xlist:
        if x >= z:
            war = True
            break
    if war:
        continue

    for y in ylist:
        if y < z:
            war = True
            break
    if war:
        continue

    if not war:
        ans = 'No War'
        break

print(ans)


Measured memory_bytes: 3060
/*
				   _ooOoo_
				  o8888888o
				  88" . "88
				  (| -_- |)
				  O\  =  /O
			   ____/`---'\____
			 .'  \\|     |//  `.
			/  \\|||  :  |||//  \
		   /  _||||| -:- |||||-  \
		   |   | \\\  -  /// |   |
		   | \_|  ''\---/''  |   |
		   \  .-\__  `-`  ___/-. /
		 ___`. .'  /--.--\  `. . __
	  ."" '<  `.___\_<|>_/___.'  >'"".
	 | | :  `- \`.;`\ _ /`;.`/ - ` : | |
	 \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
				   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		fozubaoyou    pass System Test!
		quoted from "https://codeforces.com/contest/472/submission/7996840"
*/
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){

	int h,w,a,b;
	cin>>h>>w>>a>>b;
	vvi v(h,vi(w,0));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if((i<b&&j>=a)||(i>=b&&j<a)){
				v[i][j]=1;
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<v[i][j];
		}
		cout<<endl;
	}
}


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

int n,W;
long long c[105],w[105];
long long mem[105][100005];

long long bac(int i,int tw)
{
	if (i==n)return 0;
	
	if (mem[i][tw]!=-1)return mem[i][tw];
	
	long long path1=bac(i+1,tw);
	long long path2=0;
	if (tw+w[i]<=W)
	{
		path2=bac(i+1,tw+w[i])+c[i];
	}
	
	return mem[i][tw]=max(path1,path2);
}





int main()
{
	memset(mem,-1,sizeof mem);
    scanf("%d%d",&n,&W);
    for (int i=0;i<n;i++)
    {
    	scanf("%lld%lld",&w[i],&c[i]);
    }
    
    printf("%lld",bac(0,0));
}

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

using namespace std;


/// Bismilahir Rahmanir Rahim


typedef unsigned int ui;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef short int si;
typedef unsigned short int usi;
typedef double dd;
typedef pair <int, int> pii;


#define CASE false
#define TEST false
#define BUFFER false
#define TIME false
#define DEBUG true
#define SET_GEN false
#define _ << " " <<
#define __ << "\n"
#define ff first
#define ss second
#define RANGE(a, b) (rand() % (b-a+1) + a)


const double pi = acos(-1.);
const double eps = 1e-7;
const int inf = 2147483647;
const int _inf = -2147483648;
const int mod = 1e9+7;


void delay(int sec); // DEBUG


void solution(void)
{
    int n, w;

    cin >> n >> w;

    vector <ulli> ks(w+1);
    ulli ans = 0;

    for(int i = 0; i < n; ++i) {
        int val, weight;

        cin >> weight >> val;
        for(int weight_already = w-weight; weight_already >= 0; --weight_already) {
            ks[weight_already+weight] = max(ks[weight_already+weight], ks[weight_already]+val);
            ans = max(ks[weight_already+weight], ans);
        }
    }

    cout << ans << "\n";

    ks.clear();



    return ;
}

int main(int argc, char *arv[])
{
    #if BUFFER
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #endif

    #if SET_GEN
    srand((unsigned int) time(0));
    #endif


    unsigned short int t = 1;

    #if CASE
    int cnt = 1;
    #endif

    #if TEST
    cin >> t;
    #endif

    #if TIME
    clock_t start_time, end_time;
    double time_elapsed;
    #endif


    while(t--) {

        #if TIME
        start_time = clock();
        #endif

        #if CASE
        cout << "Case " << cnt++ << ": ";
        #endif

        solution();

        #if TIME
        end_time = clock();

        time_elapsed = (double) (end_time - start_time) / CLOCKS_PER_SEC;

        cout << "\nRuntime: " << fixed << setprecision(7) << time_elapsed << "\n";
        #endif
    }


    return 0;
}

void delay(int sec)
{
    int mili_sec = 1000 * sec;

    clock_t start_time = clock();

    while (clock() < start_time + mili_sec);

    return ;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}


int main() {
  int n; cin >>n;
  vector<ll> leaf(n+1);
  rep(i, n+1) cin >> leaf[i];

  vector<ll> non_leaf(n+1);

  if (leaf[0]>1) {
    cout << -1 << endl;
    return 0;
  }
  else if (leaf[0]==1) {
    if (n==0) cout << 1 << endl;
    else cout << -1 << endl;
    return 0;
  }

  non_leaf[0] = 1;
  non_leaf[n] = 0;

  for(int d = n-1; d >= 1; d--) {
    ll children = leaf[d+1] + non_leaf[d+1];
    non_leaf[d] = children;
  }

  for(int d = 1; d <= n; d++) {
    ll parents = non_leaf[d-1];
    if(parents*2 < leaf[d]) {
      cout << -1 << endl;
      return 0;
    }
    umin(non_leaf[d], parents*2-leaf[d]);
  }

  ll ans = 0;
  for(int d = 0; d <= n; d++) ans += leaf[d] + non_leaf[d];
  cout << ans << endl;
}


Measured memory_bytes: 4756
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define mem(a) memset(a, 0, sizeof(a))
#define memm(a) memset(a, -1, sizeof(a))
#define INF 0x3f3f3f3f
#define maxn 10
using namespace std;
typedef long long LL;
typedef pair <int,int> PP;
int n,r;
double a;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    while(cin >> n){
        deque <int> dq;
        for(int i=1,a;i<=n;i++){
            cin >> a;
            if(i&1) dq.push_front(a);
            else dq.push_back(a);
        }
        if(n&1){
            for(int i=0;i<dq.size();i++) cout << dq[i] << " ";
            cout << endl;
        }
        else{
            for(int i=dq.size()-1;i>=0;i--) cout << dq[i] << " ";
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3072
N = int(input())
P = list(map(int,input().split()))
ans = 0

for n in range(N-1):
  if P[n]==n+1 and P[n+1]==n+2:
    ans+=1
    P[n+1] = n+1
  elif P[n]==n+1 and P[n+1]!=n+2:
    ans+=1

if P[-1]==N:
  print(ans+1)
else:
  print(ans)

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

int main()
{
	int n, i;
	long long int s = 0;
	scanf("%d", &n);
	
	for(i = 1; i <= n; i++)
	{
		if(i % 3 != 0 && i % 5 != 0 )
			s += i;
	}
	printf("%lld", s);
}

Measured memory_bytes: 1732
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int N, K;
    io.read(N, K);
    if(N % K == 0) cout << 0;
    else cout << 1;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int N,cnt=0;
    cin >> N;
    for (int i=1; i<=N; i++) {
        if (i % 2 == 1) cnt++;
    }
    double ans = cnt / (double)N;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    int A, B;cin >> A >> B;

    for (int i = 0; i <= 10000;i++){
        if(int(i * 0.08) == A && int(i * 0.10) == B){
            cout << i << endl;
            return 0;
        }
    }

    cout << -1 << endl;

}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    VLL A(X), B(Y), C(Z);
    REP(i, X) cin >> A[i];
    REP(i, Y) cin >> B[i];
    REP(i, Z) cin >> C[i];
    VLL AB;
    REP(i, min(K, X)){
        REP(j, min(K, Y))
            AB.PB(A[i]+B[j]);
    }
    RSORT(AB);
    VLL ANS;
    REP(i, min(K, int(AB.size()))){
        REP(j, min(K, Z))
            ANS.PB(AB[i]+C[j]);
    }
    RSORT(ANS);
    REP(i, K)
        cout << ANS[i] << "\n";
    return 0;
}


Measured memory_bytes: 43368
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = readLine()!!.split(" ").map { it.toInt() }
  val g = a.groupBy { it }
  val cnt = g.map {
    val size = it.value.size
    return@map if (it.key <= size) size - it.key else size
  }.sum()
  println(cnt)
}


Measured memory_bytes: 58252
#include<cstdio>
#include<set>
#include<cstdlib>
#include<chrono>

using namespace std;

int d, c[100], s[400][100];
int sat;
int m, t[400];
set<int> app[100];

int last(int d, int i) {
  return *(--app[i].upper_bound(d));
}

int next(int d, int i) {
  return *app[i].upper_bound(d);
}

int random(int x, int y) {
  return rand() % (y - x + 1) + x;
}

int main() {
  scanf("%d", &d);
  for (int i = 1; i <= 26; i++) {
    scanf("%d", &c[i]);
    app[i].insert(0);
    app[i].insert(d+1);
  }
  for (int i = 1; i <= d; i++) {
    for (int j = 1; j <= 26; j++) {
      scanf("%d", &s[i][j]);
    }
  }
  for (int i = 1; i <= d; i++) {
    int best = -2e9, best_j = 0;
    for (int j = 1; j <= 26; j++) {
       int tmp = 0;
       tmp += s[j][t[j]];
       for (int k = 1; k <= 26; k++) {
         if (j == k) {
           continue;
         }
         tmp -= c[k] * (i - last(i, k));
       }
       if (tmp > best) {
         best = tmp;
         best_j = j;
       }
    }
    t[i] = best_j;
    sat += s[i][t[i]];
    app[t[i]].insert(i);
    for (int j = 1; j <= 26; j++) {
      sat -= c[j] * (i - last(i, j));
    }
  }
  auto start = chrono::steady_clock::now();
  auto end = chrono::steady_clock::now();
  while (chrono::duration_cast<chrono::nanoseconds>(end - start).count() < 1.9e9) {
    int d = random(1, ::d);
    int q = random(1, 26);
    while (q == t[d]) {
      q = random(1, 26);
    }
    app[t[d]].erase(d);
    int tmp = 0;
    tmp -= s[d][t[d]];
    tmp -= c[t[d]] * (next(d, t[d]) - d) * (d - last(d, t[d]));

    tmp += s[d][q];
    tmp += c[q] * (next(d, q) - d) * (d - last(d, q));
    if (tmp > 0) {
      app[q].insert(d);
      t[d] = q;
    } else {
      app[t[d]].erase(d);
    }
    end = chrono::steady_clock::now();
  }
  for (int i = 1; i <= d; i++) {
    printf("%d\n", t[i]);
  }
}


Measured memory_bytes: 3480
#include<bits/stdc++.h>
#define rg register
#define ll long long
using namespace std;
const int N=1e3+5,mod=1e9+7;
int n,m,T,k,ans,len;
ll a[N],b[N],d[N],t[N];
ll c[1000005];
bool cmp(ll x,ll y)
{
    return x>y;
}
int main()
{
    ll ans=0;
    priority_queue< pair<ll,ll> > q;
    int x,y,z,k,temp=0;
    cin>>x>>y>>z>>k;
    for(rg int i=1;i<=x;++i)
        scanf("%lld",&a[i]);
    for(rg int i=1;i<=y;++i)
        scanf("%lld",&b[i]);
    sort(a+1,a+x+1,cmp);
    sort(b+1,b+y+1,cmp);
    for(rg int i=1;i<=x;i++)
        for(rg int j=1;j<=y;j++)
            c[++temp]=a[i]+b[j];
    sort(c+1,c+temp+1,cmp);
    for(rg int i=1;i<=z;++i)
        scanf("%lld",&d[i]);
    sort(d+1,d+z+1,cmp);
    for(rg int i=1;i<=z;++i)
    {
        t[i]=1;
        q.push(pair<ll,ll>(c[1]+d[i],i));
    }
    ll i;
    while(k--)
    {
        cout<<q.top().first<<endl;
        i=q.top().second;q.pop();
        q.push(pair<ll,ll>(c[++t[i]]+d[i],i));
    }

    //cout<<ans;
    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n;
	cin >> n;
	pair<int, int> p[n];
	REP(i, n) cin >> p[i].second >> p[i].first;
	sort(p, p+n);
	ll ans = 0;
	REP(i, n){
		ans += p[i].second;
		if (ans > p[i].first){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 1792
#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;

long long int luca(int n){
	long long int n1=2;
	long long int n2 = 1;
	long long int tmp = 1;
	int i;
	rep(i,n){
		tmp = n1+n2;
		n1 = n2;
		n2 = tmp;
	}
	return tmp;
}

int main(void){
	int z,w,i,j;
	int n;
	int cnt=0;
	long long int ans;
	cin >> n;
	ans = luca(n-1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
D = defaultdict(int)
S = [input() for _ in range(N)]

for s in S:
    D[s] += 1

maxn = max(D.values())

res = []

for s in S:
    if D[s] == maxn:
        res.append(s)

res = sorted(set(res))

for r in res:
    print(r)


Measured memory_bytes: 47920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=110,M=1010,inf=1e9;
struct E{int v,nxt,w,c;}e[2010];
int n,m,s,t,sf,sc,cc=1,tt,ff,hd[N],d[N],vis[N],pre[N];ll wx,wy;queue<int>q;
struct st{ll x,y;}o,a[100005];
inline st operator-(st a,st b){return (st){a.x-b.x,a.y-b.y};}
inline void add(int u,int v,int w,int c){e[++cc]=(E){v,hd[u],w,c};hd[u]=cc;e[++cc]=(E){u,hd[v],0,-c};hd[v]=cc;}
inline bool spfa()
{
	for(int i=1;i<=n;++i)d[i]=inf,vis[i]=0;
	d[s]=0;q.push(s);vis[s]=1;
	while(!q.empty())
	{
		int x=q.front();q.pop();vis[x]=0;
		for(int i=hd[x];i;i=e[i].nxt)if(e[i].w)
		{
			int y=e[i].v,z=d[x]+e[i].c;
			if(d[y]>z)
			{
				d[y]=z;pre[y]=i;
				if(!vis[y])q.push(y),vis[y]=1;
			}
		}
	}
	if(d[t]>=inf)return 0;
	int flw=inf;
	for(int x=t;x!=s;x=e[pre[x]^1].v)flw=min(flw,e[pre[x]].w);
	for(int x=t;x!=s;x=e[pre[x]^1].v)e[pre[x]].w-=flw,e[pre[x]^1].w+=flw;
	sf+=flw;sc+=flw*d[t];return 1;
}
inline ll F(st a,st b){return a.x*b.x+a.y*b.y;}
inline ll G(st a,st b){return a.x*b.y-a.y*b.x;}
inline ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
inline void ans(ll x,ll y)
{
	ll g=gcd(x,y);x/=g;y/=g;
	if(!ff||wx*y>x*wy)wx=x,wy=y,ff=1;
}
inline void sol(st a,st b)
{
	if(F(a,a-b)<=0||F(b,b-a)<=0)return;
	ans(G(a,b)*G(a,b),F(a-b,a-b));
}
int main()
{
	scanf("%d%d%d%d",&n,&m,&s,&t);
	for(int i=1,u,v,w,c;i<=m;++i){scanf("%d%d%d%d",&u,&v,&w,&c);add(u,v,w,c);}
	a[tt=0]=(st){0,0};
	while(spfa())a[++tt]=(st){sf,sc};
	o=(st){sf,0};
	for(int i=0;i<=tt;++i){a[i]=a[i]-o;ans(F(a[i],a[i]),1);}
	for(int i=0;i<tt;++i)sol(a[i],a[i+1]);
	printf("%lld/%lld\n",wx,wy);
	return 0;
}


Measured memory_bytes: 3308
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  for(int i = 0;i<3;i++){
    if(a.at(i) == '1')
      a.at(i) = '9';
    else
      a.at(i) = '1';
  }
  cout << a << endl;
  
    
}


Measured memory_bytes: 256
#include<stdio.h>
int binarySearch(int *A, int key, int n);
int main() {
	int S[110000];
	int T[51000];
	int n, q, i, j;
	int x = 0, xflag;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (j = 0; j < q; j++) {
		scanf("%d", &T[j]);
	}
	for (j = 0; j < q; j++) {
		if (binarySearch(S, T[j], n) != -1) {
			x++;
		}
	}
	printf("%d\n", x);
	
	return 0;
}

int binarySearch(int *A, int key, int n) {
	int left = 0, right = n;
	int mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (A[mid] == key) {
			return mid;
		}
		else if (A[mid] > key) {
			right = mid;
		}
		else {
			left = mid + 1;
		}
	}
	return -1;
}


Measured memory_bytes: 2292
n = int(input())
record = [ [ [0 for r in range(10)] for f in range(3)] for b in range(4)]
for _ in range(n):
    b,f,r,v = [int(i) for i in input().split(" ")]
    record[b - 1][f - 1][r - 1] += v
for b1 in range(4):
    for f in record[b1]:
        print(" "+" ".join([str(x) for x in f]))
    if b1 != 3:
        print("#" * 20)
        
        

Measured memory_bytes: 7716
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

const ll MX = ll(1e18);

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    bool zero = false;
    rep(i,n) {
        cin >> a[i];
        if (a[i] == 0) zero = true;
    }
    ll ans = 1;
    if (zero) { cout << 0 << "\n"; return 0; }
    rep(i,n) {
        if (ans > MX / a[i]) { cout << -1 << "\n"; return 0; }
        ans *= a[i];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4000
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

A,B = map(int,input().split())
minnum,maxnum = sorted([A,B])
div_l = factorization(gcd(minnum,maxnum))

if((div_l[0][0])==1):
    print(len(div_l))
else:
    print(len(div_l)+1)


Measured memory_bytes: 38384
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 1e5 + 5;
int n, m;
vector<int> g[2][maxn];
int used[2][maxn];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int it = 0; it < 2; it++) {
    for (int i = 0; i < max(n, m); i++) {
      g[it][i].clear();
      used[it][i] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      int l;
      scanf("%d", &l);
      l--;
      g[0][i].push_back(l);
      g[1][l].push_back(i);
    }
  }
  return true;
}

void dfs(int t, int v) {
  used[t][v] = 1;
  for (int i = 0; i < sz(g[t][v]); i++) {
    int u = g[t][v][i];
    if (!used[t ^ 1][u]) {
      dfs(t ^ 1, u);
    }
  }
}

void solve() {
  dfs(0, 0);
  for (int i = 0; i < n; i++) {
    if (!used[0][i]) {
      printf("NO\n");
      return;
    }
  }
  printf("YES\n");
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 400000;

int N;
int M;

int a[MAX];

vector<int> g[MAX];

void D(int v) {//頂点iから開始した探索
	if (a[v] == 0) {
		a[v] = 1;
		for (int j = 0; j < g[v].size(); j++) {
			D(g[v][j]);
		}
	}
}

int cncmp() {
	
	for (int i = 1; i <= N; i++) {
		a[i] = 0;
	}

	int sol = 0;

	for (int i = 1; i <= N; i++) {
		if (a[i] == 0) { 
			D(i);
			sol++;
		}

		
	}

	return sol;
}



int main() {

	cin >> N >> M;

	int x, y, z;

	for (int i = 1; i <= M; i++) {
		cin >> x >> y >> z;
		g[x].push_back(y);
		g[y].push_back(x);
	}

	cout << cncmp();
	

	system("PAUSE");

}

Measured memory_bytes: 16896
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int ll
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vb >
#define pii pair<int,int>
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi >
#define vs vector<string>
#define vvs vector<vs >
#define pqi priority_queue <int>
#define minpqi priority_queue <int, vector<int>, greater<int> >
#define all(x) x.begin(),x.end()
#define mii map<int,int>
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define per1(i,n) for(ll i=n;i>0;i--)
#define repeat(i,start,n) for(ll i=start;i<n;i++)
#define inp(arr,n) ll arr[n];rep(i,n){ cin>>arr[i];}
#define inp1(arr,n) ll arr[n+1];rep1(i,n){ cin>>arr[i];}
#define inp2d(arr,n,m) ll arr[n][m];rep(i,n)rep(j,m)cin>>arr[i][j];
#define inpg(adj,m) rep(i,m){int a,b;cin>>a>>b;adj[a].pb(b);adj[b].pb(a);}
#define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
#define print1(a,n) for(ll i=1;i<=n;i++){ cout<<a[i]<<endl;}
#define mod 1000000007
#define maxx 1000000000000000000
#define PI 3.141592653589793238462643383279
#define mmax(a,b,c) max(a,max(b,c))
#define mmin(a,b,c) min(a,min(b,c))
#define init(arr,a) memset(arr,a,sizeof(arr))
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
	if(a.ss==b.ss)
		return a.ff<b.ff;
	return (a.second<b.second);
}
string convert_to_bit(int a,int bit){
	string s;
	while(a>0){
		s+=(a%2)+48;
		a/=2;
	}
	while(s.size()<bit)
		s+='0';
	reverse(s.begin(),s.end());
	return s;
}
int to_int(string s)
{
	int ans=0;
	string temp;
	int i=0;
	while(s[i]=='0')
	{
		i++;
	}
	if(i==s.size())
		return 0;
	temp.assign(s,i,s.size());
	int mul=1;
	for(i=temp.size()-1;i>=0;i--)
	{
		int a=temp[i]-'0';
		ans+=mul*a;
		mul*=10;
	}
	return ans;

}
string to_string(int n)
{
	string ans="";
	if(n==0)
		return "0";
	while(n>0)
	{
		int a=n%10;
		n/=10;
		char temp=a+'0';
		ans+=temp;
	}
	reverse(all(ans));
	return ans;
}
int bin_to_dec(int n)
{
	int num = n;
	int dec_value = 0;
	int base = 1;
	int temp = num;
	while (temp) {
		int last_digit = temp % 10;
		temp = temp / 10;
		dec_value += last_digit * base;
		base = base * 2;
	}
	return dec_value;
}
int binstr_to_dec(string s)
{
	int ans=0;
	for0(i,s.size())
		if(s[i]=='1')
			ans+=pow(2,s.size()-i-1);
	return ans;
}
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
void faltu()
{
	int a=2;
	while(a>0)a--;
}
int nCr(ll n, ll r)
{
	ll res = 1;
	if ( r > n - r )
		r = n-r;
	for (ll i = 0; i < r; ++i)
	{
		res *= (n - i);	//general term (n-x)/(1+x)
		res /= (i + 1);
	}
	return res;
}
//------------------------------------Code Starts here------------------------------------//

void solve()
{

}
main()
{
		int t;
		cin>>t;
		if(t>=30)cout<<"Yes";
		else cout<<"No";
}


Measured memory_bytes: 3716
#include <stdio.h>

int main(void)
{
    int H, W;

    while(1)
    {
        scanf("%d %d", &H, &W);

        if(H == 0 && W == 0)
        {
            return 0;
        }

        int i, j;
        for(i = 0; i < H; ++i)
        {
            for(j = 0; j < W; ++j)
            {
                if(i == 0 || j == 0 || i == H - 1 || j == W - 1)
                {
                    printf("#");
                }

                else
                {
                    printf(".");
                }
            }

            printf("\n");
        }

        printf("\n");
    }
}

Measured memory_bytes: 572
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
               if( A<=8 && B<=8 ) {
System.out.println("Yay!");
}
else {
System.out.println(":(");
}

	}
}

Measured memory_bytes: 35776
#include<stdio.h>
int main(void)
{
 int a,b;
 scanf("%d %d",&a,&b);
 if (a > b){
     printf("a > b\n");
 }
 else if (b > a){
     printf("a < b\n");
 }
 else{
     printf("a == b\n");
 }
 return 0;
}


Measured memory_bytes: 2004
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int64 gcd(int64 a, int64 b) {
  while (b) {
    int64 c = a;
    a = b;
    b = c % b;
  }
  return a;
}

int main() {
  int64 a, b;
  cin >> a >> b;
  int64 g = gcd(a, b);
  int ret = 1;
  for (int64 i = 2; i * i <= g; ++i) {
    if (g % i == 0) {
      while (g % i == 0) g /= i;
      ++ret;
    }
  }
  if (g > 1) ++ret;
  cout << ret << endl;
  return 0;
}


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

#ifdef TEST
struct test {
    int ans;
} td[] = {
    {},
};
#endif

void
solver(long long h, long long w)
{
    long long m;

    if(h == 1) {
        m = 1;
    } else if(w == 1) {
        m = 1;
    } else if(h % 2 == 0) {
        m = h / 2 * w;
    } else {
        if(w % 2 == 0) {
            m = h * w / 2;
        } else {
            m = h * (w - 1) / 2 + (h + 1) / 2;
        }
    }

    printf("%lld\n", m);
}

int
main(int argc, char *argv[])
{
#ifdef TEST
    int tt;
    for(tt = 0; tt < sizeof(td) / sizeof(struct test); tt++) {
        solver();
        printf("%d\n", td[tt].ans);
    }
#endif
    long long H, W;
    scanf("%lld %lld", &H, &W);
    solver(H, W);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
using namespace std;
int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B;
	string S;
	cin >> A >> B >> S;
	bool f=true;
	rep(i,A){
		if (S[i]=='-'){
			f = false;
		}
	}
	if (S[A]!='-'){
		f = false;
	}
	rep(i,B){
		if (S[i+A+2]=='-'){
			f = false;
		}
	}
	cout << (f? "Yes":"No") << endl;
}

Measured memory_bytes: 256
/*
ID: allengu01
TASK: 
LANG: C++
*/
 
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <unordered_map>
using namespace std;
 
int n, k, h[101000], dp[101000];
int main()
{
	cin >> n >> k;
  	for (int i = 1; i <= n; i++) {
      cin >> h[i];
    }
  for (int i = 1; i <= n; i++) {
    dp[i] = 1000000000;
  }
  	dp[1] = 0;
  	for (int i = 1; i < n; i++) {
      for (int j = 1; j <= k; j++) {
      	dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
      }
    }
  	cout << dp[n];
}
 

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

    int a,b,c=0;
    cin>>a>>b;
    for(int i=0;i<=a;i++)
        if(i*2+(a-i)*4==b)
    {
        c=1;
        break;
    }
    if(c) cout<<"Yes";
    else cout<<"No";
    return 0;
    }


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
using namespace std;
const int N=405;
const int MOD=998244353;
int n;
int a[N],b[N];
long long ksm(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1) res=res*a%MOD;
		a=a*a%MOD,b>>=1;
	}
	return res;
}
long long fac[N];
void init(int n=400)
{
	fac[0]=1;
	for(int i=1;i<=n;i++)
		fac[i]=fac[i-1]*i%MOD;
	return;
}
long long q[N][N][N];
int sa,sb;
long long c[N][N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i],&b[i]),sa+=a[i],sb+=b[i];
	init();
	q[0][0][0]=1;
	for(int i=1;i<=n;i++)
	{
		long long p=a[i]*ksm(sa,MOD-2)%MOD,fac=MOD-1;
		for(int l=0;l<b[i];l++,fac=fac*ksm(l,MOD-2)%MOD*p%MOD)
			for(int j=0;j<=sa;j++)
				for(int k=l;k<=sb;k++)
					q[i][j][k]=(q[i][j][k]+fac*q[i-1][j][k-l]%MOD)%MOD;
		for(int j=a[i];j<=sa;j++)
			for(int k=0;k<=sb;k++)
				q[i][j][k]=(q[i][j][k]+q[i-1][j-a[i]][k])%MOD;
	}
	for(int i=0;i<=sa;i++)
		for(int j=0;j<=sb;j++)
			c[i][j]=(-q[n][i][j]+MOD)%MOD;
	c[sa][0]=(c[sa][0]+1)%MOD;
	long long ans=0;
	for(int i=0;i<=sa;i++)
		for(int j=0;j<=sb;j++)
		{
			long long t=i*ksm(sa,MOD-2)%MOD;
			long long p=ksm(ksm((1-t+MOD)%MOD,MOD-2),j+1);
			ans=(ans+c[i][j]*p%MOD*fac[j]%MOD)%MOD;
		}
	printf("%lld",ans);
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

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

	int n;
	cin>>n;
	cout<<n*n*n<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

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

    cout << (a <= x && x <= a + b ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;



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

	int X,Y,Z;
	cin >> X >> Y >> Z;

	cout << Z << " "  << X << " " << Y << endl;


	return 0;
}


Measured memory_bytes: 256
//2017-10-16
//miaomiao
//
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)

int main(){
	LL a, b, c;

	scanf("%lld%lld%lld", &a, &b, &c);

	if(!(a&1) || !(b&1) || !(c&1)){
		puts("0"); return 0;
	}

	LL x = min(a, min(b, c)), z = max(a, max(b, c));
	LL y = a+b+c - x - z;
	
	printf("%lld\n", x*y);

	return 0;
}

Measured memory_bytes: 256
N,T = [int(i) for i in input().split()]
ts = [int(i) for i in input().split()]
#ret = 0
# for ind in range (1, N):
#     ret += min(T,ts[ind]-ts[ind-1])
# for diff in [ts[ind+1]-ts[ind] for ind in range(N-1)]:
#     ret += T if T<diff else diff
ret = sum([T if T < ts[ind+1]-ts[ind] else ts[ind+1]-ts[ind] for ind in range(N-1)])
print(ret+T)


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

void del(vector<vector<char>>&a,vector<int>&b,vector<int>&c){
  int h=a.size();
  int w=a.at(0).size();
  for (int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a.at(i).at(j)=='#'){
        b.at(i)=1;
        continue;
      }
    }
  }
    for (int i=0;i<w;i++){
    for(int j=0;j<h;j++){
      if(a.at(j).at(i)=='#'){
        c.at(i)=1;
        continue;
      }
    }
  }
}

int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>>a(H,vector<char>(W));
  vector<int>h(H);
  vector<int>w(W);
  for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>a.at(i).at(j);
  del(a,h,w);
  for(int i=0;i<H;i++){
    if(h.at(i)==0)continue;
    for(int j=0;j<W;j++){
      if(w.at(j)==0){
        if(j==W-1)cout<<endl;
        continue;
      }
      cout<<a.at(i).at(j);
      if(j==W-1)cout<<endl;
    }
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            for (int i = 0; i < n; i++)
            {
                var kp = ReadInts();
                if (kp[0] % kp[1] == 0)
                {
                    WriteLine(kp[1]);
                }
                else
                {

                    WriteLine(kp[0] % kp[1]);
                }
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数

        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}



Measured memory_bytes: 17984