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

namespace MultiplicationC
{
    class Program
    {
        static void Main()
        {

            decimal A = 0m;
            decimal B = 0m;
            decimal answer = 0;

            string[] input = Console.ReadLine().Split(' ');



            try
            {
                checked
                {
                    A = decimal.Parse(input[0]);
                    B = decimal.Parse(input[1]);
                    
                    if(A<0||B<0)
                    {
                        Console.WriteLine("error");
                        return;

                    }
                    else if (A > (decimal)Math.Pow(10, 15))
                    {
                        Console.WriteLine("error");
                        return;
                    }
                    else if (B > 10)
                    {
                        Console.WriteLine("error");
                        return;
                    }

                    answer = (decimal)Math.Truncate((A * B));
                }
            }
            catch (FormatException ex)
            {
                Console.WriteLine("error");
                return;
            }


            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 27892
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*, fastout};
use superslice::*;

fn main() {
    use std::f64::consts::PI;
    input! {
        a: f64, b: f64, h: f64, m: f64,
    }
    let hour = h + m/60.0;
    let p = 2.0*PI*hour/12.0;
    let q = 2.0*PI*m/60.0;
    let xp = a*p.cos();
    let yp = a*p.sin();
    let xq = b*q.cos();
    let yq = b*q.sin();
    let dx = xp - xq;
    let dy = yp - yq;
    let dist = (dx*dx + dy*dy).sqrt();
    println!("{}", dist);
    //dbg!(hour, m, p, q, xp, yp, xq, yq);
}


Measured memory_bytes: 2980
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

template<class T> inline int sgn(T n) { if (n > 0) return 1; else if (n < 0) return -1; else return 0; }

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 is_prime(int n) {
  for (int i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}

int main () {
  ll n;
  cin >> n;

  map<int,int> mp;

  vi prime;
  FOR(i,2,n+1) {
    if (is_prime(i)) prime.push_back(i);
  }

  FOR(i,2,n+1) {
    int x = i;
    for (auto p : prime) {
      while (x%p == 0) {
        x /= p;
        mp[p]++;
      }
    }
  }

  ll ans = 1;
  for (auto p : mp) {
    ans *= (1 + p.se);
    ans %= mod;
  }

  cout << ans << endl;
 }

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define N 100000

typedef struct{
  int id;
  int p;
  int c;
  int *child;
} Tree;

int n;
Tree *T;

int getdepth(int u){

  int d = 0;

  while(T[u].p >= 0){
    u = T[u].p;
    d++;
  }
  return d;
}

void print(void){

  int i,j,flag=0;

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

    printf("node %d: parent = %d, depth = %d, ",T[i].id,T[i].p,getdepth(i));
    if(T[i].c == 0 && T[i].p != -1)
      printf("leaf, [");
    else if(T[i].c != 0 && T[i].p != -1)
      printf("internal node, [");
    else 
      printf("root, [");

    for(j=0;j<T[i].c;j++){
      if(flag==0){ 
	printf("%d",T[i].child[j]);
	flag=1;
      }
      else {
	printf(", %d",T[i].child[j]);
      }
    }
    printf("]\n");
  }
}


int main(void){

  int i,j,node,deg;

  scanf("%d",&n);

  T = malloc(n * sizeof(Tree));

  for(i=0;i<n;i++){
    T[i].id = T[i].p = T[i].c = -1;    
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&node,&deg);
    T[node].id = node;
    T[node].c = deg;
    T[node].child = malloc(deg * sizeof(int));
    for(j=0;j<deg;j++){
      scanf("%d",&T[node].child[j]);
      T[T[node].child[j]].p = node;
    } 
  }
  print();
  for(i=0;i<n;i++){
    free(T[i].child);
    }
  free(T);
  return 0; 
}

Measured memory_bytes: 6236
module MakeBinaryHeap (M : sig type t val compare : t -> t -> int end) = struct

  type t = { node : M.t array; mutable size : int }

  let make n (init : M.t) = { node = Array.make n init; size = 0 }

  let empty_p t = if t.size = 0 then true else false

  let pop t =
    let rec max_heapify i =
      let l = 2*i in
      let r = 2*i + 1 in
      let m = if l <= t.size && M.compare t.node.(l) t.node.(i) > 0 then l else i in
      let m = if r <= t.size && M.compare t.node.(r) t.node.(m) > 0 then r else m in
      if m = i then ()
      else begin
        let tmp = t.node.(i) in
        t.node.(i) <- t.node.(m);
        t.node.(m) <- tmp;
        max_heapify m
      end in
    let ret = t.node.(1) in
    t.node.(1) <- t.node.(t.size);
    t.size <- t.size - 1;
    max_heapify 1;
    ret

  let push x t =
    let parent i = int_of_float (floor (float_of_int i) /. 2.) in
    let rec doit i =
      let p = parent i in
      if i <= 1 || M.compare t.node.(p) t.node.(i) >= 0 then ()
      else begin
        let tmp = t.node.(i) in
        t.node.(i) <- t.node.(p);
        t.node.(p) <- tmp;
        doit p
      end in
    t.size <- t.size + 1;
    t.node.(t.size) <- x;
    doit t.size

end

module H = MakeBinaryHeap(struct type t = (int * int) let compare x y = snd x - snd y end)

let dijkstra g n =
  let h = H.make 100000 (0, 0) in
  let d = Array.make n max_int in
  let b = Array.make n false in
  d.(0) <- 0;
  b.(0) <- true;
  H.push (0, 0) h;
  while not (H.empty_p h) do
    let (u, x) = H.pop h in
    b.(u) <- true;
    if d.(u) < -x then ()
    else
      List.iter (fun (v, c) ->
        if not b.(v) && d.(v) > d.(u) + c then begin
          d.(v) <- d.(u) + c;
          H.push (v, (-d.(v))) h;
        end) g.(u);
  done;
  d

let rec make_pair acc = function
  | [] -> acc
  | v :: c :: tl -> make_pair ((v, c) :: acc) tl
  | _ -> assert false

let make_pair lst = make_pair [] lst

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let g = Array.make n [] in
  for _ = 0 to n - 1 do
    match read_line () |> split_on_char ' ' |> List.map int_of_string with
    | u :: _ :: l -> g.(u) <- make_pair l
    | _ -> assert false
  done;
  dijkstra g n |> Array.iteri (fun i e -> Printf.printf "%d %d\n" i e)

Measured memory_bytes: 30500
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  short N;in(N);
  string S,T;in(S,T);
  rep(i,N){
    cout<<S[i]<<T[i];
  }
  cout<<endl;
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char c[110][110];
int s[110][110];
int main()
{
	int i,j,n,m;
	scanf("%d%d",&n,&m);
	memset(s,-1,sizeof(s));
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>c[i][j];
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(c[i][j]=='c')s[i][j]=0;
			else if(s[i][j-1]!=-1&&j!=1)s[i][j]=s[i][j-1]+1;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<m;j++)
		{
			cout<<s[i][j]<<" ";
		}
		cout<<s[i][m]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int MAX_N = 200005;
vector<ll> X,H;
ll bomb[MAX_N];
vector<P> XH;
queue<P> Q;

int main()
{
	ll N,D,A;
	cin >> N >> D >> A;
	rep(i,N)
	{
		ll x,h;
		cin >> x >> h;
		X.push_back(x);
		H.push_back(h);
		XH.push_back(P(x,h));
	}
	sort(X.begin(), X.end());
	sort(XH.begin(), XH.end());
	Q.push(XH[0]);
	rep(i,N-1)
	{
		if (XH[i+1].first <= XH[0].first + 2 * D)
		{
			Q.push(XH[i+1]);
		}
		else
		{
			break;
		}
	}
	ll ans = 0;
	ll temp = 0;
	rep(i,N)
	{
		//cout << bomb[i] << " ";
		temp += bomb[i];
		//cout << temp * A << " " << XH[i].second << " ";
		if (temp * A >= XH[i].second) continue;
		ll b = (XH[i].second - temp * A + A - 1) / A;
		ans += b;
		temp += b;
		bomb[upper_bound(X.begin(), X.end(),XH[i].first+2*D) - X.begin()] -= b;
		//cout << upper_bound(X.begin(), X.end(),XH[i].first+2*D) - X.begin() << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12888
class Combination:                                      # 計算量は O(n_max + log(mod))
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):                     # 階乗(= n_max !)の逆元を生成
            f = f * i % mod                             # 動的計画法による階乗の高速計算
            fac.append(f)                               # fac は階乗のリスト
        f = pow(f, mod-2, mod)                          # 階乗から階乗の逆元を計算。フェルマーの小定理より、　a^-1 = a^(p-2) (mod p) if p = prime number and p and a are coprime
                                                        # python の pow 関数は自動的に mod の下での高速累乗を行ってくれる
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):                   # 上記の階乗の逆元から階乗の逆元のリストを生成（＝ facinv ）
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()


    def __call__(self, n, r):  # self.C と同じ
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def H(self, n, r):                                  # (箱区別:〇　ボール区別:×　空箱:〇)　重複組み合わせ nHm
        if (n == 0 and r > 0) or r < 0: return 0
        return self.fac[n+r-1] * self.facinv[r] % self.mod * self.facinv[n-1] % self.mod


def prime_factors(n):       # 戻り値はiterable type
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            yield i             # whileループを進めるごとにイテレータに値を貯め続ける
    if n > 1:
        yield n

from collections import Counter
MOD = 10**9 + 7
N, M = map(int, input().split())
C = Combination(10**6)
A = list(prime_factors(M))
B = Counter(A)
res = 1
for value in B.values():
    res *= C.H(N,value)
    res %= MOD
print(res)

Measured memory_bytes: 164444
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int a, b; cin >> a >> b;
    cout << static_cast<int>(ceil((a + b) / 2.0)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	lint h,w;
	cin>>h>>w;
	if(h==1||w==1){
		cout<<1<<endl;
		return 0;
	}
	cout<<(h*w+1)/2<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000000000000

int main() {
  int n;
  scanf("%d", &n);
  int res=0;
  for( int i=1; i<=n; i+=2 ){
    int count = 0;
    for( int j=1; j<=n; ++j ){
      if( i%j == 0 ) count++;
    }
    if (count == 8) res++;
  }

  printf("%d\n", res);

  return 0;
}


Measured memory_bytes: 128
// abc053d: Card Eater
#include <stdio.h>
#include <stdlib.h>

#define upto(i,s,e,d) for(int i=(s);i<=(e);i+=(d))
#define downto(i,s,e,d) for(int i=(s);i>=(e);i-=(d))
#define in(n) scanf("%d",n)
#define out(d) printf("%d\n",d)

typedef struct {int a,c;} pair;
#define MAX 100000
pair d[MAX+1];

int desc(const void *a, const void *b) {
  int ret = ((pair*)b)->c - ((pair*)a)->c;
  if(ret>0) return 1;
  if(ret<0) return -1;
  return 0;
}

int main(){
  int n;in(&n);
  int dn=1;
  int setnum = 0;
  upto(i,0,n-1,1){
    int a;in(&a);
    if(d[a].c==0) setnum++;
    d[a].a = a;
    d[a].c++;
    if(dn<a)dn=a;
  }

  qsort(d+1,dn,sizeof(pair),desc);

  int cardNum = n;
  int i = 1;
  while(i<=setnum){
    if(d[i].c<2){// c<2
      i++;
      continue;
    }

    if(d[i].c>2){// c>2
      d[i].c-=2;
      cardNum-=2;
      continue;
    }

    if(d[i].c==2){// c=2
      if(i==setnum){//last
        d[i].c-=2;
      }else{
        d[i].c--;
        d[i+1].c--;
      }
      cardNum-=2;
      i++;
    }
  }
  out(cardNum);

  return 0;
}

Measured memory_bytes: 1404
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d%d%d", &a,&b,&c);
    if (a>b&&a>c){
        printf("%d\n", b*c/2);
    }
    else if (b>a&&b>c){
        printf("%d\n", a*c/2);
    }
    else{
        printf("%d\n", a*b/2);
    }

    return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a[200010],b[200001];
	int n,k,t;
	cin>>n>>k;
	int i;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	while(k--){
		t=0;
		for(i=0;i<n;i++){
			int c,d;
			c=i+a[i];
			d=max(0,i-a[i]);
			b[c+1]--;
			b[d]++;
		}
		a[0]=b[0];
		if(a[0]==n)
		t++;
		for(i=1;i<n;i++){
			b[i]=b[i]+b[i-1];
			a[i]=b[i];
			b[i-1]=0;
			if(a[i]==n)
			t++; 
		}
		if(t==n)
		break;
		b[i-1]=0;
	}
	for(i=0;i<n;i++)
	cout<<a[i]<<' ';
}

Measured memory_bytes: 4696
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

struct b_match {
  static const int MAX_V = 1000;
  int V;
  VI G[MAX_V], match;
  vector<bool> used;

  // V要素で初期化
  b_match(int v_=MAX_V) : V(v_) { match.resize(v_); used.resize(v_); }
  // 辺u-vを追加する
  void add_edge(int u, int v) { G[u].PB(v); G[v].PB(u); }
  // 増加パスの探索
  bool dfs(int v) {
    used[v] = true;
    REP(i, G[v].size()) {
      int u = G[v][i], w = match[u];
      if(w < 0 || !used[w] && dfs(w)) {
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  // 二部マッチングを計算
  int matching() {
    int res = 0;
    match.assign(V, -1);
    REP(v, V) {
      if(match[v] < 0) {
        used.assign(V, false);
        if(dfs(v)) res++;
      }
    }
    return res;
  }
};

bool use[805];
int x[805], y[805];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, a, b;
  cin >> n >> a >> b;
  REP(i, n) cin >> x[i] >> y[i];

  int ans = 0;
  REP(i, n) {
    if(abs(x[i]-y[i]) <= a || (b <= abs(x[i]-y[i]) && abs(x[i]-y[i]) <= 2*a)) {
      use[i] = true;
      ans++;
    }
  }

  b_match m(n);
  vector<PII> e;
  VI v;
  REP(i, n) FOR(j, i+1, n) {
    if(use[i] || use[j]) continue;
    int diff = abs(x[i]+x[j]-y[i]-y[j]);
    if(diff <= a || (b <= diff && diff <= 2*a)) {
      m.add_edge(i, j);
    }
  }

  cout << ans + m.matching() << endl;

  return 0;
}



Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

ll a;

void solve() {
	cin >> a;
	cout << a + a*a + a*a*a << "\n";
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 3648
N = int(input())

word =  [input() for i in range(N)]

for i in range(N-1):
 for j in range(i+1, N):
  if word[i] == word[j]:
    print('No')
    exit()

for i in range(0, N-1):
  if word[i][-1] != word[i+1][0]:
    print('No')
    exit()
  else:
    True
print('Yes')

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

using namespace std;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<lli, lli> pi;

int main()
{
    int n, m;
    cin >> n >> m;
    int a[n];
    int sum = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a+n);
    reverse(a, a+n);

    bool fl = true;
    for(int i=0; i<m; i++){
        if(a[i]*4*m < sum){
            fl = false;
            break;
        }
    }
    cout << (fl? "Yes\n": "No\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);

int fastpow(int x, int n, int m){
    int a = 1;
    IREP(i, 35){
        a = (a * a) % m;
        if(((n >> i) & 1) == 1) a = (a * x) % m;
    }
    return a;
}

int extgcd(int a, int b, int &x, int &y){
    int d = a;
    if(b != 0){
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else{
        x = 1;
        y = 0;
    }
    return d;
}

int mod_inverse(int a, int m){
    int x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

class Combination
{

public:

    vec fact, invfact;
    int MAX_N, mod;

    Combination(int MAX_N, int mod): MAX_N(MAX_N), mod(mod) {
        fact = vec(MAX_N + 1);
        invfact = vec(MAX_N + 1);
        fact[0] = 1; invfact[0] = 1;
        FOR(i, 1, MAX_N + 1){
            fact[i] = (fact[i - 1] * i) % mod;
            invfact[i] = mod_inverse(fact[i], mod);
        }
    }

    int comb(int n, int r){
        if(r > n || r < 0 || n < 0) return 0;
        int a = fact[n];
        a = (a * invfact[r]) % mod;
        a = (a * invfact[n - r]) % mod;
        return a;
    }
};

signed main(){

    int K, N; cin >> K >> N;
    int mod = 998244353;

    Combination C(5000, mod);

    vec pow2(2001);
    REP(i, 2001) pow2[i] = fastpow(2, i, mod);

    FOR(i, 2, 2 * K + 1){
        int ans = 0;
        if(i % 2 == 1){
            int dmax = min(i / 2, (2 * K + 2 - i) / 2);
            int K2 = K - dmax * 2;
            FOR(d, 0, dmax + 1){
                int tmp = (C.comb(dmax, d) * C.comb(N + K2 - 1, N - d)) % mod;
                tmp = (tmp * pow2[d]) % mod;
                ans = (ans + tmp) % mod;
            }
        }

        if(i % 2 == 0){
            int dmax = min(i / 2, (2 * K + 2 - i) / 2) - 1;
            int K2 = K - dmax * 2 - 1;
            FOR(d, 0, dmax + 1){
                // (i/2,i/2)なし
                int tmp = (C.comb(dmax, d) * C.comb(N + K2 - 1, N - d)) % mod;
                tmp = (tmp * pow2[d]) % mod;
                ans = (ans + tmp) % mod;
                // (i/2,i/2)あり
                tmp = (C.comb(dmax, d) * C.comb(N + K2 - 2, N - d - 1)) % mod;
                tmp = (tmp * pow2[d]) % mod;
                ans = (ans + tmp) % mod;
            }   
        }

        cout << ans << endl;
        
    }

    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main(){
   string s,t;
   cin>>s>>t;
   int cnt=0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]==t[i]) cnt++;
    }
    cout<<cnt<<endl;
   
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
n, m = map(int, input().split())
g = [[] for i in range(n)]
for  i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    g[a].append(b)
    g[b].append(a)

used = [False] * n
ans = 0
def dfs(i, depth=1):
    ret = 0
    if depth==n:
        return 1
    else:
        for e in g[i]:
            if used[e]:
                continue
            used[e] = True
            ret+=dfs(e, depth+1)
            used[e] = False
    return ret

used[0] = True
print(dfs(0, 1))

Measured memory_bytes: 9212
import math
s = int(input())

"""
p1を原点、p2を10**9、1に固定する
S = 10**9*y3 - x3
v = 10**9 として
を満たすy3, x3を探せばよい
s%v = 0 - x3
s%v = v-x3
x3 = (v-s%v)%v # 外側の%vは括弧が負の場合の対策

s//v = y3 - x3//v
(s+x3)//v = y3
"""
v = 10**9
ans = [0] * 6
ans[0], ans[1] = 0, 0
ans[2], ans[3] = 10**9, 1
ans[4] = (v-s%v)%v
ans[5] = (s+ans[4])//v

print(' '.join(list(map(str, ans))))


Measured memory_bytes: 8948
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n;
int main()
{
    scanf("%d",&n);
    bool flag=true;
    for(int i=1;i<=n;i++)
    {
        int x;scanf("%d",&x);
        if(x%2==0&&x%3&&x%5)
            flag=false;
    }
    printf(flag?"APPROVED":"DENIED");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> A(n+1);
 
    REP(i,n+1){
        if(i==0) A[i]= 2;
        else if(i==1) A[i]= 1;
        else A[i]= A[i-1]+A[i-2];
    }
    cout << A[n] << endl;
    
}

Measured memory_bytes: 256
//
// Created by yamunaku on 2020/09/20.
//

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;


int main() {
    //CFS;
    int n;
    cin >> n;
    dsu uf(n);
    vector<pair<pair<int, int>, int>> p(n);
    rep(i, n) {
        cin >> p[i].first.first >> p[i].first.second;
        p[i].second = i;
    }
    sort(all(p));
    map<int, int> mp;
    rep(i, n) {
        auto itr = mp.begin();
        if(mp.begin() != mp.end()){
            auto beg = *mp.begin();
            if(beg.first < p[i].first.second){
                while (1) {
                    auto itr = mp.begin();
                    if (itr == mp.end()) break;
                    if (itr->first >= p[i].first.second) break;
                    uf.merge(itr->second, p[i].second);
                    mp.erase(itr);
                }
                mp.insert(beg);
            }else{
                mp[p[i].first.second] = p[i].second;
            }
        }else{
            mp[p[i].first.second] = p[i].second;
        }

    }
    mti g = uf.groups();
    vi ans(n);
    for (auto &v:g) {
        for (auto &x : v) {
            ans[x] = v.size();
        }
    }
    rep(i, n) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 13856
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let inp: Vec<i32> = read_vec();
    let a = inp[0];
    let b = inp[1];
    let x = inp[2];
    let ans = b -(x -a);
 
    println!("{}", if ans > 0 && a <= x  {"YES"} else {"NO"}  );
}

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

int main() {
  long long n,d; cin >> n >> d;

  long long ans = 0;
  long long check = d * d;
  rep(i,n) {
    long long x,y; cin >> x >> y;
    long long temp = (x * x) + (y * y);
    if(check >= temp) {
      ans++;
    }
  }
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 3612
N, M = gets.split.map(&:to_i)
H = gets.split.map(&:to_i)

ok = Array.new(N, true)
M.times do 
    a, b = gets.split.map(&:to_i)
    a -= 1
    b -= 1
    if H[a] >= H[b]
        ok[b] = false
    end
    if H[a] <= H[b]
        ok[a] = false
    end
end

ans = 0
ok.each do |a|
    ans += 1 if a
end

puts ans

Measured memory_bytes: 22712
L, R = map(int, input().split())
if R - L < 2019:
    res = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
           res = min(res, (i * j) % 2019)
else:
    res = 0

print(res)         
        

Measured memory_bytes: 2940
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<char> D(N);
    rep(i, K) {
        int tmp;
        cin >> tmp;
        D[i] = '0' + tmp;
    }


    for(int i=N; i<= 1000000; ++i) {
        string s = to_string(i);
        bool ok = true;
        for(auto d: D) {
            if(s.find(d) != string::npos) {
                ok = false;
                break;
            }
        }
        if(ok) {
            cout << s << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 3072
#include <iostream>

int main()
{
    int n, sum = 0;
    std::cin >> n;

    int arr[n];

    for(int i = 0; i < n; i++)
    {
        std::cin >> arr[i];
    }

    for(int i = 0; i < (n-1); i++)
    {
        for(int j = (i+1); j < n; j++)
        {
            sum += (arr[i] * arr[j]);
        }
    }

    std::cout << sum << std::endl;

    return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (c >= a && b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

void primeFactor(ll val, map<ll,ll> &primeList){
  if(val<1){
    return;
  }
  for(int i=2;i*i<val;i++){
    while(val%i==0){
      primeList[i]++;
      val/=i;
    }
  }
  if(val!=1){
    primeList[val]=1;
  }
  return;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int d,t,s;cin>>d>>t>>s;
  int ans=(d+s-1)/s;
  cout<<yesno(ans<=t)<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>

const int MAX = 25;
const int NIL = -1;

struct Node { int parent, left, right; };

Node T[MAX];
int D[MAX];
int H[MAX];
int n;

void print(int u) {
  std::cout << "node " << u << ": ";
  std::cout << "parent = " << T[u].parent << ", ";
  std::cout << "sibling = ";
  if (T[u].parent != NIL) {
    if (T[T[u].parent].left == u)
      std::cout << T[T[u].parent].right << ", ";
    else if (T[T[u].parent].right == u)
      std::cout << T[T[u].parent].left << ", ";
  }
  else
    std::cout << NIL << ", ";
  int deg = 0;
  if (T[u].left != NIL) ++deg;
  if (T[u].right != NIL) ++deg;
  std::cout << "degree = " << deg << ", ";
  std::cout << "depth = " << D[u] << ", ";
  std::cout << "height = " << H[u] << ", ";
  if (T[u].parent == NIL)
    std::cout << "root\n";
  else if (T[u].left == NIL && T[u].right == NIL)
    std::cout << "leaf\n";
  else
    std::cout << "internal node\n";
}

void setDepth(int u, int d) {
  D[u] = d;
  if (T[u].left != NIL) setDepth(T[u].left, d + 1);
  if (T[u].right != NIL) setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if (T[u].left != NIL)
    h1 = setHeight(T[u].left) + 1;
  if (T[u].right != NIL)
    h2 = setHeight(T[u].right) + 1;
  return H[u] = (h1 > h2 ? h1 : h2);
}

int main() {
  int id, l, r;

  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    T[i].parent = T[i].left = T[i].right = NIL;
    D[i] = H[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    std::cin >> id >> l >> r;
    T[id].left = l;
    T[id].right = r;
    if (l != NIL) T[l].parent = id;
    if (r != NIL) T[r].parent = id;
  }

  int root;
  for (int i = 0; i < n; ++i)
    if (T[i].parent == NIL) root = i;
  setDepth(root, 0);
  setHeight(root);

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

  return 0;
}



Measured memory_bytes: 3096
/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define int long long
const int N = 200005;
const ll mod = 2000000011;
#define ld long double
#define PI 3.14159265358979323846
const int X = 10000000;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(20);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
vector<int>Next;
//1. Ends here

//2. Extra Functions here
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    for(int i=1;i<=t;i++){
        solve();
    }
    return 0;
}

void solve()
{
    string s;
    cin>>s;
    int n=s.length();
    int arr[n+1]={0};
    for(int i=0;i<n;i++){
        if(s[i]=='<'){
            arr[i+1]=arr[i]+1;
        }
    }


    for(int i=s.length()-1;i>=0;i--){
        if(s[i]=='>'){
            if(arr[i]<arr[i+1]+1){
                arr[i]=arr[i+1]+1;
            }
        }
    }


    int ans=0;
    for(int i=0;i<=n;i++){
        ans+=arr[i];
    }
    cout<<ans;
    return;
}

Measured memory_bytes: 7716
n = int(input())
a = list(map(int,input().split()))

b = []
for i in range(n):
  b.append((a[i],i))
b.sort(reverse = True)

dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
  x = b[i][0]
  y = b[i][1]
  for l in range(i+1):
    r = i-l
    dp[i+1][l+1] = max(dp[i+1][l+1],dp[i][l]+x*(y-l))
    dp[i+1][l] = max(dp[i+1][l],dp[i][l]+x*(n-1-r-y))

ans = 0
for i in range(n+1):
  ans = max(dp[n][i],ans)
print(ans)
#print(dp)

Measured memory_bytes: 100816
#include <bits/stdc++.h>
using namespace std;
int m, n;

int main( ){
    while( scanf( "%d", &n ) != EOF ){
        if( n%1000 == 0 )
            printf( "0\n" );
        else{
            int tmp = n/1000*1000+1000;
            printf( "%d\n", tmp-n );
        }
    }
    return 0;
}


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

using namespace std;

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

	int n, k;
	string s;
	cin >> n >> k >> s;
	s += (s.back() == 'L' ? 'R' : 'L');
	vector<int> seg;
	int cnt = 0;
	char last = s[0];
	for (int i = 0; i < n + 1; ++i) {
		if (last != s[i]) {
			seg.push_back(cnt);
			cnt = 1;
		}
		else {
			++cnt;
		}
		last = s[i];
	}
	int ans = 0;
	for (int i = 0; i < seg.size(); ++i) {
		ans += seg[i] - 1;
	}
	cout << min(n - 1, ans + 2 * k);

	return 0;
}

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

int main () {
  vector<vector<char>> C(2, vector<char>(3));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> C.at(i).at(j);
    }
  }
  if (C.at(0).at(0) == C.at(1).at(2) && C.at(0).at(1) == C.at(1).at(1) && C.at(0).at(2) == C.at(1).at(0)) {
    cout << "YES" << endl;
  }
  else cout << "NO" <<endl;
}
  

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

ll f(ll head, ll tail, ll N)
{
    ll digits = to_string(N).size();

    ll res = 0;
    for (ll i = 1; i <= digits; ++i) {
        if (i == 1) {
            if (head == tail && head <= N) {
                res += 1;
            }
        }
        if (i == 2) {
            if (head * 10 + tail <= N) {
                res += 1;
            }
        }
        if (i >= 3) {
            if (i < digits || head < N / (ll)pow(10, digits - 1)) {
                res += pow(10, i - 2);
            } else if (i == digits && head == N / (ll)pow(10, digits - 1))
                res += max((N % (ll)pow(10, digits - 1)) / 10 + ((N % 10 >= tail) ? 1 : 0), 0LL);
        }
    }
    return res;
}

void main_()
{
    ll N;
    cin >> N;

    ll ans = 0;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            ans += f(i, j, N) * f(j, i, N);
        }
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int N, K;
	cin >> N >> K;
	if (N % K == 0) {
		cout << 0;
	}
	else {
		cout << 1;
	}

	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $N);
$H = explode(" ", trim(fgets(STDIN)));
$ans = 0;
$cur = 0;
for ($i = 1; $i < $N; $i++) {
    if ($H[$i - 1] >= $H[$i]) {
        $cur++;
        $ans = max($ans, $cur);
    } else {
        $cur = 0;
    }
}
echo $ans;


Measured memory_bytes: 14840
import java.util.Scanner;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int v[] = new int[N];
    
    for(int i=0;i<N;i++){
      v[i] = sc.nextInt();
    }
    
    Arrays.sort(v);
    double sum = 0;
    for(int j=0;j<N;j++){
      if(j==0){
       sum = v[j];
      }else{
       sum = (sum+v[j])/2.0;
      }
    }
    System.out.println(sum);
    
  }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
const ll inf=2e16;
int n,num;
ll ans,res,t[N],rv[N],a[N];

int main(){
     int i,j,pos;
	 scanf("%d",&n);
     for(i=1;i<=n;++i){
     	scanf("%lld",&a[i]);
     	a[i]-=i;
     }t[0]=0;rv[n+1]=0;
     if(n==1) {printf("0\n");return 0;}
     sort(a+1,a+n+1);t[1]=-a[1];rv[n]=a[n];
     for(i=2;i<=n;++i) t[i]=t[i-1]-a[i];
     for(i=n-1;i>=1;--i) rv[i]=rv[i+1]+a[i];
     if(n&1){pos=(n+1)>>1;ans=t[pos-1]+rv[pos+1];}
     else{pos=n>>1;ans=t[pos]+rv[pos+1];}
     printf("%lld\n",ans);
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int a,b; cin >> a >> b;
    string ans1,ans2;
    for(int i = 0;i < a;i++){
        ans1 += to_string(b);
    }
    
    for(int i = 0;i < b;i++){
        ans2 += to_string(a);
    }
    ans1 < ans2 ? cout << ans1 : cout << ans2;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

int main() {
  int a, b;
  cin >> a >> b;

  cout << a * b << endl;
}


Measured memory_bytes: 3632
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val nums = inputs.head.split(" ").map(_.toInt)

  println(solve(nums))

  def solve(nums: Seq[Int]): String = {
    val a = nums(0)
    val b = nums(1)
    val c = nums(2)

    if (a < c && c < b) {
      "Yes"
    } else if (b < c && c < a) {
      "Yes"
    } else {
      "No"
    }
  }
}


Measured memory_bytes: 27328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 1e5+100;
ll t[MN];

int main() {
    ll n,l;
    cin>>n>>l;
    pair<ll, ll> ma = {0, 0};
    for(int i = 0; i < n; ++i) {
        cin>>t[i];
        if(i) {
            ma = max(ma, {t[i]+t[i-1], i});
        }
    }
    if(ma.first < l) {
        cout<<"Impossible\n";
        return 0;
    }
    cout<<"Possible\n";
    for(int i = 1; i < n; ++i) {
        if(i < ma.second) cout<<i<<'\n';
    }
    for(int i = n-1; i > ma.second; --i) {
        cout<<i<<'\n';
    }
    cout<<ma.second<<'\n';

}


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

int main() {
    string s, t;
    cin >> s >> t;

    int count = 0;
    for(int i = 0; i < (int)s.size(); i++) {
        if (s.at(i) != t.at(i)) {
            s.at(i) = t.at(i);
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3844
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n, m := getInt(), getInt()

	s := n + (m / 2)
	ans := min(s/2, m/2)
	fmt.Fprintln(wr, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
import scala.io.StdIn._

object Main extends App {
  val Seq(a, b) = readLine().split(" ").map(_.toInt).toSeq

  println(
    (a to b).count(i => i.toString.startsWith(i.toString.substring(i.toString.length / 2, i.toString.length).reverse))
  )
}


Measured memory_bytes: 57420
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  ll A,B,K;
  cin>>A>>B>>K;
  
  
  if(A<K){
    co(0);
    
    if(A+B<K){
      co(0);
      return 0;
    }
    
    co(A+B-K);
    return 0;
  }
  
  co(A-K);
  co(B);
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func asInt(s string) []int {
	arr := strings.Split(s, " ")
	is := make([]int, 0, len(arr))
	for _, str := range arr {
		i, _ := strconv.Atoi(str)
		is = append(is, i)
	}
	return is
}

func main() {
	nm := asInt(nextLine())
	area := make([]int, 2, 2)
	lr := asInt(nextLine())
	area[0] = lr[0]
	area[1] = lr[1]
	for i := 1; i < nm[1]; i++ {
		lr = asInt(nextLine())
		if area[0] < lr[0] {
			area[0] = lr[0]
		}
		if area[1] > lr[1] {
			area[1] = lr[1]
		}
	}
	ans := area[1] - area[0] + 1
	if ans < 0 {
		ans = 0
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
def check_bracket(str)
  arr = []
  str.split('').each do |st|
    if st == '[' or st == '('
      arr.push(st)
    elsif st == ']' and arr.pop != '['
      return 'no'
    elsif st == ')' and arr.pop != '('
      return 'no'
    end
  end
  arr.size == 0 ? 'yes' : 'no'
end

while gets do
  str = $_.chomp
  break if str == '.'
  puts check_bracket(str)
end

Measured memory_bytes: 6112