akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define Rep(i,v) rep(i,0,(int)v.size()-1)
#define lint long long
#define mod 998244353
#define ull unsigned lint
#define db long double
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define gc getchar()
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
typedef pair<int,int> pii;
typedef set<int>::iterator sit;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
const int N=100010;int a[N];
inline int gcd(int a,int b) { return a?gcd(b%a,a):b; }
int main()
{
	int n=inn();rep(i,1,n) a[i]=inn();
	sort(a+1,a+n+1);int ans=1;
	rep(i,1,n) ans=(lint)ans*gcd(a[i],i-1)%mod;
	return !printf("%d\n",ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>

#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;


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

Measured memory_bytes: 3620
use proconio::*;

// 

fn run() {
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut b: Vec<_> = a.into_iter().enumerate().collect();
    b.sort_by_key(|p| p.1);
    let diff = |a: usize, b: usize| -> i64 {
        (std::cmp::max(a, b) - std::cmp::min(a, b)) as i64
    };
    let mut dp = vec![0];
    while let Some((k, a)) = b.pop() {
        let len = dp.len();
        let mut next = vec![0; dp.len() + 1];
        for (i, v) in dp.into_iter().enumerate() {
            next[i] = std::cmp::max(next[i], v + a * diff(k, n - (len - i)));
            next[i + 1] = std::cmp::max(next[i + 1], v + a * diff(k, i));
        }
        dp = next;
    }
    let ans = dp.into_iter().max().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 2352
#coding=UTF-8

N=int(input())
moti=list(range(0,N,1))

#initalize
for idx in range(0,N,1):
    moti[idx]=[]

#input
for idx in range(0,N-1,1):
    mozir=input()
    hyo=mozir.split(' ')
    a=int(hyo[0])-1
    b=int(hyo[1])-1

    moti[a].append(b)
    moti[b].append(a)

#path 0 to N-1
#width serach
belong=list(range(0,N,1))
for idx in range(0,N,1):
    belong[idx]=None

belong[0]="F"
belong[N-1]="S"

fennec_watch=[0]
sunuke_watch=[N-1]
fennec_haven=1
sunuke_haven=1
fennec_zou=1 #for breaking cond
sunuke_zou=1 #also
Teban="F"
while True:
    if Teban=="F":
        fennec_next=[]
        for mono in fennec_watch:
            kouho=moti[mono]
            for butu in kouho:
                if belong[butu]==None:
                    fennec_next.append(butu)
                    belong[butu]="F"

        fennec_watch=fennec_next
        fennec_zou=len(fennec_next)
        fennec_haven=fennec_haven+fennec_zou
    else:
        sunuke_next=[]
        for mono in sunuke_watch:
            kouho=moti[mono]
            for butu in kouho:
                if belong[butu]==None:
                    sunuke_next.append(butu)
                    belong[butu]="S"

        sunuke_watch=sunuke_next
        sunuke_zou=len(sunuke_next)
        sunuke_haven=sunuke_haven+sunuke_zou
        
    if fennec_zou==0 and sunuke_zou==0:
        break
    Teban='F' if Teban=='S' else 'S'

#when fennec_haven==sunuke_haven==k
#k+1 th turn fennec 33-4
if fennec_haven > sunuke_haven:
    print('Fennec')
else:
    print('Snuke')


Measured memory_bytes: 25124
#include <iostream>
#include <string>

int main() {
  std::string O, E;
  std::cin >> O >> E;

  std::string res;
  for (size_t i = 0; i < O.length(); ++i) {
    res += O[i];
    if (i < E.length()) res += E[i];
  }
  std::cout << res << std::endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def pow(N,R,mod):
    ans = 1
    i = 0
    while((R>>i)>0):
        if (R>>i)&1:
            ans *= N
            ans %= mod
        N = (N*N)%mod
        i += 1
    return ans%mod


def main():
    N,K = map(int,input().split())
    li = [0 for _ in range(K)]

    mod = 10**9+7
    ans = 0
    for i in range(K,0,-1):
        mm = K//i
        mm = pow(mm,N,mod)

        for j in range(2,(K//i)+1):
            mm -= li[i*j-1]    
        li[i-1] = mm


        ans += (i*mm)%mod
        ans %= mod

    print(ans)

if __name__ == '__main__':
    main()

    



Measured memory_bytes: 11204
import fractions

N,X = (int(x) for x in input().split())
x = [int(p) for p in input().split()]
x.append(X)
x.sort()
D = x[1] - x[0]

for i in range(1,N):
    D = fractions.gcd(D,x[i+1]-x[i])

print(D)

Measured memory_bytes: 16280
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	int a,b;
	cin >> a >> b;

	if(a < b)
		cout << 0 << endl;
	else
		cout << 10 << endl;


}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(a: int, b: int):
    ret = a
    if b < a:
        ret -= 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Bits
import Debug.Trace

main :: IO ()
main = readContents 2 >>= main'
    where
        main' [[n, k], as] = print $ solve k as

solve :: Int -> [Int] -> Int
solve k as = sum $ map (xor res) as
    where
        res = traceShowId $ value bs
        bs = map (check . (2 ^)) es 
        es = dropWhile (ek <) [40, 39..0]
            where
                ek = ceiling . logBase 2 $ fromIntegral k

        value = foldl' ff 0 . zip es
            where
                ff acc (e, b)
                    | b && next <= k = next
                    | otherwise = acc
                    where
                        next = acc + (2 ^ e)

        check x = br $ foldl' ff (0, 0) as
            where
                br (a, b) = a > b 
                
                ff (a, b) y 
                    | x .&. y == 0 = (a + 1, b)
                    | otherwise = (a, b + 1)

readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int &i:v) cin>>i;
  sort(v.begin(),v.end());
  cout<<v[n/2]-v[(n-1)/2];
  
  return 0;
}

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

int main() {
	int N, cnt_minus = 0; cin >> N;
	vector<long long> A(N);
	
	bool zero_find = false;
	
	for( int i = 0 ; i < N ; i++ ){
		cin >> A[i];
		if(A[i] == 0) zero_find = true;
		if(A[i] < 0 && !(zero_find)){
			cnt_minus++;
		}
	}
	
	long long sum = 0, tiisai = abs(A[0]);
	for( int i = 0 ; i < N ; i++){
		sum += abs(A[i]);
		tiisai = min( tiisai, abs(A[i]));
	}
	
	if(cnt_minus % 2 == 0 || zero_find)
	cout << sum << endl;
	else
	cout << sum - tiisai*2 << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

int main() {

    char s[105];

    int n;

    long long int d;

    scanf("%s", s);

    scanf("%lld", &d);

    n = strlen(s);

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

        if (s[i]== '1' && d==i+1) {

            printf("%c\n", s[i]);

            break;

        }

        else if (s[i]!='1') {

            printf("%c\n", s[i]);

            break;

        }

    }

    return 0;

}



Measured memory_bytes: 128
module Array = ArrayLabels
module List = ListLabels

let inf = 10000000000
let (>>=) x f = List.map f x |> List.concat

let () =
  Scanf.scanf "%d" @@ fun n ->
  let xyds = Array.init n (fun _ -> Scanf.scanf " %d %d %s" (fun x y d -> 2*x, 2*y, d)) in

  let find_edges axis dir =
    Array.fold_left xyds ~init:(inf, -inf) ~f:(fun (minv, maxv) (x, y, d) ->
      let v = match axis with `X -> x | `Y -> y in
      if d = dir then (min minv v, max maxv v) else (minv, maxv))
  in 
  let exs =
    [("R", 1); ("L", -1); ("U", 0); ("D", 0)]
    |> List.map ~f:(fun (d, m) -> let x1, x2 = find_edges `X d in (x1, x2, m)) in
  let eys =
    [("R", 0); ("L", 0); ("U", 1); ("D", -1)]
    |> List.map ~f:(fun (d, m) -> let y1, y2 = find_edges `Y d in (y1, y2, m)) in

  let area_of_time (t : int) =
    let xm, xM = List.fold_left exs ~init:(inf, -inf) ~f:(fun (xm, xM) (x1, x2, mul) ->
      (min xm (x1 + mul * t), max xM (x2 + mul * t))) in
    let ym, yM = List.fold_left eys ~init:(inf, -inf) ~f:(fun (ym, yM) (y1, y2, mul) ->
      (min ym (y1 + mul * t), max yM (y2 + mul * t))) in
    (xM - xm) * (yM - ym)
  in

  let txs =
    exs >>= fun (xa1, xa2, da) ->
    exs >>= fun (xb1, xb2, db) ->
      if da = db then []
      else
        [xa1; xa2] >>= fun xa ->
        [xb1; xb2] >>= fun xb ->
          if abs xa + abs xb >= inf then []
          else [abs @@ (xa - xb) / (da - db)] in
  let tys =
    eys >>= fun (ya1, ya2, da) ->
    eys >>= fun (yb1, yb2, db) ->
      if da = db then []
      else
        [ya1; ya2] >>= fun ya ->
        [yb1; yb2] >>= fun yb ->
          if abs ya + abs yb >= inf then []
          else [abs @@ (ya - yb) / (da - db)] in

  let ans =
    List.map area_of_time ([0] @ txs @ tys)
    |> List.fold_left ~f:min ~init:(area_of_time 0) in
  Printf.printf "%.11f\n" (float_of_int ans /. 4.)


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

public class Main {
	static final int like = 753;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for(int i = 0; i < m; i ++)
			list.add(sc.nextInt());
		
		int a = 0, b = 0;
		for(int i = x; i > 0; i--) {
			if (list.contains(i))
				a++;
		}
		for(int i = x; i < n; i++) {
			if (list.contains(i))
				b++;		
		}
		out.println(Math.min(a, b));
		
		out.close();
	}
	


static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}



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

int main() {
	int n;
	cin >> n;
	vector<int> c(n + 1);
	for (int i = 0, w; i < n; i++) {
		cin >> w;
		c[i + 1] = c[i] + w;
	}
	int min = c[n];
	for (int i = 0, a, b; i < n - 1; i++) {
		a = c[i + 1] - c[0];
		b = c[n] - c[i + 1];
		if (abs(a - b) < min)
			min = abs(a - b);
		else
			break;
	}
	cout << min << endl;

}


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

int n,m;
int a[MAX_N], b[MAX_N];
bool G[MAX_N][MAX_N];
bool visited[MAX_N];

bool dfs(int u){
    visited[u] = true;

    for(int v = 0; v < n; ++v){
        if(G[u][v] == false ) continue;
            if( visited[v] == true ) continue;
            dfs(v);
    }
}

int main(){
    cin>>n>>m;
    for(int i =0;i<=50;i++){
        for(int j =0; j<=50; j++)G[i][j] = false;
    }
    for(int i = 0; i< m; ++i){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        G[a[i]][b[i]] = G[b[i]][a[i]] = true;
    }
    int ans =0;

    for(int i = 0; i <m; ++i){
        for(int d=0; d<n; ++d) visited[d] = false;

        G[a[i]][b[i]] = G[b[i]][a[i]] = false;

        dfs(0);

        bool must_b = false;
        for(int j=0; j<n; ++j){
            if(visited[j] == false) must_b = true;
        }
        if(must_b) ans++;
        G[a[i]][b[i]] = G[b[i]][a[i]] = true;
    }
    cout<< ans <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, a;
	int x = 0, y = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		if (a % 4 == 0) x++;
		else if (a % 2 != 0) y++;
	}

	if ((x >= y) || ((x + y == n) && (x + 1 >= y))) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    string S;
    cin >> S;
    if(S.find("AC") != string::npos) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, m, a[1010], b[1010], c[1010];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	int ans = -10000000000000;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			for (int k = -1; k <= 1; k++) {
				if (i*j*k != 0) {
					int d[1010];
					for (int p = 0; p < n; p++)d[p] = a[p] * i + b[p] * j + c[p] * k;
					sort(d, d + n, greater<int>());
					int cnt = 0;
					for (int p = 0; p < m; p++)cnt += d[p];
					ans = max(ans, cnt);
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,A,B;cin>>A>>B;
  string ss;cin>>ss;
  if(ss[A]=='-'){
    ss[A]='0';
  }else{
    cout<<"No";
    return 0;
  }
  for(i=0;i<=A+B;i++){
    if(ss[i]=='-'){
      cout<<"No";
      return 0;
    }
  }
  cout <<"Yes";}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll dp[25000010];

ll f(ll n,ll a,ll b,ll c,ll p,ll q,ll r){
	rep(i,0,n+1){
		dp[i]=i;
		if(i>=c)dp[i]=max(dp[i],dp[i-c]+r);
		if(i>=b)dp[i]=max(dp[i],dp[i-b]+q);
	}
	ll ret=0;
	rep(i,0,n+1)ret=max(ret,(i%a)+i/a*p+dp[n-i]);
	return ret;	
}

ll n,a,b,c,p,q,r;
int main(){
	scanf("%lld%lld%lld%lld%lld%lld%lld",&n,&a,&b,&c,&p,&q,&r);	
	n=f(n,a,b,c,p,q,r);
	n=f(n,p,q,r,a,b,c);
	printf("%lld",n);
}

Measured memory_bytes: 195456
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int W, H;
  while (cin >> W >> H, W) {
    vs v(H);
    rep(i, H) cin >> v[i];
    vvi dp(H, vi(W));
    int b = 0, w = 0;
    rep(i, H) rep(j, W) {
      dp[i][j] = 2 * (v[i][j] == 'B') + (v[i][j] == 'W');
      b -= v[i][j] == 'B';
      w -= v[i][j] == 'W';
    }
    rep(_, W * H) rep(i, H) rep(j, W) {
      if (v[i][j] != '.') continue;
      if (i > 0) dp[i][j] |= dp[i - 1][j];
      if (j > 0) dp[i][j] |= dp[i][j - 1];
      if (i < H - 1) dp[i][j] |= dp[i + 1][j];
      if (j < W - 1) dp[i][j] |= dp[i][j + 1];
    }
    rep(i, H) rep(j, W) {
      b += dp[i][j] == 2;
      w += dp[i][j] == 1;
    }
    cout << b << ' ' << w << endl;
  }
}

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, A: "List[int]"):
    for k in range(N-K):
        if A[k] < A[K+k]:
            print("Yes")
        else:
            print("No")
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 33360
#include <bits/stdc++.h>
#define tt long t;cin>>t;while(t--)
#define tez ios_base::sync_with_stdio(false); cin.tie(NULL);
#define lli long long int
#define plli pair<lli,lli>
#define vlli vector<lli>
#define vplli vector<plli>
#define pqlli priority_queue <lli>
#define pqplli priority_queue <plli>
#define mplli map<lli,lli>
#define all(v) v.begin(),v.end()
#define alll(s) s.begin(),s.end(),s.begin(), ::tolower
#define allu(s) s.begin(),s.end(),s.begin(), ::toupper
 
#define mod 1000000007
#define ff first
#define ss second
#define fori(i,a,b)    for(int i=a;i<b;i++)
#define ford(i,a,b)    for(int i=a;i>=b;i--)
#define br cout<<endl
#define sz(v) (long)v.size()
#define YS cout<<"YES"<<endl
#define ys cout<<"yes"<<endl
#define Ys cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define no cout<<"no"<<endl
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define bs binary_search
#define mp make_pair
#define llmn LLONG_MIN
#define llmx  LLONG_MAX
#define stp setprecision
#define fxd fixed
#define tu (char)toupper
#define tl (char)tolower
#define coutv(v) for(lli index=0;index<v.size();index++) {cout<<v[index]<<" ";} br;
 
using namespace std;
using namespace std::chrono; 
 
/*
lli count01(string s,char ch){
  lli mx=0,c=0;
  if(ch=='0'){
 
   fori(i,0,sz(s)){
     if(s[i]=='0'){
        c++;}
     else{
        c=0;}
        if(c>mx){mx=c;}
 
   }
 
  }
  else{
 
    fori(i,0,sz(s)){
     if(s[i]=='1'){
        c++;}
     else{
        c=0;}
        if(c>mx){mx=c;}
 
    }
 
  }
return mx;
 
}
*/
/*
vector<lli> prime(lli n){
  bool a[n+1];
  memset(a,true,sizeof(a));
  for(lli i=2;i*i<=n;i++){
    if(a[i]){
      for(lli j=i*i;j<=n;j+=i)
      {  a[j]=false;}
    }
  }
  vector<lli>v;
  for(lli i=2;i<=n;i++){
    if(a[i]){
      v.pb(i);
    }
  }
  return v;
}
*/

lli power( lli a, lli x){
    lli ans=1;
    a=a%mod;
    while(x>0){
       if(x%2==1){
        ans=(ans*a)%mod;
       }
       a=(a*a)%mod;
       x/=2;
   }
   return ans;
}

//int dir[][2]={{0,1},{0,-1},{-1,0},{1,0}};
lli fac(lli n){
    if(n==1)
        return 1;
    return (n*fac(n-1))%mod;
}

void solve(){
    lli n;
    cin>>n;
    lli dp[n+1]={0};
    for(lli i=3;i<=n;i++){
        dp[i]=1;
    }

    for(lli i=3;i<=n;i++){
        for(lli j=3;j<=n;j++){
            if(i-j<0){
                break;
            }
            dp[i]=(dp[i]+dp[i-j])%mod;
        }
    }
    cout<<dp[n]<<endl;
}

int main(){
tez
auto start = high_resolution_clock::now(); 

solve();



auto stop = high_resolution_clock::now(); 
auto duration = duration_cast<microseconds>(stop - start);
double Tsec= (double)duration.count()/(double)1000000;
//cout<<Tsec<<endl;
 
return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define pb push_back
#define fst first
#define snd second

typedef long long ll;
typedef pair<int,int> pii;
template<typename T> using min_queue=priority_queue<T,vector<T>,greater<T>>;

const ll MOD=1e9+7;

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

    int N;cin>>N;
    cout << 999 - (N-1)%1000 << '\n';
    return 0;
}


Measured memory_bytes: 3628
W,H,N = list(map(int,input().split()))

X = [0,W]
Y = [0,H]

for n in range(N):
    x,y,a = list(map(int,input().split()))
    if a == 1:
        X[0] = max(X[0],x)
    elif a == 2:
        X[1] = min(X[1],x)
    elif a == 3:
        Y[0] = max(Y[0],y)
    elif a == 4:
        Y[1] = min(Y[1],y)
    
# print((X[1]-X[0])*(Y[1]-Y[0]))
print(max(0,X[1]-X[0])*max(0,Y[1]-Y[0]))

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

const int mod = 1e9+7;

int ans(int n) {
  if(n == 1) return 1;
  return (ll(n) * ans(n-1)) % mod;
}
int main () {
  int n;
  cin >> n;
  cout << ans(n) << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int c[3][3];
int a[3],b[3];
bool flag=false;
int main(){
  for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin >> c[i][j];

  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      for(int k=0;k<=100;k++){
        flag = true;
        a[0]=i;a[1]=j;a[2]=k;
        for(int i=0;i<3;i++) b[i]=c[0][i]-a[0];
        for(int y=1;y<3 && flag;y++){
          for(int x=0;x<3 && flag;x++){
            if(c[y][x]!=a[y]+b[x]) flag = false;
          }
        }
        if(flag){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);

        int loopCount = Integer.parseInt(scanner.next());
        Integer cheaper = null;
        Integer maximum = null;
        for (int i = 0; i < loopCount; i++) {
            int current = Integer.parseInt(scanner.next());
            if (i == 0) {
                cheaper = current;
                continue;
            }

            int diff = current - cheaper;
            if (maximum == null || diff > maximum) {
                maximum = diff;
            }
            if (current < cheaper) {
                cheaper = current;
            }
        }

        System.out.println(maximum);
    }
}

Measured memory_bytes: 71460
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

typedef pair<ll, ll> p;
typedef pair<ll, p> pt;

ll INF = 1000000000000000000;
int main(int argc, char const *argv[]) {
  ll h, w, k;std::cin >> h >> w >> k;
  p s(0, 0), e(0, 0);
  scanf("%lld %lld", &s.first, &s.second);
  scanf("%lld %lld", &e.first, &e.second);
  s.first--, s.second--;
  e.first--, e.second--;

  vvl cost = VV(h, w, INF, ll);
  vector<string> v(h);
  re(i, h) std::cin >> v[i];

  priority_queue<pt, vector<pt>, greater<pt>> q;
  q.push(pt(0, s));
  cost[s.first][s.second] = 0;

  while(!q.empty()){
    pt tmp = q.top();
    q.pop();
    ll c = tmp.first;
    ll x = tmp.second.first;
    ll y = tmp.second.second;

    if(cost[x][y] < c) continue;
    // @ かすでに訪れたマスがあるまで
    // ->
    for(int i=1;i<=k;i++){
      if(y+i>=w) break;
      if(cost[x][y+i] <= c||v[x][y+i]=='@') break;
      if(cost[x][y+i] != c+1) q.push(pt(c+1, p(x, y+i)));
      cost[x][y+i] = c + 1;
    }

    for(int i=-1;i>=-k;i--){
      if(y+i<0) break;
      if(cost[x][y+i] <= c||v[x][y+i]=='@') break;
      if(cost[x][y+i] != c+1) q.push(pt(c+1, p(x, y+i)));
      cost[x][y+i] = c + 1;
    }

    for(int i=1;i<=k;i++){
      if(x+i>=h) break;
      if(cost[x+i][y] <= c||v[x+i][y]=='@') break;
      if(cost[x+i][y] != c+1) q.push(pt(c+1, p(x+i, y)));
      cost[x+i][y] = c + 1;
    }

    for(int i=-1;i>=-k;i--){
      if(x+i<0) break;
      if(cost[x+i][y] <= c||v[x+i][y]=='@') break;
      if(cost[x+i][y] != c+1) q.push(pt(c+1, p(x+i, y)));
      cost[x+i][y] = c + 1;
    }
  }

  if(cost[e.first][e.second]==INF){
    std::cout << -1 << '\n';
    return 0;
  }
  std::cout << cost[e.first][e.second] << '\n';
  return 0;
}


Measured memory_bytes: 18460
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) (1e9)
#define mod (ll) (1e9 + 7)
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)
 
const int mxn = 1*(1e5) + 5;
ll n, m;
 
void solve(){
    cin >> n >> m;
    ll h[n];
    if(n == 0) {
        cout << "0";
        return;
    }
    for(int i=0; i<n; i++) {
        cin >> h[i];
    }
    ll dp[n+1];
    dp[1] = 0;
    // dp[2] = abs(h[1] - h[0]);
    for(int i=2; i<=n; i++) {
        dp[i] = INF;
        for(int j=i-1; j >= i-m && j>=1; j--) {
            dp[i] = min(dp[i], dp[j] + abs(h[i-1] - h[j-1]));
        }
        // dp[i] = min(dp[i-1] + abs(h[i-1] - h[i-2]), dp[i-2] + abs(h[i-1] - h[i-3]));
    }
    cout<<dp[n];
}
 
int main(){
    fast;
    //  tt
        solve();
}

Measured memory_bytes: 5220
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PI acos(-1)
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;

int main(void) {
  /* 標準入力フラグ */
  int   scan;

  /* 数入力 */
  ll    answer;
  ll    a[5];

  answer = 0;
  for (int i=0; i<5; i++) {
    scan = scanf("%lld", &a[i]);
  }
  /* プログラムを書く */
  for (int i=0; i<5; i++) {
    if (a[i] == 0) {
      int n = i + 1;
      printf("%d", n);
      return (0);
    }
  }









  return (0);
}



Measured memory_bytes: 1676
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
using namespace std;
int main()
{
    string s;
    cin >> s;
    if (s.at(3) == '7')
    {
        s.at(3) = '8';
    }
    cout << s << endl;
}


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

int main(void){
	int N;
	int ans;
	int i;
	scanf("%d", &N);
	for (i = 0; i <= N; i++){
		if (pow(2, i) <= N)
			ans = pow(2, i);
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,k,N,v;
  int A[1000];
  scanf("%d",&N);
  for(i=0;i<N;i++)
    {
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++)
    {
      printf("%d",A[i]);
      if(i!=N-1) printf(" ");
    }
  printf("%d",A[N-1]);
  printf("\n");
  for(i=1;i<N;i++)
    {
      v=A[i];
      j=i-1;
  while(j>=0 && A[j]>v)
    {
      A[j+1]=A[j];
	j--;
    }
  A[j+1]=v;
  for(k=0;k<N-1;k++)
    {
      printf("%d",A[k]);
      if(k!=N-1) printf(" ");
    }
  printf("%d",A[N-1]);
  printf("\n");
    }
  return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <queue>
#include <stack>
#define sf(n) scanf("%d",&n);
#define sfl(n) scanf("%lld",&n);
#define pf(n) printf("%d",n);
#define pfl(n) printf("%lld",n);
#define pr printf("\n");
#define LL long long
using namespace std;

int num[]={1,2,4,8,16,32,64,128};
int main(){
    int n;
    scanf("%d",&n);
    int temp=1;
    for(int i=0;i<8;i++){
        if(num[i]>n){
            temp=i;
            break;
        }
    }
    cout<<num[temp-1]<<endl;
    return 0;
}
/*
10
7 7
CEOKERE
ACMICPC
PKPIZKC
*/


Measured memory_bytes: 256
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N, K = in_nn()
    A = in_nl()

    gcd = A[0]
    for i in range(1, N):
        gcd = math.gcd(gcd, A[i])

    if K % gcd == 0 and K <= max(A):
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18764
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0
for i in range(N):
  eat = A[i]-1 #0index
  ans += B[eat]
  if i>= 1 and A[i] == A[i-1]+1:
    #print(eat)
    ans += C[eat-1]
print(ans)

Measured memory_bytes: 3064
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))

import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


a,b,c,d = m()

kk = -(-a//c)

kkk = b//c

ll = -(-a//d)

lll = b//d

p = lcm(c,d)

pp = -(-a//p)

ppp = b//p
print(b-a+1-(kkk-kk+1)-(lll-ll+1)+(ppp-pp+1))



Measured memory_bytes: 66028
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A[] = new int[N+1];
    long ans = 0;
    A[0] = -1;
    for (int i=1; i<=N; i++) {
      A[i] = sc.nextInt();
      if (A[i] - A[i-1] > 1) {
        ans = -1;
        break;
      }
      if (A[i] == 0) {
        continue;
      }
      if (A[i] == 1 || A[i] - A[i-1] == 1) {
        ans++;
      } else {
        ans += A[i];
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 85076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
    cin >> n;
    map<ll, ll> mp;
    for (ll i = 0; i < n;i++){
        ll t;
        cin >> t;
        mp[t]++;
    }
    ll x = mp.size();
    cout << ((x % 2) ? x : x - 1) << endl;
}

Measured memory_bytes: 9644
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int rank[150][150];

struct Info{
	int height,width,value;
};

int main(){

	Info info[11175];
	int index = 0;

	for(int height = 1; height <= 149;height++){
		for(int width = height+1;width <= 150;width++){
			info[index].height = height;
			info[index].width = width;
			info[index].value = height*height + width*width;
			index++;
		}
	}

	for(int i = 1; i <= 11174; i++){
		for(int k = 11174; k >= i; k--){
			if((info[k].value < info[k-1].value) || (info[k].value == info[k-1].value && info[k].height < info[k-1].height))swap(info[k],info[k-1]);
		}
	}

	for(int i = 0; i < 11175; i++){
		rank[info[i].height][info[i].width] = i;
	}

	int h,w,tmp;

	while(true){
		scanf("%d %d",&h,&w);
		if(h == 0 && w == 0)break;

		tmp = rank[h][w]+1;

		printf("%d %d\n",info[tmp].height,info[tmp].width);

	}

	return 0;
}

Measured memory_bytes: 2832
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using u128 = __uint128_t;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vi> vvll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<vector<pair<ll,ll>>> vvii;
typedef long double ld;
typedef vector<long double> vld;
typedef vector<vector<long double>> vvld;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;
#define pb push_back
#define rep(x, n) for(int x = 0 ; x < n ; x++)
#define rep1(x, n) for(int x = 1 ; x < n ; x++)
#define rrep(x, n) for(int x = n ; x >= 0 ; x--)
#define all(c) (c).begin() , (c).end()
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll MOD = 1e9 + 7;
vvi g;
ll n;
vbl visited;
vll f1, f2;

void dfs(int node, int parent=-1)
{
    if (g[node].size() == 1 && g[node][0] == parent)
        f1[node] = 1, f2[node] = 1;
    for (auto child : g[node])
    {
        if (child == parent)
            continue;
        if (!visited[child])
            dfs(child, node);
        visited[child] = true;
        f1[node] = (f1[node] * (f1[child] + f2[child]) % MOD) % MOD;
        f2[node] = (f2[node] * f1[child]) % MOD;
    }
    return;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    cin >> n;
    g.resize(n);
    visited.resize(n, false);
    f1.resize(n, 1);
    f2.resize(n, 1);
    ll a, b;
    rep(i,n - 1)        cin >> a >> b, a--, b--, g[a].pb(b), g[b].pb(a);
    dfs(0);
    cout << (f1[0] + f2[0]) % MOD << endl;
    return 0;
}

Measured memory_bytes: 15616
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a;

signed main() {
	cin >> a;
	cout << (a==3 || a==5 || a==7 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal[] ab = Console.ReadLine().Split(' ').Select(decimal.Parse).ToArray();
            Console.WriteLine(Math.Floor(ab[0] * ab[1]));
        }
    }
}


Measured memory_bytes: 28288
/*
 Read problem and understand it 100%
 Make observation
 SOLVE THE PROBLEM
*/
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
#define all(s) (int)s.begin(), s.end()
using namespace std;
 
const int N = (int)1e6 + 5;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;


main() {
	int n;
	cin >> n;
	cout << n * (n + 1) / 2 - n;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int N;
  int K;
  int i;
  char tmp;

  scanf("%d",&N);
  
  char S[N+1];
  scanf("%s",S);
  S[N]='\0';

  scanf("%d",&K);

  tmp=S[K-1];
  for(i=0;i<N;i++){
    if(S[i]!=tmp){
      S[i]='*';
    }
  }
  
  printf("%s\n",S);
  return 0;
}

Measured memory_bytes: 128
n, x, m = map(int, input().split())
X = [-1] * m
P = []
sum_p = 0
while X[x] < 0: # preset
    X[x] = len(P) # pre length
    P.append(sum_p) # pre sum_p
    sum_p += x # now sum_p
    x = x*x % m
cyc_times, nxt_len = divmod(n - X[x], len(P) - X[x])
cyc = (sum_p - P[X[x]]) * cyc_times
remain = P[X[x] + nxt_len]
print(cyc + remain)


Measured memory_bytes: 13712
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);
	
	int N1 = N;
	
	int d;
	int t = 0;

	while ( N ){
		d = N % 10;
		t += d;
		N = N / 10;
	}
	
	int y = N1 % t;
	
	if ( y == 0 ){
		printf("Yes\n");
	}
	
	else{
		printf("No\n");
	}
	
	return 0;
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	long long ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			int s = a[i] + a[j];
			int p = lower_bound(a.begin(), a.end(), s) - a.begin();
			ans += p;
			ans -= j + 1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define MAX_N   100000
typedef long long ll;

void solve(){
    int a, b;
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << endl;   

}

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

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

using namespace std;

int main() {

	int n;

	cin >> n;

	int base = 1000;
	int i = 1;
	int en=0;
	while (en < n) {
		
		en = i * base;
		i++;

	}

	cout << en - n << endl;
}

Measured memory_bytes: 3632
n = int(input())
t, a = map(int,input().split())
h = list(map(int, input().split()))
ans = 0
val = 100000000000000
for i in range(n):
    if abs(a- (t-(h[i]*0.006))) < val:
        val =  abs(a- (t-(h[i]*0.006)))
        ans = i+1
print(ans)

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {

	string s;
	cin >> s;
	reverse(ALL(s));

	int n = s.size();
	VVI dp(n, VI(2));
	dp[0][0] = s[0] - '0';
	dp[0][1] = 11 - dp[0][0];
	FOR(i, 1, n) {
		int k = s[i] - '0';
		dp[i][0] = min(dp[i - 1][0] + k, dp[i - 1][1] + k);
		dp[i][1] = min(dp[i - 1][0] + 11 -k, dp[i - 1][1] + 9 - k);
	}
	cout << min(dp[n - 1][0], dp[n - 1][1]) << endl;


}

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

int main()
{
	string W, L;
	int n = 0;

	getline(cin, W);

	for (unsigned int i = 0; i < W.size(); i++) {
		if (W[i] >= 'A' && W[i] <= 'Z')
			W[i] = tolower(W[i]);
	}		

	getline(cin, L);

	while (L != "END_OF_TEXT") {
		for (unsigned int i = 0; i < L.size(); i++) {
			if (L[i] >= 'A' && L[i] <= 'Z')
				L[i] = tolower(L[i]);
		}

		L = " " + L + " ";

		unsigned int j = 0;

		j = L.find(W);

		while (j < L.size()) {
			if ((L[j - 1] == ' ') && (L[j + W.size()] == ' '))
					n++;

			j = L.find(W, j + 1);
		}

		getline(cin, L);
	}

	cout << n << endl;

    return 0;
}

Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace abc140_a
{
    static class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().ToInteger();
            Console.WriteLine($"{Math.Pow(n, 3)}");
        }

        static int ToInteger(this string s)
        {
            return int.Parse(s);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
// #include"testlib.h"

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)1e5 + 10;
// const int mod = (int)1e9 + 7;

int main(int argc, char* argv[]){

    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);

    ll n;
    cin >> n;

    ll sq = sqrtl(n);

    while(sq * sq < n) sq++;
    while(sq * sq > n) sq--;

    // ll sum = 0;
    // for(int i = 1; i <= n; ++i){
    //     if(n / i == n % i) sum += i;
    // }

    // cout << sum << endl;


    ll res = 0;
    for(int i = 1; i <= sq; ++i){
        ll m = n / i;
        m--;
        if(m && n / m == n % m) res += m;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty = map(int, input().split())
y1=ty-sy
x1=tx-sx
a = "U"*y1+"R"*x1+"D"*y1+"L"*x1+"L"+"U"*(y1+1)+"R"*(x1+1)+"D"+"R"+"D"*(y1+1)+"L"*(x1+1)+"U"
print(a)

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

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}

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

    int64_t n,a,b,c; cin>>n>>a>>b; if(n==3)cin>>c;
    vector<int64_t> v;
    for(auto t:divisor(a))if(!(b%t))v.push_back(t);
    if(n==3)for(auto t:v)if(c%t)v.erase(find(v.begin(),v.end(),t));
    sort(v.begin(),v.end());
    for(auto t:v)cout<<t<<'\n';
}


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

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    string s, t; cin >> s >> t;

    vector<string> ans;
    int x = -1;
    REP(i, s.size() - t.size() + 1) {

        bool isok = true;
        REP(j, t.size()) if (s[i + j] != t[j] && s[i + j] != '?') {isok = false; break;}
        if (!isok) continue;

        string ts;
        REP(k, s.size()) {
            if (k == i) {
                REP(j, t.size()) ts.push_back(t[j]);
                k += t.size() - 1;
            } else if (s[k] == '?') ts.push_back('a');
            else ts.push_back(s[k]);
        }
        // cout << i << " " << ts << endl;
        if (ts.size() == s.size()) ans.push_back(ts);
    }

    sort(ans.begin(), ans.end());
    // REP(i, ans.size()) cout << ans[i] << endl;

    if (ans.size() > 0) cout << ans[0] << endl;
    else cout << "UNRESTORABLE" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {

	int a, b, c,tmp;

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

	if (a > b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	if (b > c) {
		tmp = b;
		b = c;
		c = tmp;
		
	}

	if (a > b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	printf("%d %d %d\n", a, b, c);



	
	return(0);

}


Measured memory_bytes: 2048