akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    ll sum = 0,res1 = 0,res2 = 0;
    rep(i,n){
        sum+=a[i];
        if(i%2==0&&sum<=0){
            res1+=1-sum; 
            sum=1;
        }else if(i%2==1&&sum>=0){
            res1+=1+sum;
            sum=-1;
        }
    }
    sum=0;
    rep(i,n){
        sum+=a[i];
        if(i%2==0&&sum>=0){
            res2+=1+sum; 
            sum=-1;
        }else if(i%2==1&&sum<=0){
            res2+=1-sum;
            sum=1;
        }
    }
    cout << min(res1,res2) << endl;
    return 0;
}

Measured memory_bytes: 640
def cal_cost(co, h, i, j):
    return co + abs(h[i]-h[j])

n = int(input())
h = [int(i) for i in input().split(" ")]
lis = [0 for i in range(n)]
lis[1] = cal_cost(lis[0], h, 0, 1)
for i in range(2, n):
    temp1 = cal_cost(lis[i-2], h, i-2, i)
    temp2 = cal_cost(lis[i-1], h, i-1, i)
    lis[i] = min(temp1, temp2)
print(lis[-1])

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll N;
VL A, R, L;

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

int main() {
    cin >> N;
    A.resize(N);
    VECCIN(A);
    R.resize(N + 2);
    L.resize(N + 2);
    L[0] = 0;
    R[N + 1] = 0;
    REP(i, N) { L[i + 1] = gcd(L[i], A[i]); }
    FORR(i, N, 0) { R[i] = gcd(R[i + 1], A[i - 1]); }
    ll ans = 0;
    FOR(i, 1, N + 1) { ans = max(ans, gcd(L[i - 1], R[i + 1])); }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

int main(){
    IOS;
    ll n;cin>>n;
    cout<<(n*(n-1))/2;
    return 0;
}   

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int k = a/500;
    k*=1000;
    a = a%500;
    int x = a/5;
    x*=5;
    pl((k+x)+"");
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
  int H,N;
  int sum = 0;
  int t;
  cin >> H >> N;
  for(int i=0;i<N;i++){
    cin >> t;
    sum+=t;
  }
  if(sum < H)cout << "No";
  else cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_V = 100005;
int N;
int main(void) {
	
	cin >> N;
	if (N == 3 || N == 5 || N == 7)ct("YES");
	else ct("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

signed main() {
	int n, ma = 0, ans = 0;
	cin >> n;
	rep(i, n) {
		int t;
		cin >> t;
		if (t >= ma) {
			ans++;
		}
		ma = max(ma, t);
	}
	cout << ans << endl;

	END;
}


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

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
//const------------------------------------------------------------------------------------------------------------------------
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;

//global-----------------------------------------------------------------------------------------------------------------------
int a, b;

//function--------------------------------------------------------------------------------------------------------------------
int main() {
	while ( scanf( "%d %d", &a, &b ) ) {
		if ( !a && !b ) {
			break;
		}
		rep( i, a ) {
			rep( j, b ) {
				printf( "#" );
			}
			printf( "\n" );
		}
		printf( "\n" );
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#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))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
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 int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//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; }

int main () {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  vi water, sugar;
  rep(i,f+1) {
    rep(j,f+1) {
      int x = 100*a*i + 100*b*j;
      int y = c*i + d*j;
      if (x <= f) water.pb(x);
      if (y <= f) sugar.pb(y);
    }
  }

  sort(water.begin(), water.end());
  sort(sugar.begin(), sugar.end());
  uni(water);
  uni(sugar);

  double cnct_max = 0.0;
  int xm, ym;
  for (auto x : water) {
    for (auto y : sugar) {
      if (x == 0 && y == 0) continue;
      if (y*100 > x*e || x+y > f) continue;
      double cnct = 100*(double)y/(x+y);
      if (cnct_max < cnct + EPS) {
        cnct_max = cnct;
        xm = x;
        ym = y;
      }
    }
  }

  cout << xm + ym SP ym << endl;
  return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b;
    cin >> n >> a >> b;
    for(int i=a;i<=b;i++){
        if(i%n==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n+1], b[n+2];
  a[0] = 0;
  b[0] = 0;
  cin >> a[1];
  b[1] = abs(a[1]);
  long long sum = b[1];
  for(int i = 2; i < n+1; i++){
    cin >> a[i];
    b[i] = abs(a[i] - a[i-2]) - abs(a[i] - a[i-1]) - abs(a[i-1] - a[i-2]);
    sum += abs(a[i] - a[i-1]);
  }
  sum += abs(a[n]);
  b[n+1] = abs(a[n-1]) - abs(a[n]) - abs(a[n] - a[n-1]);
  for(int i = 1; i < n+1; i++){
    cout << sum + b[i+1] << endl;
  }
  return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>

int main()
{
  long long n,d,s;
  long long x[200001],y[200001];
  int i;
  int ans=0;
  scanf("%lld%lld",&n,&d);
  for(i=0;i<n;i++){
    scanf("%lld%lld",&x[i],&y[i]);
    s=x[i]*x[i]+y[i]*y[i];
    if(s<=d*d) ans++;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 4852
S=input()
K=int(input())

if list(S).count(S[0])==len(S):
    print(len(S)*K//2)

else:
    S_count=0
    i=0
    while i<len(S)-1:
        if S[i]==S[i+1]:
            S_count+=1
            i+=1
        i+=1

    if S[0]==S[-1]:
        a=1
        i=0
        while i<len(S)-1:
            if S[i]==S[i+1]:
                a+=1
                i+=1
            else:
                break
        b=1
        i=len(S)-1
        while i>0:
            if S[i]==S[i-1]:
                b+=1
                i+=-1
            else:
                break

        S_count*=K
        S_count-=(K-1)*(a//2 + b//2 - (a+b)//2)

    else:
        S_count*=K
    print(S_count)


Measured memory_bytes: 38256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define pb push_back
#define ll long long
#define ae addEdge
#define mp make_pair
#define vi vector<int>
#define vll vector<long long>
#define si set<int>
#define vvi vector< vector<int> >
#define pii pair <int,int>
#define sortv sort(v.begin(),v.end())
#define sorta sort(a.begin(),a.end())
#define sortb sort(b.begin(),b.end())
#define sorts sort(s.begin(),s.end())

int main(){
	int n; cin>>n;
	vi v;
	for(int i=0;i<n;i++){
		int a; cin>>a;
		v.pb(a);
	}
	int dp[n];
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]), dp[i-2]+abs(v[i]-v[i-2]));
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1144
s_data = STDIN.gets.chomp

p_data = Array.new(10)
i = j = 0
n = s_data.length

n.times{
    s = s_data[j]
    if s == "0" || s == "1"
        p_data[i] = s
        i = i + 1
    elsif s == "B" && i > 0
        i = i - 1
        p_data[i] = nil
    end
    j = j + 1
}

STDOUT.puts p_data.join

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

using namespace std;

#define ZERO_IQ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main() {
    ZERO_IQ
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for (int i = 0; i < n; ++i) {
        cin>>v[i];
    }
    vector<bool>dp(k+1,0);
    for (int j = 0; j <=k; ++j) {
        for (auto i:v) {
            if(j>=i&&!dp[j-i]){
                dp[j]=true;
            }
        }
    }
    if(dp[k]){
        cout<<"First\n";
    }
    else cout<<"Second\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define con_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define con_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;
bool isPrime(long long int n){
    if(n<=1)return false;
    if(n==2)return true;
    if(n%2==0)return false;
    int Nsqrt = sqrt(n);
    for(int q=3;q<=Nsqrt;q+=2){
        if(n%q==0)return false;
    }
    return true;
}

int main(){
    long long int n;
    cin>>n;
    long long int ans=1000000000000;
    if(isPrime(n)){
        cout<<n-1<<endl;
        return 0;
    }else{
        for(long long int i=2;i<=sqrt(n);i++){
            if(n%i==0){
                ans=min(ans,i+(n/i)-2);
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, d;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> d;

  if(n % (2 * d + 1) == 0) {
    cout << n / (2 * d + 1) << endl;
  } else {
    cout << n / (2 * d + 1) + 1 << endl;
  }
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	//i組とj個がある
	//組->1つ以上でたらボーナスで数*2
	//普通にDPする nlognいけないのが不思議
	//dp[組の数][さいころを使った数]
	int n,K,i,j;cin>>K>>n;
	static llint dp[1005][2005]={0};
	static llint ep[2005][2005]={0};
	dp[0][0]=1;
	for(i=1;i<=K/2;i++){
		for(j=1;j<=n;j++){dp[i][j]=dp[i-1][j-1]+dp[i][j-1];}
		for(j=1;j<=n;j++){dp[i][j]=(dp[i][j]*2+dp[i-1][j])%mod;}
		dp[i][0]=1;
	}
	for(i=0;i<=K;i++){ep[i][0]=1;}
	//for(j=0;j<=n;j++){ep[0][j]=1;}
	for(i=1;i<=K;i++){
		for(j=1;j<=n;j++){
			ep[i][j]=(ep[i-1][j]+ep[i][j-1])%mod;
		}
	}
	
	for(i=2;i<=K+K;i++){
		int it=min(i,K+K+2-i);
		int pa=(it-1)/2;
		int sa=K-pa*2;
		
		if(i%2==0){sa--;}
		llint ans=0;
		//cerr<<pa<<" "<<sa<<"pasa"<<endl;
		for(j=0;j<=n;j++){
			ans+=dp[pa][j]*ep[sa][n-j];
			ans%=mod;
		}
		if(i%2==0){
			for(j=0;j<n;j++){
				ans+=dp[pa][j]*ep[sa][n-1-j];
				ans%=mod;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 47992
N=input()
Blue=[]
for i in range(int(N)):
    Blue.append(input())
M=input()
Red=[]
for i in range(int(M)):
    Red.append(input())


Max=-int(M)
for i in range(int(N)):
    point=int(0)
    str=Blue[i]
    for s in Blue:
        if s==str:
            point+=int(1)

    for s in Red:
        if s==str:
            point-=int(1)

    Max=max(Max,point)
print(max(Max,0))

Measured memory_bytes: 3064
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub struct Graph {
    graph: Vec<Vec<usize>>,
    v: usize,
}

type Edge = (usize, usize);
impl Graph {
    pub fn new_directed(edges: &[Edge], v: usize) -> Self {
        let mut graph = vec![Vec::new(); v];
        for &(u, v) in edges {
            graph[u].push(v);
        }
        Graph { graph, v }
    }

    pub fn solve(&self, mut indegreev: Vec<usize>) -> isize {
        let mut dp = vec![0; self.v];
        let mut que = VecDeque::new();
        for u in 0..self.v {
            if indegreev[u] == 0 {
                que.push_back(u);
                dp[u] = 1;
            }
        }
        while let Some(u) = que.pop_front() {
            for &v in &self.graph[u] {
                indegreev[v] -= 1;
                if indegreev[v] == 0 {
                    que.push_back(v);
                    dp[v] = dp[u] + 1;
                }
            }
        }

        let is_ok = indegreev.into_iter().all(|x| x == 0);
        if is_ok {
            dp.into_iter().max().unwrap_or(0) as isize
        } else {
            -1
        }
    }
}

fn solve() {
    input! {
        n: usize,
        matchv: [[Usize1; n - 1]; n]
    };

    let vn = n * (n - 1) / 2;
    let id_table = (0..n)
        .into_iter()
        .combinations(2)
        .enumerate()
        .map(|(i, ab)| ((ab[0].min(ab[1]), ab[0].max(ab[1])), i))
        .collect::<HashMap<_, _>>();
    let mut indegreev = vec![0; vn];
    let mut edges = Vec::new();
    for i in 0..n {
        let a = i;
        for mv in matchv[i].windows(2) {
            let b = mv[0];
            let u = *id_table.get(&(a.min(b), a.max(b))).unwrap();
            let c = mv[1];
            let v = *id_table.get(&(a.min(c), a.max(c))).unwrap();
            indegreev[v] += 1;
            edges.push((u, v));
        }
    }

    let graph = Graph::new_directed(&edges, vn);
    let res = graph.solve(indegreev);
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 86972
"use strict";

var util = require("util"),
    puts = console.log,
    p = util.print,
    cin = parseInput();

function expression() {
    var n = term();

    while(true) {
        if ( line[idx] == "+" ) {
            idx++;
            n += term();
        } else if ( line[idx] == "-" ) {
            idx++;
            n -= term();
        } else {
            break;
        }
    }
    return n;
}

function term() {
    var n = factor();

    while(true) {
        if ( line[idx] == "*" ) {
            idx++;
            n *= factor();
        } else if ( line[idx] == "/" ) {
            idx++;
            n = ~~(n / factor());
        } else {
            break;
        }
    }
    return n;
}

function factor() {
    if ( line[idx] == "(" ) {
        idx++;  // (
        var ret = expression();
        idx++;  // )
        return ret;
    } else {
        return number();
    }
}

function number() {
    var ret = 0, sign = 1;

    if ( line[idx] == "-" ) {
        idx++;
        sign = -1;
    }

    while( /^\d/.test(line[idx]) ) {
        ret = ret * 10 + +line[idx];
        idx++;
    }
    return ret * sign;
}

var n = cin.nextInt(),
    line, idx;

while(n--) {
    idx = 0;

    line = cin.next();
    line = line.slice(0, line.length - 1);

    puts(expression());
}

function parseInput(useSplitSpace) {
    var index = 0,
        ret = [],
        input = require("fs").readFileSync("/dev/stdin", "utf8"),
        inputs = input.replace(/\r/g, '').split("\n");

    useSplitSpace = useSplitSpace || true;

    // 入力を改行/空白で区切り平坦な配列に変換
    inputs.forEach(function(val) {
        if ( useSplitSpace && val !== "" ) {
            val.split(" ").forEach(function(el) {
                if ( el !== "" ) ret.push(el);
            });
        } else {
            ret.push(val);
        }
    });

    return {
        hasNext: function(val) {
            if ( typeof val === "undefined" ) {
                return typeof ret[index] !== "undefined";
            } else {
                return ret[index] === val;
            }
        },
        next: function() {
            if ( typeof ret[index+1] === "undefined" ) throw new RangeError("Index out of bounds at '" + index+1 + "'");
            return ret[index++];
        },
        nextNumber: function () {
            if ( !/^\d+$/.test(this.top()) ) throw new TypeError("'" + this.top() + "' cannot convet to Number");
            return +this.next();
        },
        nextInt: function() {
            return parseInt(this.nextNumber());
        },
        top: function() {
            return ret[index];
        },
        rewind: function() {
            index = 0;
        }
    };
}

Measured memory_bytes: 8860
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, T = sc.nextInt()
  val x :: xs = List.fill(N)(sc.nextLong()).reverse
  val (_, sum) = xs.foldLeft((x, T.toLong)) {
    case ((before, acc), x) => (x, acc + (before - x).min(T))
  }
  println(sum)
}


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

int main(){
int a[10];
int i,j;
int b=0;
int n[4]={0};
  
for(i=0;i<6;i++){
cin>>a[i];
}
  
for(i=0;i<6;i++){
if(a[i]==1){
n[0]++;
}
if(a[i]==2){
n[1]++;
}
if(a[i]==3){
n[2]++;
}
if(a[i]==4){
n[3]++;
}
}

for(i=0;i<4;i++){
if(n[i]>=3){
b++;
}

}
if(b!=0){
cout<<"NO";
}
else{
cout<<"YES";
}
}

Measured memory_bytes: 256
local line = io.read("*n")

local tab = {{0, 0, 0}}
local len = 1

for i=1,line do
	local a = io.read("*n")
	local b = io.read("*n")
	local c = io.read("*n")
	table.insert(tab, {a, b, c})
	len = len + 1
end

local stata = "Yes"
for i=2,len do
	local cur = tab[i]
	local per = tab[i - 1]

	local v = math.abs(cur[2] - per[2]) + math.abs(cur[3] - per[3])

	if v > cur[1] - per[1] then
		stata = "No"
		break
	elseif math.abs((v - (cur[1] - per[1]))) % 2 == 1 then
		stata = "No"
		break
	end
end

print(stata)

Measured memory_bytes: 14840
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  int cu=0;
  for(int i=0;i<s.size();i++){
    if(s[i]==s[i+1]){
      cu++;
    }
    else{
      if(cu%2==0){
        cu=100000;
        break;
      }
      cu=0;
    }
  }
  if(cu==100000)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}
      
    
    

Measured memory_bytes: 256
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  S = readline()
  T = readline()

  cout = 0
  for i in 1:length(S)
    if S[i] != T[i]
      cout += 1
    end
  end
  println(cout)
end

main()

Measured memory_bytes: 182868
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INT = 1e9;
const ll LINF = 1e18;

struct UF{
    vector<int> d;
    UF(int size):d(size,-1){}
    bool u(int x,int y){
        x = r(x); y = r(y);
        if(x != y){
            if(d[y] < d[x]) swap(x,y);
            d[x] += d[y]; d[y] = x;
        }
        return x!=y;
    }
    bool f(int x,int y){
        return r(x) == r(y);
    }
    int r(int x){
        return d[x] < 0 ? x:d[x] = r(d[x]);
    }
    int s(int x){
        return -d[r(x)];
    }
};
void solve(){
    int n,q; cin >> n >> q;
    UF uf(n);
    while(q--){
        int com,x,y; cin >> com >> x >> y;
        if(com == 0){
            uf.u(x,y);
        }else{
            cout << uf.f(x,y) << endl;
        }
    }
}
int main(void){
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 3192
#include <stdio.h>
#define H_MAX 200
#define W_MAX 200
#define INF 9999
#define N 10

int main(void){
  int h,w;
  int i,j,k;
  int c[N][N];
  int a;
  int mp;
  
  scanf("%d %d",&h,&w);
  
  for( i=0; i<N; i++) for( j=0; j<N; j++){
    scanf("%d",&c[i][j]);
  }
  
  for( k=0; k<N; k++){
    for( j=0; j<N; j++){
      for( i=0; i<N; i++){
        if( c[i][j] > c[i][k] + c[k][j] ) c[i][j] = c[i][k] + c[k][j];
      }
    }
  }
  
  for( i=0, mp=0; i<h; i++) for( j=0; j<w; j++){
    scanf("%d",&a);
    if( a >= 0 ) mp += c[a][1];
  }
  
  printf("%d\n",mp);
  
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> X(N);
    rep(i, N) cin >> X[i];
    ll ans = 0;
    rep(i, N) {
        ans += min(abs(X[i]) +  abs(X[i]),  abs(X[i] - K) + abs(X[i] - K));
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<int> h(N);
    vector<int> dp(N,INT_MAX);
    for(auto& x : h){
        cin >> x;
    }
    dp[0] = 0;
    for(int i = 0; i < N;i++){
        for(int j : {i + 1,i + 2}){
            dp[j] = min(dp[j],dp[i] + abs(h[i] - h[j]));
        }
    }
    printf("%d\n",dp[N-1]);
    return 0;
}


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

int main()
{
    int n; cin >> n;
    vector<tuple<string, int, int>> R(n);
    rep(i, n) {
        cin >> get<0>(R.at(i)) >> get<1>(R.at(i));
        get<2>(R.at(i)) = i + 1;
        get<1>(R.at(i)) *= -1;
    }

    sort(R.begin(), R.end());
    rep(i, n) cout << get<2>(R.at(i)) << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
long long t[100000000];
long long f(long long n)
{
	if (n<100000000)
		if (t[n])
			return t[n];
	if (n<=1)
		return 1;
	else
	{
		if (n<100000000)
			return t[n]=f(n/2)+f(n/2)+1;
		else
			return f(n/2)+f(n/2)+1;
	}
}
int main()
{
	long long n;
	cin>>n;
	cout<<f(n);
	return 0;
}

Measured memory_bytes: 18688
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++) // for簡略表記
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl // 配列一覧表示
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl; // 配列一行一覧表示
#define COUT(x) cout << x << endl // 単要素出力
#define ALL(ar) ar.begin(), ar.end() // コンテナの全要素
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl // ループ回数デバグ
using namespace std;
// cout << fixed << setprecision(4) で小数点以下4桁の桁そろえ
// cout << setw(5) << ... で表示形式を5桁に設定 5桁未満なら頭に空白がつく 5桁越なら先頭から5桁まで
// cout << setw(5) << setfill('0') << ... で空白部分の埋め文字に5を使う
// getline(cin, [変数]); で空白などを含む入力の受け取り(行ごとの受け取り)
// cin >> ws; でそこまでにストリームに残されたホワイトスペースを取り除く(=以降のgetlineの有効化)

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

    int n;
    cin >> n;
    vector<string> s(n);
    FOR(i, n) cin >> s[i];

    vector<vector<int>> cnt(n, vector<int>(26, 0));
    for(int i=0; i<n; i++){
        for(int k=0; k<(int)s[i].size(); k++){
            cnt[i][s[i][k] - 'a']++;
        }
    }

    vector<pair<int, bool>> ans(26, make_pair(0, true));
    for(int i=0; i<n; i++){
        for(int k=0; k<26; k++){
            if(cnt[i][k] == 0){
                ans[k].second = false;
            }else{
                if(ans[k].first == 0)
                    ans[k].first = cnt[i][k];
                else
                    ans[k].first = min(ans[k].first, cnt[i][k]);
            }
        }
    }

    for(int i=0; i<26; i++){
        if(ans[i].second){
            for(int k=0; k<ans[i].first; k++){
                cout << (char)(i + 'a');
            }
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1111;
const int mod = 1000000007;
char in[SIZE][SIZE];
long long dp[SIZE][SIZE];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int H, W;
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++)
      cin >> in[i][j];
  }
  dp[0][0] = 1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (in[i][j] == '#') {
        continue;
      }
      if (i - 1 >= 0) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j]) % mod;
      }
      if (j - 1 >= 0) {
        dp[i][j] = (dp[i][j - 1] + dp[i][j]) % mod;
      }
    }
  }
  cout << dp[H - 1][W - 1];
  return 0;
}


Measured memory_bytes: 11008
///ShzFahad
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    ll m=0,i;
    cin >> s;
    for (i=0; i<s.size(); i++)
        {
            m = ((m * 10) + (s[i]-'0')) %9;
        }
        if(m==0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;



}


Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;

ll a, b;


int main() {
	cin >> a >> b;
	if (a == 1) {cout << 1 << endl; return 0;}
	if (b == 1) {cout << 1 << endl; return 0;}
	ll ans = 0;
	ans += ((a + 1) / 2) * ((b + 1) / 2);
	ans += (a / 2) * (b / 2);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,v[100000],a=0;
    cin>>n;
    for(int i=0;i<2*n;i++){
        cin>>v[i];
    }
    for(int i=0;i<n;i++){
        if(v[i]-v[i+n]>0){
            a+=(v[i]-v[i+n]);
        }
    }
    cout<<a;
    }


Measured memory_bytes: 256
# include <bits/stdc++.h>
// A pretty cool dp problem
// https://atcoder.jp/contests/agc030/tasks/agc030_d
using namespace std;
const int MOD = 1'000'000'007;
const long long HALF = 500'000'004LL;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    // pInverted[i][j] = The probability that a_i < a_j.
    vector<vector<int>> pLess(n, vector<int>(n, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            pLess[i][j] = a[i] < a[j];
        }
    }
    long long ways = 1;
    for (int i = 0; i < q; i++) {
        ways = (ways * 2) % MOD;
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        for (int j = 0; j < n; j++) {
            if (j != x && j != y) {
                pLess[j][y] = pLess[j][x] =
                        ((pLess[j][y] + pLess[j][x]) * HALF) % MOD;
                pLess[x][j] = pLess[y][j] =
                        ((pLess[x][j] + pLess[y][j]) * HALF) % MOD;
            }
        }
        pLess[x][y] = pLess[y][x] =
                ((pLess[x][y] + pLess[y][x]) * HALF) % MOD;
    }
    long long expectedWays = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            // In this loop, j < i. Now we add if a[i] < a[j]
            expectedWays += pLess[i][j];
        }
    }
    expectedWays = expectedWays % MOD;
    int totalWays = (expectedWays * ways) % MOD;
    cout << totalWays << "\n";
    return 0;
}

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

int main() {
   int N;
  cin >> N ;
  int S , H , J , I;
  S = N / 1000;
  N = N % 1000;
  H = N / 100;
  N = N % 100;
  J = N / 10;
  N = N % 10;
  I = N;
  if ( ( S == H && H == J ) || ( H == J && J == I ) ) {
    cout << " Yes " << endl;
  }
  else {
    cout << " No " << endl;
  }
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,m,k;
LL a[500005];

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	if(n > m) swap(n,m);
	for(LL i = 1;i <= m;i ++) cout << n;
	cout << endl; 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n,m;
		cin >> n >> m;
		cout << (n*(n-1))/2 + (m*(m-1))/2 <<endl;
	
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

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

int main()
{
    int x, n, dif_x1 = 150, dif_x2 = 150;
    bool ans_is_x = true;
    cin >> x >> n;
    vector<int>p(n);
    rep(i,n){ 
        cin >> p[i];
        if(x == p[i]) ans_is_x = false;
    }
    if(ans_is_x){
        cout << x << endl;
        return 0;
    }
    if(x == 1){
        cout << 0 << endl;
        return 0;
    }
    sort(p.begin(),p.end());
    //xより小さい数字について
    rep(i,200){
        bool ok = true;
        rep(j,n){
            if((x - i - 1) == p[j]) ok = false;
        }
        if(ok){
            dif_x1 = min(dif_x1,(i + 1));
        }
    }
    //xより大きい数字について
    rep(i,200){
        bool ok = true;
        rep(j,n){
            if((x + i + 1) == p[j]) ok = false;
        }
        if(ok){
            dif_x2 = min(dif_x2,(i + 1));
        }
    }
    if(dif_x1 <= dif_x2){
        cout << x - dif_x1 << endl;
    }else{
        cout << x + dif_x2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<math.h>
#include<functional>
#include<bitset>
#include<cassert>
#include<random>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
#define INF 1000000000LL
#define EPS 1e-12
#define FOR(i,n,m) for(int i=n;i<(int)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

#include <cstdint>
using i64 = std::int_fast64_t;
const static i64 mod = 1000000007;
struct mint {
	i64 n;
public:
	mint(const i64 n = 0) : n((n % mod + mod) % mod) {}
	mint pow(int m) const {
		i64 a = n, r = 1;
		while(m > 0) {
			if(m & 1) { r *= a; r %= mod; }
			a = (a * a) % mod; m /= 2;
		}
		return mint(r);
	}
	mint &operator++() { *this += 1; return *this; }
	mint &operator--() { *this -= 1; return *this; }
	mint operator++(int) { mint ret = *this; *this += 1; return ret; }
	mint operator--(int) { mint ret = *this; *this -= 1; return ret; }
	mint operator~() const { return (this -> pow(mod - 2)); } // inverse
	friend bool operator==(const mint& lhs, const mint& rhs) {
		return lhs.n == rhs.n;
	}
	friend bool operator<(const mint& lhs, const mint& rhs) {
		return lhs.n < rhs.n;
	}
	friend bool operator>(const mint& lhs, const mint& rhs) {
		return lhs.n > rhs.n;
	}
	friend mint &operator+=(mint& lhs, const mint& rhs) {
		lhs.n += rhs.n;
		if (lhs.n >= mod) lhs.n -= mod;
		return lhs;
	}
	friend mint &operator-=(mint& lhs, const mint& rhs) {
		lhs.n -= rhs.n;
		if (lhs.n < 0) lhs.n += mod;
		return lhs;
	}
	friend mint &operator*=(mint& lhs, const mint& rhs) {
		lhs.n = (lhs.n * rhs.n) % mod;
		return lhs;
	}
	friend mint &operator/=(mint& lhs, const mint& rhs) {
		lhs.n = (lhs.n * (~rhs).n) % mod;
		return lhs;
	}
	friend mint operator+(const mint& lhs, const mint& rhs) {
		return mint(lhs.n + rhs.n);
	}
	friend mint operator-(const mint& lhs, const mint& rhs) {
		return mint(lhs.n - rhs.n);
	}
	friend mint operator*(const mint& lhs, const mint& rhs) {
		return mint(lhs.n * rhs.n);
	}
	friend mint operator/(const mint& lhs, const mint& rhs) {
		return mint(lhs.n * (~rhs).n);
	}
};
istream& operator>>(istream& is, mint& m) { is >> m.n; return is; }
ostream& operator<<(ostream& os, mint& m) { os << m.n; return os; }

mint _pow(mint a, long long n) {
	if(n == 0) return 1;
	mint res = 1;
	mint buf = a;
	while(n > 0) {
		if(n % 2) res *= buf;
		buf *= buf;
		n /= 2;
	}
	return res;
}

int main() {
	using mi = mint;
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	int mx = max({a, b, c}), tmp = 3 * mx - a - b - c;
	if(tmp % 2 == 0) {
		cout << tmp / 2 << endl;
	} else {
		cout << (tmp + 3) / 2 << endl;
	}
	return 0;
}

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


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

int main(){
    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    if(s == "Cloudy") cout << "Rainy" << endl;
if(s == "Rainy") cout << "Sunny" << endl;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;
const int M=1e9 + 7;

int32_t main()
{
	IOS;
	//memset(dp,-1,sizeof(dp));	
	int T;
	T = 1;
	while(T--)
	{
		long double a;
		long double b;
		cin >> a >> b;
		long double f = a*b;
		cout << (int)f;
	}
}


Measured memory_bytes: 3748
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int t,y,ans,mem;
    char sign;
    while(scanf("%d%d",&t,&y),t + y)
    {
        int field[510][510] = {0};
        ans = 0;
        scanf("%c",&sign);
        for(int i = 0; i < t; i++)
        {
            for(int j = 0; j < y + 1; j++)
            {
                scanf("%c",&sign);
                if(sign == '*')field[j][i] = -1;
            }
        }//ok
        for(int i = 0; i < y; i++)
        {
            for(int j = 0; j < t; j++)
            {
                if(j == 0 && field[i][j] != -1)field[i][j] = 1;
                else if(field[i][j - 1] == -1)field[i][j] = 1;
                else if(field[i][j] == 0)field[i][j] = field[i][j - 1] + 1;
            }
        }
        /*for(int i = 0; i < y; i++)
        {
            for(int j = 0; j < t; j++)
            {
                printf("%3d",field[j][i]);
            }
            printf("\n");
        }*/
        for(int i = 0; i < t; i++)
        {
            for(int j = 0; j < y; j++)
            {
                mem = field[j][i];
                for(int k = 0; k < j + 1; k++)
                {
                    if(field[j - k][i] == -1)break;
                    if(mem > field[j - k][i])mem = field[j - k][i];
                    ans = max(ans,mem * (k + 1));
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
ll q[N],ans[N];
int n,Q,top;
ll cnt[N];
int main(){
	scanf("%d%d",&n,&Q);
	q[++top]=n;
	for (int i=1;i<=Q;i++){
		ll x; scanf("%lld",&x);
		for (;q[top]>=x;top--);
		q[++top]=x;
	}
	cnt[top]=1;
	for (int i=top;i>1;i--){
		if (!cnt[i]) continue;
		ll tmp=q[i];
		for (;tmp>q[1];){
			int l=1,r=i-1,ans;
			while (l<=r){
				int mid=(l+r)/2;
				if (q[mid]<=tmp)
					ans=mid,l=mid+1;
				else r=mid-1;
			}
			cnt[ans]+=tmp/q[ans]*cnt[i];
			tmp%=q[ans];
		}
		ans[tmp]+=cnt[i];
	}
	ans[q[1]]+=cnt[1];
	for (int i=n;i;i--)
		ans[i]+=ans[i+1];
	for (int i=1;i<=n;i++)
		printf("%lld\n",ans[i]);
}

Measured memory_bytes: 4096
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<(a+b-1)/b<<endl;
}


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

public class Main {

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

		int array[] = new int[3];
		array[0] = a;
		array[1] = b;
		array[2] = c;

		Arrays.sort(array);

		System.out.println(array[0]+" "+array[1]+" "+array[2]);




	}

}



Measured memory_bytes: 26180
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
#include<stack>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

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

int main(void){
  stack<int> st1;
  stack<int> st2;
  
  int n ;
  cin>>n;
  bool ans;
  rep(j,n){
    ans = false;
    st1.push(0);
    st2.push(0);
    rep(i,10){
      int inp;
      
      cin>>inp;

      if(st1.top()<inp){
	st1.push(inp);
      }else if(st2.top()<inp){
	st2.push(inp);
      }else{
	ans= true;
      }

    }
  if(!ans)cout<<"YES";
  else cout<<"NO";
  cout<<endl;
  }

}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#include <string>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);


vector<ll>vec;ll n;
void f(ll x)
{
    if (x > n) { return; }
    vec.push_back(x);
    f((10 * x) + 3);
    f((10 * x) + 5);
    f((10 * x) + 7);
}
int main()
{
    cin >> n;
    ll ans = 0;
f(0);
    for (auto k : vec)
    {
        bool san = false, go = false, nana = false;
        std::string s = to_string(k);
        for (auto ch : s)
        {
            if (ch == '3') { san = true; }
            if (ch == '7') { nana = true; }
            if (ch == '5') { go = true; }
        }
	if(san&&go&&nana){
++ans;
	}
    }
    cout<<ans<<endl;
    return 0;
}
// https://atcoder.jp/contests/abc167/submissions/13086283
/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 3780
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))


def factorial(n):
    ret = 1
    for i in range(1, n + 1):
        ret = ret * i % MOD
    return ret


if abs(N - M) >= 2:
    print(0)
    exit()
if abs(N - M) == 1:
    a = factorial(N) % MOD * factorial(M) % MOD
else:
    a = factorial(N) % MOD * factorial(M) % MOD * 2 % MOD

print(a)


Measured memory_bytes: 13676