akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> p(n), r(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
    --p[i];
    r[p[i]] = i;
  }
  vector<int> L(n), R(n);
  L[0] = 1;
  for (int i = 1; i < n; ++i) {
    if (r[i - 1] < r[i]) {
      L[i] = L[i - 1] + 1;
    } else {
      L[i] = 1;
    }
  }
  R[n - 1] = 1;
  for (int i = n - 2; i >= 0; --i) {
    if (r[i + 1] > r[i]) {
      R[i] = R[i + 1] + 1;
    } else {
      R[i] = 1;
    }
  }
  // for (int i = 0; i < n; ++i) {
  //   trace(i, L[i], R[i]);
  // }
  int ret = min(n - L[n - 1], n - R[0]);
  // trace(ret);
  for (int i = 1; i < n; ++i) {
    if (r[i - 1] > r[i]) continue;
    // trace(i, (i - L[i - 1]), (n - i - R[i]));
    ret = min(ret, (i - L[i - 1]) + (n - i - R[i]));
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 3456
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ret = "";
  for (int i = 0; i < n; i++) {
    ret += s[i];
    ret += t[i];
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#define ENABLE_DEBUG 1
// hidden common codes{{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    lint a=input,b=input;
    std::cout<<std::max(a-2*b,0ll)<<'\n';
}


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

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

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

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

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

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

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n;
double x[300], y[300];

signed main() {
	while (1) {
		cin >> n;
		if (n==0) break;
		rep(i,n) cin >> x[i] >> y[i];
		
		int res = 1;
		// 2点に接する円のみ考える
		rep(i,n) reps(j,i+1,n) {
			double d = sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
			if (d>2) continue;
			P I = P(x[i],y[i]), J = P(x[j],y[j]), C = (I+J)/2.0;
			double l = sqrt(1. - abs(I-C)*abs(I-C));
			P HA = P(I-J) * P(0,1), HB = P(I-J) * P(0,-1);
			HA /= abs(HA), HA *= l;
			HB /= abs(HB), HB *= l;
			double xi = (C+HA).real(), yi = (C+HA).imag(), xj = (C+HB).real(), yj = (C+HB).imag();
			int t = 0;
			rep(k,n) if (sqrt((xi-x[k])*(xi-x[k]) + (yi-y[k])*(yi-y[k]))<=1+eps) t++;
			chmax(res,t);
			t = 0;
			rep(k,n) if (sqrt((xj-x[k])*(xj-x[k]) + (yj-y[k])*(yj-y[k]))<=1+eps) t++;
			chmax(res,t);
		}
		cout << res << ln;
	}
}


Measured memory_bytes: 3236
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define Fast_cin ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, a, b) for(register int i = a; i <= b; i++)
#define per(i, a, b) for(register int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long double lb;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') fu = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if(x < 0) putchar('-'), x = -x;
    if(x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

int a, b;

int main() {
    cin >> a >> b;
    if(a <= 9 && b <= 9) cout << a * b << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

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

    int a, b;
    cin >> a >> b;
    if(a - 2 * b > 0)
        cout << a - 2 * b;
    else
        cout << 0;
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

class Data{
public:
	int id;
	int h;
	Data(int _id,int _h){
		id=_id;h=_h;
	}
	bool operator < (const Data &o) const{
		return h < o.h;
	}
};
typedef priority_queue<Data> PQ;
int main(){
	int d;
	while(cin>>d&&d){
		PQ pq;
		for(int p,d1,d2;d--;){
			cin>>p>>d1>>d2;
			pq.push(Data(p,d1+d2));
		}
		cout<<pq.top().id<<" "<<pq.top().h<<endl;
	}
}

Measured memory_bytes: 1112
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    mod = 998244353
    
    N = int(input())
    robot = [tuple(map(int, input().split())) for _ in range(N)]
    robot.sort()

    stack = []
    dp = [1] * (N+1)
    for i in reversed(range(N)):
        x, d = robot[i]
        while stack and robot[stack[-1]][0] < x + d:
            stack.pop()
        if stack:
            dp[i] = dp[i+1] + dp[stack[-1]]
        else:
            dp[i] = dp[i+1] + 1
        dp[i] %= mod
        stack.append(i)
    
    print(dp[0])

main()

Measured memory_bytes: 42728
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}


//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll S, W; cin >> S >> W;
	if (W >= S) cout << "unsafe" << endl;
	else cout << "safe" << endl;
}

Measured memory_bytes: 11020
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <math.h>

using namespace std;
typedef complex<double> Complex;

static const double E = 0.0000000001;

inline bool check_collision_rectangle(const Complex p11, const Complex p12, const Complex p21, const Complex p22) {
  return min(p11.real(), p12.real()) <= max(p21.real(), p22.real()) &&
         max(p11.real(), p12.real()) >= min(p21.real(), p22.real()) &&
         min(p11.imag(), p12.imag()) <= max(p21.imag(), p22.imag()) &&
         max(p11.imag(), p12.imag()) >= min(p21.imag(), p22.imag());
}

inline double ccw(const Complex vect1, const Complex vect2) {
  return vect1.real() * vect2.imag() - vect2.real() * vect1.imag();
}

inline double ccw3(const Complex s, const Complex e1, const Complex e2) {
  return ccw(e1 - s, e2 - s);
}

inline bool check_parallel_line(const Complex s1, const Complex e1, const Complex s2, const Complex e2) {
  Complex vect1 = e1 - s1;
  Complex vect2 = e2 - s2;
  return fabs(vect1.real() * vect2.imag() - vect2.real() * vect1.imag()) < E;
}

inline bool check_intersection_segment(const Complex s1, const Complex e1, const Complex s2, const Complex e2) {
  if (!check_collision_rectangle(s1, e1, s2, e2)) { return false; }
  if (ccw3(s1, e1, s2) * ccw3(s1, e1, e2) > 0 || ccw3(s2, e2, s1) * ccw3(s2, e2, e1) > 0) { return false; }
  return !check_parallel_line(s1, e1, s2, e2);
}

inline Complex intersection_line(const Complex s1, const Complex e1, const Complex s2, const Complex e2) {
  Complex vect1 = e1 - s1;
  Complex vect2 = e2 - s2;
  Complex vertex1 = s1;
  Complex vertex2 = s2;
  double a = vect1.imag();
  double b = -vect1.real();
  double c = vertex1.imag() * vect1.real() - vertex1.real() * vect1.imag();
  double d = vect2.imag();
  double e = -vect2.real();
  double f = vertex2.imag() * vect2.real() - vertex2.real() * vect2.imag();
  assert(fabs(a * e - b * d) > E && fabs(b * d - a * e) > E);
  return Complex((b * f - c * e) / (a * e - b * d), (a * f - c * d) / (b * d - a * e));
}

Complex start[100];
Complex end[100];
Complex points[100];

int main() {
  int n;
  while (scanf("%d", &n), n != 0) {
    for (int i = 0; i < n; i++) {
      int a, b, c, d;
      scanf("%d %d %d %d", &a, &b, &c, &d);
      start[i] = Complex(a, b);
      end[i] = Complex(c, d);
    }
    int ans = 1;
    for (int i = 0; i < n; i++) {
      ans++;
      int m = 0;
      for (int j = 0; j < i; j++) {
        if (!check_intersection_segment(start[i], end[i], start[j], end[j])) { continue; }
        Complex p = intersection_line(start[i], end[i], start[j], end[j]);
        if (fabs(100.0 - fabs(p.real())) < E || fabs(100.0 - fabs(p.imag()))< E) { continue; }
        for (int k = 0; k < m; k++) {
          if (abs(p - points[k]) < E) { goto next; }
        }
        ans++;
        points[m] = p;
        m++;
next:
        ;
      }
    }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 896
import sys
import os
sys.setrecursionlimit(100000000)

def lcm(x,y):
    return (x*y)//gcd(x,y)

def gcd(x,y):
    if y <= 0:
        return x
    else:
        return gcd(y,x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T[0])
    sys.exit()

ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)


Measured memory_bytes: 3064
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;

int main() {
	speed;
	int a, b;
	int ans = 0;
	bool flg = false;
	cin >> a >> b;
	rep(i, 1000000000) {
		if (abs(a - i) == abs(b - i)) {
			flg = true;
			ans = i;
			break;
		}
	}
	if (flg) {
		c(ans);
	}
	else {
		c("IMPOSSIBLE");
	}
	ed;
	return 0; 
}



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


int main(){
int n;cin>>n;
int ct=0,sol=0;
vector<int> v(n);
for(int i=0;i<n;i++)
  cin>>v[i];
for(int i=0;i<n-1;i++){
    if(v[i]-v[i+1]>=0)
        ct++;
    else{
        sol=max(ct,sol);
    //    out i<<" "<<c<<endl;
        ct=0;
    }
}
sol=max(ct,sol);
cout<<sol<<endl;
}


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

int main() {
	int N;
	while (~scanf("%d", &N)) {
		vector<int> A(N);
		for (int i = 0; i < N; ++ i)
			scanf("%d", &A[i]);
		long long sum = 0;
		map<long long, int> cnt;
		long long ans = 0;
		for (int a : A) {
			++ cnt[sum];
			sum += a;
			ans += cnt[sum];
		}
		printf("%lld\n", ans);
	}
}


Measured memory_bytes: 13568
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n; cin >> n;
  cout << "ABC" << n << endl;
  
  
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int maxn = 2e5+10;
const LL inf = 1e15;
int n;
LL a[maxn], sum[maxn];
LL ans = inf;
int main () {
    scanf ("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf ("%lld", &a[i]);
        sum[i] = sum[i-1] + a[i];
        //printf ("%lld\n", sum[i]);
    }
    for (int i = 1; i <= n-1; i++) {
        ans = min (ans, abs (sum[n]-2*sum[i]));
    }
    printf ("%lld\n", ans);
}


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

typedef long long ll;

int main(){
    while(true){
        ll a,b;
        cin >> a >> b;
        if(a+b==0) break;
        ll th, fiv, hun;
        a=b-a;
        th=a/1000;
        a%=1000;
        fiv=a/500;
        a%=500;
        hun=a/100;
        
        cout << hun << " " << fiv << " " << th << "\n";
    }
    
    
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N;
	vector<int> l;

	cin >> N;
	for (int i = 0; i < 2 * N; i++) {
		int tmp;
		cin >> tmp;
		l.push_back(tmp);
	}

	int num = 0;
	for (unsigned int i = 0; i < l.size(); i+=2)
		num += l[i+1] - l[i] + 1;

	cout << num << endl;

	return 0;
}

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

double dp[3000][3000];
int N;
double a[3000];

int main() {
    int N; cin >> N;
    for(int i=0;i<N;++i) cin >> a[i];
    dp[0][0] = 1.0;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            dp[i+1][j+1] += dp[i][j] * a[i];
            dp[i+1][j] += dp[i][j] * (1-a[i]);
        }
    }
    double ans = 0.0;
    for(int i = N; i >= N/2+1; --i) ans += dp[N][i];
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 70528
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main()

{
    FILE *in = stdin;
    int n, k;
    fscanf(in, "%d %d\n", &n, &k);
    //printf("%d,%d\n", n, k);

    char tmp[51];
    fscanf(in, "%s", tmp);

    tmp[k - 1] = tolower(tmp[k - 1]);
  puts(tmp);
    return 0;
}

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

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

	int n, m, x;
	cin >> n >> m >> x;

	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m));

	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	}

	int ans = 1e9;
	for (int q = 0; q < (1 << n); q++) {
		int cnts[15] = {};
		int cur = 0;

		for (int i = 0; i < n; i++) {
			if ((1 << i) & q) {
				cur += c[i];
				for (int j = 0; j < m; j++)
					cnts[j] += a[i][j];
			}
		}

		for (int j = 0; j < m; j++)
			if (cnts[j] < x) cur = 1e9;

		ans = min(ans, cur);
	}

	if (ans == 1e9) ans = -1;
	cout << ans << endl;
}

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

using namespace std;

signed main(){
	int n;
	cin >> n;
	vector<int> A(n);
	for(int i = 0; i < n; ++i)
		cin >> A[i];
	
	// 10^9が10^5個続いた時とかにintだとオーバーフローする
	vector<long> S(n + 1, 0);
	for(int i = 0; i < n; ++i)
		S[i + 1] = S[i] + A[i];
	
	// (値, 個数)を持つようにする
	map<long, int> m;
	for(int i = 0; i < n + 1; ++i)
		++m[S[i]];

	long ans = 0;
	for(auto& x : m){
		long value = x.second;
		long pat = value * (value - 1) / 2;
		ans += pat;
	}
	cout << ans << endl;
}


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

using ll = long long;
using P = pair<int, int>;
#define reps(i,n) for (int i=1; i<=n; i++)
#define zarray(x,n) x[n+1]; reps(i,n) {x[i]=0;} 
#define zarray2(x,n,m) x[n+1][m+1]; reps(i,n) { reps(j,m) {x[i][j]=0;}}

const ll l10_9 = 10L*10L*10L*10L*10L *10L*10L*10L*10L;
//const ll l10_9 = 10L;

bool over(ll a, ll b) {
    ll a5 = a*a*a*a*a;
    ll b5 = b*b*b*b*b;
    //cerr << a << "," << b << " - " << a5 - b5 << "," << a5 + b5 << "," << -a5 + b5 << "," <<  -a5 - b5 << " > " << l10_9 << endl;
    return (abs(a5 - b5) > l10_9 && abs(a5 + b5) > l10_9);
}

int main() {
    int x = 0;
    cin >> x;
    //cerr << x << endl;

    ll a=0;
    ll b=0;
    while (!over(a,a-1)) {
        ll a5 = a*a*a*a*a;
        while (!over(b,b-1)) {
            ll b5 = b*b*b*b*b;
            //cerr << a << "," << b << " - " << a5 - b5 << "," << a5 + b5 << "=" << x << endl;
            if (a5 - b5 == x) {
                goto exit;
            }
            if (a5 + b5 == x) {
                b = -b;
                goto exit;
            }
            if (-a5 - b5 == x) {
                a = -a;
                goto exit;
            }
            if (-a5 + b5 == x) {
                a = -a; b = -b;
                goto exit;
            }
            b++;
        }
        b = 0;
        a++;
    }
    exit:
    cout << a << " " << b << endl;
}


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


int main() {

  int h, w;
  cin >> h >> w;
  vector<vector<char>> c ((h+1), vector<char>(w+1));
  for (int i=1; i<=h; i++){
    for (int j=1; j<=w; j++){
      cin >> c.at(i).at(j);
    }
  }
  for (int i=1; i<=h*2; i++){
    for (int j=1; j<=w; j++){
      cout << c.at((i+1)/2).at(j);
      if (j==w)
        cout << endl;
    }
  } 

  
  return 0;
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()
a = []
for i in range(len(x)):
   a.append(int(x[i]))
num = 3
if a[0] ==a[2] or a[1] ==a[0] or a[2]==a[1]:num=2
if a[0] ==a[2] and a[1] == a[2]: print(1)
else: print(num)


Measured memory_bytes: 5136
def dec2bin(n, base=10):
    s = format(n,'b')
    s = "0"*(10-len(s))+s
    return s
 
x=[[0]*50 for i in range(11)]
for i in range(0, 2**10):
    B = dec2bin(i)
    s = 0
    c = B.count("1")
    j = 0
    for e in B:
        if e=="1": s+=j
        j+=1
    x[c][s]+=1

while 1:
    n, s=map(int, raw_input().split())
    if n==0 and s==0: break
    if s>=50: print 0
    else: print x[n][s]

Measured memory_bytes: 4260
n,m = map(int,input().split())
A = [[0 for i in range(m)] for j in range(n)]
b = []
for i in range(n):
    line = input().split()
    for j in range(m):
        A[i][j] = int(line[j])
for i in range(m):
    b.append(int(input()))
for i in range(n):
    sumn = 0
    for j in range(m):
        sumn += A[i][j]*b[j]
    print(sumn)
    


Measured memory_bytes: 6000
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define fi first
#define se second
#define int long long
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 100010;
const int INF = 1e12;

struct edge{
    int to, cost;
};

int n, m, r, q;
int d[11][100110];
vector<edge> G[100110];

void dijkstra(int s){
    rep(i, 0, n + 100) d[s][i] = INF;
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0, s + MAX_N));
    d[s][s + MAX_N] = 0;
    while(!q.empty()){
        P p = q.top(); q.pop();
        int pos = p.se;
        int cost = p.fi;
        if(cost > d[s][pos]) continue;
        rep(i, 0, G[pos].size()){
            edge e = G[pos][i];
            int next = e.to;
            int newCost = e.cost + cost;
            if(newCost < d[s][next]){
                d[s][next] = newCost;
                q.push(P(newCost, next));
            }
        }
    }
}

signed main(){
    cin >> n >> m >> r >> q;
    rep(i, 0, m){
        int a, b, c;
        cin >> a >> b >> c;
        G[b]. push_back((edge){a, c});
    }
    rep(i, 1, n + 1){
        G[MAX_N + i % r]. push_back((edge){i, 0});
    }
    rep(i, 0, r) dijkstra(i);
    // rep(i, 0, r){
    //     rep(j, 1, n + 1){
    //         cout << d[i][j] << " ";
    //     }
    //     cout << endl;
    //     cout << endl;
    // }
    int ans = 0;
    rep(i, 0, q){
        int x, y, z;
        cin >> x >> y >> z;
        int MIN = 1e12;
        rep(j, 0, r){
            MIN = min(MIN, d[j][x] + d[j][y]);
        }
        // cout << MIN << endl;
        if(MIN < z) ans += z - MIN;
    }
    cout << ans << endl;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    cout << min(9, n) + min(900, max(0, n - 99)) + min(90000, max(0, n - 9999)) << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define int long long
#define ve vector<int>
#define mod 1000000007
#define eb emplace_back
#define inf ((long long) 1e18 )
#define all(x) (x).begin(),(x).end()
#define debug(x) cout << '>' << #x << ':' << x << '\n';
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug2(x,y) cout << '>' << #x <<" = "<< x <<" & "<< #y <<" = "<< y << '\n';
#define fileIO freopen("input.txt", "r", stdin); freopen("output2.txt", "w", stdout);
using namespace std;
const int N = 1e6 + 7;

int32_t main()
{
	IOS
#ifndef ONLINE_JUDGE
	fileIO
#endif
	int t;
	t = 1;
	// cin >> t;
	while (t--) {
		int n;
		cin >> n;
		string a;
		cin >> a;

		int i = 0, j = n - 1;
		int ans = 0;
		while (i < j) {
			if (a[i] == 'R') {
				i += 1;
				continue ;
			}
			if (a[j] == 'W') {
				j -= 1;
				continue ;
			}
			ans += 1;
			i += 1;
			j -= 1;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr(i, n) for (int i = 0; i < (int)n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef long double ld;

const ll INF = 2e18 + 10;
const ld PI = acos(-1);
const ld EPS = 1e-9;
const int M = 1e8;
const int N = 2e5 + 10;

struct pt {
    ll x, y, y1;
} a[N];

vector <pt> b;

void transf(int n, ll &x1, ll &y1, ll &x2, ll &y2) {
    if (x2 < x1) {
        swap(x1, x2);
        swap(y1, y2);
    }

    if (y2 < y1) {
        fr(i, n)
            a[i].y = M - a[i].y;
        y1 = M - y1;
        y2 = M - y2;
    }
}

bool cmpx(pt a, pt b) {
    return a.x < b.x;
}

ll t[4 * N];

ll get(int v, int tl, int tr, int l, int r) {
    if (tl > r || tr < l) return 0;
    if (l <= tl && tr <= r) return t[v];
    int tm = (tl + tr) / 2;
    return max(get(2 * v, tl, tm, l, r), get(2 * v + 1, tm + 1, tr, l, r));
}

void upd(int v, int tl, int tr, int pos, ll val) {
    if (tl == tr) {
        t[v] = val;
        return;
    }
    int tm = (tl + tr) / 2;
    if (pos <= tm)
        upd(2 * v, tl, tm, pos, val);
    else
        upd(2 * v + 1, tm + 1, tr, pos, val);
    t[v] = max(t[2 * v], t[2 * v + 1]);
}

int main()  {
    //freopen("a.in", "r", stdin);
    ll x1, y1, x2, y2;
    int n;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> n;
    fr(i, n) {
        int tx, ty;
        scanf("%d %d", &tx, &ty);
        a[i].x = tx;
        a[i].y = ty;
    }

    transf(n, x1, y1, x2, y2);

    fr(i, n)
        if (x1 <= a[i].x && a[i].x <= x2 && y1 <= a[i].y && a[i].y <= y2)
            b.pb(a[i]);
    n = b.size();
    fr(i, n)
        a[i] = b[i];

    if (x1 == x2) {
        ld ans = 0;
        assert(n <= 1);
        if (n)
            ans = 100ll * (y2 - y1) - 20 + PI * 10;
        else
            ans = 100ll * (y2 - y1);
        cout << fixed << setprecision(15) << ans;
        return 0;
    }

    if (y1 == y2) {
        ld ans = 0;
        assert(n <= 1);
        if (n)
            ans = 100ll * (x2 - x1) - 20 + PI * 10;
        else
            ans = 100ll * (x2 - x1);
        cout << fixed << setprecision(15) << ans;
        return 0;
    }

    sort(a, a + n, cmpx);

    vector <ll> ys;
    fr(i, n)
        ys.pb(a[i].y);
    sort(ys.begin(), ys.end());
    map <ll, int> mys;
    fr(i, ys.size()) {
        mys[ys[i]] = i;
    }
    fr(i, n)
        a[i].y1 = mys[a[i].y];

    fr(i, n) {
        //cout << a[i].y1 << endl;
        ll val = get(1, 0, n - 1, 0, a[i].y1);
        upd(1, 0, n - 1, a[i].y1, val + 1);
    }

    ll anscnt = get(1, 0, n - 1, 0, n - 1);

    ld ans = (y2 - y1 + x2 - x1) * 100ll;
    ans -= 20 * anscnt;
    ans += PI * 5 * anscnt;

    bool bad = true;
    fr(i, n - 1)
        if (a[i + 1].y < a[i].y)
            bad = false;

    assert(y2 > y1);
    assert(n <= min(y2 - y1, x2 - x1) + 1);

    if (n == min(y2 - y1, x2 - x1) + 1 && bad) {
        ans += (PI * 5);
        //cout << "!" << endl;
    }
    cout << fixed << setprecision(15) << ans;
}




Measured memory_bytes: 31340
/*
ID: iCoder0020
PROG: Knapsack 2
LANG: C++                  
*/

#include <bits/stdc++.h>

using namespace std;

#define int long long

#define w(n) info[n].first
#define v(n) info[n].second

#define N_MAX 1e5+1
#define INF 1e9+5

int32_t main()
{
	int N,W;
	cin>>N>>W;
	vector<int>dp (N_MAX, INF);
	pair<int, int> info[N];
	dp[0] = 0;
	for(int n = 0; n<N; n++)
	{
		cin>>w(n)>>v(n);
		for(int j = N_MAX-v(n); j>=0; j--)
			dp[v(n)+j] = min(dp[v(n)+j], w(n) + dp[j]);
	}
	int ans = 0;
	for(int n = 0; n<N_MAX; n++)
		if(dp[n] <= W)
			ans = n;
	cout<<ans<<endl;
	return 0;	
}

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

int main() {
  int N, S, M;
  cin >> N;
  M = N;
  for (int i = 0; i < M; i++) {
    if (N / 10 != 0) {
      S += (N % 10);
      N /= 10;
    }
    else {
      S += N;
      break;
    }
  }
  if (M % S == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long A[200005]={0};
long long B[200005]={0};
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1; i<=n; i++) cin>>A[i];
	for(int i=1; i<=m; i++) cin>>B[i];
	for(int i=1; i<=n; i++) A[i]+=A[i-1];
	for(int i=1; i<=m; i++) B[i]+=B[i-1];
	long long ret = 0;
	for(int i=0; i<=n; i++){
		if(A[i]>k) break;
		long long read = i;
		read+=(upper_bound(B+1,B+m+1,k-A[i])-B-1);
		ret = max(ret,read);
	}
	cout<<ret;
}

Measured memory_bytes: 6732
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[29];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++) cin>>f[b];
	for(b=2; b<a; b++){
		if(f[b]>min(f[b-1],min(f[b],f[b+1]))&&f[b]<max(f[b-1],max(f[b],f[b+1]))) c++;
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string s;cin>>s;
  	for(int i=0;i<s.size()-1;i++){
    	if(s.substr(i,2)=="AC"){ cout<<"Yes"<<endl;return 0;}
    }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
// ここからトピック10
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d float64
	fmt.Scan(&a, &b, &c, &d)
	fmt.Println(math.Sqrt(math.Pow((a-c), 2) + math.Pow((b-d), 2)))
}


Measured memory_bytes: 1184
import sys
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    monsters = list(map(int, input().split()))
    heroes = list(map(int, input().split()))

    defeated = 0

    for i in reversed(range(len(heroes))):
        if heroes[i] == 0:
            continue

        for _ in [1, 0]:
            if monsters[i+_] >= heroes[i]:
                defeated += heroes[i]
                monsters[i+_] -= heroes[i]
                heroes[i] = 0
            elif monsters[i+_] < heroes[i]:
                defeated += monsters[i+_]
                heroes[i] -= monsters[i+_]
                monsters[i+_] = 0

    print(defeated)


if __name__ == '__main__':
    main()



Measured memory_bytes: 19516
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<time.h>
#include<typeinfo>
#include <cstdlib>
#include<stdio.h>

using namespace std;

#define ll long long
#define MOD 1000000007

int main(){
	int n,k;
	cin >> n >> k;
	double ans = 0.0;
	for(int dice = 1;dice <= n;dice++){
		int now = dice;
		int count = 0;
		double s = 1.0;
		while(true){
			if(now >= k)break;
			now*=2;//コインを振る
			s/=2.0;
		}
		ans += s;
		// cout << s << endl;
	}
	ans /= n;
	printf("%.10lf",ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, K;
  cin >> N >> K;
  long ans = 0;
  for (long b = 1; b <= N; b++) {
    long foo = N / b;
    // 3 で割ると 0, 1, 2
    ans += max(b - K, 0l) * foo;

    long bar = N % b;
    // 100 % 3 は 1
    ans += max(bar - K + 1, 0l);
  }
  // 0が含まれてるので調整する
  if (K == 0) ans -= N;
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import Data.List
import qualified Data.Vector.Unboxed as V
readIntPair :: B.ByteString -> (Int,Int)
readIntPair s = p
    where
    Just p = do
        (n1, s') <- B.readInt s
        (n2, _ ) <- B.readInt (B.tail s')
        return (n1,n2)

main :: IO ()
main = do
    (_,w_limit) <- fmap readIntPair B.getLine
    items <- fmap (map readIntPair . B.lines) B.getContents 
    let v_end = V.maximum $ foldl' step s0 items
        step :: V.Vector Int -> (Int, Int) -> V.Vector Int
        step tbl (wi, vi) = tbl'
            where
            tbl' = V.generate (w_limit+1) $ \i -> 
                    max (tbl V.! i) (if i >= wi then tbl V.! (i - wi) + vi else 0)
        s0 = V.generate (w_limit+1) $ \_ -> 0
    print (v_end :: Int)
    


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

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

    string S; cin >> S;
    int ans0 = 0, ans1 = 0;
    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == S[i]-'0')
            ans1++;
        else
            ans0++;
    }
    cout << min(ans0, ans1) << "\n";
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  lb r;cin>>r;

  out(fixed<<setprecision(10)<<M_PI*r*r<<" "<<2*M_PI*r);


  return 0;
}



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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int t = Integer.parseInt(sl[2]);

    System.out.println(b * (t / a));


  }

}


Measured memory_bytes: 23124
mozi={"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000}
while True:
    try:
        N = list(input())
    except:
        break
    ans = i = 0
    while i < len(N):
        if i+1 < len(N) and mozi[N[i]] < mozi[N[i+1]]:
            ans += mozi[N[i+1]] - mozi[N[i]]
            i += 1
        else: ans += mozi[N[i]]
        i += 1
    print(ans)


Measured memory_bytes: 5556
*v,i,s,p,t,D,d[4],O,o[];C(x,q,y){q=o[q]-43;x+=q?q-2?0:-y:y;return-~q?x:x*y;}main(w,x,y,z){for(;~scanf("%d%d%d%d",&w,&x,&y,&z)&&w+x+y+z;puts("0"))for(v=&w,D=256;D--;){for(s=i=0,p=1;i<4;d[i++]=v[t])s+=t=D>>i*2&3,p*=t+1;for(O=27;s==6&&p==24&&O--;printf(C(C(C(*d,0,d[1]),1,d[2]),2,d[3])-10?C(C(*d,0,d[1]),1,C(d[2],2,d[3]))-10?"":"(%d%c%d)%c(%d%c%d)\n":"((%d%c%d)%c%d)%c%d\n",*d,*o,d[1],o[1],d[2],o[2],d[3])&&main())for(t=O,i=3;i--;t/=3)o[i]="+-*"[t%3];}exit(0);}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main()
{
	int n;
	int mochi;
	int backet[101] = {0};
	int ans = 0;
	
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> mochi;
		backet[mochi]++;
	}
	
	for (int i = 0; i < 101; i++) {
		if (backet[i] > 0) {
			ans++;
		}
	}
	
	cout << ans << endl;
	
	return (0);
}

Measured memory_bytes: 256
from fractions import gcd

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

n = gcd(N, M)
# print(n)

if n == 1:
    print(1)
else:
    ans = 1

    
    for i in range(2, int(gcd(N, M)**0.5)+1):
        flag = 0
        # print("i", i)
        # print("n", n)
        if n%i == 0:
            while n%i == 0:
                n //= i
                # print(n)
            flag = 1
        # print("n", n)
        ans += flag

    print(ans if n == 1 else ans+1)

Measured memory_bytes: 5556
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
int main() {
    int A,B,C;
    ios::sync_with_stdio(false);
    cin>>A>>B>>C;
    int temp_A = A;
    A = B;
    B = temp_A;
    temp_A = A;
    A = C;
    C = temp_A;
    cout<<A<<" "<<B<<" "<<C<<endl;


    return 0;
}


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

void Main()
{
	int N;
	cin >> N;
	double denominator = 0;
	for (int i = 0; i < N; i++) {
		double A;
		cin >> A;
		denominator += 1 / A;
	}

	cout << setprecision(16) << 1 / denominator;
}
 
int main()
{
	Main();
	return 0;
}



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

typedef long long ll;

const int maxn = 1e5 + 5, maxh = 1e4 + 5;

int main(int argc, const char * argv[])
{
    ll n, k, h[maxn], dp[maxn] = {0};
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        scanf("%lld", &h[i]);

    for (int i = 2; i <= n; i++) {
        dp[i] = maxn * maxh;
        for (int j = max(1ll, i - k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
    }

    cout << dp[n] << endl;
    return 0;
}

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

int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int count =0, sum=0;
  for(int a = 0; a <= A; a++){
    for(int b = 0; b <= B; b++){
      for(int c = 0; c <= C; c++){
        sum = 500*a +100*b + 50*c;
        if(sum == X){
        count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
H,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

dp = [[0 for _ in range(N+1)] for _ in range(H+1)]

for h in range(1,H+1):
    dp[h][0] = 10**9

for n in range(1,N+1):
    for h in range(H+1):
        if h >= AB[n-1][0]:
            dp[h][n] = min(dp[h-AB[n-1][0]][n]+AB[n-1][1] , dp[h][n-1])
        else:
            dp[h][n] = dp[h][n-1]

# for i in range(H+1):
#     print(*dp[i])
        
ans = dp[H][N]
for n in range(N):
    for h in range(H):
        if (H-AB[n][0])<=h:
            ans = min(ans,dp[h][N]+AB[n][1])

print(ans)

Measured memory_bytes: 126300
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int  N;
    cin >> N;
    vector<double>u(N);
    double cnt = 0;
    for(int i = 0; i < N; i++) {
        cin >> u[i];
    }
    sort(u.begin(),u.end());
    cnt = u[0];
    for(int i = 1; i < N; i++) {
        cnt+=u[i];
        cnt/=2;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3764
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    rep(i, n){
        ll a;
        cin >> a;
        ans += (a&1);
    }
    if(ans)cout << "first";
    else cout << "second";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;

int main() {
    int n, num = 0, ans = 0;
    cin >> n;

    for (int i = 0; i <= n; i++) {
        if (i % 2 == 0)continue;
        
        for (int j = 1; j <= i; j++) {
            if (i%j == 0)num++;
        }
        if (num >= 8)ans++;
        num = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple

ll k,l,p,mni;
ld mn = inf;
set<ll> s;
vector<pair<ld, ld>> v;

ld sum(ll x){
ld res=0;
    while(x>0){
        res+=x%10;
        x/=10;
    }
return res;
}

void add(ll x){
ll d[202];
ll p = 1, i = 1;
ll c=0, temp = x;
while(temp>0){
    d[i]=temp%10;
    temp/=10;
    c+=9*p;
    p*=10;
    v.pb({((ld)(temp*p + c) / sum(temp*p +c)), temp*p +c } );
    i++;
}

}


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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

cin >> k;

ll cur = 1;
s.insert(cur);
while(s.size()<k){

v.pb({cur/sum(cur+1) , cur+1 });
add(cur+1);
sort(all(v));
s.insert(v[0].ss);
cur = v[0].ss;
v.clear();
}




for(auto t: s){
    cout << t << endl;
}


return 0;}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    if(a<=b) cout << a << endl;
    else cout << a-1 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  if (N >= M) {
    cout << 0 << endl;
    return 0;
  }
  vector<int>za(M);
  vector<int>length(M - 1);
  for (int i = 0; i < M; i ++) {
    cin >> za.at(i);
  }
  sort(za.begin(), za.end());
  for (int i = 0; i < M - 1; i ++) {
    length.at(i) = za.at(i + 1) - za.at(i);
  }
  sort(length.begin(), length.end());
  int sum = 0;
  for (int i = 0; i < M - N; i ++) {
    sum += length.at(i);
  }
  cout << sum << endl;
}

Measured memory_bytes: 1024
/**
 * THIS IS MOOONI'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>
 
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define LOCAL 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        ans += __gcd(i, __gcd(j, k));
      }
    }
  }
  cout << ans << '\n';
  return 0;
}

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

int main() {
    long long h1, m1, h2, m2, k;
    cin >> h1 >>  m1 >>  h2 >>  m2 >>  k;
    cout << 60 * h2 + m2 - k - 60 * h1 - m1 << endl;
}


Measured memory_bytes: 3636