akhauriyash/Code-Regression huggingface dataset:
s = int(input())
x = [s]
a = s
cnt = 1
while True:
    if a % 2 == 0:
        a = a // 2
    else:
        a = 3 * a + 1
    x.append(a)
    cnt += 1
    if len(set(x)) != cnt:
        break

print(cnt)

Measured memory_bytes: 3060
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True)
F.sort()

C = [None] * N
for i, (a, f) in enumerate(zip(A, F)):
    C[i] = (a * f, f)


def solve(x):
    global K, N
    t = 0
    for c, f in C:
        temp = ((c - x) + f - 1) // f
        t += max(0, temp)
        if t > K:
            result = False
            break
    else:
        result = True
    return result


ok = A[0] * F[N - 1]
ng = -1
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid


print(ok)


Measured memory_bytes: 121548
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    int count=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++){
        if(c%i==0)count++;
        
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <ext/rope>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define vi vector<int>
#define pii pair<int,int>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
const int maxn=2e3+10;
const int dis[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
using namespace std;
using namespace __gnu_cxx;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
int n,m,a[maxn][maxn],ma,cnt;
vi p[maxn];
pii q[maxn];
void dfs(int root,int pre,int now,int s)
{
    a[root][now]=s;
    for(int x:p[now])
    {
        if(x!=pre)dfs(root,now,x,s+1);
    }
}
int main()
{
    int i,j,k,t;
    scanf("%d%d",&n,&k);
    rep(i,1,n-1){
        scanf("%d%d",&j,&t);
        p[j].pb(t),p[t].pb(j);
        q[i].fi=j,q[i].se=t;
    }
    rep(i,1,n)dfs(i,-1,i,0);
    rep(i,1,n)
    {
        cnt=0;
        rep(j,1,n)
            if(2*a[i][j]<=k)cnt++;
        ma=max(ma,cnt);
    }
    rep(i,1,n-1)
    {
        cnt=0;
        rep(j,1,n)
            if(2*min(a[j][q[i].fi],a[j][q[i].se])+1<=k)
                cnt++;
        ma=max(ma,cnt);
    }
    printf("%d\n",n-ma);
    //system ("pause");
    return 0;
}


Measured memory_bytes: 16256
from math import factorial as fa
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
f=fa(n)
g=fa(n-1)*2
s=0
for i in range(n-1):
  for j in range(i+1,n):
    d=((l[i][0]-l[j][0])**2+(l[i][1]-l[j][1])**2)**0.5
    s+=d*g
print(s/f)

Measured memory_bytes: 3188
n, m  = map(int, input().split())

a_max = -1
b_min = 999999999999999

for i in range(m):
    a, b = map(int, input().split())
    
    a_max = max(a_max, a)
    b_min = min(b_min, b)

ans = max(b_min - a_max + 1, 0)
print(ans)

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

/*==========type============*/
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
typedef std::pair<std::string,ll> psl;

/*==========constant============*/
#define INF INT_MAX
#define INF_L LONG_MAX
#define INF_LL LLONG_MAX
#define MOD 1000000007

/*==========function============*/
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

using namespace std;

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

    ll k;
    string s;
    cin >> k >> s;

    string ans = "";
    REP(i,0,s.size()){
        if(i >= k){
            ans += "...";
            break;
        }else{
            ans += s[i];
        }
    }
    
    cout << ans << endl;

    return 0;
}    

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

template <typename T>
void print(const T &v);

vector<vector<int>> grid(55, vector<int>(55, -1));
vector<vector<bool>> seen(55, vector<bool>(55, false));

void dps(int x, int y)
{
    int xs[8] = {1, -1, 0, 0, -1, -1, 1, 1};
    int ys[8] = {0, 0, 1, -1, -1, 1, -1, 1};
    for (int i = 0; i < 8; i++)
    {
        int nx = x + xs[i];
        int ny = y + ys[i];
        if (nx < 0 || ny < 0)
        {
            continue;
        }
        if (seen[nx][ny] || grid[nx][ny] != 1)
        {
            continue;
        }
        seen[nx][ny] = true;
        dps(nx, ny);
    }
}

void init()
{
    for (int i = 0; i < 55; i++)
    {
        for (int j = 0; j < 55; j++)
        {
            grid[i][j] = -1;
            seen[i][j] = false;
        }
    }
}
int main()
{
    while (1)
    {
        int w, h;
        cin >> w >> h;
        if (w == 0 || h == 0)
        {
            return 0;
        }
        init();
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                cin >> grid[i][j];
            }
        }
        int cnt = 0;
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (seen[i][j] || grid[i][j] != 1)
                {
                    continue;
                }
                ++cnt;
                dps(i, j);
            }
        }
        cout << cnt << endl;
    }
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] xa = br.readLine().split(" ");
        int x = Integer.parseInt(xa[0]);
        int a = Integer.parseInt(xa[1]);
        System.out.println(problem130a(x, a));
    }

    private static int problem130a(int x, int a) {
        return (x < a) ? 0 : 10;
    }
}

Measured memory_bytes: 21716
n=int(input())
mod=10**9+7

def factorize(n):
    i=2
    result=[]
    while i**2<=n:
        while n%i==0:
            n//=i
            result.append(i)
        i+=1
    if n>1:
        result.append(n)
    return result

p_dict={}
for i in range(2,n+1):
    facts=factorize(i)
    for p in facts:
        if p not in p_dict:
            p_dict[p]=1
        else:
            p_dict[p]+=1
ans=1
for i in p_dict.values():
    ans=(ans*(i+1))%mod
print(ans)

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextLong();
  int Z = nextLong();
  int W = nextLong();

  vector<ll> A(N);
  REP(i, N) {
    A[i] = nextLong();
  }

  if (N == 1) {
    cout << abs(A[N-1] - W) << endl;
    return 0;
  }


  ll ans = max( abs(A[N-1] - W),
                abs(A[N-1] - A[N-2]));
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 3712
using System;

class Program{
    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        var fib=new int[n+2];
        fib[0]=fib[1]=1;
        for (var i=2; i<=n; i++) {
            fib[i]=fib[i-1]+fib[i-2];
        }
        Console.WriteLine(fib[n]);
    }
}

Measured memory_bytes: 9176
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = sorted(LI())

    m = max(a)
    t = [False] * (m + 1)
    r = 0
    for i in range(n):
        ai = a[i]
        if t[ai]:
            continue
        for j in range(ai, m+1, ai):
            t[j] = True
        if i < n-1 and a[i+1] == ai:
            continue
        r += 1

    return r


print(main())




Measured memory_bytes: 34776
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,bool> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


int main(void) {
    int num;
    cin >> num;
    vector<vector<pii>> says(num);
    for(int i = 0; i < num; i++) {
        int qs;
        cin >> qs;
        for(int q = 0; q < qs; q++) {
            int x;
            bool y;
            cin >> x >> y;
            // 0-indexed
            x--;
            says[i].push_back(make_pair(x, y));
        }
    }

    int ans = 0;
    for(int pat = 1; pat < (1<< num); pat++) {
        bool is_ok = 1;
        for(int i = 0; i < num; i++) {
            if(!(pat & (1<<i))) continue;
            for(pii p: says[i]) {
                bool real = !!(pat & (1<<p.first));
                bool word = p.second;
                is_ok &= (real == word);
            }
            debug("pat: %d i: %d-> %d\n", pat, i, is_ok);
        }
        if(is_ok) ans = max(ans, __builtin_popcount(pat));
    }

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

Measured memory_bytes: 3616
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <cstdlib>
#include <random>
#include <chrono>
#include<iterator>
#include <locale>
 
/*,---.   ,--.                          ,--.
'   .-'  |  ,---.  ,--.,--. ,--.  ,--. `--'
`.  `-.  |  .-.  | |  ||  |  \  `'  /  ,--.
.-'    | |  | |  | '  ''  '   \    /   |  |
`-----'  `--' `--'  `----'     `--'    `--'*/
 
using namespace std;   
int n;
long long f(int pos, vector<long long> vals){
    if(pos == -1){
        return 0;
    }
    int zero = 0;
    int one = 0;
    vector<long long> zeroVal;
    vector<long long> oneVal;
    for(int i = 0;i<vals.size();i++){
        if(((vals[i])&(1<<pos)) != 0){
            oneVal.push_back(vals[i]);
        }else{
            zeroVal.push_back(vals[i]);
        }
    }
    if(zeroVal.size() == 0 || oneVal.size() == 0){
        return f(pos - 1, vals);
    }else{
        return min(f(pos - 1, zeroVal), f(pos - 1, oneVal)) + (1<<pos);
    }

}
int dp[200047][3];
int value[200047][3];
int main(){
    int k;
    cin >> n;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<3;j++){
            cin >> value[i][j];
        }
    }
    dp[0][0] = value[0][0];
    dp[0][1] = value[0][1];
    dp[0][2] = value[0][2];
    for(int i = 1;i<n;i++){
        dp[i][0] = max(dp[i-1][1] + value[i][0], dp[i-1][2] + value[i][0]);
        dp[i][1] = max(dp[i-1][2] + value[i][1], dp[i-1][0] + value[i][1]);
        dp[i][2] = max(dp[i-1][1] + value[i][2], dp[i-1][0] + value[i][2]);
    }
    cout<<max(dp[n-1][2], max(dp[n-1][0], dp[n-1][1]));
    
    

}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N, M;
  double res=0;
  cin >> N >> M;

  double m = 1.0;
  rep(i,M){
    m *= 2;
  }
  //double e = M * 1900 / m;                                                    
  //double f = 100 * (N-M) / m;                                                 
  double e = (100 * N + 1800 * M)/m;

  int cnt=1;
  while(e>1e-20){
    res += cnt * e;
    //cout << cnt << ":" << e*cnt << "->" << res << endl;                       
    e = e * (m-1)/m;
    cnt ++;
  }

  cout << (int)round(res) << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        Integer jewel = Integer.parseInt(sc.nextLine()); // not use count

        String[] value = sc.nextLine().split(" ");
        String[] costs = sc.nextLine().split(" ");

        List<Integer> amount = new ArrayList<>();

        int limit = value.length;
        for (int i = 0; i < limit; i++) {
            int v = Integer.parseInt(value[i]);
            int c = Integer.parseInt(costs[i]);

            if (v > c) {
                // using value as over cost
                amount.add(v - c);
            }
        }

        int total = amount.stream().reduce(0, (s1, s2) -> s1 + s2);
        System.out.println(total);
    }
}


Measured memory_bytes: 28752
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define LL_MAX LLONG_MAX
#define ULL_MAX ULLONG_MAX
#define ull unsigned long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define mk make_pair
#define endl '\n'

int main()
{
    IOS;
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int sum=0;
    sum+=min(a,k);
    k-=min(a,k);
    sum+=0*min(b,k);
    k-=min(b,k);
    sum-=min(c,k);
    k-=min(c,k);
    cout<<sum;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long> vl;
typedef vector<vector<long> > vvl;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

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

    long long time = 1;
    long long startTime;

    repeat (i, N) {
        cin >> startTime;
        time = lcm(time, startTime);
    }
    cout << time << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace AOJ0000{
	class Program{
		public static void Main(String[] args){
			for(int i = 1; i < 10; i ++){
				for(int j = 1; j < 10; j++){
					Console.Write("{0}x{1}={2}\n", i, j, i * j);
				}
			}
		}
	}
}

Measured memory_bytes: 8968
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [10 ** 9] * N
dp[0] = 0
for i in range(N):
    for jump in range(1, K + 1):
        if i + jump < N:
            dp[i + jump] = min(dp[i + jump], dp[i] + abs(h[i] - h[i + jump]))
print(dp[N - 1])


Measured memory_bytes: 52448
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int cnta[100005];
int cntb[100005];

signed main()
{
    int N; cin>>N;
    vint a,b;
    REP(i,N){
	int t; cin>>t;
	if(i%2==0){
	    a.push_back(t);
	    cnta[t]++;
	}
	else{
	    b.push_back(t);
	    cntb[t]++;
	}
    }

    vector<pint> aa,bb;
    for(int i=1;i<=100000;i++)
	if(cnta[i]>0) aa.push_back(pint(cnta[i],i));
    sort(ALL(aa),greater<pint>());
    for(int i=1;i<=100000;i++)
	if(cntb[i]>0) bb.push_back(pint(cntb[i],i));
    sort(ALL(bb),greater<pint>());

    aa.push_back(pint(0,0));
    bb.push_back(pint(0,0));

    int ans=1e9;
    REP(i,bb.size()){
	if(aa[0].second==bb[i].second) continue;
	int cost=N-aa[0].first-bb[i].first;
	ans=min(ans,cost);
    }
    REP(i,aa.size()){
	if(bb[0].second==aa[i].second) continue;
	int cost=N-bb[0].first-aa[i].first;
	ans=min(ans,cost);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4848
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int c = sc.nextInt();
        int[][] table = new int[r+1][c+1];

        for(int i = 0; i < r; i++) {
        	for(int j = 0; j < c; j++) {
        		int x = sc.nextInt();
        		table[i][j] = x;
        		table[i][c] += x;
        		table[r][j] += x;
        		table[r][c] += x;
        	}
        }

        for(int i = 0; i < r+1; i++) {
        	for(int j= 0; j < c+1; j++) {
        		if(j == c) {
            		System.out.println(table[i][j]);
        		} else {
            		System.out.print(table[i][j] + " ");
        		}
        	}
        }
    }
}


Measured memory_bytes: 42176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    ll k;
    cin >> n >> k;
    vector<ll>d(10,0);
    for(ll i=1;i<10;i++){
        d[i]=i;
    }
    for(ll i=0;i<k;i++){
        ll x;
        cin >> x;
        d[x]=10;
    }
    sort(d.begin(),d.end());
    ll ans=0;
    ll copy=n;
    ll keta=0;
    while(copy>0){
        keta++;
        copy/=10;
    }
    copy=n;
    vector<ll>num(keta);
    for(ll i=0;i<keta;i++){
        num[keta-i-1]=copy%10;
        copy/=10;
    }
    bool judge=true;
    bool judge1=false;
    for(ll i=0;i<keta;i++){
        for(ll j=0;j<10;j++){
            if(d[j]==10){
                judge1=true;
                judge=false;
                break;
            }
            if(num[i]<d[j]||judge==false){
                break;
            }
            if(num[i]==d[j]&&judge){
                break;
            }
        }
    }
    for(ll i=0;i<keta;i++){
        if(judge1){
            if(d[0]!=0){
                ans+=d[0]*pow(10,keta);
                ans+=d[0]*pow(10,keta-1);
            }
            else {
                ans+=d[1]*pow(10,keta);
                ans+=d[0]*pow(10,keta-1);
            }
            judge1=false;
            continue;
        }
        for(ll j=0;j<10;j++){
            if(num[i]<d[j]||judge==false){
                ans+=d[j]*pow(10,keta-i-1);
                judge=false;
                break;
            }
            if(num[i]==d[j]&&judge){
                ans+=d[j]*pow(10,keta-i-1);
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4012
#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

#define ri(x) i64 x; cin >> x
#define rii(x, y) i64 x, y; cin >> x >> y
#define ri3(x, y, z) i64 x, y, z; cin >> x >> y >> z
#define ri4(x, y, z, u) i64 x, y, z, u; cin >> x >> y >> z >> u
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x
#define rx(x, t) t x; cin >> x

#define ws(x) cout << x << ' '
#define wl(x) cout << x << '\n'
#define wln cout << '\n'

#define dbg(x) cerr << '[' << #x << "]: " << x << '\n'

#define fa(x, v) for (auto &x : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(x) ri(_x); fi(x, _x)

#define l first
#define r second
#define all(x) x.begin(), x.end()
#define bit(x) ((u64) 1 << (u32) (x))

using namespace std;

typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t i32;
typedef int64_t i64;
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef pair<i64, i64> pi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) ws(x);
    wln;
    return out;
}


int main() {
    fio;

    ri(x);
    if (x < 600){
        wl(8);
    } else if (x < 800) {
        wl(7);
    } else if (x < 1000) {
        wl(6);
    } else if (x < 1200) {
        wl(5);
    } else if (x < 1400) {
        wl(4);
    } else if (x < 1600) {
        wl(3);
    } else if (x < 1800) {
        wl(2);
    } else if (x < 2000) {
        wl(1);
    }

    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#define IN 10000000000000
using namespace std;
int main(){
  int n, c;
  cin>>n>>c;
   int A[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
int dp[n];
  dp[0]=0;
  dp[1]=abs(A[1]-A[0]);
  for(int i=2;i<n;i++){
        dp[i]=IN;
        for(int j=i-c;j<i;j++){
                if(j>=0){
  	dp[i]=min(dp[j]+abs(A[j]-A[i]),dp[i]);
  }
        }
  }
   cout<<dp[n-1];
    }


Measured memory_bytes: 4376
#include<stdio.h>
main(void){
	int W=0,H=0,x=0,y=0,r=0;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x-r<0||x+r>W||y-r<0||y+r>H){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 584
# -*- coding:utf-8 -*-
N = int(input())
D,X = map(int,input().split())

A = []
for _ in range(N):
    A.append(int(input()))

member = len(A)

Chocolate = member + X
days = 1

while days<=D:
    for single_member in A:
        if single_member*days + 1 <= D:
            Chocolate += 1
    days += 1

print(Chocolate)

Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

template <typename T>
void scanInt(T &x) {
    bool neg = false;
    register int c = getchar_unlocked();
    x = 0;
    for (; (c < 48 || c > 57) && (c != '-'); c = getchar_unlocked());
    if (c == '-') {
        neg = true;
        c = getchar_unlocked();
    }
    for (; c > 47 && c < 58; c = getchar_unlocked())
        x = (x << 1) + (x << 3) + c - 48;
    if (neg)
        x *= -1;
}

template <typename T>
void printInt(T n) {
    if (n < 0) {
        n = -n;
        putchar_unlocked('-');
    }
    int i = 21;
    char output_buffer[21];
    do {
        output_buffer[--i] = (n % 10) + '0';
        n /= 10;
    } while (n);
    do {
        putchar_unlocked(output_buffer[i]);
    } while (++i < 21);
}

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

    int a, b, c;
    cin >> a >> b >> c;
    int val = c - (a - b);
    (val > 0) ? cout << val : cout << 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(i,a,n) for(i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

using namespace std;

void fin(int i,int n,vin &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 

signed main() {
    int i,N;
    cin>>N;
    vector<vector<int> > dp(N+1,vector<int>(2));
    vin A(N+1);
    rep(i,1,N+1){
        cin>>A.at(i);
    }
    dp.at(1).at(0)=A.at(1);
    dp.at(1).at(1)=-A.at(1);

    rep(i,1,N){
        dp.at(i+1).at(0)=max(dp.at(i).at(0)+A.at(i+1),dp.at(i).at(1)-A.at(i+1));
        dp.at(i+1).at(1)=max(dp.at(i).at(0)-A.at(i+1),dp.at(i).at(1)+A.at(i+1));
    }
    cout<<dp.at(N).at(0)<<endl;
return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
string s;
cin>>s;
if(s=="SUN")
{
	ol(7);
}
else if(s=="MON")
{
	ol(6);
}
else if(s=="TUE")
{
	ol(5);
}
else if(s=="WED")
{
	ol(4);
}
else if(s=="THU")
{
	ol(3);
}
else if(s=="FRI")
{
	ol(2);
}
else if(s=="SAT")
{
	ol(1);
}
return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
ll a, b, c;
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	qread(a);
	qread(b);
	qread(c);
	cout << (a - b) % c << endl;
	return 0;
}


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

using namespace std;

int main(void){
  int n, ans = 1;
  cin >> n;
  if(n == 1)
    cout << 1 << endl;
  else if(n == 2 || n ==3 || n == 5 || n == 7 || n == 11){
    ans = pow(2,n-1);
    cout << ans << endl;
  }
  else{
    if(n == 9)
      cout << pow(2,2)*pow(3,2) << endl;
    else if(n == 12)
      cout << 60 << endl;
    else{
      ans = n/2-1;
      cout << pow(2,ans)*3 << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3348
from numpy import int_

mod = 10 ** 9 + 7

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

M = int(N ** 0.5)

T = [N // i - N // (i + 1) for i in range(1, M + 1)]
A = int_([1] * (N - sum(T)) + T[::-1])

dp = A[:]
for _ in range(K - 1):
    dp = A * dp.cumsum()[::-1] % mod

print(sum(dp) % mod)

Measured memory_bytes: 14692
#include<iostream>
#include<complex>
#include<array>
#include<vector>
#include<cstdio>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

typedef  complex<double> point;

double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}
double dot(const point& a, const point& b) {
	return real(conj(a)*b);
}
int ccw(point a, point b, point c) {
	b -= a; c -= a;
	if (cross(b, c) > 0)   return +1;  // counter clockwise
	if (cross(b, c) < 0)   return -1;  // clockwise
	if (dot(b, c) < 0)     return +2;  // c--a--b on line
	if (norm(b) < norm(c)) return -2;  // a--b--c on line
	return 0;  // a--c--b on line or a----bc
}

typedef array<point, 2> line;

point projection(const line& l, const point& p) {
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}

point reflection(const line& l, const point& p) {
	return p + 2. * (projection(l, p) - p);
}
 typedef array<point, 2> line;
//using line = array<point, 2>;
/*
 * 平行かどうか
 */
bool is_parallel(const line& s, const line& t) {
	return eq(cross(s[0] - s[1], t[0] - t[1]), 0.0);
}

bool is_orthogonal(const line& s, const line& t) {
	return eq(dot(s[0] - s[1], t[0] - t[1]), 0.0);
}

bool intersectLL(const line& l, const line& m) {
	return !eq(cross(l[1]-l[0], m[1]-m[0]), 0.) || // non-parallel
			eq(cross(l[1]-l[0], m[0]-l[0]), 0.);   // same line
}
bool intersectSS(const line &s, const line &t) {
	return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
			ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

int main()
{
  int q;
  cin>>q;
  for(;q--;)
    {
      line l1,l2;
      double x,y;
      cin>>x>>y;
      l1[0]=point(x,y);
      cin>>x>>y;
      l1[1]=point(x,y);
      cin>>x>>y;
      l2[0]=point(x,y);
      cin>>x>>y;
      l2[1]=point(x,y);

      cout<< (int)intersectSS(l1,l2) <<endl;

    }
}

Measured memory_bytes: 1256
s=input()
n=input().split(" ")
a=1
flag=False
for i in n:
  if int(i)==0:
    print(0)
    exit(0)
  if flag==False:
    a=a*int(i)
  if a>1000000000000000000:
    flag=True
if flag==True:
  print(-1)
else:
  print(a)

Measured memory_bytes: 19320
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;

ll dp[N], koj[N], n, a[N];

int main(){
	IOS;
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
		koj[a[i]] = i;
	}
	dp[a[1]] = 1;
	for (int i = 2; i <= n; i++){
		dp[a[i]] = 1;
		if (koj[a[i] - 1] < koj[a[i]]){
			dp[a[i]] += dp[a[i] - 1];
		}
		//cout << dp[a[i]] << '\n'; 
	}
	ll Max = 0;
	for (int i = 1; i <= n; i++) Max = max(Max, dp[i]);
	cout << n - Max;
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

int main()
{
	string a, b;
	cin >> a >> b;
	a += b;
	int n = stoi(a);

	bool ans = false;
	for (int i = 0; i*i <= 100100; i++)
	{
		if (i*i == n)
			ans = true;
	}
	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=998244353;
const llint moe=998999971;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int i,n;cin>>n;
	llint ans=0;
	string str;cin>>str;
	llint gya=1,gyb=1,bb=100;
	for(int h=0;h<30;h++){
		if((mod-2)&(1<<h)){gya*=bb;gya%=mod;}
		bb*=bb;bb%=mod;
	}
	bb=100;
	for(int h=0;h<30;h++){
		if((moe-2)&(1<<h)){gyb*=bb;gyb%=moe;}
		bb*=bb;bb%=moe;
	}
	vector<llint>cd(n+1);
	vector<llint>ce(n+1);
	llint cp=1,cq=1;
	for(i=0;i<n;i++){
		if(str[i]=='>'){cp*=100;cq*=100;cp%=mod;cq%=moe;}
		if(str[i]=='<'){cp*=gya;cq*=gyb;cp%=mod;cq%=moe;}
		if(str[i]=='+'){cd[i]=cp;ce[i]=cq;}
		if(str[i]=='-'){cd[i]=mod-cp;ce[i]=moe-cq;}
	}
	for(i=n-1;i>=0;i--){cd[i]+=cd[i+1];cd[i]%=mod;ce[i]+=ce[i+1];ce[i]%=moe;}
	map<pair<llint,llint>,int>ma;
	for(i=0;i<=n;i++){ma[mp(cd[i],ce[i])]++;}
	llint apd=1,ahd=0,ape=1,ahe=0;
	llint Sd=cd[0];
	llint Se=ce[0];
	for(i=0;i<n;i++){
		ma[mp(cd[i],ce[i])]--;
		llint tdr=(Sd-ahd-apd*Sd)%mod;
		llint ter=(Se-ahe-ape*Se)%moe;
		if(tdr<0){tdr+=mod;}
		if(ter<0){ter+=moe;}
		ans+=ma[mp(tdr,ter)];
		if(str[i]=='>'){apd*=100;ape*=100;apd%=mod;ape%=moe;}
		if(str[i]=='<'){apd*=gya;ape*=gyb;apd%=mod;ape%=moe;}
		if(str[i]=='+'){ahd+=apd;ahe+=ape;ahd%=mod;ahe%=moe;}
		if(str[i]=='-'){ahd+=mod-apd;ahe+=moe-ape;ahd%=mod;ahe%=moe;}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 35604
#include<stdio.h>

int main(void) {
	int S, h, m, s;
	

	scanf("%d", &S);

	h = S / (60 * 60);
	m = (S - h * 60*60)/60;
	s = (S - h * 60 * 60) % 60;

	printf("%d:%d:%d\n", h, m,s);

	return 0;
}



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

int main()
{
    string s;
    cin >> s;
    bool ok = false;
    rep(i, s.size() - 1) {
        if(s[i] == 'A' && s[i + 1] == 'C') ok = true;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>

int main() {
	int n;
	std::cin >> n;

	bool prev = false;
	std::vector<int> vec;
	for (int i = 0; i < n; ++i) {
		int p;
		std::cin >> p;

		if (p == i + 1) {
			if (prev)
				++vec.back();
			else
				vec.push_back(1);

			prev = true;
		}
		else
			prev = false;
	}

	int64_t ans = 0;
	for (auto&& e : vec)
		ans += std::max((e + 1) / 2, 1);

	std::cout << ans << std::endl;
}

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

int main()
{
    long n, m;
    cin >> n >> m;
    if(n == 1 && m == 1){
        cout << 1 << endl;
    }
    else if(n == 1){
        cout << m-2 << endl;
    }
    else if(m == 1){
        cout << n-2 << endl;
    }
    else{
        cout << n*m-2*n-2*m+4 << 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 rep1(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;

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

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

int main(){
  int n;
  cin>>n;
  
  ll ans = 0;
  cin>>ans;
  rep1(i,n){
    ll tmp;
    cin>>tmp;
    ans=lcm(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}

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

int main()
{
int Alice,Bob;cin>>Alice>>Bob;

if(Alice==1&&Bob==1)
{
    cout<<"Draw";
    return 0;
}

if(Alice==1){
    cout<<"Alice";
    return 0;
}

if(Bob==1){
    cout<<"Bob";
    return 0;
}
if(Alice==Bob)
{
    cout<<"Draw";
    return 0;
}
if(Alice >Bob)
{
    cout<<"Alice";
    return 0;
}
cout<<"Bob";
    return 0;
}


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

int main() {
    ll N, K, ans = 0;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        ll x;
        cin >> x;
        ans += 2 * min(x, abs(x-K));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    string s;
    cin >> s;

    s[3] = '8';
    cout << s << endl;

    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n, l;
  cin >> n >> l;
  int ans = 0, m = INF;
  for (int i = l; i < l + n; i++) {
    if (abs(i) < abs(m)) m = i;
    ans += i;
  }
  ans -= m;
  cout << ans << endl;
}


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

using namespace std;

int main()
{
    long X;
    long m = 100;
    cin >> X;
    long ans = 0;
    while (1)
    {
        m *= 1.01;
        ans++;
        if (X <= m)
        {
            cout << ans << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
int main(){
    ll n,k;cin>>n>>k;
    vl h(n);rep(i,n)cin>>h[i];
    vl dp(n,LINF);
    dp[0]=0;
    rep(i,n-1){
        rrep(j,k){
            if(i+j>=n)continue;
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1920
A,B = map(int,input().split())
ans = 0
if A < B:
  ans+=B
  if A < B-1:
    ans+=B-1
  else:
    ans+=A
else:
  ans+=A
  if B < A-1:
    ans+=A-1
  else:
    ans+=B
print(ans)

Measured memory_bytes: 3060
// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
//my template ends//
string s,temp,ans;
map<string,int>m;
int32_t main()
{
	ios_base::sync_with_stdio(0);
  	cin.tie(0);
 // 	input();
  	int n;
  	cin>>n;
  	if(n<30)
  	{
  		cout<<"No";
  	}
  	else
  		cout<<"Yes";
  
    return 0;
}



Measured memory_bytes: 3648
H, N = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(N)]
val = 1e+9
mps = [val] * H
mps[0] = 0

for i in range(H):
  for d, c in magics:
    if i + d < H:
      mps[i + d] = min(mps[i] + c, mps[i + d])
    else:
      val = min(mps[i] + c, val)
    
print(val)


Measured memory_bytes: 44252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

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

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  rep(i, n - 1) {
    if (a[i] > a[i + 1]) break;
    if (i == n - 2) {
      cout << "YES" << endl;
      return;
    }
  }
  rep(i, n) rep3(j, i + 1, n) {
    if (a[i] > a[j]) {
      swap(a[i], a[j]);
      rep(i, n - 1) {
        if (a[i] > a[i + 1]) break;
        if (i == n - 2) {
          cout << "YES" << endl;
          return;
        }
      }
      swap(a[i], a[j]);
    }
  }
  cout << "NO" << endl;
}


Measured memory_bytes: 256