akhauriyash/Code-Regression huggingface dataset:
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();
            var x = line[0];
            var y = line[1];
            //var a = long.Parse(ReadLine());

            if(2 * x < y || 2 * y < x)
            {
                WriteLine(0);
                return;
            }

            var total = x + y;
            if(total % 3 != 0)
            {
                WriteLine(0);
                return;
            }

            total /= 3;

            var fac = new long[total + 1];
            var inv = new long[total + 1];
            var facInv = new long[total + 1];

            Init(fac, inv, facInv, total);

            long count = 0;
            for(var i = 0; i <= total; i++)
            {
                if(i - (total - i) != -x + y)
                {
                    continue;
                }
                count += Combination(fac, inv, facInv, total, i);
                count %= mod;
            }

            WriteLine(count);
        }

        private static void Init(long[] fac, long[] inv, long[] facInv, long n)
        {
            fac[0] = fac[1] = 1;
            facInv[0] = facInv[1] = 1;
            inv[1] = 1;

            for(var i = 2; i <= n; i++)
            {
                fac[i] = fac[i - 1] * i % mod;
                inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                facInv[i] = facInv[i - 1] * inv[i] % mod;
            }
        }

        private static long Combination(long[] fac, long[] inv, long[] facInv, long n, long r)
        {
            return fac[n] * (facInv[r] * facInv[n - r] % mod) % mod;
        }
    }
}


Measured memory_bytes: 33796
#include <ctype.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

inline int comp(long *a, long *b){
	return (*a<*b)-(*a>*b);
}

int n;
int a[300000][2];
int cx[300000], cy[300000];
int main(void){
	int h=nextint();
	int w=nextint();
	n=nextint();
	for(int i=0; i<n; i++){
		int x=nextint()-1;
		int y=nextint()-1;
		a[i][0]=x; cx[x]++;
		a[i][1]=y; cy[y]++;
	}
	int bxm=0, bym=0;
	int bx=0, by=0;
	for(int x=0; x<h; x++){
		if(cx[x]>bxm){
			bxm=cx[x];
			bx=1;
		}else if(cx[x]==bxm){
			bx++;
		}
	}
	for(int y=0; y<w; y++){
		if(cy[y]>bym){
			bym=cy[y];
			by=1;
		}else if(cy[y]==bym){
			by++;
		}
	}
	if(bx*by>n){
		int ans=bxm+bym;
		printf("%d\n", ans);
	}else{
		int s=0;
		for(int i=0; i<n; i++){
			if(cx[a[i][0]]==bxm && cy[a[i][1]]==bym){
				s++;
			}
		}
		if(s==bx*by){
			int ans=bxm+bym-1;
			printf("%d\n", ans);
		}else{
			int ans=bxm+bym;
			printf("%d\n", ans);
		}
	}
}


Measured memory_bytes: 6272
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

a,b,n = l_in()

if n >= b-1:
    print((a*(b-1))//b)
else:
    print(a*n//b)


Measured memory_bytes: 61872
// https://beta.atcoder.jp/contests/abc063

#include <bits/stdc++.h>
using namespace std;

int main() {
    set<char> cs;
    string s;
    cin >> s;
    for (auto c : s) {
        if (cs.find(c) != cs.end()) {
            cout << "no" << endl;
            exit(0);
        }
        cs.insert(c);
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int ans = 0;
	int N, M, C;
	cin >> N >> M >> C;
	vint B(M);
	int A;

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

	for (int i = 0; i < N; i++) {
		int tmp = 0;
		for (int j = 0; j < M; j++) {
			cin >> A;
			tmp += (A * B[j]);
		}
		if(tmp+C>0){
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 1000000007ll;

// structure ------------------------------------------

// function -------------------------------------------

// main -----------------------------------------------

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    REP(i, n) { cin >> a[i] >> b[i]; }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll ans = 0;
    if(n % 2 == 1) {
        // odd
        ans = b[n / 2] - a[n / 2] + 1;
    } else {
        ans = b[n/2-1] + b[n/2] - a[n/2-1] - a[n/2] + 1;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6408
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll n,m; cin >> n >> m;
  
  if(n == 1 && m == 1){
    cout << 1;
  }
  else if(n == 1 && m >= 2){
    cout << m-2 << endl;
  }
  else if(n >= 2 && m == 1){
    cout << n-2 << endl;
  }
  else{
    cout << (n-2)*(m-2) << endl;
  }
  
}

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

int main(){ 
  string S, T, A = "";
  int N;
  cin >> N;
  cin >> S >> T;
  
  rep(i,N) {
    A += S.at(i);
    A += T.at(i);
  }
  
  cout << A << endl;
}
    

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  int r;
  cin >> r;
  double pi = 3.14159265;
  double ans = r * 2 * pi;
  cout << ans << endl;
}

Measured memory_bytes: 3772
#include <stdio.h>
#include <algorithm>

struct stu{
    long long b,l,u;long long suml,sumu;
}s[100010];
long long n,x;
int cmp(stu aa,stu bb){
    return aa.u*((long long)x-aa.b)+aa.l*aa.b>bb.u*((long long)x-bb.b)+bb.l*bb.b;
}

int check(long long mid)
{

    long long p=mid%x, q=mid/x;

    for( int i=1;i<=q;i++ )
    {
        long long dis=0;
        dis += s[i-1].sumu;dis += (s[q+1].sumu-s[i].sumu);
        if(p>s[i].b) dis+=(p-s[i].b)*s[i].u;
        else dis += (p-s[i].b)*s[i].l;
        dis -= (s[n].suml-s[q+1].suml);
        if (dis>=0) return 1;
    }
    for ( int i=q+1;i<=n;i++)
    {
        long long dis=0;
        dis += s[q].sumu;
        dis -= (s[i-1].suml-s[q].suml);dis-= (s[n].suml-s[i].suml);
        if(p>s[i].b) dis+=(p-s[i].b)*s[i].u;
        else dis += (p-s[i].b)*s[i].l;
        if (dis>=0) return 1;
    }


    return 0;
}

int main()
{
    scanf("%lld%lld",&n,&x);

    for (int i=1;i<=n;i++)
    {
         scanf("%lld%lld%lld",&s[i].b,&s[i].l,&s[i].u);
         s[i].suml=s[i].sumu=0;
    }
    std::sort(s+1,s+n+1,cmp);
    s[0].suml=s[0].sumu=0;
    for (int i=1;i<=n;i++) {
        s[i].suml=s[i-1].suml+s[i].b*s[i].l;
        s[i].sumu=s[i-1].sumu+(x-s[i].b)*s[i].u;
    }
    long long ans=(long long)n*x,l=0,r=(long long)n*x;

    while(l<=r){
        long long mid=(l+r)/2;
        if (check(mid)){
            ans=mid;r=mid-1;
        }
        else l=mid+1;
    }
    printf("%lld",ans);



}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define ll          long long int 
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        400005
#define mod         1000000007 
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,mx;
    cin>>n>>m;
    mx=max({n+n-1,m+m-1,n+m});
    cout<<mx;
}

Measured memory_bytes: 256
import math

def checkifprime(NN):
    for i in range(len(MSprime)):
        if MSprime[i]>NN:
            break
        elif NN%MSprime[i]==0:
            return -1
    return NN


nummax=int(50000)
MSall=sorted([7*x-1 for x in range(1,nummax/7)]+[7*x+1 for x in range(1,nummax/7)])
MSprime=[]
smax=math.sqrt(nummax)
i=6
while i<=smax:
    for x in MSall:
        if x%i==0:
            MSall.remove(x)
    MSprime.append(i)
    i=MSall[0]
MSprime=MSprime+MSall

while(1):
    N=int(raw_input())
    if N==1:
        break
    else:
        ok=[]
        for i in range(len(MSprime)):
            if MSprime[i]>N:
            	break
            elif N%MSprime[i]==0:
                ok.append(MSprime[i])
                cifp=checkifprime(N/MSprime[i])
                if cifp>0 and cifp!=1:
                    ok.append(cifp)
        if len(ok)==0:
        	ok.append(N)
        ok.sort()
                
        print str(N)+': '+' '.join([str(x) for x in ok])

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

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

    //寿司のペア配列（おいしさ、種類の順）
    vector<pair<int, int>> dt(N);
    rep(i, N) {
       int t, d;
       cin >> t >> d;
       dt[i] = make_pair(d, t);
    }
    sort(dt.begin(), dt.end());

    //まず、種類に関係なくおいしさの高いK個の寿司を選び、その後
    //まだ食べたことのない種類のネタを持つ寿司のうちおいしさが最大のものと、
    //すでに選んである寿司のうち消してもネタの種類数が減らないものを交換していく。

    //始めにK個の寿司をおいしさが高いものから順に選び取るとき、すでに食べたことのある
    //ネタが現れた場合、その寿司のおいしさを優先度付きキューを用いて昇順に記録する。
    priority_queue<int, vector<int>, greater<int>> eat;

    //ネタの種類ごとに、食べたかどうかを記録する配列
    vector<bool> kinds(N+1, false);

    ll res = 0, sum = 0, cnt = 0, kin = 0;
    for(int i=N-1; i>=0; i--) {
        cnt++;

        //食べたことのあるネタなら
        if(kinds[dt[i].second]) {
            if(cnt > K) continue; //最初のK回以降、すでに食べた種類の寿司は無視する
            eat.push(dt[i].first); //最初のK回の間にネタが重複した場合、優先度付きキューにおいしさを記録

        //食べたことのないネタなら    
        } else {
            if(cnt > K) {

                //優先度付きキューの中身が全て交換に出されていたら、その時の満足ポイントは必ず最大
                if(eat.empty()) break;

                //最初に選んだ寿司のうち、2回以上選んだネタをもつもの
                //(消去してもネタの種類数が減らないもの)を選択から外す。
                sum -= eat.top();
                eat.pop();
            }
            //新しく食べたネタを記録
            kinds[dt[i].second] = true;
            kin++;
        }
        sum += dt[i].first;
        res = max(res, sum + kin * kin);
    }

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

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else
		return gcd(b, a % b);
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll sum = 0;
    rep(i,n){
        int a;
        cin >> a;
        sum += a - 1;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>

typedef long long ll;

using namespace std;

int main() {
  string S;
  cin >> S;
  ll res = 0;
  ll cnt = 0;
  for (int i = S.size() - 1; i >= 0; --i) {
    if (S[i] == 'W') {
      ++cnt;
    } else {
      res += cnt;
    }
  }
  printf("%lld\n", res);
}

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

int main(void){

  string str;

  getline(cin,str);

  for ( int i = 0 ; str[i] != '\0' ; i++){

    if ( (str[i] >= 'a') && (str[i] <= 'z')){
      str[i] -= 32;
    }else if ( (str[i] >= 'A') && (str[i] <= 'Z')){
      str[i] += 32;
    }
  }

  cout << str << endl;
}

Measured memory_bytes: 3180
#include <stdio.h>

int main(){
    char YM[4];
    int first,last;
    int first1,first2;
    int last1,last2;
    scanf("%s",&YM);
    first1 = ( YM[0] - '0' ) * 10;
    first2 = ( YM[1] - '0' );
    last1 = ( YM[2] - '0' ) * 10;
    last2 = ( YM[3] - '0' );
    first = first1 + first2;
    last = last1 + last2;
    if( ((first >= 1) && (first <= 12)) && ((last >= 0) && (last <= 99)) && ((first >= 0) && (first <= 99)) && ((last >= 1) && (last <= 12))){
        printf("AMBIGUOUS\n");
    }else if( ((first >= 1) && (first <= 12)) && ((last >= 0) && (last <= 99)) ){
        printf("MMYY\n");
    }else if( ((first >= 0) && (first <= 99)) && ((last >= 1) && (last <= 12)) ){
        printf("YYMM\n");
    }else{
        printf("NA\n");
    }
    //printf("%d %d",first,last);
    return 0;
}

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

typedef long long ll;

int dp[5005][5005];

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (int i=N-1;i>=0;i--){
        for (int j=N-1;j>=0;j--){
            if (S[i] == S[j]) dp[i][j] = dp[i+1][j+1] + 1;
            else dp[i][j] = 0;
        }
    }
    int ans = 0;
    for (int i=0;i<N;i++){
        for (int j=0;j<N;j++){
            if (j<i) continue;
            ans = max(ans, min(dp[i][j],j-i));
        }
    }
    cout << ans << endl;
    

    return 0;
}

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

int main()
{
  double N,M;
  int64_t sum=0;
  vector<double> a(1001);
  bool chk=true;
  cin >>N>>M;
  for(int i=0; i<N; i++)
  {
    cin >> a.at(i); 
  }
  for(int i=0; i<N; i++)
  {
    sum+=a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i=0; i<M; i++)
  {
      if(a.at(i)<(sum/(4*M)))
      {
		chk=false;
      }
  }
  if(chk)
  cout << "Yes" << endl;
  else
  {
  cout << "No" << endl;
  }
}



Measured memory_bytes: 256
// AOJ0558.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//Global
const int MAX_H = 1000;
const int MAX_W = 1000;
const int MAX_N = 9;
const int INF = 100000000;
char maze[MAX_H][MAX_W + 1];
int d[MAX_H][MAX_W];
int H, W, N;
int sx, sy;
int gx, gy;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
P dot[MAX_N + 1];

//solve
int solve() {
	//S(0)-->1 1-->2 ....N-1-->N??????????????¢????±?????????????
	int sumDistance = 0;
	for (int i = 0; i < N; i++) {
		sx = dot[i].first;
		sy = dot[i].second;
		gx = dot[i + 1].first;
		gy = dot[i + 1].second;

		//??¨??????????????????????????????
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				d[i][j] = INF;
			}
		}

		queue<P> que;
		que.push(P(sx, sy));
		d[sy][sx] = 0;//??????????????°??????0?????????

		//?????\???????????????????????§?????????
		while (que.size()) {
			//?????\???????????????????????????
			P p = que.front(); que.pop();
			//??????????????????????????\????????´??????????????°???????????????
			if (p.first == gx && p.second == gy)break;
			//?§????4??????
			for (int i = 0; i < 4; i++) {
				int nx = p.first + dx[i];
				int ny = p.second + dy[i];
				if (0 <= nx && nx < W && 0 <= ny && ny < H && maze[ny][nx] != 'X' && d[ny][nx] == INF) {
					que.push(P(nx, ny));
					d[ny][nx] = d[p.second][p.first] + 1;
				}
			}
		}
		//cout << i <<"-->" << i+1 << "????????¢" << d[gy][gx] << endl;
		sumDistance += d[gy][gx];
	}
	return sumDistance;
}
	
	
	
//main
int main()
{
	//input
	cin >> H >> W >> N;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> maze[i][j];
			if (maze[i][j] == 'S') {
				dot[0] = P(j, i);
			}
			else {
				switch (maze[i][j]) {
				case '1':dot[1] = P(j, i); break;
				case '2':dot[2] = P(j, i); break;
				case '3':dot[3] = P(j, i); break;
				case '4':dot[4] = P(j, i); break;
				case '5':dot[5] = P(j, i); break;
				case '6':dot[6] = P(j, i); break;
				case '7':dot[7] = P(j, i); break;
				case '8':dot[8] = P(j, i); break;
				case '9':dot[9] = P(j, i); break;
				}
			}
		}
	}


	//cout << "========================" << endl;
	/*
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << maze[i][j];
		}
		cout << endl;
	}
	*/

	/*
	for (int i = 0; i <=  N; i++) {
		cout << "dot[" << i << "]=" << dot[i].first << "," << dot[i].second << endl;
	}
	cout << "===================================" << endl;
	*/
	cout << solve() << endl;
	
	return 0;
}

Measured memory_bytes: 6104
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
using namespace std;
int main(){
    int A,B;
    int ans= -1;
    cin>>A>>B;

    for(int i=1500;i>0;--i){
        float AA = i * 0.08;
        float BB = i * 0.1;
        if(floor(AA) == A && floor(BB) == B){
            ans = i ;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
#define ll long long 
#define pb push_back
int main(){	
	fast;
		ll n,k; cin>>n>>k;
		ll a[k],sum=0;
		for(ll i=0;i<k;i++){
			cin>>a[i];
			sum+=a[i];
			}
		if(sum>=n) cout<<"Yes";
		else cout<<"No";
		}
	

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
class BIT{
public:
	vector<int> bit;
	int M;
	// 1-index
	BIT(int M):
		bit(vector<int>(M+1, 0)), M(M) {}

	int sum(int i) {
		if (!i) return 0;
		return bit[i] + sum(i-(i&-i));
	}

	void add(int i, int x) {
		if (i > M) return;
		bit[i] += x;
		add(i+(i&-i), x);
	}
};

int main(){
	ll N;
	cin >> N;
	vector<ll> p(N);
	FOR(i,0,N) cin >> p[i];
	BIT bits(N);
	ll ans = 0;
	FOR(i,0,N){
		bits.add(p[i],1);
		if(bits.sum(p[i]-1)==0){
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
from math import factorial

mod = 10**9 + 7

# 組み合わせ　n_C_r
def comb(n,r):
    if not n >= r:
        return 0
    return factorial(n) // (factorial(n-r)*factorial(r))

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

def cal(i):
    return comb(K-1,i-1) * comb(N-K+1,i) % mod

for i in range(1,K+1):
    ans = cal(i)
    print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
//ll

int main(){
  int n,h,w;cin>>n>>h>>w;
  int ans = 0;
  rep(i,n){
    int a,b;cin>>a>>b;
    if(a>=h&&b>=w){
      ans++;
    }
  }
  cout << ans << endl;
}


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

int main() {
	int N,K,count=0;
	string S;
	cin>>N>>K>>S;
	for(int i=0; i<N-1; i++){
		if(S[i] == S[i+1]){
			count++;
		}
	}
	count += 2*K;
	cout<<((count<N-1)?count:N-1)<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main()
{
	long long a,b,m=1000000;
	scanf("%lld%lld",&a,&b);
	if(b-a>2019)printf("0\n");
	else
	{
		for(long long i=a;i<b;i++)
		{
			for(long long j=i+1;j<=b;j++)
			{
				if((i%2019*j%2019)%2019<m)m=(i%2019*j%2019)%2019;
			}
		}
		printf("%lld\n",m);
	}
}

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

int main()
{
	int a,b,c,sum=0;
    cin>>a;
    if(a<1200)
        cout<<"ABC";
    else if(a<2800)
        cout<<"ARC";
    else
    {
        cout<<"AGC";
    }
    
	
	
	return 0;
}
	

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vl p(N),pos(N);
    rep(i,N){
        cin >> p[i];
        pos[p[i]-1]=i;
    }
    ll res=0,k=0;
    rep(i,N-1){
        if(pos[i]<pos[i+1]){
            k++;
        }
        else{
            k=0;
        }
        chmax(res,k);
    }
    res++;
    cout << N-res << endl;
}

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

int main(){
  
  int N;cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  vector<int> C(N);
  for(int i=0;i<N;i++) C[i] = A[i];
  
  sort(C.begin(),C.end());
  
  int Amax = C[N-1];
  int Asec = C[N-2];
  
  for(int i=0;i<N;i++){
    if(A[i] == Amax) cout << Asec << endl;
    else cout << Amax << endl;
  }
  
  
}

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

string str, ans;

int main()
{
    cin >> str;
    for(int i = 0; i < str.length(); i++)
        if(str[i] == 'B')
        {
            if(!ans.empty())
                ans.pop_back();
        }
        else
            ans += str[i];

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) - 1 for i in input().split()]
ans = []
while len(a):
    key = -1
    for i, j in enumerate(a):
        if i == j:
            key = i
    if key == -1:
        break
    else:
        a.remove(key)
        ans.append(key + 1)

if len(ans) != n:
    print(-1)
else:
    for i in ans[::-1]:
        print(i)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
  
public class Main{
  
  public static void main(String [] args)throws IOException{
      
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int [] num = new int[51];
    for(int a = 0; a <= 9; a++)
      for(int b = 0; b <= 9; b++)
        for(int c = 0; c <= 9; c++)
          for(int d = 0; d <= 9; d++) 
             num[a+b+c+d]++;
    String ln ="";
    while((ln = br.readLine())!= null)
      System.out.println(num[Integer.parseInt(ln)]);    
         
      
    }
      
}

Measured memory_bytes: 24056
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
	unsigned long long n;
	vector<unsigned long long> num;

	cin >> n;

	for (unsigned long long i = 1; i < sqrt(n)+1; i++) {
		if (n % i == 0) {
			num.push_back(i + (n / i) - 2);
		}
	}
	sort(num.begin(), num.end());

	cout << num.at(0) << endl;

	return 0;
}

Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//222
	int n,m,x;
	cin>>n>>m>>x;
	vi arr(m);
	for(int &i:arr)cin>>i;
	int add = upper_bound(arr.begin(),arr.end(),x)-arr.begin();
	cout<<min(add,m-add);
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X,N;
  cin >> X>>N;
  vector<bool>p(101,true);
  while(N-->0){int i; cin>>i; p[i]=false;}
  for(int i=0;i<=101;i++){
    if(p[X-i]){cout << X-i <<endl;return 0;}
    else if(p[X+i]){ cout << X+i<<endl; return 0;}
  }
}

Measured memory_bytes: 3624
#include <stdio.h>
int main()
{
	int n;
	char a[105], b[105];
	scanf("%d", &n); getchar();
	scanf("%s", a);
	scanf("%s", b);
	for(int i=0;i<n;i++)
	{
		printf("%c%c", a[i], b[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] line = scanner.nextLine().split(" ", 4);
        int[] arr = new int[4];
        for (int i = 0; i < 4; i++) {
            arr[i] = Integer.parseInt(line[i]);
        }
        Arrays.sort(arr);
        if (arr[0] == 1 && arr[1] == 4 && arr[2] == 7 && arr[3] == 9) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


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

using namespace std;


typedef long long ll;

int main()
{
    int n;
    cin>>n;
    int d;
    cin>>d;
    d=d*2;
    d++;
    //cout<<d<<endl;
    int u=n/d;
    if(u==0)u++;
    else{
    if(n%d!=0)u++;
    }
    cout<<u<<endl;
}


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

int main()
{
  int n;
  cin>>n;
  int a[n],b[n],c[n-1],i,j,k;
  for(i=0;i<n;i++){
    cin>>a[i];
    a[i]-=1;
  }
  for(i=0;i<n;i++){
    cin>>b[i];
  }
  for(i=0;i<n-1;i++){
    cin>>c[i];
  }
  int ans=b[a[0]];
  for(i=1;i<n;i++){
    ans+=b[a[i]];
    if(a[i]-a[i-1]==1) ans+=c[a[i-1]];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
long long mod=998244353;
int main(){
	int n,x,t;
	cin>>n>>x>>t;
	cout<<(n+x-1)/x*t<<endl;
	return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define endl "\n"
#define pi 3.14159265358979323846264338327950288
#define MOD 100000000000000000
#define INF -100000000000000
#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lld long double
using namespace __gnu_pbds; 
int main()
{
    fast;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
   // #endif
    ll int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
    
    int[] lst = new int[100];
    int point = 0;
        
    int fun(int n){
        if(n==0){
            point--;return lst[point+1];
        }
        point++;lst[point]=n;return 0;
    }
    
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main();
        int n;
        while(sc.hasNext()){
            n=sc.nextInt();
            if(n==0){System.out.println(m.fun(n));continue;}
            m.fun(n);
        }
    }
}


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

int h, w;

int main (){
  std::cin >> h >> w;
  std::vector<std::vector<char>> pic(h+2, std::vector<char>(w+2)); 
  for (int i = 1; i < h+1; ++i){
	for (int j = 1; j < w+1; ++j){
	  std::cin >> pic[i][j];
	}
  }

  for (int i = 0; i < h+2; ++i){
	pic[i][0] = '#';
    pic[i][w+1] = '#';
  }
  for (int i = 1; i < w+1; ++i){
	pic[0][i] = '#';
	pic[h+1][i] = '#';
  }
  for (int i = 0; i < h+2; ++i){
	for (int j = 0; j < w+2; ++j){
	  std::cout <<  pic[i][j];
	}
	std::cout << std::endl;
  }
}



Measured memory_bytes: 256
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(n):
    data = input()
    if data == 'AC':
        AC += 1
    elif data == 'WA':
        WA += 1
    elif data == 'TLE':
        TLE += 1
    elif data == 'RE':
        RE += 1

print('AC', 'x', AC)
print('WA', 'x', WA)
print('TLE', 'x', TLE)
print('RE', 'x', RE)

Measured memory_bytes: 74680
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
#define ALL(a) a.begin(), a.end()
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int main(){
    string s;
    cin >> s;
    int ans=0;
    if(s=="RRR"){
        cout<<3<<endl;
    }else if(s=="RRS"){
        cout<<2<<endl;
    }else if(s=="SRR"){
        cout<<2<<endl;
    }else if(s=="SSS"){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define pb push_back
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ll long long
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  int m = max(a, b);
  int ans = (a == b) ? a * 2 : m * 2 - 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
const int MAXN = 100005;
long long s[MAXN],t[MAXN],A,B,Q;

int find(long long a[],int n, long long x)
{
	int l = 1, r = n;
	while(l < r){
		int mid = (l + r) >> 1;
		if (a[mid]>=x) r = mid;
			else l = mid + 1;
	}
	return l;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> A >> B >> Q;
	for(int i = 1; i <= A; i++) cin >> s[i];
	for(int i = 1; i <= B; i++) cin >> t[i];
	sort(s+1,s+1+A);
	sort(t+1,t+1+B);
	t[0] = s[0] = -2e10;
	t[B+1] = s[A+1] = 2e10;
	for(int i = 0; i < Q; i++){
		long long x;
		cin >> x;
		int ps = find(s,A+1,x);
		int pt = find(t,B+1,x);
		long long ans = 2e15;
		for(int c = ps - 1; c <= ps + 1; c++)
			for(int d = pt - 1; d <= pt + 1; d++){
				ans = min(ans, abs(x-s[c])+abs(s[c]-t[d]));
				ans = min(ans, abs(x-t[d])+abs(t[d]-s[c]));
			}
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 2944
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define ull unsigned long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string o,e; cin>>o>>e;
	REP(i,o.size()){
		cout<<o[i];
		if(i<e.size()) cout<<e[i];
	}
	return 0;
}

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

int k,ans;
int dif[12];
const int M = 10;

void rec(int d, int p){
  if(p==k){
    ans = d;
    return;
  }
  if(d>=ans)return;

  int rot = dif[p];
  if(rot == 0){
    rec(d,p+1);
    return;
  }

  for(int i=p;i<k;i++)dif[i] = (dif[i]-rot+M)%M;
  rec(d+1,p+1);

  for(int i=k-1;i>=p;i--){
    dif[i] = (dif[i]+rot)%M;
    rec(d+1,p+1);
  }
}

int main(){
  while(cin >> k,k){
    string s,t;
    cin >> s >> t;
    for(int i=0;i<k;i++){
      dif[i] = ( (int)(t[i]-s[i]) + M ) % M;
    }

    ans = k;
    rec(0,0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, mi = 1000000, cnt,a;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		cnt += a;
		if (a % 2) {
			mi = min(mi, a);
		}
	}
	if (cnt % 2) {
		cout << (cnt - mi) / 2 << endl;
	}
	else {
		cout << cnt / 2 << endl;
	}
	endre;
}


Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int N = Integer.parseInt(scan.next());
	int min = 1000;
	int max = 0;

	for (int i = 0; i < N; i++) {
	    int a = Integer.parseInt(scan.next());
	    min = (a < min ? a : min);
	    max = (a > max ? a : max);
	}

	System.out.println(max-min);
	scan.close();
    }
}


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

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

Measured memory_bytes: 3628
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
using namespace std;
int n,used[100005],np[100005],nps,tp[100005],tps,ht,cl,cr,vf,vs;
vector <int> ve[100005];
void dfs(int x){
	np[nps++]=x;
	used[x]=true;
	if (x==n){
		ht=true;
		for (int i=0;i<=nps;i++) tp[i]=np[i];
		tps=nps;
	}
	for (int i=0;i<ve[x].size();i++){
		if (!used[ve[x][i]]){
			dfs(ve[x][i]);
			if (ht) return;
		}
	}
	nps--;
}
void dfs2(int x){
	used[x]=true;
	vf++;
	for (int i=0;i<ve[x].size();i++){
		if (!used[ve[x][i]]){
			if (cl==x && cr==ve[x][i]) continue;
			if (cl==ve[x][i] && cr==x) continue;
			dfs2(ve[x][i]);
		}
	}
}
void dfs3(int x){
	used[x]=true;
	vs++;
	for (int i=0;i<ve[x].size();i++){
		if (!used[ve[x][i]]){
			if (cl==x && cr==ve[x][i]) continue;
			if (cl==ve[x][i] && cr==x) continue;
			dfs3(ve[x][i]);
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for (int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		ve[a].push_back(b);
		ve[b].push_back(a);  
	}
	dfs(1);
	if (tps%2==0){
		cl=tp[tps/2-1];
		cr=tp[tps/2];
	}else{
		cl=tp[(tps/2)];
		cr=tp[(tps/2)+1];
	}
	for (int i=0;i<=n;i++) used[i]=false;
	dfs2(1);
	for (int i=0;i<=n;i++) used[i]=false;
	dfs3(n);
	if (vf>vs){
		cout<<"Fennec";
	}else{
		cout<<"Snuke";
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  ll n;cin>>n;
  ll t[n+10],a[n+10];
  rep(i,0,n)cin>>t[i]>>a[i];

  ll pt=t[0],pa=a[0];
  rep(i,1,n){
    ll p=max((pt%t[i]?pt/t[i]+1:pt/t[i]),(pa%a[i]?pa/a[i]+1:pa/a[i]));
    pt=p*t[i],pa=p*a[i];
  }

  out(pt+pa);

  return 0;
}


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

int main() {
  int H, A, a;
  cin >> H >> A;
  for (int i = 0; ; i++) {
    H -= A;
    if (H <= 0) {
      a = i + 1;
      break;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=1e9+7;

signed main() {
  int N,K;cin>>N>>K;
  typedef pair<int,int> P;
  std::vector<P> v(N);
  for(int i=0;i<N;i++){
    int a,b;cin>>a>>b;a--;
    v[i]=P(b,a);
  }
  sort(v.rbegin(),v.rend());
  int ans=0;
  std::vector<int> usedc(N,0);
  stack<int> sta;
  int res=0;int color=0;
  for(int i=0;i<K;i++){
    res+=v[i].first;
    if(usedc[v[i].second]++==0)color++;
    else sta.push(v[i].first);
  }
  ans=res+color*color;
  for(int i=K;i<N&&sta.size();i++){
    if(usedc[v[i].second]++)continue;
    int a=sta.top();sta.pop();
    res-=a;res+=v[i].first;color++;
    ans=max(ans,res+color*color);
  }
  cout<<ans<<endl;
}


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

using namespace std;

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

    float max_area = float(W) * float(H) / 2;
    cout << max_area << " ";
    if((W / 2.0 == x) && (H / 2.0 == y)) {
        cout << "1" << endl;
    } else {
        cout << "0" << endl;
    }
}


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

int isprime(int);

int main()
{

  int n, count = 0, i, x[10000];

  scanf("%d", &n);

  for(i = 0; i < n; i++) scanf("%d", &x[i]);

  for(i = 0; i < n; i++){
    if(isprime(x[i]) == 1) count++;
    // else if(isprime(x[i]) == 0) continue;
  }
  printf("%d\n", count);
  return 0;
}

int isprime(int x)
{
  int j;

  if(x == 1 || x == 2) return 1;

  if(x <  2 || x % 2 == 0 ) return 0;

  j = 3;
  while(j <= sqrt(x)){
    if(x % j == 0) return 0;
    j = j + 2;
  }
  return 1;
}

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

using namespace std;
#define ll long long int

void solve(){

	int N , a;
	cin>>N;
	

	vector<int>v;
	
	for(int i = 0 ; i < N ;i++){
		cin>>a;
		v.push_back(a);
	}

	sort(v.rbegin(),v.rend());

	ll c = v[0];
	int count = 0;
	int p = 1;

	for(int i = 0; i < N-2 ; i++){

		c = c + v[p];
		count++;


		
		if(count == 2){
		    p++;	
			count = 0;
		}
	}

	cout<<c<<"\n";

}




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

    
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif

   
    solve();
   
    return 0;
}


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

int main() {
  char c;
  cin >> c;

  if(c == 'a' || c== 'i' || c== 'u' || c== 'e' || c== 'o') {
     cout << "vowel" <<  endl;
  } else {
     cout << "consonant" << endl;
  }

  return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (auto i = 0; i < m; i++)
    {
        int xi;
        cin >> xi;
        x[i] = xi;
    }

    vector<int> b(m - 1);
    sort(x.begin(), x.end());
    for (auto i = 0; i < m - 1; i++)
    {
        b[i] = x[i + 1] - x[i];
    }

    sort(b.begin(), b.end());

    if (n >= m)
    {
        cout << 0 << endl;
    }
    else
    {
        int ans = 0;
        for (auto i = 0; i < m-n; i++)
        {
            ans += b[i];
        }
        cout << ans << endl;
        }
}

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

vector<long long> v(3, 0);

int main() {
  for(int i = 0; i < 3; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  for(int i = 0; i < 3; ++i) {
    if(i != 0) cout << " ";
    cout << v[i];
  }
  cout << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    if (s == "Sunny") {
        cout << "Cloudy";
    } else if (s == "Cloudy") {
        cout << "Rainy";
    } else {
        cout << "Sunny";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define rep(i,a,b) for (rg int i=a;i<=b;i++)
#define per(i,a,b) for (rg int i=b;i>=a;i--)
#define pb push_back
#define lowbit(x) (x&(-x))
#define mk make_pair
#define VI vector<int>
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define fi first
#define se second
#define il inline
#define ll long long
#define db double
#define ld long double
#define inf 0x3f3f3f3f
#define getc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char buf[1<<15],*p1 = buf,*p2 = buf;
inline ll read(){
    #define num ch-'0'
    char ch;bool flag=0;ll res;
    while(!isdigit(ch=getc()))
    (ch=='-')&&(flag=true);
    for(res=num;isdigit(ch=getc());res=res*10ll+num);
    (flag)&&(res=-res);
    #undef num
    return res;
}
inline void write(ll x){
	if (x < 0) x = ~x + 1ll, putchar('-');
	if (x > 9) write(x / 10ll);
	putchar(x % 10ll + '0');
}
#define mid ((l + r)>>1)
#define ls (x<<1)
#define rs ((x<<1)|1)
#undef mid
#undef ls
#undef rs
ll gcd(ll a,ll b) {return b == 0?a:gcd(b,a%b);}
void solve()
{
	ll a = read(),b = read();
	ll c = gcd(a,b);
	int tot = 1;
	for(ll i =2 ;i*i<=c;i++)
	{
		if(c%i==0)
		{
			while(c%i==0) c/=i;
			tot++;
		}
	}
	if(c>1) tot++;
	cout<<tot<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("data.txt","r",stdin);
	#endif
//	int T = read();
//	while(T--)
	solve();
}

Measured memory_bytes: 3612
//
// Created by moono on 2018/10/27.
//

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;



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

    //
    char table[h][w];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> table[i][j];
        }
    }

    //
    char new_table[h][w];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {

            if(table[i][j] == '#'){
                new_table[i][j] = '#';
            } else{
                int n = 0;
                for (int k = max(0, i-1); k <= min(h-1, i+1); ++k) {
                    for (int l = max(0, j-1); l <= min(w-1, j+1); ++l) {
//                for (int k = i-1; k <= i+1; ++k) {
//                    for (int l = j-1; l <= j+1; ++l) {
                        if(table[k][l] == '#') n++;
                    }
                }
                sprintf(&new_table[i][j], "%d", n);
            }
        }
    }

    //
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cout << new_table[i][j];
        }
        cout << endl;
    }



    return 0;
}

Measured memory_bytes: 256