akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int dfs(string& s, int& idx) {
    vi N;
//    LOG("%s (%d)\n  ->", s.c_str()+idx, idx);
    for (; idx < s.length();) {
        if (s[idx] == '[') {
            idx++;
            N.push_back(dfs(s, idx));
        } else if (s[idx] == ']') {
            idx++;
            SORT(N);
            return accumulate(N.begin(), N.begin()+SZ(N)/2+1, 0);
        } else {
            int n = 0;
            while (isdigit(s[idx])) {
                n *= 10;
                n += s[idx] - '0';
                idx++;
            }
            idx++;
            return n/2+1;
        }
    }
    return N[0];
}

int main() {
    int n;
    cin >> n;
    REP(_i, n) {
        string s;
        cin >> s;
        int idx = 0;
        cout << dfs(s, idx) << endl;
    }
}

Measured memory_bytes: 3200
/***
	chauhan176's code

	Nothing Happens , It's True
***/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define maxn 300005
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;

typedef pair<double,double>pi;
const ll inf = 1e10;//0x3f3f3f3f3f3f3f3fll;//4x10e18
const int maxx = 10000000;
#define PI 3.14159265
int main()
{
    fastio;
    int n;
    cin>>n;
    pi p[n];
    for(int i=0;i<n;i++)
    {
        cin>>p[i].fi>>p[i].se;
    }
    double tot = 0;
    double div = 1;
    double mul=1;
    for(int i=1;i<=n-2;i++)
        mul*=i;
    for(int i=0;i<n;i++)
    {
        div = div*(i+1);
        for(int j=i+1;j<n;j++)
        {
            double f = pow(p[j].se-p[i].se,2);
            double s = pow(p[j].fi-p[i].fi,2);

            tot = tot + (n-1)*2*sqrt(f+s)*mul;
        }
    }
    cout<<fixed<<setprecision(10)<<(tot/div)<<endl;
    return 0;
}


Measured memory_bytes: 256
A, B = input().split()
 
# 方針：少数の計算を避け、整数の範囲で計算する
# [A*B] = [A*(100*B)/100]と見る
# Bを100倍して整数に直す操作は、文字列のまま行う
A = int(A)
B = int(B.replace('.', ''))
 
# 100で割った整数部分を求める操作は、100で割った商を求めることと同じ
ans = (A*B) // 100
print(ans)

Measured memory_bytes: 9164
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int N = Integer.parseInt(in.readLine());

		String[] tokens = in.readLine().split(" ");
		long[] A = new long[N];
		for (int i = 0; i < N; ++i) {
			A[i] = Long.parseLong(tokens[i]);
		}
		Arrays.sort(A);
		BigDecimal result = new BigDecimal(A[0]);
		BigDecimal threshold = new BigDecimal(1000000000000000000L);
		for (int i = 1; i < N; ++i) {
			result = result.multiply(new BigDecimal(A[i]));
			if (result.compareTo(threshold) > 0) {
				System.out.println("-1");
				return;
			}
		}
		System.out.println(result);

	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 53100
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  invar(int, N);
  invar(string, S);
  
  if(N%2==0) {
    for(int i=0; i<N/2; ++i) {
      if(S[i] != S[i+N/2]) {
        fin("No");
        return 0;
      }
    }
    fin("Yes");
  } else {
    fin("No");
  }
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b)    for (int i = (a); i < (b); i++)
#define F0R(i, a)       for (int i = 0; i < (a); i++)
#define FORd(i, a, b)   for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a)      for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)      for (auto& a : x)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<typename T1, typename T2> istream& operator >>(istream& i, pair<T1, T2>& p) {
        i >> p.first >> p.second; return i;
    }
    template<typename T, size_t N> istream& operator >>(istream& i, array<T, N>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
    template<typename T> istream& operator >>(istream& i, vector<T>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
}
using namespace __input;

namespace __output {
    template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& t) {
        return o << "(" << t.first << ", " << t.second << ")";
    }
    template<typename T, size_t N> ostream& operator<<(ostream& o, const array<T, N>& a) {
        o << "["; for (int i = 0; i < N; i++) { if (i) o << ", "; o << a[i]; } return o << "]";
    }
    template<typename T> ostream& operator<<(ostream& o, const vector<T>& v) {
        o << "["; for (int i = 0; i < sz(v); i++) { if (i) o << ", "; o << v[i]; } return o << "]";
    }
}
using namespace __output;

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

    int N;
    cin >> N;

    vi perm(N);
    cin >> perm;

    int ans = 0;
    FOR (i, 1, N - 1) {
        bool ok = (perm[i-1] < perm[i]) == (perm[i] < perm[i+1]);
        ans += ok;
    }
    cout << ans << endl;

    return 0;
}



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

int main(void) {
  int a, city[4];
  bool flag = true;
  for(int i = 0; i < 4; ++i) {
    city[i] = 0;
  }
  for(int i = 0; i < 6; ++i) {
    cin >> a;
    ++city[(a - 1)];
  }
  for(int i = 0; i < 4; ++i) {
    if(city[i] > 2) {
      flag = false;
    }
  }
  cout << (flag ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
import Control.Monad

main = do
  [n,c] <- fmap (map read . words) getLine
  xs <- replicateM n (fmap ((\(x:v:_)->(x,v)) . map read . words) getLine)
  print (solve c xs)


-- MaxState, CurrentState, CurrentX
type State = (Int, (Int, Int))

solve :: Int -> [(Int,Int)] -> Int
solve c xs =
  solveTurn roundR roundL
  where
    roundR = scanl f (0,(0,0)) xs
    roundL = scanr (flip f) (0,(0,0)) [(c-x,v)|(x,v)<-xs]

    f (m,(s,y)) (x,v) = let s' = s-(x-y)+v in (max m s', (s', x))


solveTurn :: [State] -> [State] -> Int
solveTurn ss1 ss2 =
  max (go ss1 ss2 0) (go ss2 ss1 0)
  where
    go :: [State] -> [State] -> Int -> Int
    go [(m1,(s1,x1))]     _                  a = max a m1
    go ((m1,(s1,x1)):tt1) ((m2,(s2,x2)):tt2) a = go tt1 tt2 (max a (s1+m2-x1))

Measured memory_bytes: 237948
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
using ll = long long;
using P = pair<int, int>;

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

  ll ng = -1;
  ll ok = LINF;
  while(abs(ok - ng) > 1){ // O(nlogn)
    ll mid = (ok + ng) / 2;

    vector<int> nxt(n, -1);
    vector<ll> nxt_size(n, -1);
    ll tmp_sum = 0;
    int r = 0;
    for(int l = 0; l < n; ++l){
      while(r < n * 2 && tmp_sum < mid){
        tmp_sum += a[r];
        ++r;
      }

      if(tmp_sum >= mid){
        nxt[l] = r;
        nxt_size[l] = tmp_sum;
      }

      if(l == r)++r;
      else tmp_sum -= a[l];
    }

    bool is_ok = false;
    for(int i = 0; i < n; ++i){
      int ni = nxt[i];
      if(ni == -1)continue;
      if(nxt_size[i] >= total)continue;

      ni %= n;
      int nni = nxt[ni];
      if(nni == -1)continue;

      if(total - nxt_size[i] - nxt_size[ni] >= mid)is_ok = true;
    }

    if(!is_ok)ok = mid;
    else ng = mid;
  }

  cout << ng << endl;

  return 0;
}



Measured memory_bytes: 5588
while True:
    m,f,r=map(int,input().split())

    if m == -1 and f == -1 and r == -1:
        break

    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65 and m + f < 80:
        print('B')
    elif m + f >= 50 and m + f < 65:
        print('C')
    elif m + f >= 30 and m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    elif m + f < 30:
        print('F')
    
    



Measured memory_bytes: 5592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer str = new StringTokenizer(bfr.readLine());
		int n = Integer.parseInt(str.nextToken());
		str = new StringTokenizer(bfr.readLine());
		int[] arr = new int[n + 1];
		HashMap<Integer, Integer> list = new HashMap<Integer, Integer>();

		for (int i = 1; i <= n; i++) {
			int temp = Integer.parseInt(str.nextToken());
			arr[i] = temp;
			if (list.containsKey(temp)) {
				list.replace(temp, list.get(temp) + 1);
			} else {
				list.put(temp, 1);
			}
		}
		long sum = 0;
		for(int temp : list.keySet()) {
			int tmp = list.get(temp);
			sum+=1L*tmp*(tmp-1)/2;
		}
		for (int i = 1; i <= n; i++) {
			int temp = arr[i];
			long answer = sum - (list.get(temp)-1);
			System.out.println(answer);
		}

	}

}


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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

typedef long long ll;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int n, l[N], r[N], len[N];

ll tl, tr, ans;

priority_queue<ll> L;
priority_queue<ll, vector<ll>, greater<ll> > R;

int main () {

	File();

	For (i, 1, n = read()) 
		l[i] = read(), r[i] = read(), len[i] = r[i] - l[i];

	L.push(r[1]); R.push(r[1]);
	For (i, 2, n) {
		tl -= len[i - 1]; tr += len[i];
		ll lp = L.top() + tl, rp = R.top() + tr;
		if (lp <= r[i] && r[i] <= rp) 
			L.push(r[i] - tl), R.push(r[i] - tr);
		else if (r[i] >= lp) {
			ans += r[i] - rp; R.pop(); L.push(rp - tl);
			R.push(r[i] - tr); R.push(r[i] - tr);
		} else {
			ans += lp - r[i]; L.pop(); R.push(lp - tr);
			L.push(r[i] - tl); L.push(r[i] - tl);
		}
	}
	printf ("%lld\n", ans);

	return 0;

}

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    int n;cin>>n;
    int ans = 0;
    repsg(i,1,n+1){
        if(i%2==0)continue;
        int count = 0;
        repsg(j,1,i+1){
            count+= (i%j==0);
        }
        ans += (count==8);
    }
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin >> A >> B;
    if(A>B) swap(A,B);
    if(A==1 && B==2) cout << 3 << endl;
    else if(A==1 && B==3) cout << 2 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
  // top を加算してからその位置へ挿入
  S[++top] = x;
}

int pop() {
  top--;
  // topが指していた要素を返す
  return S[top+1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];

  while( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      b = pop();
      a = pop();
      push(a + b);
    } else if ( s[0] == '-' ) {
      b = pop();
      a = pop();
      push(a - b);
    } else if ( s[0] == '*' ) {
      b = pop();
      a = pop();
      push(a * b);
    } else {
      push(atoi(s));  // atoi()は文字列で表現された数値をint型の数値に変化する
    }                 // C言語の標準ライブラリの関数
  }

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

  return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <bitset>
using namespace std;

#define int long long


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

    vector<int> v(10050);
    for(int x = 1; x < 105; x++) {
        for(int y = 1; y < 105; y++) {
            for(int z = 1; z < 105; z++) {
                int m = x * x + y * y + z * z + x * y + y * z + z * x;
                if(m < 10050) v[m]++;
            }
        }
    }

    for(int i = 1; i <= n; i++) {
        cout << v[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3696
a=int(input())
li = list(map(int,input().split()))

ans = 'NO'

even = []
odd = []

for i in li:
  if i % 2 == 0:
    even.append(i)
  else:
    odd.append(i)

if len(odd) % 2 == 0:
  ans = 'YES'
  
print(ans)

Measured memory_bytes: 14108
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n)  for(int i=0; i<(n); i++)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

//int Counter(int x)
/*int factorial(int n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}*/
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    bool ans=false;
       if(a==b) ans=true;
       if(b==c) ans=true;
       if(a==c) ans=true;
       if(a==b&&b==c) ans=false;
    if(ans==false) cout << "No" << endl;
    else cout << "Yes"  << endl;
}

    



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


int main(){
  long long n,i;
  long long q,h,s,d;
  long long ans=0;
  cin >> q >> h >> s >> d;
  cin >> n;
  long long qh=min(q*2,h);
  long long qhs=min(qh*2,s);
  if(2*qhs<=d){
    ans=qhs*n;
  }else{
    if(n%2==0){
      ans=(n/2)*d;
    }else{
      ans=((n-1)/2)*d+qhs;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int a[1000000];
int main(){
	int n;
	cin>>n>>s;
	s=s+s;
	for(int i=0;i<2;i++)
	for(int j=0;j<2;j++){
		a[0]=i;
		a[1]=j;
		for(int k=2;k<n+2;k++){
			if(s[k-1]=='o'&&a[k-1]==0)
			a[k]=1-a[k-2];
			if(s[k-1]=='o'&&a[k-1]==1)
			a[k]=a[k-2];
			if(s[k-1]=='x'&&a[k-1]==0)
			a[k]=a[k-2];
			if(s[k-1]=='x'&&a[k-1]==1)
			a[k]=1-a[k-2];
		}
		if(a[n]==a[0]&&a[n+1]==a[1]){
			for(int k=0;k<n;k++)
			cout<<(a[k]?'S':'W');
			return 0;
		}
	}
	cout<<-1;
	return 0;
}

Measured memory_bytes: 1052
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(true) {
			int n = scan.nextInt();
			if(n == 0) break;
			int[] incomes = new int[n];
			int sum = 0;
			for(int i = 0; i < n; i++) {
				incomes[i] = scan.nextInt();
				sum += incomes[i];
			}
			int sumBar = sum / n;
			int count = 0;
			for(int i = 0; i < n; i++) {
				if(sumBar >= incomes[i] ) count++;
			}
			System.out.println(count);
		}
		scan.close();
	}
}


Measured memory_bytes: 58708
N,M=map(int,input().split())

if N >= 2*M:
  print(M//2)
  exit()
  
def f(x):
  return max(min(N+x, (M-2*x)//2),0)
  
delta = [-3,-2,-1,0,1,2,3]
x = (M-2*N)//4

ans = 0
for i in range(7):
  x_ = max(0,x+delta[i])
  ans = max(ans,f(x_))

print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[1005][100007];
int solve(int n,int w[],int p[],int W){
	for(int i=0;i<=W;i++)	dp[0][i]=0;
	for(int i=0;i<=n;i++)	dp[i][0]=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=W;j++){
			if(j-w[i]>=0)
				dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]] + p[i]);
			else
				dp[i][j] = dp[i-1][j];
		}
	}	
	return dp[n][W];
}

int32_t main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    #ifdef _WIN32
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
    int t=1;//cin>>t;
    while(t--){
    	int n;cin>>n;
    	int W;cin>>W;
    	int w[n+1],p[n+1];
    	for(int i=1;i<=n;i++)
    		cin>>w[i]>>p[i];
    	// for(int i=1;i<=n;i++)	cin>>p[i];
    	cout<<solve(n,w,p,W);
    	// cout<<endl;
    	// for(int i=1;i<=n;i++){
    	// 	for(int j=0;j<W+1;j++){
    	// 		cout<<dp[i][j]<<" ";
    	// 	}
    	// 	cout<<endl;
    	// }
    }
}

Measured memory_bytes: 80128
import re


def resolve():
    a, b = input().split()
    s = input()
    pattern = "\\d{{{a}}}-\\d{{{b}}}".format(a=a, b=b)
    if re.match(pattern, s):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;



int main() {

	while (true) {
		int n = 0, tmp1 = 0, cnt1 = 0, cnt2 = 0;
		int tmp[210];
		rep(i, 210)tmp[i] = 0;
		bool j = true;
		cin >> n;
		if (n == 0)break;
		rep(i, n) {
			cin >> tmp1;
			tmp[tmp1] = 1;
		}
		tmp[n * 2 + 1] = 2;

		while (cnt1 != n && cnt2 != n) {
			REP(i, 1, n * 2 + 2) {
				if (j) {
					if (tmp[i] == 1) {
						tmp[i] = 2;
						cnt1++;
						j = false;
					}
					if (i == n * 2 + 1)j = false;
					if (cnt1 == n)break;
				}
				else {
					if (tmp[i] == 0) {
						tmp[i] = 2;
						cnt2++;
						j = true;
					}
					if (i == n * 2 + 1)j = true;
					if (cnt2 == n)break;
				}
			}
		}

		cout << n - cnt2 << endl;
		cout << n - cnt1 << endl;
	}

	return 0;
}



Measured memory_bytes: 3060
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w

  def initialize
    @n = gets.to_s.to_i
    @f = Array.new(n){ gets.to_s.split.map{ |v| v.to_i } }
    @p = Array.new(n){ gets.to_s.split.map{ |v| v.to_i } }

    @mask = @f.map{|v|v.join.to_i(2)}
  end

  def solve
    ans = -10**10
    (1<<10).times do |bit|
      next if bit == 0
      x = profit(bit)
      ans = x if ans < x
    end
    ans        
  end

  def profit(bit)
    ans = 0
    n.times do |i|
      cnt = popcount(@mask[i] & bit)
      ans += @p[i][cnt]
    end
    ans
  end

  def show(ans)
    puts ans
  end

  def popcount(x)
    x.to_s(2).count("1")
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14340
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};

const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; 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 comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/
ll H, W, h, w;
ll a = 1e6, b;
void solve(){
  if(H % h == 0 && W % w == 0){
    cout << "No" << endl;
    return;
  }
  cout << "Yes" << endl;
  if(W % w != 0){
    b = -(a * (w-1) + 1);
    vector<ll> A;
    for(ll i = 1; i <= W; i++){
      if(i % w == 0) A.pb(b);
      else A.pb(a);
    }
    rep(i, H){
      rep(j, A.size()){
        cout << A[j];
        if(j + 1 == A.size()) cout << endl;
        else cout << " ";
      }
    }
  }else{
    b = -(a * (h-1)+1);
    vector<ll> A;
    for(ll i = 1; i <= H; i++){
      if(i % h == 0) A.pb(b);
      else A.pb(a);
    }
    rep(i, A.size()){
      rep(j, W){
        cout << A[i];
        if(j + 1 == W) cout << endl;
        else cout << " ";
      }
    }
  }
}

int main(){
  cin >> H >> W >> h >> w;
  solve();
}


Measured memory_bytes: 2432
from sys import stdin
import numpy as np

def main():
    readline = stdin.readline
    n, m, x = map(int, readline().split())
    a = [list(map(int, readline().split())) for _ in range(n)]
    res = []
    for i in range(2 ** n):
        price = 0
        skill = []

        for j in range(n):
            if ((i >> j) & 1):
                price += a[j][0]
                skill.append(a[j][1:])
        np_skill = np.array(skill)
        skill_sum = np.sum(np_skill, axis=0)\
                        if np_skill.shape[0] > 1 else np_skill

        if skill_sum.size != 0 and (skill_sum >= x).all():
            res.append(price)

    if not res: return print('-1')

    return print(min(res))

if __name__ == '__main__':
    main()


Measured memory_bytes: 27424
using System;

namespace C___To_Infinity
{
    class Program
    {
        static void Main (string[] args)
        {
            var s = Console.ReadLine ();
            var k = long.Parse (Console.ReadLine ());
            for (var i = 0; i < k; i++)
            {
                if (s[i] != '1')
                {
                    Console.WriteLine (s[i]);
                    return;
                }
            }
            Console.WriteLine (1);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll>v;
map<ll,ll>cnt;
bool prime(ll n){ 
    for(ll i=2;i<=sqrt(n);i++){ 
        if(n%i==0)return false;
    }
    return true;
}

void fact(ll n){ 
    for(ll i=1;i<=sqrt(n);i++){ 
        if(n%i==0){ 
            cnt[i]++;
            if(i!=sqrt(n))cnt[n/i]++;  
        }
    }
}

int main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll a,b;
    ll ans=0;
    cin>>a>>b;
    fact(a);
    fact(b);
    for(auto &i:cnt){
      if(i.second==2)v.push_back(i.first);
    }
    for(int i=0;i<v.size();i++){ 
        if(prime(v[i])){ 
            ans++;
        }
    }
   
    cout<<ans<<'\n';
    
  
  
  

     
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

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

	int sum=0;
	for (int i = 0; i < n; ++i){
		int a;
		cin>>a;
		if(a>=k)sum++;
	}

	cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 384
##全探索...?
S = input()
T = input()

last = len(S) - len(T) + 1
ans = len(T)

for i in range(last):
    tent = 0
    for j in range(len(T)):
        if(S[i+j] != T[j]):
            tent += 1
    if(tent < ans):
        ans = tent
print(ans)

Measured memory_bytes: 9048
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define INF (int)1e18


auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i.F<<','<<(i).S<<"  ";cerr<<'\n';}


signed main()
{
	// fio
	inp(n)
	inp(m)
	vector<pair<pair<int,int>,int>> a(m);
	fo(i,m)
	{
		cin>>a[i].F.F>>a[i].F.S>>a[i].S;
	}
	sort(all(a));
	set<pair<int,int>> s;
	s.insert({1,0});
	// print(s);
	fo(i,m)
	{
		int l=a[i].F.F;
		int r=a[i].F.S;
		int w=a[i].S;
		auto itr=s.lower_bound(mp(l,(int)0));
		if(itr==s.end())
			continue;
		pair<int,int> curr=*itr;
		int nw=w+curr.S;
		itr=s.lower_bound(mp(r+1,(int)0));
		itr--;
		while((*itr).S>nw)
		{
			auto temp=itr;
			itr--;
			s.erase(temp);
		}
		itr=s.lower_bound(mp(r,(int)0));
		if(itr==s.end() || (*itr).S>nw)
		{
			s.insert({r,nw});
		}
		// print(s);
	}
	auto itr=s.lower_bound(mp(n,(int)0));
	if(itr==s.end())
	{
		cout<<-1<<'\n';
	}
	else
	{
		cout<<(*itr).S<<'\n';
	}
	printclock;
}

Measured memory_bytes: 8704
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while(true)
		{
			try
			{
				long a = sc.nextInt();
				long b = sc.nextInt();
				
				long n = a;
				long m = b;
				while (true)
				{
					long k = m % n;
					if (k == 0) break;
					m = n;
					n = k;
				}
				System.out.print(Long.toString(n) + " ");
				System.out.println(Long.toString(a * b / n));
			}
			catch (Exception e)
			{
				break;
			}
		}
	}
}

Measured memory_bytes: 12000
n ,x = map(int, input().split())
B=[1]
P=[1]
for i in range(n):
	B.append(2*B[i]+3)
	P.append(2*P[i]+1)

def cnt(n,x):
	if n==0 and x<=0:
		return 0
	if n==0 and x>=1:
		return 1
	m=(B[n]+1)//2
	if x<m:
		return cnt(n-1,x-1)
	elif x==m:
		return P[n-1]+1
	elif x>m:
		return P[n-1]+1+cnt(n-1, x-m) 

print(cnt(n,x))
	

Measured memory_bytes: 9128
a, b, c, d = map(int, input().split())
 
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
 
def lcm(a, b):
	return a * b // gcd (a, b)
 
bb = b-int(b//c)-int(b//d)+int(b//lcm(c,d))   
aa = (a-1)-int((a-1)//c)-int((a-1)//d)+int((a-1)//lcm(c,d))
print(bb-aa)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
bool arrive[25][25];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
void dfs(vector<string> &grid, int x, int y){
  REP(r,4){
    if(arrive[y+dy[r]][x+dx[r]]==false&&grid[y+dy[r]][x+dx[r]]=='.'){
      arrive[y+dy[r]][x+dx[r]] = true;
      dfs(grid,x+dx[r],y+dy[r]);
    }
  }
}
int main(void){
  int W,H;
  while(cin>>W>>H,W){
    memset(arrive,0,sizeof(arrive));
    vector<string> grid;
    string tmp;
    REP(i,W+2)tmp+="#";
    grid.push_back(tmp);
    REP(i,H){
      string tmp;
      cin>>tmp;
      tmp = "#"+tmp+"#";
      grid.push_back(tmp);
    }
    grid.push_back(tmp);
    REP(y,grid.size())REP(x,grid[0].size())if(grid[y][x]=='@')dfs(grid,x,y);
    int ans=1;
    REP(y,25)REP(x,25)if(arrive[y][x])ans++;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=18;
ll a[N];
map<pair<int,int>,ll> dp[N][N];
ll Solve(int l, int r, int mul_l, int mul_r)
{
	if(l>r) return 0;
	if(dp[l][r].count({mul_l,mul_r})) return dp[l][r][{mul_l,mul_r}];
	if(l==r) return a[l]*(mul_l+mul_r);
	ll ans=1e18;
	for(int i=l;i<=r;i++) ans=min(ans,Solve(l,i-1,mul_l,mul_r+mul_l)+Solve(i+1,r,mul_l+mul_r,mul_r)+a[i]*(mul_l+mul_r));
	return ans;
}
int main()
{
	int n;
	scanf("%i",&n);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    printf("%lld\n",Solve(1,n-2,1,1)+a[0]+a[n-1]);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Circle
 */
public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = r * r * pi;
        double length = 2 * r * pi;
        System.out.printf("%f %f\n", area, length);
    }
}


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

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = ip()                              #入力整数1つ
#x,y= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
s = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意

t = input()
l = len(t)
a=t
for i in range(l):
    b = [a[l-1],a[:l-1]]
    a = ''.join(b)
    if a==s:
        j(1)
j(0)

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

/*
Nは2〜8なので、
8でも40320通り -> 全探索でいける。問題は辞書順にどう並べるか。
*/

int N;
vector<bool> used;
vector<int> perm;
vector<int> P, Q;

int a, b;
int v=1;

void permutation(int pos, int n) {
    if (pos == n) {
        // check
        if (perm == P)
        {
            a = v;
        }
        if (perm == Q) {
            b = v;
        }
        v++;

        return;
    }

    for (int i = 1; i <= n; i++)
    {
        if(!used[i]) {
            perm[pos] = i;
            used[i] = true;
            permutation(pos + 1, n);
            used[i] = false;
        }
    }
    
}

int main() {
    cin >> N;

    used = vector<bool>(N+1, false);
    perm = vector<int>(N);

    vector<int> C(N);
    for (int i = 0; i < N; i++)
    {
        C[i] = i + 1;
    }

    P = Q = vector<int>(N);
    for (int i = 0; i < N; i++)
    {
        cin >> P[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> Q[i];
    }

    // int i = 1;
    // int a, b;
    // do
    // {

    //     if (C == P) {
    //         a = i;
    //     }
    //     if (C == Q) {
    //         b = i;
    //     }
    //     i++;

    // } while (next_permutation(C.begin(), C.end()));

    permutation(0, N);

    cout << abs(a-b) << endl;
}

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

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

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

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

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

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll cnt_deleted = (b / d - (a - 1) / d) + (b / c - (a - 1) / c) -
                   (b / lcm(c, d) - (a - 1) / lcm(c, d));
  cout << (b - a + 1) - cnt_deleted << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int min = 1000000000;
  int max = 1;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (A > max) max = A;
    if (A < min) min = A;
  }
  cout << max-min << endl;
  return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int,int>
#define mii map<int,int>
#define mci map<char,int>
#define fir first
#define sec second
#define eline "\n"

int main() {

	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;

	if(s == "ABC") cout << "ARC" << eline;
	else cout << "ABC" << eline;

	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

vector<ll>a;
ll b[3];
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	ll s1=a[0],s2=a[n-1];
	ll s3=s1^s2;
	if(s1==0&&s2==0){
		cout << "Yes";
		return 0;
	}
	for(int i=0;i<n;i++){
		ll now=a[i];
		if(now==s1){
			b[0]++;
		}
		else if(now==s2){
			b[1]++;
		}
		else if(now==s3){
			b[2]++;
		}
	}
	if(s2!=s3){
	if(b[0]*3==n&&b[1]*3==n&&b[2]*3==n){
		cout << "Yes";
		return 0;
	}
	}
	else if(b[0]*3==n&&b[1]*3==n*2){
		cout << "Yes";
		return 0;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

int arr[10];
int main()
{
	cin >> A >> B >> N;
	ll val = min(N, B-1);
	cout << (A*val)/B;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
int main(){
    int X;
    cin >> X;
    if(X == 1 || X == 2){
        cout << 1 << endl;
        return 0;
    }
    int max = 0;
    int t;
    for(int i=1; i<=sqrt(X); i++){
        t = i;
        for(int j=2; j<X; j++){
            t = t * i;
            if(max < t && t <= X){
                max = t;
            }
            if(t >= X) break;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AIrohaAndHaikuABCEdition {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c;
	    in >> a >> b >> c;
        map<int, int> cnt;
        cnt[a]++;
        cnt[b]++;
        cnt[c]++;
        if(cnt[5] == 2 && cnt[7] == 1) out << "YES" << endl;
        else out << "NO" << endl;
	}
};


int main() {
	AIrohaAndHaikuABCEdition solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "numeric"
#include "iomanip"
using namespace std;
typedef long long ll;



int main() {
	char a;
	cin >> a;
	cout << char(a + 1) << endl;
}

Measured memory_bytes: 256
/* 
   AOJ 2001
   Amida, the Cty of Miracle

 */

#include<stdio.h>
#include<stdlib.h>

struct node
{
  int height, from, to;
  struct node *next;
};

struct node *head = NULL;


void traverse()
{
  struct node *next;

  for(next = head; next != NULL; next = next->next)
    {
      printf("%d %d %d ->", next->height, next->from, next->to);
    }
  printf("\n");
}


void make_amida(int height, int first_line, int second_line)
{
  struct node *line = malloc(sizeof(*line)), *next = head, *prev = head;
  
  if(head == NULL)
    {
      head = line;
      line->next = NULL;
    }
  else
    {
      while(next != NULL && next->height >= height)
	{
	  prev = next;
	  next = next->next;
	}
      if(next == head)
	{
	  head = line;
	  line->next = next;
	}
      else
	{

	  prev->next = line;
	  line->next = next;
	}
    }

  line->height = height;
  line->from = first_line;
  line->to = second_line;

  //traverse();
}

int search_goal_line(int target_line)
{
  struct node *next;
  int current_line = target_line;

  for(next = head; next != NULL; next = next->next)
    {
      if(next->from == current_line)
	{
	  current_line = next->to;
	}
      else if(next->to == current_line)
	{
	  current_line = next->from;
	}
    }
  return current_line;
}



int main(void)
{
  int i, total_vertical_line, total_horizontal_line, target_line, height, first_line, second_line, hoge;

  while(1)
    {
      scanf("%d %d %d", &total_vertical_line, &total_horizontal_line, &target_line);

      if(total_horizontal_line == 0 && total_vertical_line == 0 && target_line == 0)
	{
	  break;
	}

      for(i = 0; i < total_horizontal_line; i++)
	{

	  scanf("%d %d %d", &height, &first_line, &second_line);
	  make_amida(height, first_line, second_line);
	}
      
      printf("%d\n", search_goal_line(target_line));

      head = NULL;
    }

  return 0;
}

Measured memory_bytes: 1852
#include <stdio.h>
int main(void) {
    int i;
    double v,y;
    while (scanf("%lf",&v)!=EOF) {
        i=1;
        y = 10.0*v*v/(14.0*14.0);
        while (5.0*i-5.0<y) i++;
        printf("%d\n",i);
    }
    return 0;
}

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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
#endif
	int l;
	cin>>l;
	l=l*l*l;
	double bb=(double)l/27;
	cout<<ps(bb,12)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <stack>
using namespace std;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main(void) {
  stack<int> st;
  
	cin.tie(0);
  ios::sync_with_stdio(false);
  
  //ABCDを取得
  string S;
  cin >> S;
  int A = ctoi(S[0]);
  int B = ctoi(S[1]);
  int C = ctoi(S[2]);
  int D = ctoi(S[3]);
  
  string ope[3];
  for (int i=0 ; i<8 ; i++) {
    st.push(D);
    st.push(C);
    st.push(B);
    st.push(A);
    
    for (int j=0 ; j<3 ; j++) {
      ope[j] = ((i>>j) % 2) == 1 ? "+" : "-" ;
      
      int left = st.top();
      st.pop();
      int right = st.top();
      st.pop();
      if (ope[j] == "+") {
        st.push(left + right);
      } else {
        st.push(left - right);
      }
    }  
    
    if (st.top() == 7) {
      break;
    }
    
    st.pop();
  }
  
  cout << A << ope[0] << B << ope[1] << C << ope[2] << D << "=7" << "\n";
}


Measured memory_bytes: 256