akhauriyash/Code-Regression huggingface dataset:
a, b = map(int, input().split())
c = (b-2*a)/2
d = (4*a-b)/2
if c<0 or d<0:
    print("No")
else:
    if c.is_integer() == True and d.is_integer() == True:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
#define N 1000005
int n,m,len;
int a[N];
bool f[N];
char s[N];
int main()
{
	int T=1;
	//scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d",&n,&m);
		if(n<=9&&m<=9)
			printf("%d",n*m);
		else
			printf("-1");
	}
}

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

using namespace std;

using int64 = long long;

struct Item {
  int index;
  char type;
  int64 value;
};

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  vector<Item> items;
  for (int i = 0; i < n; i++) {
    int64 a, b;
    cin >> a >> b;
    items.push_back({i, 'A', a});
    items.push_back({i, 'B', b});
  }

  sort(items.begin(), items.end(), [](const Item& item1, const Item& item2) {
    return item1.value < item2.value;
  });

  int64 total = 0;
  vector<int> a_used(n);
  vector<int> b_used(n);
  for (int i = 0; i < n; i++) {
    if (DEBUG) {
      cout << items[i].index << " " << items[i].type << " "
           << items[i].value << endl;
    }
    if (items[i].type == 'A') {
      a_used[items[i].index] = 1;
    } else if (items[i].type == 'B') {
      b_used[items[i].index] = 1;
    } else {
      exit(1);
    }
    total += items[i].value;
  }

  int ox_count = 0;
  int xo_count = 0;
  for (int i = 0; i < n; i++) {
    if (a_used[i] && !b_used[i]) {
      ox_count++;
    }
    if (!a_used[i] && b_used[i]) {
      xo_count++;
    }
  }
  if (DEBUG) {
    cout << "ox_count: " << ox_count << " xo_count: " << xo_count << endl;
  }

  if (ox_count + xo_count < n || ox_count == n || xo_count == n) {
    cout << total << endl;
    return 0;
  }

  if (items[n - 1].index != items[n].index) {
    cout << total - items[n - 1].value + items[n].value << endl;
    return 0;
  } else {
    int64 min_addition = min(
        -items[n - 1].value + items[n + 1].value,
        -items[n - 2].value + items[n].value);
    cout << total + min_addition << endl;
    return 0;
  }
}


Measured memory_bytes: 6512
import sys
from collections import defaultdict, deque
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7

def divide(k):
    return pow(k, MOD-2, MOD)


def make_nck(n):
    ret = [1]
    for i in range(1, n+1):
        ret.append((ret[-1] * (n + 1 - i) * divide(i)) % MOD)

    # print(ret)
    return ret

def make_nigojyo(n):
    ret = [1]

    for i in range(1, n+1):
        ret.append((ret[-1] * 25) % MOD)

    # print(ret)
    return ret


def solve():
    n = getN()
    nums = getList()

    agentss = [num - i for i, num in enumerate(nums)]
    agents = [-num - i for i, num in enumerate(nums)]
    agents.sort()
    agentss.sort()
    ans = 0
    for ag in agentss:
        ans += bisect_right(agents, ag) - bisect_left(agents,ag)
        # print(ag, ans)
        # bisect_left()
    print(ans)
    # print(agents)
    # print(agentss)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 120836
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/arc067/tasks/arc067_a
# C - Factors of Factorial
"""
need to consider the case that ticket is not enough to lower everything
"""

N = gi()
A = {}
for i in range(N):
    a = gi()
    if a in A:
        A[a] += 1
    else:
        A[a] = 1

ec = 0
for _, v in A.items():
    if (v > 1 and v % 2 == 0):
        ec += 1
ans = len(A)

if (ec % 2):
    ans -= 1
print(ans)

Measured memory_bytes: 32236
i = list(map(int, input().split()))
limit = int(input())
k = 0
while not i[0] < i[1] < i[2]:
    if i[2] <= i[1]:
        i[2] *= 2
        k += 1
    if k == limit:
        break
    if i[1] <= i[0]:
        i[1] *= 2
        k += 1
    if k == limit:
        break
if k <= limit and i[0] < i[1] < i[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61864
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        long n = long.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        var dic = new Dictionary<long, long>() { };
        for (long i = 0; i < n; i++)
        {
            if (!dic.ContainsKey(a[i]))
            {
                dic.Add(a[i], 1);
            }
            else
            {
                dic[a[i]]++;
            }
        }

        for (long i = 0; i < n; i++)
        {
            if (dic[a[i]] < 2)
            {
                dic[a[i]] = 0;
            }
        }

        var tmp1 = new Dictionary<long, long>() { };
        foreach (var item in dic)
        {
            if (item.Value > 1)
            {
                tmp1.Add(item.Key, nCr(item.Value , 2));
            }
        }

        var tmp2 = new Dictionary<long, long>() { };
        foreach (var item in dic)
        {
            if (item.Value > 2)
            {
                tmp2.Add(item.Key, nCr(item.Value -1 , 2));
            }
            else if (item.Value == 2)
            {
                tmp2.Add(item.Key, 0);
            }
        }

        long[] ans = new long[n];
        var sum = tmp1.Values.Sum();
        for (long i = 0; i < n; i++)
        {
            if (dic[a[i]] == 0)
            {
                ans[i] = sum;
            }
            else
            {
                ans[i] = sum - tmp1[a[i]] + tmp2[a[i]];
            }
        }

        for (long i = 0; i < n; i++)
        {
            Console.WriteLine(ans[i]);
        }
    }

    public static long nCr(long n, long r)
    {
        // naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
        return nPr(n, r) / Factorial(r);
    }

    public static long nPr(long n, long r)
    {
        // naive: return Factorial(n) / Factorial(n - r);
        return FactorialDivision(n, n - r);
    }

    private static long FactorialDivision(long topFactorial, long divisorFactorial)
    {
        long result = 1;
        for (long i = topFactorial; i > divisorFactorial; i--)
            result *= i;
        return result;
    }

    private static long Factorial(long i)
    {
        if (i <= 1)
            return 1;
        return i * Factorial(i - 1);
    }
}

Measured memory_bytes: 47428
/* AtCoder My Practice
 * author: Leonardone @ NEETSDKASU
 */
#include <stdio.h>
#include <stdlib.h>

#define N_MAX (200001)

typedef struct _range {
    int upper, lower;
    struct _range *ubound, *lbound;
} Range;

Range *newRange(int lower, int upper) {
    Range *range = (Range*)malloc(sizeof(Range));
    range->lower = lower;
    range->upper = upper;
    return range;
}

int idx[N_MAX];
long long sum;
Range range;

void calc(int value, int index) {
    Range *tmp = &range;
    long long len1, len2, len3;
    for (;;) {
        if (tmp->lower <= index && index <= tmp->upper) {
            // 解説読後
            // http://agc005.contest.atcoder.jp/data/agc/005/editorial.pdf
            
            // len1 = (long long)(tmp->upper - tmp->lower + 1);
            len2 = (long long)(tmp->upper - index + 1);
            len3 = (long long)(index - tmp->lower + 1);
            //sum += ((len1 * (len1 + 1LL) - (len2 * (len2 + 1LL)) - (len3 * (len3 + 1))) ) * (long long)value;
            sum += len2 * len3 * (long long)value;
            if (tmp->lower == index) {
                tmp->lower++;
            } else if (tmp->upper == index) {
                tmp->upper--;
            } else {
                tmp->lbound = newRange(tmp->lower, index - 1);
                tmp->ubound = newRange(index + 1, tmp->upper);
                tmp->lower = tmp->upper = index;
            }
            break;
        } else if (index < tmp->lower) {
            tmp = tmp->lbound;
        } else {
            tmp = tmp->ubound;
        }
    }
}

char buf[N_MAX * 10];
char *p = buf;

int getInt(void) {
    int v = 0;
    while (*p < '0' || '9' < *p) p++;
    while ('0' <= *p && *p <= '9') {
        v = v * 10 + (int)(*p - '0');
        p++;
    }
    return v;
}

int main(void){
    int i, n;
    int a;
    
    a = fread(buf, sizeof(char), sizeof(buf), stdin);
    
    n = getInt();

    for (i = 0; i < n; i++) {
        a = getInt();
        idx[a] = i;
    }
    
    range.upper = n - 1;
    
    for (i = 1; i <= n; i++) {
        calc(i, idx[i]);
    }
    
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 6400
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

#define VSORT(v) sort(v.begin(), v.end());
using namespace std;


int main() {
  int h,w,b;
  vector<int> v(1);
  cin >> h >> w;
  int a[h][w];
  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) {
       cin >> b;
       // if(b % 2) num++;
       a[i][j] = b;
    }
  }
  for (size_t i = 0; i < h; i++) {
    for (size_t j = 0; j < w; j++) {
      if(i == h-1 && j == w-1) break;
      else if(j == w-1 && a[i][j] % 2) {
        a[i][j] -= 1;
        a[i+1][j] += 1;
        v.push_back(i);
        v.push_back(j);
        v.push_back(i+1);
        v.push_back(j);
      } else if(a[i][j] % 2) {
        a[i][j] -= 1;
        a[i][j+1] += 1;
        v.push_back(i);
        v.push_back(j);
        v.push_back(i);
        v.push_back(j+1);
      }
    }
  }
  v[0] = v.size()/4;
  cout << v[0] << endl;
  for (size_t i = 0; i < v[0]; i++) {
    cout << v[i*4 + 1] + 1 << ' ' << v[i*4 + 2] + 1 << ' ' << v[i*4 + 3] + 1 << ' ' << v[i*4 + 4] + 1 << endl;
  }
}


Measured memory_bytes: 5104
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;
 
 int main()
 {
   string s;
   while(cin>>s)
   {
     int start=0;
     int end=s.length()-1;
     int cnt=0;
     bool im=false;
     while(end>start)
     {
       if(s[start]==s[end])
       {
         start++;
         end--;                    
       }       
       else
       {
         if(s[start]=='x'&&s[end]!='x')
         {
           cnt++;
           start++;                              
         }    
         else if(s[start]!='x'&&s[end]=='x')
         {
           cnt++;
           end--;     
         }
         else
         {
           im=true;
           break;    
         }
       }         
     }  
     if(im) cout<<"-1"<<endl;
     else cout<<cnt<<endl;
   } 
   return 0;
 }
 

        

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[])
{
  int A, B, M;
  cin >> A >> B >> M;
  
  vector<int> a(A), b(B);
  for (int i=0; i<A; i++)
    cin >> a[i];
  for (int i=0; i<B; i++)
    cin >> b[i];
  
  vector<int> x(M), y(M), c(M);
  for (int i=0; i<M; i++)
    cin >> x[i] >> y[i] >> c[i];
  
  int min = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  for (int i=0; i<M; i++){
    int tmp = a[x[i]-1] + b[y[i]-1] - c[i];
    if (tmp < min)
      min = tmp;
  }
  cout << min << endl;
  
  
  return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    ll N, M;
    cin >> N >> M;

#if 0
    if(N == 1) {
        printf("%lld\n", M);
        return 0;
    }
#endif
    ll ans = 1;
    for(ll i = M / N; i >= 2; --i) {
        if(M % i == 0) {
            ans = i;
            break;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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

using namespace std;

using ll = long long;
using vll = vector<ll>;

void A() {
  ll num;
  scanf("%lld", &num);
  printf("%lld\n", (num % 1000 == 0) ? 0 : (1000 - (num % 1000)));
}

void B() {
  string line;
  getline(cin, line);
  ll subs = stoll(line);
  ll ac = 0, wa = 0, tle = 0, re = 0;

  for (auto i = 0; i < subs; ++i) {
    getline(cin, line);
    if (line.compare("AC") == 0) {
      ac++;
    } else if (line.compare("TLE") == 0) {
      tle++;
    } else if (line.compare("WA") == 0) {
      wa++;
    } else {
      re++;
    }
  }

  cout << "AC x " << ac << "\n";
  cout << "WA x " << wa << "\n";
  cout << "TLE x " << tle << "\n";
  cout << "RE x " << re << "\n";
}

int main() {
  B();
  return 0;
}


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

void fnInput(vector<string>& rvsSortBbl, vector<string>& rvsSortSel)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  
  rvsSortBbl.resize(nMaxSiz);
  rvsSortSel.resize(nMaxSiz);
  for (int i = 0; i < nMaxSiz; i++)
  {
    cin >> rvsSortBbl[i];
    rvsSortSel[i] = rvsSortBbl[i];
  }
}

void fnBubbleSort(vector<string>& rvsSortBbl)
{
  int nSorting = 0;
  bool bSorting = true;

  while (bSorting)
  {
    bSorting = false;
    for (int j = rvsSortBbl.size() - 1; j > nSorting; j--)
    {
      if (rvsSortBbl[j].at(1) < rvsSortBbl[j - 1].at(1))
      {
        swap(rvsSortBbl[j], rvsSortBbl[j - 1]);
        bSorting = true;
      }
    }
    nSorting++;
  }
}

void fnOutputBbl(const vector<string>& cnrvsSortBbl)
{
  for (int i = 0; i < cnrvsSortBbl.size(); i++)
  {
    if (i) cout << " ";
    cout << cnrvsSortBbl[i];
  }
  cout << endl;
  cout << "Stable" << endl;
}

void fnSelectionSort(vector<string>& rvsSortSel)
{
  for (int nSorting = 0; nSorting < rvsSortSel.size() - 1; nSorting++)
  {
    int nMin = nSorting;
    bool bSorting = false;
    for (int j = nSorting + 1; j < rvsSortSel.size(); j++)
    {
      if (rvsSortSel[j].at(1) < rvsSortSel[nMin].at(1))
      {
        nMin = j;
        bSorting = true;
      }
    }
    if (bSorting == true)  swap(rvsSortSel[nSorting], rvsSortSel[nMin]);
  }
}

void fnOutputSel(const vector<string>& cnrvsSortSel, const vector<string>& cnrvsSortBbl)
{
  string sSortEnd = "Stable";

  for (int i = 0; i < cnrvsSortSel.size(); i++)
  {
    if (i) cout << " ";
    cout << cnrvsSortSel[i];
    
    if (cnrvsSortSel[i] != cnrvsSortBbl[i]) sSortEnd = "Not stable";
  }
  cout << endl;
  cout << sSortEnd << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<string> vsSortBbl, vsSortSel;

  fnInput(vsSortBbl, vsSortSel);
  fnBubbleSort(vsSortBbl);
  fnOutputBbl(vsSortBbl); 

  fnSelectionSort(vsSortSel);
  fnOutputSel(vsSortSel, vsSortBbl);

  return 0;
}

Measured memory_bytes: 3168
h,n = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]

#dp[v]:体力をv減らす時の最小魔力
dp=[10**20 for i in range(h+1)]
dp[0]=0

for i in range(h+1):
    for j in range(n):
        if i-x[j][0]<0:
            dp[i] = min(dp[i], dp[0] + x[j][1])

        else:
            dp[i]=min(dp[i],dp[i-x[j][0]]+x[j][1])
print(dp[-1])


Measured memory_bytes: 43116
N,K = map(int,input().split())
V = list(map(int,input().split()))
vmax = 0
for i in range(K+1):
    for j in range(K-i+1):
        cnt = sum(V[:j])
        A = V[:j]
        n = N-(K-i-j)
        if n>=j:
            cnt += sum(V[n:])
            A += V[n:]
        else:
            cnt += sum(V[j:])
            A += V[j:]
        A = sorted(A)
        B = []
        for k in range(i):
            if k<len(A) and A[k]<0:
                B.append(k)
        for k in B:
            cnt -= A[k]
        vmax = max(vmax,cnt)
print(vmax)

Measured memory_bytes: 74644
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, A, B, n, sum, ans = 0;

	cin >> N >> A >> B;

	repc(i, 1, N) {
		sum = 0;
		n = i;

		while (n > 0) {
			sum += n % 10;
			n /= 10;
		}

		if (A <= sum && sum <= B) ans += i;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  string S;
  cin >> S;
  
  if (S == "ABC") {
    puts("ARC");
  } else {
    puts("ABC");
  }
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A,B,M;
    cin>>A>>B>>M;
    vector<int> a(A),b(B);
    for(int i=0;i<A;i++)cin>>a[i];
    for(int i=0;i<B;i++)cin>>b[i];
    int res=mod;
    for(int i=0;i<M;i++){
        int x,y,c;
        cin>>x>>y>>c;
        x--;y--;
        res=min(res,a[x]+b[y]-c);
    }
    sort(All(a));
    sort(All(b));
    res=min(res,a[0]+b[0]);
    cout<<res<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long     ll;
#define fast          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define last          freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fr            first
#define sc            second
#define lcm(a,b)      (a*b)/__gcd(a,b)
#define com(i,n)      for(int i=0;i<n;i++)
#define dom(i,n)      for(int i=1;i<=n;i++)
#define mom(i,n)      for(int i=n;i>=0;i--)
#define sortI(a,n)    sort(a,a+n)
#define sortD(a,n)    sort(a,a+n,greater<int>())
#define sortvi(a)     sort(a.begin(),a.end())
#define sortvd(a)     sort(a.begin(),a.end(),greater<int>())
#define sumall(a,x)   accumulate(a.begin(),a.end(),x)
#define pi            3.14159265358979323846264338327950
#define endl          '\n'
using namespace std;
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n+1],b[m+1],cnt=0,sum=0,x=m;
    a[0]=b[0]=0;
    dom(i,n)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }
    dom(i,m)
    {
        cin>>b[i];
        b[i]+=b[i-1];
    }
    com(i,n+1)
    {
        if(a[i]>k)
            break;
        while(x>=0 && a[i]+b[x]>k)
            x--;
        cnt=max(cnt,i+x);
    }
    cout << cnt << endl;
}


Measured memory_bytes: 6688
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll n,x;
ll Pnum[55],Bnum[55],num[55];
ll solve(ll level, ll k) {
    if(level == 0) {
        return Pnum[0];
    }
    ll ans = 0;
    k--;//第一个面包
    if(k > num[level-1]) {
        k-=num[level-1];
        ans += Pnum[level-1];
        if(k>0) {
            k--;
            ans++;
        }
        if(k > num[level-1]) {
            k -= num[level-1];
            ans += Pnum[level-1];
            return ans;
        }
    }
    if(k>0)
        ans += solve(level-1,k);
    return ans;
}

int main() {
    cin>>n>>x;
    Pnum[0] = 1;
    num[0] = 1;
    for(int i=1;i<=50;++i) {
        Pnum[i] = Pnum[i-1] * 2 + 1;
        Bnum[i] = Bnum[i-1] * 2 + 2;
        num[i] = Pnum[i] + Bnum[i];
    }
    //cout<<Pnum[2]<<" "<<Bnum[2]<<endl;
    cout<<solve(n,x)<<endl;
}

Measured memory_bytes: 256
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

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

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (K, A, B) = read!(i64, i64, i64);

    if A >= B || K <= A - 1 {
        println!("{}", K + 1);
        return;
    }

    let mut k = K - A + 1;
    let mut v = A;
    if k % 2 == 1 {
        k -= 1;
        v += 1;
    }

    v += (k / 2) * (B - A);
    k = 0;

    println!("{}", max(v, K + 1))
}


Measured memory_bytes: 4352
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
6
1 2 2 3
2 2 3 4
3 1 5
4 1 6
5 1 6
6 0

output:
1 1 12
2 2 11
3 3 8
4 9 10
5 4 7
6 5 6
"""
import sys

UNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2


def generate_adj_matrix(v_info):
    for v_detail in v_info:
        v_index, adj_num, *adj_list = map(int, v_detail)
        # assert len(adj_list) == adj_num
        init_adj_table[v_index].extend(sorted(adj_list, reverse=True))
    return init_adj_table


def graph_dfs(v_init):
    global time

    # init the first node of overall graph iterations(times >= 1)
    stack.append(v_init)
    color[v_init] = VISITED_IN_STACK
    d_time[v_init] += time
    # init end

    while len(stack) > 1:
        current = stack[-1]
        v_table = adj_table[current]
        adj = v_table.pop() if v_table else None

        if adj:
            if color[adj] is UNVISITED:
                color[adj] = VISITED_IN_STACK
                time += 1
                d_time[adj] += time
                stack.append(adj)
        else:
            stack.pop()
            color[current] = POPPED_OUT
            time += 1
            f_time[current] += time

    return None


def dfs_start():
    global time
    for i in range(vertices_num):
        if color[i + 1] == UNVISITED:
            # print('round: ', i + 1)
            graph_dfs(i + 1)
            time += 1


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num = int(_input[0])
    vertices_info = map(lambda x: x.split(), _input[1:])
    init_adj_table = tuple([] for _ in range(vertices_num + 1))
    # assert len(vertex_info) == vertex_num

    # config length = (vertex_num + 1)
    stack = [-1]
    color = [UNVISITED] * (vertices_num + 1)
    d_time, f_time = ([0] * (vertices_num + 1) for _ in range(2))

    adj_table = generate_adj_matrix(vertices_info)
    # timing start from 1
    time = 1
    dfs_start()
    for k, v in enumerate(zip(d_time[1:], f_time[1:]), 1):
        print(k, *v)

Measured memory_bytes: 7812
# N項目までを指定する数字sの標準入力を得る
s = int(input())
myList = list(range(1,s+1))
newList = []
otherList = []

for number in myList:
  if number % 15 == 0:
    otherList.append(number)
  elif number % 5 == 0:
    otherList.append(number)
  elif number % 3 == 0:
    otherList.append(number)
  else:
    newList.append(number)

print(sum(newList))

Measured memory_bytes: 56320
import bisect
n,m,k = map(int,input().split())
a_list = [0]+list(map(int,input().split()))
b_list = list(map(int,input().split()))
b_added = [0]
for b_i in b_list:
    b_added.append(b_added[-1]+b_i)
    if b_added[-1]>k:
        break
    
max_book = 0
temp_ki = 0
break_flag = False
for i in range(len(a_list)):
    temp_ki += a_list[i]
    if temp_ki > k:
        if i-1>max_book:
            max_book = i-1
        break_flag = True
        break
    temp_j = bisect.bisect(b_added,k-temp_ki)-1
    if i+temp_j > max_book:
        max_book = i+temp_j
        
print(max_book)


Measured memory_bytes: 113796
a, b, c, d = map(int, input().split())

x = c
y = d
while y:
    x, y = y, x % y
gcd = x
lcm = c * d // gcd
if a != b:
    sc = (b // c - (a-1) // c)
    sd = (b // d - (a-1) // d)
    slcm = b // lcm - (a-1) // lcm
    print(b-a+1 - sc - sd + slcm)
else:
    if a % c != 0 and a % d != 0:
        print(1)
    else:
        print(0)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define ss second
#define ff first
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
using namespace std;
typedef pair<int, int> pii;
const ll mod = 998244353;
const int sz = 200000 + 3, inf = 1e9 + 10;

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

	ll x;
	cin >> x;
	ll n = x / 500;
	ll rem = x - (n * 500);
	ll r = rem / 5;
	ll  ans = n * 1000 + r * 5;
	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;



void solve(){

    ll n,k;
    cin >> n >> k;
    ll t = n%k;
    cout << min(t, k-t) << endl;

}

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


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

int main() {
  int a, b, c, x, sum = 0;
  cin >> a >> b >> c >> x;
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k <= c; k++) {
        if (500 * i + 100 * j + 50 * k == x)
          sum++;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int N;

bool dfs(int total)
{
    if(total==N)return true;
    if(total>N)return false;
    if(dfs(total+4))return true;
    if(dfs(total+7))return true;
    return false;
}

int main()
{
    cin>>N;
    if(dfs(0))
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<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 all(v) v.begin(), v.end()
#define int long long
//#define _GLIBCXX_DEBUG

signed main() {
  int H, W; cin >> H >> W;
  unordered_map<char,int> a;
  rep(i, H*W) {
    char c; cin >> c;
    a[c]++;
  }
  
  int four=0, two=0, one=0;
  
  for(auto p : a) {
    if(p.second%4 == 0) four++;
    else if(p.second%2 == 0) two++;
    else one++;
  }
  
  if(H%2 == 0 && W%2 == 0) {
    if(two == 0 && one == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if(H%2 == 0) {
    if(two <= H/2 && one == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if(W%2 == 0) {
    if(two <= W/2 && one == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    if(two <= (H-1)/2 + (W-1)/2  && one == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val x = sc.nextInt()
    val y = sc.nextInt()
    println(problem160d(n, x, y))
}

fun problem160d(n: Int, x: Int, y: Int): String {
    val dist = Array(n) { IntArray(n) { -1 } }
    for (s in 0 until n) {
        val que = ArrayDeque<Int>()
        que.offer(s)
        dist[s][s] = 0
        while (!que.isEmpty()) {
            val v = que.poll()
            val nvs = mutableListOf<Int>()
            if (v > 0) nvs.add(v - 1)
            if (v < n - 1) nvs.add(v + 1)
            if (v == x - 1) nvs.add(y - 1)
            if (v == y - 1) nvs.add(x - 1)
            for (nv in nvs) {
                if (dist[s][nv] == -1) {
                    dist[s][nv] = dist[s][v] + 1
                    que.offer(nv)
                }
            }
        }
    }
    val res = IntArray(n) { 0 }
    for (i in 0 until n) {
        for (j in i + 1 until n) {
            res[dist[i][j]]++
        }
    }
    return res.drop(1).joinToString("\n")
}

Measured memory_bytes: 79644
#include<stdio.h>
int main()
{
    int x,y,count=1,min;
    scanf("%d",&y);
    scanf("%d",&x);
    y--;
    min=x;
    while(y--)
        {
        scanf("%d",&x);
    if(min>=x)
    {
        count++;
        min=x;
    }

    }
printf("%d",count);

return 0;

}


Measured memory_bytes: 1732
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll dp[110000], x[110000], n, s, rmq[280000], v, res = 1LL << 60;
void update(ll i, ll x) {
	i += v; rmq[i] = x;
	while (i > 1) {
		i /= 2, rmq[i] = max(rmq[i * 2], rmq[i * 2 + 1]);
	}
}
long long query(ll p, ll q, ll k, ll l, ll r) {
	if (r <= p || q <= l) return 0;
	if (p <= l && r <= q) return rmq[k];
	long long vl = query(p, q, 2 * k, l, (l + r) / 2);
	long long vr = query(p, q, 2 * k + 1, (l + r) / 2, r);
	return max(vl, vr);
}
int main() {
	cin >> n; for (int i = 0; i < 20; i++) { if ((1 << i) < n) { v = (1 << (i + 1)); } }
	for (int i = 0; i < n; i++) { cin >> x[i]; dp[i] = x[i]; s += x[i]; }update(x[0], dp[0]);
	for (int i = 1; i < n; i++) {
		dp[i] = query(1, x[i], 1, 0, v) + x[i];
		update(x[i], dp[i]);
	}
	for (int i = 0; i < n; i++)res = min(res, s - dp[i]);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4308
#pragma comment(linker, "/stack:200000000")
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
#define int long long
 
using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;
#define y1 sfasfd
const int N = 3e5 + 123;
ll n , s , ans = 1e18;
ll f(ll b , ll n){
	if(n < b)
		return n;
	return f(b , n / b) + n % b;	
}
void SearchInSector(ll  l , ll r){
	if(l < 2) l = 2;
	if(r > n + 1) r = n + 1;
	if(r - l <= 3e8)
	for(int i = l ; i <= r ; i++){
		if(f(i , n) == s){
			ans = min(ans , i);return;
		}
	}}
main(){
	cin >> n >> s;
	SearchInSector(	1 , 1e6);if(ans != 1e18) ret(ans);
	if(n == s)ret(n + 1);
	for(int i = 1; i  <= 1e6 ; i++){
		ll b = (n - s) / i + 1;
		if(b < 2)	continue;
		if(f(b , n) == s)
			ans = min(ans , b);
	}
	if(ans == 1e18)	ans = -1;
	cout << ans;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vl vector<long>
#define P pair<int,int>
using namespace std;

main()
{
        vi v(5);
        rep(i,5)cin>>v[i];
        sort(all(v));

        int ans=10101010;
        do{
                int time=0;
                int i=0;
                while(i<5)
                {
                        if(time%10!=0)
                        {
                                time++;
                                continue;
                        }
                        time+=v[i];
                        i++;
                }
                ans=min(ans,time);
        }while(next_permutation(all(v)));
        cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

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

    vector<int> w(N, 0), b(N, 0);
    for(int i = 0; i < N; ++i) {
        if (s[i] == '.') w[i] = 1;
        if (s[i] == '#') b[i] = 1;
    }

    vector<int> sw(N+1, 0), sb(N+1, 0);
    for(int i = 0; i < N; ++i) {
        sw[i+1] = sw[i] + w[i];
        sb[i+1] = sb[i] + b[i];
    }

    int ans = INF;
    for(int i = 0; i < N+1; i++) {
        int ret = (sb[i] - sb[0]) + (sw[N] - sw[i]);
        ans = min(ans, ret);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3716
main(a){float b,c,d,e,f;for(;~scanf("%d%f%f%f%f%f",&a,&b,&c,&d,&e,&f);printf("%.3f %.3f\n",(c-b*f)/a,f/=a*e-b*d))f=a*f-d*c;exit(0);}

Measured memory_bytes: 644
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

signed main() {
	int h, w, n; cin >> h >> w >> n;
	int ans = min(
		n / h + (n % h == 0 ? 0 : 1),
		n / w + (n % w == 0 ? 0 : 1)
	);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static int n;
	static int m;

	private static void solve(){
		//Implement solution here.
		n = ni();
		m = ni();
		int[] aary = na(m);
		Arrays.sort(aary);

		int[] mary = new int[]{-1,2,5,5,4,5,6,3,7,6};
		int[] cary = new int[m];
		for(int i = 0; i < m; i++){
			cary[i] = mary[aary[i]];
		}

		int[] dp = new int[n + 1];
		Arrays.fill(dp,Integer.MIN_VALUE);
		dp[0] = 0;
		
		for(int i = 1; i <= n; i++){
			for(int j = 0; j < m; j++){
				int before = i - cary[j];
				if(before >= 0){
					dp[i] = Math.max(dp[i],dp[before] + 1);
				}
			}
		}
		int rest = n;
		StringBuilder sb = new StringBuilder();
		for(int i = dp[n] ; i > 0; i--){
			for(int j = m - 1; j >= 0; j--){
				if(rest - mary[aary[j]] >= 0 && dp[rest - mary[aary[j]]] == i - 1){
					rest -= mary[aary[j]];
					sb.append(aary[j]);
					break;
				}
			}
		}
		System.out.println(sb.toString());
	}


	//Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 22868
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n,m;
    cin>>n>>m;

    ll dp[n][m];

    f(i,n)
    {
        f(j,m) dp[i][j]=INT_MAX;
    }

    string s[n];
    f(i,n) cin>>s[i];

    if(s[0][0]=='.') dp[0][0]=0;
    else dp[0][0]=1;

    f(i,n)
    {
        f(j,m)
        {
           ll v1=INT_MAX,v2=INT_MAX;
           if(s[i][j]=='#')
           {
                if(i && j)
                {
                    if(s[i-1][j]=='#') v1=0;
                    else v1=1;

                    if(s[i][j-1]=='#')v2=0;
                    else v2=1;

                    v1+=dp[i-1][j];
                    v2+=dp[i][j-1];
                }
                else if(i)
                {
                    if(s[i-1][j]=='#') v1=0;
                    else v1=1;
                    v1+=dp[i-1][j];
                }
                else if(j)
                {
                    if(s[i][j-1]=='#') v2=0;
                    else v2=1;
                    v2+=dp[i][j-1];
                }
           }
           else
           {
               if(i && j)
                {
                    v1=dp[i-1][j];
                    v2=dp[i][j-1];
                }
                else if(i)
                {
                    v1=dp[i-1][j];
                }
                else if(j)
                {
                    v2=dp[i][j-1];
                }
           }
           if(i || j) dp[i][j] = min(v1,v2);
        }
    }

    cout<<dp[n-1][m-1]<<"\n";

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 384
import java.util.Calendar;
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int month;
		int day;
	    Calendar calendar = Calendar.getInstance();

	    while(true){
	    	month = scan.nextInt();
			day = scan.nextInt();
			
			if(month == 0)break;
	    calendar.set(2004, month - 1, day);
	    dispCalendar(calendar);
	    }
	  }

	  private static void dispCalendar(Calendar calendar){
	    String[] week_name = {"Sunday", "Monday", "Tuesday", 
	                          "Wednesday", "Thursday", "Friday", "Saturday"};

	    int month = calendar.get(Calendar.MONTH);
	    int day = calendar.get(Calendar.DATE);
	    int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;

	    System.out.println(week_name[week]);

	  }
}

Measured memory_bytes: 27196
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = 0
S = input()
weeklist = ['SUN','MON','TUE','WED','THU','FRI','SAT']
numlist  = list(range(7))
weekdic = dict(zip(weeklist,numlist))


ans = 7 - weekdic[S]
print(ans)


Measured memory_bytes: 12144
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B > C + D) cout << "Left";
	else if (A + B == C + D) cout << "Balanced";
	else cout << "Right";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
from operator import mul
from functools import reduce

MOD = 10 ** 9 + 7

def get_soinnsuu(num):
    soinnsuu = []
    for i in range(2, int(num ** 0.5) + 2):
        now_time = 0
        if num < i:
            break
        while num % i == 0:
            now_time += 1
            num = num // i
        if now_time > 0:
            soinnsuu.append(now_time)
    if num > 1:
        soinnsuu.append(1)
    return soinnsuu


def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


def start_process(N, M):
    soinnsuu = get_soinnsuu(M)
    ans = 1
    for ele in soinnsuu:
        ans *= int(comb(ele + N - 1, ele))
    # print(soinnsuu)
    print(ans % MOD)


def main():
    N, M = map(int, input().split())
    start_process(N, M)



if __name__ == '__main__':
    main()


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

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

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

int main(){
int a[5];
int ans=0;
for(int i=0;i<5;i++){
  cin >> a[i];
}
for(int i=0;i<5;i++){
  if(a[i]==0) ans =i+1;
}
cout << ans <<endl;
}


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

int main()
{
    int x ;
    cin>>x;
    if(x>=1800 && x<=1999)
        cout<<"1";
    else if(x>=1600 && x<=1799)
        cout<<"2";
    else if(x>=1400 && x<=1599)
        cout<<"3";
    else if(x>=1200 && x<=1399)
        cout<<"4";
    else if(x>=1000 && x<=1199)
        cout<<"5";
    else if(x>=800 && x<=999)
        cout<<"6";
    else if(x>=600 && x<=799)
        cout<<"7";
    else
        cout<<"8";
        
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a=0, b = 0,c,d, n, k;
string s, t;


int main()
{
	cin >> n >> k; long double sum=0;
	for(int i=1;i<=n;i++)
	{
		int x = i;  long double z=1;
		while (x<k)
		{
			x *= 2;
			z /= 2.0;
		}
		sum += z;
	}

	sum = sum/ n;
	printf("%.12Lf\n", sum);
	return 0;
}

Measured memory_bytes: 256
fn main(){
  loop {
    let hwn: Vec<usize> = read_vec();
    let h = hwn[0];
    let w = hwn[1];
    let n = hwn[2] as u32;

    if h == 0 && w == 0 && n == 0 { break; }
  
    let mut mp: Vec<Vec<u32>> = Vec::new();
  
    for _ in 0 .. h {
      mp.push(read_vec());
    }

    let mut vc: Vec<Vec<u32>> = vec![vec![0; w]; h];

    vc[0][0] = n - 1;

    for i in 1 .. w {
      if vc[0][i-1] % 2 == 0 {
        vc[0][i] = vc[0][i-1] / 2;
      } if mp[0][i-1] == 0 {
        vc[0][i] = vc[0][i-1] / 2;
      } else {
        vc[0][i] = (vc[0][i-1] + 1) / 2;
      }
    }

    for j in 1 .. h {
      if vc[j-1][0] % 2 == 0 {
        vc[j][0] = vc[j-1][0] / 2;
      } if mp[j-1][0] == 1 {
        vc[j][0] = vc[j-1][0] / 2;
      } else {
        vc[j][0] = (vc[j-1][0] + 1) / 2;
      }
    }
    
    for i in 1 .. w {
      for j in 1 .. h {
        match (vc[j][i-1] % 2, vc[j-1][i] % 2) {
          (0, 0) => {
            vc[j][i] = vc[j][i-1] / 2 + vc[j-1][i] / 2;
          },
          (0, 1) => {
            vc[j][i] = vc[j][i-1] / 2 + if mp[j-1][i] == 1 { vc[j-1][i] / 2 } else { (vc[j-1][i] + 1) / 2 };
          },
          (1, 0) => {
            vc[j][i] = if mp[j][i-1] == 0 { vc[j][i-1] / 2 } else { (vc[j][i-1] + 1) / 2 } + vc[j-1][i] / 2;
          },
          _ => {
            vc[j][i] = if mp[j][i-1] == 0 { vc[j][i-1] / 2 } else { (vc[j][i-1] + 1) / 2 } +
                       if mp[j-1][i] == 1 { vc[j-1][i] / 2 } else { (vc[j-1][i] + 1) / 2 } ;
          },
        }
      }
    }
    
    let mut x: usize = 0;
    let mut y: usize = 0;

    loop {
      if x == w || y == h {
        println!("{} {}", y + 1, x + 1);
        break;
      }

      if vc[y][x] % 2 == 0 && mp[y][x] == 0 || vc[y][x] % 2 == 1 && mp[y][x] == 1 {
        y += 1;
      } else {
        x += 1;
      }
    }
  }
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}



Measured memory_bytes: 13212
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  ll L[N];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = i+1; j < N; j++) {
      for (int k = j+1; k < N; k++) {
        if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
          if (L[i] + L[j] + L[k] > 2LL * max({L[i],L[j],L[k]})) {
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#define rep(i, n) for(ll i = 0; i < n; i++)
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
// a^n mod p を繰り返し2乗法で求める関数
ll mod_pow(ll a, ll n, ll p) {
	if (n == 1) return a % p;
	if (n % 2 == 1){
		return (a * mod_pow(a, n-1, p)) % p;
	} 
	else {
		ll t = mod_pow(a, n / 2, p);
		return (t * t) % p;
	}
}

// (a / b) mod p を求める関数
ll mod_div(ll a,ll b,ll p) {
	return (a * mod_pow(b, p-2, p)) % p; 
}

// nCr mod p を求める関数
ll nCr(ll n,ll r,ll p) {
	ll ans = 1;
	for (ll i=n; i>=n-r+1;i--) {
		ans = (ans * i) % p;
	}
	for (ll i=r; i>=1; i--) {
		ans = (ans * mod_pow(i, p-2, p)) % p;
	}
	return ans;
}

int main() {
	ll x,y;
	ll m = 1e9 + 7;
	cin >> x >> y;
	ll ans = 0;
	ll p3 = 2*y-x;
	ll q3 = 2*x-y;
	if (p3>=0 && p3%3==0 && q3>=0 && q3%3==0) {
		ll p = p3/3;
		ll q = q3/3;
		ans = nCr(p+q,p,m);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256