akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcount((unsigned int)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    vl A(N); rep(i, N) cin >> A[i];
    
    ll sum = 0;
    rep(i, N-1){
        if(i%2 == 0) sum -= A[i];
        else sum += A[i];
    }
    
    ll x = A[N-1] - sum;
    
    rep(i, N){
        cout << x << " ";
        x = 2*A[i] - x;
    }
    cout << endstr;
    return 0;
}


Measured memory_bytes: 2176
function main(s) {
	s = s.split("\n")[1].split(" ").map(x => Number(x));
	var x = 1000;
	var y = 0;
	for (var i = 0; i < s.length; i++) {
		if (s[i] < x) {x = s[i];}
		if (s[i] > y) {y = s[i];}
	}
	console.log(y-x);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 7372
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){
int N;
ll K,Q;
cin>>N>>K>>Q;
vector<int> A(N+1,K-Q);
rep(i,Q){
    int a;
    cin>>a;
    A[a]++;


}

rep3(i,N){

    if(A[i]>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  int w, h, n;
  cin >> w >> h >> n;
  int x1 = w, y1 = h;
  int x0 = 0, y0 = 0;

  int ans;
  rep(i,n){
    int a, b, ai;
    cin >> a >> b >> ai;
    if (ai == 1 && a > x0) x0 = a;
    else if (ai == 2 && a < x1) x1 = a;
    else if (ai == 3 && b > y0) y0 = b;
    else if (ai == 4 && b < y1) y1 = b;
    ans = (x1 - x0) * (y1 - y0);
    if (ans < 0){
      ans = 0;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

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> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(string A, string B, string C) {
  cout << (A.back() == B.front() && B.back() == C.front()) << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	string A;
	string C;
	string B;
	cin >> A;
	cin >> B;
	cin >> C;
	solve(A, B, C);
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef pair<int, int>    PII;
typedef vector<int>       VI;
typedef vector<VI>        VII;
typedef vector<long long> VL;
typedef long long         ll;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int n;
    cin >> n;
    VI a(n);
    rep(i, n) { cin >> a[i]; }
    // check
    // rep(i, n) { cout << a[i] << endl; }
    // 処理
    int num1, num2, num3;
    int cnt = 0;
    for (int i = 0; i < n - 2; i++) {
        num1 = a.at(i);
        num2 = a.at(i + 1);
        num3 = a.at(i + 2);
        if ((max({num1, num2, num3}) == num1 &&
             min({num1, num2, num3}) == num3) ||
            (min({num1, num2, num3}) == num1 &&
             max({num1, num2, num3}) == num3)) {
            cnt++;
        }
    }

    // 出力
    cout << cnt << endl;

    return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define loop(i,n) for(int i=0;i<(n);i++)
#define cont(i,n) for(int i=1;i<=(n);i++)
#define circ(i,a,b) for(int i=(a);i<=(b);i++)
#define range(i,a,b,c) for(int i=(a);((c)>0?i<=(b):i>=(b));i+=(c))
#define foreach(it,v) for(__typeof((v).begin()) it=(v).begin(),_e_D_=(v).end();it!=_e_D_;it++)
#define y0 y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1 y1II11II11III11I1III11II111IIII1II1I1
#define pub push_back
#define pob pop_back
#define mak make_pair

typedef long long ll;
typedef long double lf;
const int Inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

const int jt=998244353;
int n;
pair<ll,ll> r[1<<18];
int dp[1<<18];

int main(){
	scanf("%d",&n);
	cont(i,n)scanf("%lld%lld",&r[i].first,&r[i].second);
	sort(r+1,r+n+1);
	r[n+1].first=INF;
	vector<int> stk;stk.pub(n+1);
	dp[n+1]=1;
	range(i,n,1,-1){
		while(r[i].first+r[i].second>r[stk.back()].first)stk.pob();
		dp[i]=(dp[i+1]+dp[stk.back()])%jt;stk.pub(i);
	}
	printf("%d\n",dp[1]);
	return 0;
}

Measured memory_bytes: 7820
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<math.h>
using namespace std;

int main() {
	int A, B, C, X;
	cin >> A >> B >> C >> X;
	int c=0;
	A = min(X / 500, A);
	int z;
	if (X % 50 != 0) {
		cout << 0;
		return 0;
	}
	for (int i = 0; i <= A; i++) {
		for (int j = 0; j<=B; j++) {
			if (X - 500 * i - 100 * j < 0)break;
			if ((X - 500 * i - 100 * j) / 50 <= C)c++;
		}
	}
	cout << c;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long j,n,i,w;
cin>>n>>w;
long long cost[n+1],weight[n+1];
for(i=1;i<=n;i++)
    cin>>weight[i]>>cost[i];

long long dp[n+1][w+1];
for(i=0;i<=w;i++)dp[0][i]=0;
for(i=0;i<=n;i++)dp[i][0]=0;
for(i=1;i<=n;i++){
    for(j=1;j<=w;j++){

        dp[i][j]=dp[i-1][j];
        if(j>=weight[i])
            dp[i][j]=max(cost[i]+dp[i-1][j-weight[i]],dp[i][j]);

    }
}
cout<<dp[n][w]<<endl;


}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 500'000;
const int LOGN = 19;

int n, m, k;

void solve(int test) {
  int x, y, ex, ey;
  cin >> n >> m;
  cin >> x >> y;
  cin >> ex >> ey;
  --x; --y; --ex; --ey;
  vector<string> a(n);
  vector<vector<int>> d(n, vector<int>(m, inf));
  for (auto& s : a) {
    cin >> s;
  }
  deque<pair<int, int>> q;
  deque<int> vals;
  q.emplace_front(ex, ey);
  vals.emplace_front(0);
  d[ex][ey] = 0;
  int dx[4] = {-1, 0, 1, 0};
  int dy[4] = {0, 1, 0, -1};
  while (!q.empty()) {
    auto[x, y] = q.front();
    q.pop_front();
    int v = vals.front();
    vals.pop_front();
    if (d[x][y] != v) {
      continue;
    }
    for (int i = 0; i < 4; ++i) {
      int tx = x + dx[i];
      int ty = y + dy[i];
      if (0 <= tx && tx < n && 0 <= ty && ty < m && a[tx][ty] == '.' && d[tx][ty] > d[x][y]) {
        d[tx][ty] = d[x][y];
        q.emplace_front(tx, ty);
        vals.push_front(d[x][y]);
      }
    }
    for (int i = -2; i <= 2; ++i) {
      for (int j = -2; j <= 2; ++j) {
        int tx = x + i;
        int ty = y + j;
        if (0 <= tx && tx < n && 0 <= ty && ty < m && a[tx][ty] == '.' && d[tx][ty] == inf) {
          d[tx][ty] = d[x][y] + 1;
          q.emplace_back(tx, ty);
          vals.push_back(d[x][y] + 1);
        }
      }
    }
  }
  if (d[x][y] == inf) {
    cout << "-1\n";
  } else {
    cout << d[x][y] << '\n';
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 8804
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int M = Integer.parseInt(S[1]);
    int X = Integer.parseInt(S[2]);
    
    int[][] val = new int[N][M+1];
    for(int i = 0; i < N; i++){
      S = sc.nextLine().split(" ");
      for(int j = 0; j < M+1; j++){
        val[i][j] = Integer.parseInt(S[j]);
      }
    }
    
    int ans = 1000000000;
    for(int i = 1; i < 1<<N; i++){
      String bit = "000000000000"+Integer.toBinaryString(i);
      bit = bit.substring(bit.length()-N);
      int[] abi = new int[M];
      int sum = 0;
      for(int j = 0; j < N; j++){
        if(bit.charAt(j) == '1'){
          sum += val[j][0];
          for(int k = 1; k <= M; k++){
            abi[k-1] += val[j][k];
          }
        }
      }
      boolean flag = true;
      for(int j = 0; j < M; j++){
        if(abi[j] < X){
          flag = false;
          break;
        }
      }
      
      if(flag){
        ans = Math.min(ans, sum);
      }
    }
    System.out.println(ans == 1000000000 ? -1 : ans);
  }
}

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

int main(){
    int r, c;
    cin >> r >> c;
    vector<vector<int>> a(r+1, vector<int>(c+1,0));
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> a.at(i).at(j);
        }
    }
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            a.at(i).at(c)+=a.at(i).at(j);
            a.at(r).at(j)+=a.at(i).at(j);
            a.at(r).at(c)+=a.at(i).at(j);
        }
    }
    for(int i=0; i<r+1; i++){
        for(int j=0; j<c+1; j++){
            cout << a.at(i).at(j);
            if(j < c) cout << " ";
            else cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
//#define MOD 1000000007
#define MOD 998244353
using namespace std;

ll dp[4005][4005];

int main(int argc, char* argv[])
{
    char str[2005]={0};
    scanf("%s", str);
    long n=strlen(str);

    vector<long> r(n);
    vector<long> b(n);
    vector<ll> sr(2*n+1,0);
    vector<ll> sb(2*n+1,0);
    long i;
    for(i=0; i<n; i++) {
        r[i]='2'-str[i];
        b[i]=str[i]-'0';
        sr[i+1]=(sr[i]+r[i])%MOD;
        sb[i+1]=(sb[i]+b[i])%MOD;
    }
    for(i=n; i<2*n; i++) {
        sr[i+1]=sr[i];
        sb[i+1]=sb[i];
    }

    dp[0][0]=1;
    long j;
    for(i=1; i<=2*n; i++) {
        for(j=0; j<=i; j++) {
            if ( j <= sr[i] ) dp[i][j] = dp[i-1][j-1] %MOD;
            if ( i-j <= sb[i] ) dp[i][j] = (dp[i][j] + dp[i-1][j]) %MOD;
        }
    }

    ll sum=0;
    for(j=0; j<=2*n; j++) {
        sum = (sum + dp[2*n][j]) %MOD;
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 123904
H,W,M=map(int,input().split())
dicti={}
dictj={}
bomb=set()
for i in range(M):
  h,w=map(int,input().split())
  bomb.add((h,w))
  if h in dicti:
    dicti[h]+=1
  if h not in dicti:
    dicti[h]=1
  if w in dictj:
    dictj[w]+=1
  if w not in dictj:
    dictj[w]=1
LI=sorted(dicti.items(),key=lambda x:x[1],reverse=True)
LJ=sorted(dictj.items(),key=lambda x:x[1],reverse=True)
Imax=LI[0][1]
Jmax=LJ[0][1]
I=0
J=0
IL=[]
JL=[]
for i in range(len(LI)):
  if LI[i][1]==Imax:
    IL.append(LI[i][0])
for i in range(len(LJ)):
  if LJ[i][1]==Jmax:
    JL.append(LJ[i][0])
  
ans=Imax+Jmax-1

for h in IL:
  for w in JL:
    if (h,w) not in bomb:
      ans=Imax+Jmax
      break
print(ans)
      

Measured memory_bytes: 231928
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }

int D;
vector<int> c(26+1);
vector<vector<int>> s;

int compute_score(vector<int> t) {
    vector<vector<int>> last(D+1,vector<int>(26+1,0));
    int ans = 0;
    for(int d = 1; d <= D; d++) {
        last[d][t[d]] = d;
        ans += s[d][t[d]];
        for(int i = 1; i <= 26; i++) {
            if(i == t[d]) continue;
            last[d][i] = last[d-1][i];
            ans -= c[i]*(d-last[d][i]);
        }
    }
    return 0;
}

vector<int> greedy() {
    vector<int> t(D+1);
    vector<vector<int>> last(D+1,vector<int>(26+1,0));
    for(int d = 1; d <= D; d++) {
        int best_i = 0;
        int best_score_diff = -INT32_MAX;
        for(int i = 1; i <= 26; i++) {
            int score_diff = s[d][i] - c[i]*(d-last[d][i]);
            if(score_diff >= best_score_diff) {
                best_i = i;
                best_score_diff = score_diff;
            }
        }
        for(int i = 1; i <= 26; i++) {
            if(i == best_i) {
                last[d][i] = d;
                t[d] = i;
            } else {
                last[d][i] = last[d-1][i];
            }
        }
    }
    return t;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> D;
    s.assign(D+1,vector<int>(26+1,0));
    for(int i = 1; i <= 26; i++) cin >> c[i];
    for(int d = 1; d <= D; d++) for(int i = 1; i <= 26; i++) cin >> s[d][i];

    vector<int> t = greedy();
    for(int d = 1; d <= D; d++) cout << t[d] << endl;
}


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

int main(){
  int N;
  int A[210];
  cin >> N ;
  rep (i, N) {
    cin >> A[i];
  }
  
  int res = 0;
  
  while (true) {
    bool exist_odd = false;
    rep(i, N) {
      if (A[i] % 2 != 0) exist_odd = true;
    }
 
    if (exist_odd) break;

    rep(i, N) {
       A[i] /= 2;
    }
      
    res ++;
  }
  
  cout << res << endl;
}

Measured memory_bytes: 384
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N = 0;

vector<pair<int,int> > v;
int main()
{
	ios::sync_with_stdio(0);
	int n;
	cin>>n ;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		v.emplace_back(a,i);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	{
		cout<<v[i].second<<' ';
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 1780
n,x,y = map(int, input().split())
d = [0]*n
r = y-x-1
for i in range(1,n):
  for j in range(i+1,n+1):
    if i<=x and y<=j:
      ans = j-i-r
      d[ans] += 1
    elif j<=x or y<=i:
      ans = j-i
      d[ans] += 1
    else:
      ans = min(j-i,abs(x-i)+1+abs(y-j))
      d[ans] += 1
print(*d[1:],sep="\n")

Measured memory_bytes: 3444
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CMultiplication3 solver = new CMultiplication3();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMultiplication3 {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long a = in.nextLong();
            String bRaw = in.next();
            String[] parts = bRaw.split("\\.");
            long part2 = parts.length == 1 ? 0 : Integer.parseInt(parts[1]);
            long b = Integer.parseInt(parts[0]) * 100 + part2;
            out.println(((a * b) / 100));
            //out.print("Case #"+ testNumber + ": ");
        }

    }

    static class FastReader {
        public BufferedReader br;
        public StringTokenizer st;
        String context = null;

        public FastReader(InputStream in) {
            this(new InputStreamReader(in));
        }

        public FastReader(InputStreamReader input) {
            br = new BufferedReader(input);
        }

        public String next() {
            if (context != null) {
                System.err.print("[" + context + "] Wait for input ...");
            }
            while (st == null || !st.hasMoreElements()) {
                try {
                    String s = br.readLine();
                    if (s == null)
                        return null;
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    throw new RuntimeException("Could not read");
                }
            }
            String res = st.nextToken();
            if (context != null) {
                System.err.println("[" + context + "] ... received : " + res);
            }
            return res;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 32804
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
    return x;

}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right, k);

}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x=y;
    y = y->parent;
  }
  return y;
  
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  if(y->left != NIL) x = y->left;
  else x = y->right;
  if(x != NIL) x->parent = y->parent;
  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if(y != z) z->key = y->key;
	    
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else if(z->key<y->key){
    y->left=z;
  }
  else{
    y->right=z;
  }

}

void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20448
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;

struct Edge {
    int v, next;
    Edge() { }
    Edge(int v_, int next_): v(v_), next(next_) { }
};

int N;
int tote, head[MAXN];
Edge edge[MAXN * 2 + 5];

inline void addEdge(int u, int v)
{
    edge[++tote] = Edge(v, head[u]);
    head[u] = tote;
}

void input()
{
    read(N);
    for (int i = 1; i < N; ++i) {
        int u, v;
        read(u); read(v);
        addEdge(u, v);
        addEdge(v, u);
    }
}

int calc(int u, int f)
{
    int ret = 1;
    for (int i = head[u]; i; i = edge[i].next) {
        int v = edge[i].v;
        if (v == f) continue;
        int t = calc(v, u);
        if (t) {
            if (!~t || !ret) return -1;
            ret = 0;
        }
    }
    return ret;
}

void solve()
{
    puts(calc(1, 0) ? "First" : "Second");
}

int main()
{
#ifdef __DEBUG
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

//                学弈
//            [先秦] 佚名
// 弈秋，通国之善弈者也。
// 使弈秋诲二人弈，其一人专心致志，惟弈秋之为听；
// 一人虽听之，一心以为有鸿鹄将至，思援弓缴而射之。
// 虽与之俱学，弗若之矣。
// 为是其智弗若与？曰：非然也。


Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
       int a = in.nextInt();
       int b = in.nextInt();

       if((a+b)%2 == 0){
           System.out.println((a+b)/2);
       }
       else{
           System.out.println("IMPOSSIBLE");
       }

    }


}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF=(1LL<<50);
double eps=1e-10,PI=acos(-1);

struct segtree{
  ll t[(1<<20)];
  void init(){
    for(int i=0;i<(1<<20);i++)t[i]=INF;
  }
  ll get(int a,int b,int k=0,int l=0,int r=(1<<19)){
    if( !(a<b) )return INF;
    if(b<=l||r<=a)return INF;
    if(a<=l&&r<=b)return t[k];
    return min( get(a,b,k*2+1,l,(l+r)/2) , get(a,b,k*2+2,(l+r)/2,r) );
  }
  void set(int i,ll x){
    i+=(1<<19)-1;
    t[i]=x;
    while(i){
      i=(i-1)/2;
      t[i]=min(t[i*2+1],t[i*2+2]);
    }
  }
};

struct data{
  double A;
  int x,y,cost;
  bool operator < (const data &p) const {
    return A < p.A;
  }
};

segtree st;
int n,a,b,c,d,e,f;
data t[400000];

void update(int i,int &a,double key){
  while(a+1<n+n && t[a].A<t[i].A+key )a++;
}
ll solve(){
  if(n<3)return -1;
  ll ans=INF;
  for(int i=0;i<n;i++){
    update(i,a,PI*0.5-eps);
    update(i,b,PI*1.0-eps);
    update(i,c,PI*1.0+eps);
    update(i,d,PI*1.5-eps);
    update(i,e,eps);
    update(i,f,PI*2.0-eps);
    ans=min( ans , st.get(a,b) + st.get(c,d) + t[i].cost);
    if( abs(t[b].A-(t[i].A+PI)) <eps ){
      ans=min( ans, st.get(e,b) + st.get(b,c) + st.get(c,f) + t[i].cost );
    }
  }
  return (ans==INF?-1LL:ans);
}

int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d %d",&t[i].x,&t[i].y,&t[i].cost);
    if(t[i].x==0&&t[i].y==0){
      n--;
      i--;
      continue;
    }
    t[i].A=atan2( t[i].y , t[i].x );
    if(t[i].A<0)t[i].A+=PI*2.0;
  }
  sort(t,t+n);
  for(int i=0;i<n;i++){
    t[i+n]=t[i];
    t[i+n].A+=2.0*PI;
  }
  
  st.init();
  for(int i=0;i<n+n;i++){
    st.set( i , t[i].cost );
  }
  cout<<solve()<<endl;

  return 0;
}

Measured memory_bytes: 18880
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 998244353;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  i64 n, a, b;
  cin >> n >> a >> b;

  i64 cnt = n / (a + b);
  n %= (a + b);
  cout << cnt * a + min(n, a) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int num[5] = {0};
	int koku = 0, san = 0;

	//freopen("C:\\Users\\j2402\\Desktop\\nyu.txt","r",stdin);
	//freopen("C:\\Users\\j2402\\Desktop\\syu.txt","w",stdout);

	for(int i =0;i<5;i++)
	{
		scanf("%d",&num[i]);
	}

	while(num[1] >0 || num[2] >0)
	{
		if(num[1] > 0)
		{
			num[1]= num[1] - num[3];
			koku++;
		}
		if(num[2] > 0)
		{
			num[2] = num[2] - num[4];
			san++;
		}

		num[0] = num[0]-1;
	}

	printf("%d\n",num[0]);

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double x_p1 = scan.nextDouble();
		double y_p1 = scan.nextDouble();
		double x_p2 = scan.nextDouble();
		double y_p2 = scan.nextDouble();
		double vx = x_p2 - x_p1;
		double vy = y_p2 - y_p1;
		int q = scan.nextInt();
		double l = norm(x_p1, y_p1, x_p2, y_p2);
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < q; i++) {
			double x = scan.nextDouble();
			double y = scan.nextDouble();
			double ux = x - x_p1;
			double uy = y - y_p1;
			double t = dot(ux, uy, vx, vy);
			double k = t / l;
			double a = k * vx + x_p1;
			double b = k * vy + y_p1;
			//System.out.println(a + " " + b);
			sb.append(a).append(" ").append(b).append("\n");
		}
		scan.close();
		System.out.print(sb.toString());
	}
	static double dot(double x1, double y1, double x2, double y2) {
		return x1 * x2 + y1 * y2;
	}
	static double norm(double x1, double y1, double x2, double y2) {
		return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	}
}


Measured memory_bytes: 42044
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int N, H; cin >> N >> H;
	vector<pair<int, int>> vs;
	for (int i = 0; i < N; i++) {
		int a, b; cin >> a >> b;
		vs.emplace_back(a, 0);
		vs.emplace_back(b, 1);
	}
	sort(vs.rbegin(), vs.rend());
	int64_t sum = 0;
	int count = 0;
	for (int i = 0; i < vs.size(); i++) {
		if (vs[i].second == 0) {
			count += (H - sum + vs[i].first - 1) / vs[i].first;
			break;
		}
		sum += vs[i].first;
		count++;
		if (sum >= H) {
			break;
		}
	}
	cout << count << "\n";
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin>>S;
  
  if(S=="hi"|S=="hihi"|S=="hihihi"|S=="hihihihi"|S=="hihihihihi"){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define lol __int128
#define ld long double
#define pii pair<int, int>
#define dbg(x) cerr << #x << " = " << x << "\n"
using namespace std;
int x;
int32_t main() {
	//srand(chrono::steady_clock::now().time_since_epoch().count());
	boost;
	cin >> x;
	cout << !x;
}

Measured memory_bytes: 3608
N = int(input())
B = list(map(int, input().split()))

B.reverse()
result = [B[0]]
for i, e in enumerate(B):
    if i < len(B) - 1:
        result.append(min(B[i], B[i+1]))
    else:
        result.append(B[i])
print(sum(result))

Measured memory_bytes: 3060
### main

loop do
  pn, n = gets.split.map(&:to_i)
  break if (pn | n) == 0

  rpn0 = Math.sqrt(pn).to_i
  rpn1 = rpn0 + 1
  
  uv = Rational(rpn0, 1)
  xy = Rational(rpn1, 1)

  
  for den in (1..n)
    pnden2 = pn * den * den

    num0 = (uv * den).ceil
    break if num0 > n

    num1 = (xy * den).floor
    num1 = n if num1 > n

    for num in (num0..num1)
      if num * num < pnden2
        r = Rational(num, den)
        uv = r if uv < r
      else
        r = Rational(num, den)
        xy = r if xy > r
      end
    end
  end

  puts [xy, uv].join(' ')
end

Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define int long long

typedef long long ll;


int n, k;
signed main(){
    cin >> n >> k;

    cout << n - k + 1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define MAX_N 5001


/* -----------------------------------------------------------------------------
	型とクラス定義
----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
	大域データ
----------------------------------------------------------------------------- */
int N;			// 文字列長
char 	s[MAX_N];	// 文字列
int		A[MAX_N];	// 共通接頭辞の長さの配列

// Z-algorithm
int ZA(char *s, int A[]);

int main () {

	int len = 0;

	// 個数の読込み
	scanf("%d %s", &N, s);
	
	for(int i = 0; i < strlen(s); i++) {
		ZA(s + i, A);
		for(int j = 1; j < strlen(s + i); j++)
			len =  std::max(len, std::min(A[j], j));
	}
	printf("%d\n", len);

	return 0;
}

// Z-algorithm
// S と S[i:N-1] の最長共通接頭辞の長さ
int ZA(char *s, int A[]) {
	A[0] = strlen(s);
	int i = 1, j = 0;
	while (i < strlen(s)) {
  		while (i+j < strlen(s) && s[j] == s[i+j]) ++j;
  		A[i] = j;
  		if (j == 0) { ++i; continue;}
  		int k = 1;
  		// while (i+k < strlen(s) && k+A[k] < j) A[i+k] = A[k], ++k;
  		while (k+A[k] < j) A[i+k] = A[k], ++k;
  		i += k; j -= k;
	}
}

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

using namespace std;

const int N = 500017;

long long a, b, c, d;

bool read() {
    if (!(cin >> a >> b >> c >> d))
        return false;

    return true;
}

long long gcd(long long c, long long d) {
    return c ? gcd(d % c, c) : d;
}

long long blya(long long r) {
    return r - (r / c + r / d - r / (c * d / gcd(c, d)));
}

void solve() {
    cout << blya(b) - blya(a - 1) << endl;
}

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

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, x, a = 0, b;
  long long cnt = 0;
  scanf("%d%d", &n, &x);
  for(int i = 0; i < n; i++){
    scanf("%d", &b);
    cnt += max(a+b-x, 0);
    a = min(x-a, b);
  }
  printf("%lld\n", cnt);
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    X, K = MI()
    p = LI()
    diff = []
    ps = set(p)
    c = []

    for i in range(-100, 200):
        if i not in ps:
            c.append(i)

    for i in range(len(c)):
        n = (abs(c[i] - X), i)
        diff.append(n)

    diff.sort()

    # print(diff[:10])

    if len(diff) == 0:
        print(X)
    elif len(diff) == 1:
        print(c[diff[0][1]])
    elif len(diff) > 1:
        if diff[0][0] == diff[1][0]:
            a = c[diff[0][1]]
            b = c[diff[1][1]]
            print(min(a, b))
        else:
            a = c[diff[0][1]]
            print(a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68364
n, w = map(int, input().split())
ws = [0] * n
vs = [0] * n

for i in range(n):
    ws[i], vs[i] = map(int, input().split())

INF = 10 ** 18
dp = [[INF] * 100010 for _ in range(110)]
dp[0][0] = 0
for i in range(n):
    for sum_v in range(100010):
        # i番目を選ぶ
        if sum_v - vs[i] >= 0:
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - vs[i]] + ws[i])
        
        # i番目を選ばない
        dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])

ans = 0
for sum_v in range(100010):
    if dp[n][sum_v] <= w:
        ans = sum_v

print(ans)

Measured memory_bytes: 121496
/*
    Takayuki Inubushi
    2014.06.25
    C language Lecture week 2
    
*/

#include <stdio.h>

int main (void) {
    
    int a;
    int b;
    int area;
    int round;
    
    scanf ( "%d %d", &a, &b );
    
    area = a * b;
    round = ( a + b ) * 2;
    
    printf ("%d %d\n", area, round );
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int t = n -1;
  ll ans = 0;
  rep(i, n) {
    int lim = 2;
    if(i == 0) lim = 1;
    rep(j, lim) {
      if(t > 0) {
        ans += a[i];
        t--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 100005
#define ALL(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;


int32_t main()
{
    IOS;

    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        int n,a,b; cin>>n>>a>>b;
        cout<<(n)/(a+b) * (a) + min(n%(a+b),a);


		
		cout<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
import copy
s = input()
N = len(s)
chr_set = set([c for c in s])
if len(chr_set) == 1:
    print(0)
    exit()

ans = []
for c in chr_set:
    count = 0
    t = copy.deepcopy(s)
    loop_len = N
    while True:
        tmp_t = ""
        for i in range(loop_len-1):
            if t[i] == c:
                tmp_t += c
            elif t[i+1] == c:
                tmp_t += c
            else:
                tmp_t += t[i]
        count += 1
        if len(set(tmp_t)) == 1:
            ans.append(count)
            break
        t = tmp_t
        loop_len -= 1

print(min(ans))

Measured memory_bytes: 3572
# coding: utf-8
# Your code here!

import sys
from collections import defaultdict

N = int(input())
A = list(map(int, input().rstrip().split(' ')))

count = 0
for i in range(N-2):
    if A[i] <= A[i+1] and A[i+1] <= A[i+2]:
        count += 1
    elif A[i] >= A[i+1] and A[i+1] >= A[i+2]:
        count += 1
        
print(count)

Measured memory_bytes: 3444
#include<stdio.h>

int main()
{
  int N = 0,T = 0,c = 0,t = 0,cmin = 0,tmin = 0,count = 0;
  scanf("%d%d",&N,&T);
  for(int i = 0;i < N;i++)
  {
    count++;
    scanf("%d%d",&cmin,&tmin);
    if(tmin <= T)
    {
      break;
    }
    cmin = tmin = 0;
  }

  if(tmin != 0)
  {
   for(int i = 0;i < N - count;i++)
   {
    scanf("%d%d",&c,&t);
    if(t <= T)
    {
      if(c < cmin)
      {
        cmin = c;
      }
    }
   }
  }

  
  if(T < tmin || tmin == 0)
  {
    printf("TLE");
  }else{
    printf("%d",cmin);
  }
  
  return 0;
}

Measured memory_bytes: 128
'use strict'

const main = (input) => {
    input = input.split('\n')
    const N = parseInt(input[0].split(' ')[0])
    const M = parseInt(input[0].split(' ')[1])
    const nums = input.slice(1, M + 1)
    const arr = new Array(N).fill(0)
    nums.forEach(v => {
        let a = parseInt(v.split(' ')[0]) - 1
        let b = parseInt(v.split(' ')[1]) - 1
        arr[a]++
        arr[b]++
    })
    arr.forEach(v => console.log(v))
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  ll X,T;
  scanf("%lld%lld",&X,&T);
  if(X<=T){
    printf("0\n");
  }else{
    printf("%lld\n",X-T);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
ll a[100001][3];
ll dp[100001][3];
int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
ll n;
cin>>n;
for(ll i=0;i<n;i++)
{
	for(ll j=0;j<3;j++)
	{
		cin>>a[i][j];
	}
}
dp[0][1]=a[0][1];
dp[0][2]=a[0][2];
dp[0][0]=a[0][0];
for(ll i=1;i<n;i++)
{
	dp[i][0]=max(a[i][0]+dp[i-1][1],a[i][0]+dp[i-1][2]);
	dp[i][1]=max(a[i][1]+dp[i-1][2],a[i][1]+dp[i-1][0]);
	dp[i][2]=max(a[i][2]+dp[i-1][1],a[i][2]+dp[i-1][0]);
}
cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}

 


Measured memory_bytes: 8300
// 2

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

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

  bool flg = false;
  for(int i = 0; i <= N; i++){
    for(int k = 0; k <= N; k++){
      if(i + k > N) break;
      int m = N - (i+k);
      if(m < 0) m = 0;
      if(i * 10000 + k * 5000 + m * 1000 == Y){
        cout << i << " " << k << " " << m << endl;
        flg = true;
        break;
      }
    }
    if(flg) break;
  }

  if(!(flg)) cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m, s;
typedef pair<ll, ll> P;
using edge = pair<ll, P>;
const ll INF = 1e18, MAX_COST = 2500;

signed main(){
	ll n, m, s; cin >> n >> m >> s;
	s = min(s, MAX_COST);
	vector<vector<edge> > G(n);
	for(int i = 0; i < m; i++){
		ll u, v, a, b; scanf("%lld%lld%lld%lld", &u, &v, &a, &b); --u; --v;
		G[u].push_back(edge(v, P(a, b))); G[v].push_back(edge(u, P(a, b)));
	}
	vector<ll> c(n), d(n);
	for(int i = 0; i < n; i++) scanf("%lld%lld", &c[i], &d[i]);
	vector<vector<ll> > dist(n, vector<ll> (MAX_COST + 1, INF));
	priority_queue<edge, vector<edge>, greater<edge> >  que;
	dist[0][s] = 0;
	que.push(edge(0, P(0, s)));

	while(!que.empty()){
		edge e = que.top(); que.pop();
		ll time = e.first, now = e.second.first, money = e.second.second;
		//if(dist[now][money] < time) continue;

		if(money + c[now] <= MAX_COST) {
			ll ntime = time + d[now], nmoney = money + c[now];
			if(dist[now][nmoney] > ntime){
				dist[now][nmoney] = ntime;
			  que.push(edge(ntime, P(now, nmoney)));
			}
		}

		for(auto e : G[now]){
			if(money < e.second.first) continue;
			ll next = e.first, ntime = time + e.second.second, nmoney = money - e.second.first;
			if(dist[next][nmoney] > ntime){
				dist[next][nmoney] = ntime;
				que.push(edge(ntime, P(next, nmoney)));
			}
		}
	}

	for(int i = 1; i < n; i++){
		ll ans = INF;
		for(int j = 0; j <= MAX_COST; j++) ans = min(ans, dist[i][j]);
		cout << ans << endl;
	}
}


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

#define int long long
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)x.size())
template <class T> bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> using V = vector<T>;
using P = pair<int, int>;

/*
 *  *  */

signed main() {
  int n, k;
  cin >> n >> k;

  if(n < k){
    cout << min(n, k-n) << endl;
  }else{
    cout << min({n, n-k, n%k, k-n%k}) << endl;
  }

  return 0;
}





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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<double> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    double ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += 1/a[i];
    }
    ans = 1/ans;
    cout << ans << endl;
	return 0;
}

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

int main(){
  //ifstream in("input.txt");
  //cin.rdbuf(in.rdbuf());

  int N;
  cin>>N;

  vector<int> X(8);

  int over=0;

  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    if  (          x< 400) X.at(0)++;
    else if( 400<=x & x< 800) X.at(1)++;
    else if( 800<=x & x<1200) X.at(2)++;
    else if(1200<=x & x<1600) X.at(3)++;
    else if(1600<=x & x<2000) X.at(4)++;
    else if(2000<=x & x<2400) X.at(5)++;
    else if(2400<=x & x<2800) X.at(6)++;
    else if(2800<=x & x<3200) X.at(7)++;
    else if(3200<=x         ) over++;
  }

    int minans=0;
    int maxans;

    for(int i=0;i<8;i++){
      if(X.at(i)>=1) minans++;
    }

    maxans = minans + over;
    //if(maxans>8) maxans=8; ???

    if(minans==0 & over>=1) minans=1; 

    cout<<minans<<' '<<maxans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

int main(){
  ll N, K;

  cin >> N >> K;

  cout << min((N+K)%K, K-(N+K)%K) << endl;

  return 0;
  
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	long x,sum=0,zc;
	cin>>x;
	zc=x;
	while(x!=0){
		sum+=x%10;
		x/=10;
	}
	if(zc%sum==0)
	cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
    
}

Measured memory_bytes: 256