akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << endl;
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << endl;
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  ll N;
  cin >> N;
  vector<int> a(N);
  if(N%2==1){
    a[N-1] = 3;
  }

  vector<int> plus(N);
  vector<bool> numbers(55555 + 1, true);
  numbers[0] = false;
  numbers[1] = false;
  int initial = 2;
  int count_plus = 0;
  while(initial < 55555 + 1){
    int multi = 2;
    while(initial*multi < 55555 + 1){
      numbers[initial*multi] = false;
      ++multi;
    }

    rep(i, (initial-1)*(initial-1), initial*initial){
      if(numbers[i]){
        if(i%5==2){
          if(count_plus < N){
            plus[count_plus] = i;
          }
          count_plus++;
        }
      }
    }

    if(count_plus >= N){
      break;
    }

    ++initial;
    while(!numbers[initial]){
      ++initial;
    }
  }

  rep(i, 0, N){
    cout << plus[i] << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
  int d=sc.nextInt();
  int x=sc.nextInt();
  int po[]=new int[n];
  for(int i=0;i<n;i++){
  po[i]=sc.nextInt();
  }
  int ans=n;
  d--;
  for(int i=0;i<n;i++){
  ans+=d/po[i];
  }
  System.out.println(ans+x);
}
}

Measured memory_bytes: 22740
x,y = map(int,input().split())
n = abs(abs(x)-abs(y))
if x >=0:
  if y > 0:
    if y>x:
      ans = n
    else:
      ans = n+2
  else:
    ans = n+1
else:
  if y > 0:
    ans = n+1
  else:
    if y > x:
      ans = n
    else:
      ans = n+2
print(ans)

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

using namespace std;

int main(int argc, char const *argv[]) {
	int N;
	std::cin >> N;
	unsigned long long T[N];
	for (size_t i = 0; i < N; i++) {
		std::cin >> T[i];
	}
	unsigned long long ans = T[0];
	unsigned long long x,r,a,b;
	for (size_t i = 1; i < N; i++) {
		a = ans;
		b = x = T[i];
		if (a < b) {
			swap(a, b);
			swap(ans,x);
		}

		r = a % b;
		while (r != 0) {
			a = b;
			b = r;
			r = a % b;
		}

		ans = ans / b * x;
	}
	std::cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint gcd( lint m, lint n )
{
	lint a=max(m,n),b=min(m,n);
	if(m==0) return n;if(n==0) return m;
	if(a%b==0) return b;
	return gcd(b,a-b*(a/b));
}
int gc[210][210];
int main()
{
	rep(i,205) rep(j,205) gc[i][j]=gcd(i,j);
	lint out=0;int n;cin>>n;
	REP(i,1,n+1) REP(j,1,n+1) REP(k,1,n+1){
		out+=gc[gc[i][j]][k];
	}
	cout<<out<<endl;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
int main(){
	int n; //n=number of items 
	cin >> n;
	int weight;
	cin >> weight; //weights of items
	int w[n+1]; // array for item weight
	ll v[n+1];	//array for values
	w[0]=v[0]=0;
	for(int i=1; i<=n; i++)
		cin>> w[i] >> v[i];
	ll result[n+1][weight+1];
	for(int i=0; i<=n; i++){
		for(int j=0; j<=weight; j++)
			result[i][j]=0;
	}
	for(int i=1; i<=n; i++){
		for(int j=0; j<=weight; j++){
			if(j<w[i]) result[i][j]=result[i-1][j];
			else result[i][j]=max(result[i-1][j],v[i]+result[i-1][j-w[i]]);
		}
	}
	cout << result[n][weight];
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn = 4079, mlg = 17, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = (1 << 20);
ll tr[MAXN];
template<class T>
struct fenwick
{
	int sz;

	void init(int _sz)
	{
		sz = _sz + 1;
		memset(tr, 0, sizeof(tr));
	}

	T query(int idx)
	{
		T ans = 0;
		for(; idx >= 1; idx -= (idx & -idx))
			ans += tr[idx];
		return ans;
	}

	void update(int idx, T val)
	{
		if(idx <= 0) return;
		for(; idx <= sz; idx += (idx & -idx))
			tr[idx] += val;
	}

	void update(int l, int r, T val)
	{
		update(l, val);
		update(r + 1, -val);
	}
};

int main() {
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	vi a(n+1);
	for(auto &i : a) cin >> i;
	
	if(n == 0) {
		if(a[0] == 1) cout << 1;
		else cout << -1;
		return 0;
	}
	if(a[0] != 0) {
		if(n == 0) cout << 1;
		else cout << -1;
		return 0;
	}
	fenwick<ll> cnt;
	cnt.init(n+10);
	ll sz = 1, cd = 1;
	cnt.update(cd, cd, 2);
	for(ll i = 1; i <= n; i++) {
		ll t = a[i];
		//cout << i << " : \n";
		while(cd <= i && t) {
			ll u = min(t, cnt.query(cd));
			//cout << t << " " << cd << " " << u << " / " << (i-cd+1)*u << '\n';
			t -= u;
			sz += (i-cd+1)*u;
			cnt.update(cd, cd, -u);
			cnt.update(cd+1, i, u);
			if(cnt.query(cd) == 0) cd++;
		}
		if(t) return cout << -1, 0;
	}
	cout << sz;
}


Measured memory_bytes: 12140
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	if(k<=n)
	s[k-1]=(char)(s[k-1]-'A'+'a');
	cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
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); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)

void Main()
{
    int n;
    cin >> n;
    int ans = 0;
    repn(i, n) ans += i;
    cout << ans << endl;

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int A, B;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                A = line[0];
                B = line[1];
            }

            int N = 100;
            char[,] M = new char[N, N];

            for (int y = 0; y < N; y++)
            for (int x = 0; x < N; x++)
            {
                M[y, x] = (y < 50) ? '.' : '#';
            }

            {
                int x = 1;
                int y = 51;
                for (int a = 0; a < A - 1; a++)
                {
                    M[y, x] = '.';
                    x += 2;
                    if (x >= 50)
                    {
                        x = 1;
                        y += 2;
                    }
                }
            }

            {
                int x = 1;
                int y = 1;
                for (int b = 0; b < B - 1; b++)
                {
                    M[y, x] = '#';
                    x += 2;
                    if (x >= 50)
                    {
                        x = 1;
                        y += 2;
                    }
                }
            }

            Console.WriteLine("{0} {1}", N, N);
            for (int y = 0; y < N; y++)
            {
                for (int x = 0; x < N; x++)
                {
                    Console.Write(M[y, x]);
                }
                Console.WriteLine();
            }
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13368
N,M,Q = map(int,input().split())

data = []

for i in range(M):
    l,r = map(int, input().split())
    data.append((0,l-1,r-1,0))
for i in range(Q):
    l,r = map(int, input().split())
    data.append((1,l-1,r-1,i))

data.sort()
data.sort(key=lambda x:x[2])

n0 = 2**(N-1).bit_length()
segdata = [0]*(2*n0-1)

def add(k):
    k += n0-1
    segdata[k] += 1
    while k > 0:
        k = (k-1)//2
        segdata[k] += 1

def getsum(a,b,k=0,l=0,r=n0):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return segdata[k]
    vl = getsum(a,b,2*k+1,l,(l+r)//2)
    vr = getsum(a,b,2*k+2,(l+r)//2, r)
    return vr + vl

ans = []

for q, a, b,i in data:
    if q:
        ans.append((i, getsum(a,b+1)))
    else:
        add(a)

ans.sort()
for i, j in ans:
    print(j)

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

int main() {
    long long N, K;
    cin >> N >> K;
    long long res = 0;

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

    for (long long b = 1; b <= N; b++) {
        res += max(0LL, b - K) * (N / b);
        res += max(0LL, N % b - K + 1);
    }

    cout << res << endl;
    return 0;
}

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

int main() {
    vector<vector<int>> c(3,vector<int>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c.at(i).at(j);
        }
    }

    vector<int> a(3);
    vector<int> b(3);

    a.at(0);
    for (int i = 0; i < 3; i++) {
        b.at(i) = c.at(0).at(i);
        a.at(i) = c.at(i).at(i) - b.at(i);
    }

    bool can = true;
    for(int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (c.at(i).at(j) != a.at(i) + b.at(j)) {
                can = false;
            }
        }
    }

    if(can) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long M =1e5+2,MOD=1e9+7;
typedef long long ll;
#define pb push_back
#define Y printf("YES\n")
#define N printf("NO\n")
#define O printf("-1\n")
bool f_2=false,vis[M]= {false},f=false;
vector<ll>v,v_1,v_2;
string s,p,q,ok,ch;
map<ll,ll>mp,mp_2;
set<ll>st,st_1;
ll arr[M],ar[M];
ll cnt=0,cost=0,mx=0,NODE,t,par,zero=0;
deque<ll>Q;
//vector< pair<ll,ll > >v,v_1;
struct node
{
    ll pa,ran,visit;

};
//node X[M];
int main()
{
    ios::sync_with_stdio(false);//ISHWAR
    cin.tie(0);//Tourist_Twin
    //freopen("kamona.txt","r",stdin);
    ll a,b,c=1,n,t,sum=0,mx=0,l,x,y,i=0,j=0,result=0,e,sum_2,sum_1=0,d=0,k,mx_2=0,pos=0,neg=0,m,second=0;
    double cc=0.0;
    cin>>t;
    while(t--)
    {
        cin>>a;
        cc+=(1.0/a);
    }
    cc=1/cc;
    cout<<fixed<<setprecision(9)<<cc<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<ctype.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int inv2=5e8+4;
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
inline int Fast_pow(int b,int p){
	int ans=1;
	while(p){
		if(p&1)ans=1ll*ans*b%mod;
		b=1ll*b*b%mod;p>>=1;
	}
	return ans;
}
int fac[8007]={1},inv[8007];
inline void init(int n=8000){
	for(int i=1;i<=n;++i)fac[i]=1ll*i*fac[i-1]%mod;
	inv[n]=Fast_pow(fac[n],mod-2);
	for(int i=n;i>1;--i)inv[i-1]=1ll*inv[i]*i%mod;
}
inline int C(int n,int m){return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int a[200007],b[200007],f[4007][4007];
int main(){
//	freopen("notshuxue.in","r",stdin);
//	freopen("notshuxue.out","w",stdout);
	init();
	int n=read(),ans=0;
	for(int i=1;i<=n;++i)a[i]=read(),b[i]=read(),f[2001-a[i]][2001-b[i]]++;
	for(int i=1;i<=4001;++i)
		for(int j=1;j<=4001;++j)
			f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%mod;
	for(int i=1;i<=n;++i)
		ans=(ans+f[2001+a[i]][2001+b[i]]-C(a[i]+a[i]+b[i]+b[i],a[i]+a[i]))%mod;
	ans=1ll*inv2*ans%mod;
	printf("%d\n",(ans+mod)%mod);
//	fclose(stdin);fclose(stdout);
	return 0;
}

Measured memory_bytes: 64640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int sum = 0 - N - M;
        for(int i=N;i>0;i--)
        {
            sum = sum + i;
        }
        for(int i=M;i>0;i--)
        {
            sum = sum + i;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  if (s.back() == 's') {
    cout << s + "es" << endl;
  } else {
    cout << s + "s" << endl;
  }
}

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

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main() {

	string t;
	cin >> t;
	int le = t.length();
	int ans = 0;
	REP(i,le/2) {ans += t[i] != t[le-i-1];}
  cout << ans << endl;
}


Measured memory_bytes: 3608
my $input_string = <STDIN>;

my $X=0;
my $A=0;
my $B=0;

($X, $A, $B) = split(/ /, $input_string);

if($A >= $B){
	print "delicious\n";
}
elsif($A < $B && $B <= $X+$A){
	print "safe\n";
}
else{
	print "dangerous\n";
}


Measured memory_bytes: 512
#include<stdio.h>
 
int main(void){
	char S[200001],T[200001];
	int i=0,count=0;
	if(scanf("%s",S)){};
	if(scanf("%s",T)){};
 
	for(i=0;S[i] != '\0';i++){
		if(S[i] != T[i]){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 2124
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define MAX_N 101000
#define INF 10000000000
vector<ll> dp(MAX_N, INF);

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];
  // ここだけ調整
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);

  for (int i = 0; i < N; i++) {
    for (int k = 1; k <= K; k++) {
      dp[i + k] = min(dp[i + k], dp[i] + abs(h[i + k] - h[i]));
    }
  }

  cout << dp[N - 1] << endl;
  return 0;
}

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

int main(){
  string str;
  int ab[26]={};
  int i;
  
  while(getline(cin,str)){
    for(i=0; i<str.size() ; i++){
      if(str[i]>='a' && str[i]<='z') 
      ab[str[i]-'a']++;
      else if(str[i]>='A' && str[i]<='Z') 
      ab[str[i]-'A']++;
    }
  }
  for(i=0 ; i<26 ; i++){
    cout << (char)('a'+ i) << " : " << ab[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3192
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  if(n % 2 == 0)
    printf("%f",n / 2.0 / n);
  else
    printf("%f",(n + 1) / 2.0 / n);  
  return 0;
}
  
  
  
  


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main () {
  int n,a[210],counter;
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  while(1){
    bool flag = false;
    for(int i=0; i<n; i++){
      if(a[i]%2 != 0)flag = true;
    }
    if(flag)break;
    
    for(int i=0; i<n; i++){
      a[i] = a[i]/2;
    }
    counter++;
  }
  cout << counter << endl;
}


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

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t,n,m,i,j,k,sum=0;
    cin>>n;
    vector<int> a(n+1),b(n);
    int temp=0;
    for(i=0;i<=n;i++){
        cin>>a[i];
        temp+=a[i];
    }
    for(i=0;i<n;i++){
        cin>>b[i];
    }
    for(i=0;i<n;i++){
        if(a[i]>=b[i]){
            a[i]=a[i]-b[i];
            b[i]=0;
        }
        else{
            b[i]-=a[i];
            a[i]=0;
        }
        if(a[i+1]>=b[i]){
            a[i+1]-=b[i];
            b[i]=0;
        }
        else {
            b[i]-=a[i+1];
            a[i+1]=0;
        }
    }
    sum=0;
    for(i=0;i<n+1;i++){
        sum+=a[i];
    }
    cout<<temp-sum<<'\n';



    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>

#define N 1000

int lcs(std::string x, std::string y) {
	int c[N + 1][N + 1];
	int m = x.size();
	int n = y.size();
	int maxl = 0;

	x = ' ' + x;
	y = ' ' + y;
	for (int i = 0; i <= m; i++) c[i][0] = 0;
	for (int i = 0; i <= m; i++) c[0][i] = 0;

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (x[i] == y[j]) c[i][j] = c[i - 1][j - 1] + 1;
			else c[i][j] = std::max(c[i - 1][j], c[i][j - 1]);
			maxl = std::max(maxl, c[i][j]);
		}
	}
	return maxl;
}

int main() {
	std::string s1, s2;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> s1 >> s2;
		std::cout << lcs(s1, s2) << std::endl;
	}
	return 0;
}

Measured memory_bytes: 5128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] chars = scanner.nextLine().toCharArray();
        int n = chars.length;
        for (int i = 0; i < n / 2; i++) {
            if(chars[i]!=chars[n-i-1]){
                System.out.println("No");
                return;
            }
        }
        int n2 = (n-1) / 2;
        int n1 = (n - 1) / 4;
        for (int i = 0; i < n1; i++) {
            if(chars[i]!=chars[n2-1-i]){
                System.out.println("No");
                return;
            }
        }
        int n3 = (n + 3) / 2-1;
        for (int i = n3; i < n; i++) {
            if(chars[i]!=chars[n-i+n3-1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 22996
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int[] array = new int[N];
        int count = 0;

        for(int i = 0; i < N; i++){
            array[i] = scan.nextInt();
        }

        for(int i = 0; i <= N-1; i++){
            int minj = i;
            for(int j = i; j <= N-1; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
                }

                if(array[minj] < array[i]){
                    int temp = array[i];
                    array[i] = array[minj];
                    array[minj] = temp;
                    count++;
                }
            }

        for(int i= 0; i < array.length; i++){
        System.out.print(array[i]);
        if(i < array.length-1){
            System.out.print(" ");
        } else {
            System.out.println();
            System.out.println(count);
            }
        }
    }
}


Measured memory_bytes: 26324
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
#include <queue>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int n, m; cin >> n >> m;
    vvec<int> graph(n);
    vec<array<int, 2>> edge(m);
    for (int i = 0; i < m; ++i) {
        int a, b; cin >> a >> b; --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
        edge[i][0] = a; edge[i][1] = b;
    }

    int ans = 0;
    for (int i = 0; i < m; ++i) {
        auto [na, nb] = edge[i];

        int cycle = 0;
        vec<bool> visited(n, false);
        for (int j = 0; j < n; ++j) {
            if (visited[j]) continue;
            visited[j] = true;

            queue<int> que; que.push(0);
            while (!que.empty()) {
                int cur = que.front(); que.pop();
                int unused = cur == na ? nb : cur == nb ? na : -1;
                for (auto e : graph[cur]) {
                    if (visited[e]) continue;
                    if (e == unused) continue;
                    visited[e] = true;
                    que.push(e);
                }
            }

            ++cycle;
        }

        if (cycle != 1) {
            ++ans;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 3604
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>

using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}




int atcoder(){
    ll n,sum=0;
    cin>>n;
    vector<ll> a(n),b(n);
    set<ll> st;
    bool check=true;
    REP(i,0,n){
        cin>>a[i]>>b[i];
        if(a[i]!=b[i]) check=false;
        sum+=a[i];
        if(b[i]<a[i]) st.insert(b[i]);
    }
    if(check) cout<<0<<ENT;
    else cout<<sum-*st.begin()<<ENT;
    return 0;
}


signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}




Measured memory_bytes: 1024
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    A, B = [0] * N, [0] * N
    for i in range(N):
        A[i], B[i] = map(int, rl().split())
    
    A.sort()
    B.sort()
    
    if N % 2 == 0:
        med_a = (A[N // 2 - 1] + A[N // 2]) / 2
        med_b = (B[N // 2 - 1] + B[N // 2]) / 2
        ans = int((med_b - med_a) // 0.5 + 1)
    else:
        med_a = A[N // 2]
        med_b = B[N // 2]
        ans = med_b - med_a + 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 74784
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    ll n;
    std::cin >> n;
    ll nown = n;
    
    priority_queue< ll,vector<ll>,greater<ll> > que;
    
    for (int i = 2; i <= sqrt(n); i++) {
        while(nown%i==0){
            que.push(i);
            nown/=i;
        }
    }
    if(nown!=1){
        que.push(nown);
    }
    std::cout << n<<":";
    
    while(!que.empty()){
        ll v = que.top();que.pop();
        std::cout << " "<< v;
    }
    std::cout << std::endl;
}



Measured memory_bytes: 3164
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
	float n;
	char a[10],b[10];

	scanf("%s%s",a,b);

	strcat(a,b);
	n=sqrt(atof(a));
	if(n==(int)n)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

int main(void){
    int a,b,c = 0;
    cin >> a >> b >> c;
    int m = a+b;
    if(m > b+c){
        m = b+c;
    }
    if(m > c+a){
        m = c+a;
    }
    cout << m;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
    int n, m, c, ans = 0;
    scanf("%d%d%d", &n, &m, &c);
    vector<int> b(m), a(m);
    for (int i = 0; i < m; ++i) scanf("%d", b.begin() + i);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            scanf("%d", a.begin() + j);
            a.at(j) *= b.at(j);
        }
        if (accumulate(a.begin(), a.end(), c) > 0) ++ans;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n, m;
  cin >> n >> m;
  vector<int> posx(n);
  vector<int> posy(n);
  vector<int> cx(m);
  vector<int> cy(m);
  REP(i,n) {
    int a, b;
    cin >> a >> b;
    posx[i] = a;
    posy[i] = b;
  }

  REP(i,m){
    int a, b;
    cin >> a >> b;
    cx[i] = a;
    cy[i] = b;
  }

  vector<int> ans(n); //check point


  REP(j,n){
    int minlen = 1000000009;
   REP(i,m){
      int sum = 0;
      sum = abs(posx[j]-cx[i]) + abs(posy[j]-cy[i]);
      // cout << minlen << endl;
      // cout << sum << endl;
      if(sum < minlen){
        ans[j] = i + 1;
        minlen = sum;
      }
    }
  }
  for(auto x: ans) cout << x << endl;


  return 0;
}


Measured memory_bytes: 3640
import java.util.*;

// UVa 11504

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		char c = in.next().charAt(0);
		if (c == 'a' || c == 'i' || c == 'o' || c == 'e' || c == 'u') {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}
	}
}

Measured memory_bytes: 20820
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll A, P;

int main() {
	cin >> A >> P;
	cout << (A * 3 + P) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll A;
    cin >> A;
    ll B;
    cin >> B;
    prt(A*B)

    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int cnt = 0;
    for(int i=0; i<N; i++){
      if(sc.nextInt()>=K){
        cnt++;
      }
    }
    System.out.print(cnt);
  }
}

Measured memory_bytes: 47252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n,x,y;
    cin >> n >> x >> y;
    x--;y--;
    vector<vi> dis(n,vi(n));
    rep(i,n){
        for(int j=i+1;j<n;j++){
            dis[i][j] = min({j-i,abs(i-x) + 1 + abs(y-j), abs(i-y) + 1 + abs(x-j)});
        }
    }
    map<int,int> ss;
    rep(i,n){
        rep(j,n){
            if(dis[i][j]!=0) ss[dis[i][j]]++;
        }
    }
    for(int i=1;i<=n-1;i++){
        cout << ss[i] << endl;
    }
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int M = min(A, B);
	int i;
	vector<int> I;
	for (i = M; i >= 1; i--) {
		if (A%i == 0 && B%i == 0) {
			I.push_back(i);
		}
	}
	cout << I.at(K-1);
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long[] a=new long[4],b=new long[4];
    long sum=0;
    for(int i=0;i<4;i++){
      a[i]=sc.nextLong();
    }
    long n=sc.nextLong(),min=1000000000;
    b[0]=a[0]*8;
    b[1]=a[1]*4;
    b[2]=a[2]*2;
    b[3]=a[3];
    int f=0;
    
    for(int i=0;i<3;i++){
      min=(long)Math.min(min,b[i]);
    }
    if(min>=b[3]){
      for(int i=0;i<n/2;i++){
        sum+=a[3];
      }
      if(n%2==1){
        sum+=min/2;
      }
    }else{
      for(int i=0;i<n;i++){
        sum+=min/2;
      }
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 22736
#include <cstdio>

typedef long long LL;
const int MN = 200005;

int N, A[MN], L[MN], R[MN];
int stk[MN], tp;
LL Ans;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
	stk[tp = 1] = 0;
	for (int i = 1; i <= N; ++i) {
		while (A[stk[tp]] > A[i]) R[stk[tp--]] = i;
		L[i] = stk[tp], stk[++tp] = i;
	}
	while (tp) R[stk[tp--]] = N + 1;
	for (int i = 1; i <= N; ++i) Ans += (LL)(i - L[i]) * (R[i] - i) * A[i];
	printf("%lld\n", Ans);
	return 0;
}

Measured memory_bytes: 3328
fn main() {
    let mut sc = Scanner::new();
    let a: Vec<usize> = sc
        .read::<String>()
        .chars()
        .map(|c| ((c as u8) - ('a' as u8)) as usize)
        .collect();
    let n = a.len();

    let mut used = vec![false; 26];
    let mut k = vec![0; n + 1];

    for i in (0..n).rev() {
        used[a[i]] = true;
        let mut ok = true;
        for &b in &used {
            ok &= b;
        }
        if ok {
            for i in 0..used.len() {
                used[i] = false;
            }
        }
        k[i] = if ok { k[i + 1] + 1 } else { k[i + 1] };
    }

    let mut indices = vec![vec![]; 26];
    for i in 0..n {
        indices[a[i]].push(i + 1);
    }

    let mut ans = Vec::new();
    let mut cur = 0;
    for _ in 0..(k[0] + 1) {
        for i in 0..26 {
            let t: usize = match indices[i].binary_search(&(cur + 1)) {
                Ok(t) => indices[i][t],
                Err(t) => if t == indices[i].len() {
                    n + 1
                } else {
                    indices[i][t]
                },
            };
            if t != n + 1 && k[cur] == k[t] {
                continue;
            }
            cur = t;
            ans.push(i);
            break;
        }
    }

    for &i in &ans {
        print!("{}", ((i as u8) + ('a' as u8)) as char);
    }
    println!();
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

int main(int argc, char *argv[]) {
    char  s[1002];
    cin >> s;
    cout << s;
    if(s[strlen(s)-1]=='s') cout << "es" << endl;
    else cout << "s" << endl;
    return 0;
}



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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

vector<ll> fct, inv;
void finit(int cmx, ll mod =MD){
	auto bin_pows =[](ll x, ll n, ll mod){
		ll res = 1LL;
		for(; n > 0; n >>=1, x = x*x %mod) if(n & 1) res = res * x %mod;
		return res;
	};
	fct.assign(cmx+20, 0); inv.assign(cmx+20, 0);
	fct[0] = fct[1] = inv[1] = 1;
	for(int i=2;i<cmx+3;i++) fct[i] = fct[i-1] * i % mod;
	inv[cmx] = bin_pows(fct[cmx], mod-2, mod);
	for(int i=cmx;i>=1;i--) inv[i-1] = inv[i] * i % mod;
}
ll nCk(ll n, ll k, ll mod =MD) {
	if(k > n) return 0;
	ll ret =fct[n] * inv[k] % mod * inv[n-k] % mod;
	return ret;
}

int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	
	int x, y;
	cin >>x >>y;
	finit(x+y+20);
	
	if((x+y)%3){puts("0"); return 0;}
	
	//a + 2b= x, 2a +b = y
	int a = (2*y -x)/3;
	int b = y - 2*a;
	if(a<0 || b<0 ) {puts("0"); return 0;}
	
	cout << nCk(a+b, a, MD) <<"\n";
	return 0;
}


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

#define MAX_N 50

int main() {
    int N;
    cin >> N;
    double v[MAX_N] = {0};
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    sort(v, v+N);
    double res = v[0];
    for (int i = 1; i < N; i++) {
        res = (res + v[i]) / 2;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<int> t(N);
  int sum = 0;
  rep(i, N) {
    cin >> t[i];
    sum += t[i];
  }

  int M;
  cin >> M;

  int p, x;
  int diff;
  rep(i, M) {
    cin >> p >> x;
    p--;
    diff = t[p] - x;
    cout << sum - diff << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll n, m;
  cin >> n >> m;
  set<P> s;
  REP(i, m) {
    ll a, b;
    cin >> a >> b;
    s.insert(P(a, b));
  }
  ll ret = 0;
  while (s.size()) {
    P now = *s.begin();
    s.erase(s.begin());
    auto itr = s.lower_bound(P(now.first, 0));
    while (itr != s.end()) {
      P next = *itr;
      if (now.second <= next.first)
        break;
      s.erase(itr);
      now = P(max(next.first, now.first), min(next.second, now.second));
      itr = s.lower_bound(P(now.first, 0));
    }
    ret++;
  }
  cout << ret << endl;
}

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

#ifdef LOCAL
	#define debug(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(...) 42
#endif

#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

inline string getString(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string getLine(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

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

const int S=100100;
int main()
{
	ll a,b;
	while(~sf("%lld %lld",&a,&b))
	{
		ll g=__gcd(a,b);

		int cnt=0;
		if(g%2==0)
		{
			cnt++;
			while(g%2==0)g/=2;
		}

		for(int i=3;i<=sqrt(g);i++)
		{
			if(g%i==0)
			{
				cnt++;
				while(g%i==0)g/=i;
			}
		}
		if(g>1)cnt++;
		pf("%d\n",cnt+1);
	}
    return 0;
}



































Measured memory_bytes: 3780
s = input()

i = 0
while True:
    if s[i] == "A":
        a = i
        break
    i = i + 1

i = -1
while True:
    if s[i] == "Z":
        z = i
        break
    i = i - 1

ans = len(s) - a + (z + 1)
print(ans)

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

int main()
{
    int A, B, C;

    cin >> A >> B >> C;

    bool dec = false;
    if(A < B)
    {
        for(int i = A; i < B; i++)
        {
            if(i == C)
            {
                dec = true;
                break;
            }
        }
    }
    else
    {
        for(int i = B; i < A; i++)
        {
            if(i == C)
            {
                dec = true;
                break;
            }
        }
    }
    
    if(dec) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;

namespace c
{
    class Program
    {
        public static readonly long INF = 999999999999;

        static void Main(string[] args)
        {
            var n = Scanner.LongScan()[0];
            var h = Scanner.LongScan();
            var dp = new long[100010];

            for (var i = 0; i < 100010; i++) dp[i] = INF;
            dp[0] = 0;

            for (var i = 1; i < n; i++)
            {
                Ex.Chmin(ref dp[i], dp[i - 1] + Math.Abs(h[i] - h[i - 1]));
                if(i > 1) Ex.Chmin(ref dp[i], dp[i - 2] + Math.Abs(h[i] - h[i - 2]));
            }
            Console.WriteLine(dp[n - 1]);
        }
    }

    public class Scanner
    {
        public static string[] Scan() => Console.ReadLine().Split(' ');
        public static int[] IntScan() => Array.ConvertAll(Scan(), int.Parse);
        public static long[] LongScan() => Array.ConvertAll(Scan(), long.Parse);
        public static string[][] Scan(int n) => Enumerable.Repeat(0, n).Select(_ => Scan()).ToArray();
        public static int[][] IntScan(int n) => Enumerable.Repeat(0, n).Select(_ => IntScan()).ToArray();
        public static long[][] LongScan(int n) => Enumerable.Repeat(0, n).Select(_ => LongScan()).ToArray();

    }

    public class Ex
    {
        public static bool Chmin(ref int a, int b) { if (a > b) { a = b; return true; } return false; }
        public static bool Chmin(ref long a, long b) { if (a > b) { a = b; return true; } return false; }
        public static bool Chmax(ref int a, int b) { if (a < b) { a = b; return true; } return false; }
        public static bool Chmax(ref long a, long b) { if (a < b) { a = b; return true; } return false; }
        public static int[] SubArr(int[] arr, int begin, int n) { int[] a = new int[arr.Length]; Array.Copy(arr, begin, a, 0, n); return a; }
    }
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

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

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    string s;
    cin >> s;
    if (s == "a" || s == "i" || s == "u" || s == "e" || s == "o") {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	int n, m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No") << endl;
}

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

string S;

int main(){
  cin >> S;
  int y = stoi(S.substr(0, 4));
  int m = stoi(S.substr(5, 2));
  int d = stoi(S.substr(8, 2));
  if (y <= 2019 && m <= 4 && d <= 30) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
}


Measured memory_bytes: 3616
# include <bits/stdc++.h>
# define ll long long int
# define pb push_back
# define pf push_front
# define mpi make_pair
# define pi pair<ll,ll>
# define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
# define mod 1000000007
# define endl "\n"
using namespace std;
int main()
{
	fast
	ll n;
	string s;
	cin>>n;
	s=to_string(n);
	ll val=s.size();
	if(val==1)
	{
		cout<<n;
	}
	else if(val==2)
	{
		cout<<"9";
	}
	else if(val==3)
	{
		cout<<(9+(n-100)+1);
	}
	else if(val==4)
	{
		cout<<"909";
	}
	else if(val==5)
	{
		cout<<(909+(n-10000)+1);
	}
	else
	{
		cout<<"90909";
	}
	return 0;
}


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

int main(){
  long long N, A, B; cin >> N >> A >> B;
  long long X = (N/(A + B));
  if(N%(A+B)==0) X--;
  if ((N-(A+B)*X) - A >= 0)
    cout << A*X+A << endl;
  else
    cout << A*X+(N-(A+B)*X) << endl;

}


Measured memory_bytes: 256