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

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

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7, MAX_N = 210, MAX_VAL = 1e5 + 10;

inline int add (ll a, ll b) { return (a + b) % MOD; }
inline int mul (ll a, ll b) { return (a * b) % MOD; }

int n, x;
int dp[MAX_N][MAX_VAL];
vector <int> S;

int rec (int pos, int rem) {
  if (pos == n) return rem;
  int& ret = dp[pos][rem];
  if (ret != -1) return ret;
  ret = 0;
  ret = add(ret, rec(pos + 1, rem % S[pos]));
  ret = add(ret, mul(n - pos - 1, rec(pos + 1, rem)));
  return ret;
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> x;
  S.resize(n);
  for (int i = 0; i < n; i++) cin >> S[i];
  sort(all(S));
  reverse(all(S));
  memset(dp, -1, sizeof dp);
  cout << rec(0, x) << endl;
  return (0);
}


Measured memory_bytes: 82304
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t INF = 1e9 + 1;

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

  int32_t N;
  cin >> N;
  vector<int32_t> A(N,0);
  cin >> A[0];
  int32_t all_xor = A[0];
  for (int i = 1; i < N; i++) {
    cin >> A[i];
    all_xor = all_xor ^ A[i]; 
  }

  for (int i= 0; i< N; i++) {
    int32_t res = all_xor ^ A[i];
    cout << res << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3984
#include <stdio.h>
int main(){
    int a[26]={0};
    char temp;
    while(scanf("%c",&temp)!=EOF){
        if(temp-'a'>=0&&temp-'a'<26)a[temp-'a']++;
        if(temp-'A'>=0&&temp-'A'<26)a[temp-'A']++;
     }
    for(int i=0;i<26;i++){
        printf("%c : %d\n",i+'a',a[i]);
    }
}

Measured memory_bytes: 2740
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, L, R, H, W;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	map<int, int>m;
	for (int i = 0; i < N; i++) {
		cin >> M;
		m[M]++;
		if (m[M] % 2) {
			K++;
		}
		else {
			K--;
		}
	}
	cout << K << endl;
}

Measured memory_bytes: 4992
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
 
   int x = sc.nextInt();
   int y = sc.nextInt();

   int[] re = {9,1,8,1,0,1,0,1,1,0,1,0,1,0,1};
   
   if(re[x] == re[y]) System.out.println("Yes");
   else System.out.println("No");
 }
}

Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S; cin >> S;
  int l = S.length();
  int result = l;
  for (int i=1; i<l; i++) { 
    if (S[i-1]!=S[i]) result = min(result, max(i, l-i));
  }
  cout << result << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int n;
    int temp;
    cin >> n;
    while(n!=0) {
        int now=0;
        int target=0;

        vector<int> player[2];
        vector<int>::iterator itr[2];

        for(int i=0; i<n; ++i) {
            cin >> temp;
            player[0].push_back(temp);
        }

        sort(player[0].begin(),player[0].end());

        itr[0]=player[0].begin();
        for(int i=1; i<=2*n; ++i) {
            if(itr[0]==player[0].end() || *itr[0]>i) {
                player[1].push_back(i);
            } else {
                ++itr[0];
            }
        }

        sort(player[0].begin(),player[0].end());
        itr[0]=player[0].begin();

        sort(player[1].begin(),player[1].end());
        itr[1]=player[1].begin();

        while(!player[0].empty() && !player[1].empty()) {
            itr[now]=upper_bound(player[now].begin(),player[now].end(),target);
            if(itr[now]==player[now].end()) {
                target=0;
                now=(now+1)%2;
                continue;
            }
            target=*itr[now];
            player[now].erase(itr[now]);
            now=(now+1)%2;
        }
        cout << player[1].size() << endl;
        cout << player[0].size() << endl;
        player[0].clear();
        player[1].clear();
        cin >> n;
    }
    return 0;
}

Measured memory_bytes: 3100
#include<iostream>
#include<vector>
using namespace std;
long long GCD(long long a,long long b){return b?GCD(b,a%b):a;}

int main(){
	int N;
  	cin >> N;
  	vector<long long> A(N);
  	for(int i=0;i<N;i++)cin>>A[i];
  	
  	long long res =A[0];
  	
  	for(int i=0;i<N;i++){
    	res = GCD(res,A[i]);
    }
  	
  	cout << res << endl;

}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(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 = m; i >= n; i--)
#define SORT(a, n) sort(a, a+n)
#define VSORT(v) sort(v.begin(), v.end())

using namespace std;

int main()
{
    int k, a, b;

    cin >> k >> a >> b;

    if((a % k == 0) || ((a / k ) != (b / k))) { cout << "OK" << endl; }
    else { cout << "NG" << endl; }

    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <atcoder/segtree>

using namespace std;

int op(int a, int b){ return max(a, b); }
int e(){ return -1; }

int main(){
    int N, Q; cin >> N >> Q;
    vector<int> A(N);
    for(auto& t : A) cin >> t;
    atcoder::segtree<int, op, e> seg(A);
    for(int i=0;i<Q;i++){
        int t, x, v; cin >> t >> x >> v;
        if(t == 1){
            seg.set(x-1, v);
        } else if(t == 2){
            cout << seg.prod(x-1, v) << endl;
        } else {
            cout << seg.max_right(x-1, [&](int t){ return t < v; }) + 1 << endl;
        }
    }
}

Measured memory_bytes: 6172
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    // 引数の受け取り
    long long  N,K;
    cin >> N >> K;
    long long A[N];
 
    for (long long i =0 ; i < N ;i++){
       cin >> A[i];
    }
 
    long long mod = 1000000007;
    long long ans1 =0;
    long long ans =0;
    long long o = K*(K-1)/2%mod;
    long long o2 = K*(K+1)/2%mod;
    for(long long i = 0;i<N;i++){
        ans1 =0;
        for (long long j= 0;j<i;j++){
            if(A[i]>A[j]) ans1++;//ブロックにあるかず
        }
        ans = (ans + (ans1 * o) % mod) % mod;
        ans1 =0;
        for (long long j= i+1;j<N;j++){
            if(A[i]>A[j]) ans1++;//ブロックにあるかず
        }
        ans = (ans + (ans1 * o2) % mod) % mod;
    }
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 256
s = input()
K = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

ans = ''
for i,w in enumerate(s):
    if i != len(s)-1 and (26-(ord(w)-ord('a')))%26 <= K:
        ans += 'a'
        K -= (26-(ord(w)-ord('a')))%26
    elif i != len(s)-1:
        ans += w
    if i == len(s)-1:
        #ans = ans[:-1]
        lastlidx = (ord(w)-ord('a') + K%26)%26
        ans += alp[lastlidx]
print(ans)



Measured memory_bytes: 3444
#include<vector>
#include<algorithm>
#include <iostream>
using namespace std;

int main(){
    int a[10];
    int N,K;
    cin >> N >> K;

    for(int i = 0; i <= 9; i ++){
        a[i] = 0;
    }
    int x;
    for(int i = 0; i < K; i ++){
        cin >> x;
        a[x] = 1;
    }
    int b[10];
    for(int i = 0; i < 10; i ++){
        b[i] = 10;
    }


    for(int i = N; i < 1050000; i ++){
        int j = i;
        while(j != 0){
            if(a[j % 10] == 1){
                goto l;
            }
            j /= 10;
        }
        cout << i <<endl;
        return 0;
        l:0;

    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline void maxch(int& a, int b) { if (a < b) a = b; }



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

	if (s == "SUN") cout << 7;
	else if (s == "MON") cout << 6;
	else if (s == "TUE") cout << 5;
	else if (s == "WED") cout << 4;
	else if (s == "THU") cout << 3;
	else if (s == "FRI") cout << 2;
	else if (s == "SAT") cout << 1;
}

Measured memory_bytes: 256
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		String result = "";
		if(a == b){
			result = "Draw";
		}else if(a > b){
			result = b != 1 ? "Alice" : "Bob";
		}else{
			result = a != 1 ? "Bob" : "Alice";
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 35612
#include<stdio.h>

int main()
{
    int n,i,j;

    scanf("%d",&n);
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if(n== i*j)
            {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");

    return 0;

}


Measured memory_bytes: 1632
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
//using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
const double PI = acos(-1.0);

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  vector<vector<int>> list(26);
  for (int i = 0; i < n; i++)
  {
    list[s[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < n; i++)
  {
    list[s[i] - 'a'].push_back(i + n);
  }
  ll ans = 0;
  int p = 0; // after p
  for (int i = 0; i < m; i++)
  {
    int c = t[i] - 'a';
    if (list[c].size() == 0)
    {
      cout << -1 << endl;
      return 0;
    }
    p = *lower_bound(list[c].begin(), list[c].end(), p) + 1;
    if (p >= n) {
      p -= n;
      ans += n;
    }
  }
  ans += p;
  cout << ans << endl;
  return 0;
}

// Sの部分列として各位置を取ったときその次にa～zをとるとき何文字先が最寄であるかを先に前処理として求めておく．あとはtの各文字の順で最寄りの位置に遷移していけばよい．
// 場所i以降で文字cが最初に現れる位置


Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define riterator reverse_iterator
#define pll pair<llong,llong>
using namespace std;

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

const int mxN = 100;
const int INF = 1e9;
const int P = 1e9+7;
int a[mxN+3];
int n;

llong quickpow(llong x,llong y)
{
	llong cur = x,ret = 1ll;
	for(int i=0; y; i++)
	{
		if(y&(1ll<<i)) {y-=(1ll<<i); ret = ret*cur%P;}
		cur = cur*cur%P;
	}
	return ret;
}

pll dfs(int l,int r,int h)
{
//	printf("l=%d r=%d h=%d\n",l,r,h);
	int h2 = INF; for(int i=l; i<=r; i++) h2 = min(h2,a[i]);
	pll ret(0ll,1ll); int mncnt = 0ll,segcnt = 0ll; llong prod1 = 1ll;
	for(int i=l,j=l; i<=r+1; i++)
	{
		if(a[i]==h2||i==r+1)
		{
			if(j<=i-1)
			{
				pll tmp = dfs(j,i-1,h2);
				ret.second = ret.second*tmp.second%P;
				prod1 = prod1*(tmp.first+tmp.second*2ll)%P;
				segcnt++;
			}
			if(i<=r)
			{
				mncnt++;
			}
			j = i+1;
		}
	}
	ret.first = (prod1*quickpow(2ll,mncnt)-ret.second*2ll%P+P)%P;
	ret.second = ret.second*quickpow(2ll,h2-h)%P;
//	printf("(%lld,%lld)\n",ret.first,ret.second);
	return ret;
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%lld",&a[i]);
	pll ans = dfs(1,n,0);
	printf("%lld\n",(ans.first+ans.second)%P);
	return 0;
}

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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define INF 1e16
#define mod 1e9+7


int main() {
  ll n,m;
  cin>>n>>m;
  ll ans;
  ans=(n*3+m)/2;
  co(ans);
}


Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
count=0
ans=[[0 for i in range(2)] for j in range(2*n)]
aaa=0

a_max=max(a)
a_min=min(a)
if abs(a_max)>=abs(a_min):
    delta=a_max
else:
    delta=a_min
if delta>0:
    seifu=1
else:
    seifu=-1

for i in range(n):
    if delta==a[i]:
        aaa=i+1
        break




if seifu==1:

  for i in range(n-1):
    while a[i]>a[i+1]:
        if seifu==1:
            a[i+1]=a[i+1]+delta
            ans[count][0], ans[count][1]=aaa, i+2
        count=count+1
        a_max=max(a)
        delta=a_max
        for k in range(n):
            if delta==a[k]:
                aaa=k+1

else:
  for i in range(n-1):
    while a[n-2-i]>a[n-1-i]:
        if seifu==-1:
            a[n-2-i]=a[n-2-i]+delta
            ans[count][0], ans[count][1]=aaa, n-2-i+1
        count=count+1

        a_min=min(a)
        delta=a_min
        for k in range(n):
            if delta==a[k]:
                aaa=k+1


print(count)
for i in range(count):
    print(ans[i][0],ans[i][1])


Measured memory_bytes: 3188
#include<iostream>
#define INF 100000000
using namespace std;
int n,m[101][101],p[101];
void dp(){
  for(int i=1;i<=n;i++)m[i][i]=0;
  for(int l=2;l<=n;l++)
    for(int i=1;i<=n-l+1;i++){
     int j=i+l-1;
     m[i][j]=INF;
     for(int k=i;k<j;k++)m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
    } 
}

int main(){
  cin>>n;
  for(int i=1;i<=n;i++)cin>>p[i-1]>>p[i];
  dp();
  cout<<m[1][n]<<endl;
  
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t l;
    cin >> l;

    auto k = l / 3.0;

    cout << setprecision(10) << k * k * k << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

int MOD;
int add(int x, int y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int mult(int x, int y) {
	return ((ll)x * y) % MOD;
}

const int N = 303;
//const int N = 7;
int dp[N][N];
int a[N];
int b[N];
int C[N][N];

void getRev() {
	for (int i = 0; i < N; i++)
		eprintf("%d ", a[i]);
	eprintf("\n");
	if (a[0] != 1) throw;
	b[0] = 1;
	for (int i = 1; i < N; i++) {
		b[i] = 0;
		for (int j = 0; j < i; j++)
			b[i] = sub(b[i], mult(mult(b[j], a[i - j]), C[i][j]));
	}
	for (int i = 0; i < N; i++)
		a[i] = b[i];
}

void solve() {
	for (int i = 0; i < N; i++)
		C[i][0] = C[i][i] = 1;
	for (int i = 1; i < N; i++)
		for (int j = 1; j < i; j++)
			C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
	for (int k = 1; k < N; k++) {
		dp[k][1] = 1;
		for (int x = 1; x < N; x++)
			for (int y = 1; x + y < N; y++)
				dp[k][x + y] = add(dp[k][x + y], mult(mult(dp[k][x], dp[k - 1][y]), C[x + y - 2][y - 1]));
		for (int x = 1; x < N; x++)
			dp[k][x] = add(dp[k][x], dp[k - 1][x]);
	}
	/*
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++)
			eprintf("%d ", dp[i][j]);
		eprintf("\n");
	}
	*/
}

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

	int n, k;
	scanf("%d%d%d", &n, &k, &MOD);
	solve();
	printf("%d\n", sub(dp[k + 1][n + 1], dp[k][n + 1]));

	return 0;
}


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

using namespace std;

char s[200001];
int dp[200001][4];

int main() {
    int n, ans = -1, i, j, k, l;
    
    scanf("%s", s);
    
    n = strlen(s);
    
    for (i = 0; i <= n; i++) {
        for (j = 0; j <= 3; j++) {
            dp[i][j] = -1;
        }
    }
    
    dp[0][0] = 0;
    
    for (i = 0; i < n; i++) {
        for (j = 0; j <= 3; j++) {
            if (dp[i][j] == -1) continue;
            
            for (k = 1; k <= 3 && i + k <= n; k++) {
                bool f = true;
                
                if (j == k) {
                    for (l = 0; l < k; l++) {
                        if (s[i - k + l] != s[i + l]) break;
                    }
                    
                    if (l == k) f = false;
                }
                
                if (f) dp[i + k][k] = max(dp[i + k][k], dp[i][j] + 1);
            }
        }
    }
    
    for (i = 0; i <= 3; i++) ans = max(ans, dp[n][i]);
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 3456
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int n; cin >> n; cout << (n + 1) * n / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	rep (i, n) cin >> a[i];

	ll sum = 0;
	rep (i, n) sum += a[i];

	sort(rrng(a));
	bool ok = true;
	rep (i, m) {
		if (a[i] * 4 * m < sum) ok = false;
	}

	if (ok)yn
	return 0;
}

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

int main(void)
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    int cnt=0;
    for(int i=A;i<B;i++)
    {
        if(C<=i&&i<D)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int h1,m1,h2,m2,k;
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
	int t1=h1*60+m1;
	int t2=h2*60+m2;
	printf("%d\n",t2-t1-k);
}

Measured memory_bytes: 1732
#template
def inputlist(): return [int(j) for j in input().split()]
#template
N,K = inputlist()
A = inputlist()
left = 0
right = 10**9+1
while right - left > 1:
    mid = (left+right)//2
    count = 0
    for i in range(N):
        count += A[i]//mid
        if A[i] % mid == 0:
            count -=1
    if count > K:
        left = mid
    else:
        right = mid
print(right)


Measured memory_bytes: 104372
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String inputed = new String(in.readLine());

		String value[] = inputed.split("[\\s]+");
		//int intInputed = Integer.parseInt(inputed);

		int W  = Integer.parseInt(value[0]);
		int H = Integer.parseInt(value[1]);
		int x  = Integer.parseInt(value[2]);
		int y = Integer.parseInt(value[3]);
		int r  = Integer.parseInt(value[4]);

		boolean jugde = true;

		if ((x - r >= 0 ) && ((x + r) - W <= 0)) {
			if ((y - r >= 0 ) && ((y + r) - H <= 0)) {
				jugde = true;
			} else {
				jugde = false;
			}
		} else {
			jugde = false;
		}

		if (jugde == true) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 24580
using System;

namespace ABC173B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine().Trim());
            int ac = 0;
            int tle = 0;
            int wa = 0;
            int re = 0;
            for(int i=0;i<N;i++) {
                var t = Console.ReadLine();
                switch(t){
                    case "AC": ac++; break;
                    case "TLE": tle++; break;
                    case "WA": wa++; break;
                    case "RE": re++; break;
                }
            }
            Console.WriteLine("AC x {0}", ac);
            Console.WriteLine("WA x {0}",wa);
            Console.WriteLine("TLE x {0}",tle);
            Console.WriteLine("RE x {0}",re);
        }
    }
}


Measured memory_bytes: 30676
#include <iostream>
using namespace std;
long long mod=998244353;
long long dp[3001][3001][3];
int main(){
	long long n,s;
	long long a[3000];
	cin>>n>>s;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	dp[0][0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<=s;j++){
			(dp[i+1][j][0]+=dp[i][j][0])%=mod;
			(dp[i+1][j][1]+=dp[i][j][0]+dp[i][j][1])%=mod;
			(dp[i+1][j][2]+=dp[i][j][0]+dp[i][j][1]+dp[i][j][2])%=mod;
			if(j+a[i]<=s){
				(dp[i+1][j+a[i]][1]+=dp[i][j][0]+dp[i][j][1])%=mod;
				(dp[i+1][j+a[i]][2]+=dp[i][j][0]+dp[i][j][1])%=mod;
			}
		}
	}
	cout<<dp[n][s][2]<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int N;
int t, x, y;

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

	cin >> N;

	int nt = 0, nx = 0, ny = 0;

	for (int i = 0;i < N;i++){
		cin >> t >> x >> y;
		int d = abs(nx-x)+abs(ny-y);
		int dt = t-nt;
		if(dt < d || (dt-d)%2 != 0){
			cout << "No" << endl;
			return 0;
		}
		nt = t; nx = x; ny = y;
	}

	cout << "Yes" << endl;

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 2e5+5;
int main()
{
	string s,t,a;
	cin>>s>>t;
	a=t.substr(0,s.length());
	if(a==s)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, m;
	cin >> n >> m;
	pair<int, int> p[m];
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		p[i] = pair<int, int>(a, b);
	}
	int cnt = 0;
	for(int i = 0; i < m; i++){
		int uf[n + 1][2];
		for(int j = 1; j <= n; j++) uf[j][0] = j, uf[j][1] = 1; 
		for(int j = 0; j < m; j++){
			if(i == j) continue;
			int x = p[j].first, y = p[j].second;
			while(x != uf[x][0]) x = uf[x][0];
			while(y != uf[y][0]) y = uf[y][0];
			if(x != y){
				if(uf[x][1] > uf[y][1]) uf[y][0] = x;
				else if(uf[x][1] < uf[y][1]) uf[x][0] = y;
				else uf[y][0] = x, uf[x][1]++;
			}
//			cout << i << ' ' << j << endl;
		}
//		cout << endl << i << endl << endl;
//		for(int j = 1; j <= n; j++) cout << uf[j][0] << ' ' << uf[j][1] << endl;
		int flg = 1, z = 1;
		while(z != uf[z][0]) z = uf[z][0];
		for(int j = 2; j <= n; j++){
			int x = j;
			while(x != uf[x][0]) x = uf[x][0];
			if(x != z){
				flg = 0;
				break;
			}
		}
		if(flg == 1) cnt++;
	}
	cout << m - cnt << endl;
	return 0;
}

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

struct Dinic {
public:
    using Flow = int;
    Dinic(int n_) : n(n_), g(n_) {}
    Flow maximum_flow(int s_, int t_) {
        s = s_;
        t = t_;
        que.resize(n);
        Flow res = 0;
        while (levelize()) {
            prog.assign(n, 0);
            res += augment(s, numeric_limits<Flow>::max());
        }
        return res;
    }
    void add_edge(int u, int v, Flow c) {
        assert(u != v);
        g[u].push_back({ u,v,c,0,(int)g[v].size() });
        g[v].push_back({ v,u,c,c,(int)g[u].size() - 1 });
    }

private:
    struct Edge { int s, d; Flow c, f; int r; };
    int n, s, t;
    vector<vector<Edge>> g;
    vector<int> level, prog, que;

    bool levelize() {
        int fst = 0, lst = 0;
        que[lst++] = s;
        level.assign(n, -1);
        level[s] = 0;
        while (fst != lst) {
            int v = que[fst++];
            if (v == t) break;
            for (auto &e : g[v]) {
                if (level[e.d] == -1 && residue(e) != 0) {
                    level[e.d] = level[v] + 1;
                    que[lst++] = e.d;
                }
            }
        }
        return level[t] != -1;
    }
    Flow augment(int v, Flow lim) {
        Flow res = 0;
        if (v == t) return lim;
        for (int &i = prog[v]; i < (int)g[v].size(); ++i) {
            if (lim == 0) break;
            auto &e = g[v][i];
            if (level[v] < level[e.d] && residue(e) != 0) {
                Flow aug = augment(e.d, min(lim, residue(e)));
                if(aug == 0) continue;
                e.f += aug;
                reverse(e).f -= aug;
                res += aug;
                lim -= aug;
            }
        }
        return res;
    }
    Flow residue(const Edge &e) { return e.c - e.f; }
    Edge &reverse(const Edge &e) { return g[e.d][e.r]; }
};

int main() {
    int N, M;
    cin >> N >> M;
    Dinic g(N);
    for(int i = 0; i < M; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        g.add_edge(a, b, c);
    }
    Dinic d(g);
    cout << d.maximum_flow(0, N-1) << endl;
}

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

int main() {
    int n;
    std::cin >> n;

    std::vector<int> ls(n * 2);
    int count = 0;

    while (count++ < n * 2) {
        int l;
        std::cin >> l;
        ls[count - 1] = l;
    }

    std::sort(ls.rbegin(), ls.rend());

    int result = 0;
    count = 0;
    while (count++ < n) {
        int l0 = ls[count * 2 - 2];
        int l1 = ls[count * 2 - 1];

        result += (l0 < l1 ? l0 : l1);
    }

    std::cout << result << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll GCD(ll x, ll y) {
	ll tmp;
	if (y > x) {
		tmp = x;
		x = y;
		y = tmp;
	}
	while (x%y != 0) {
		tmp = y;
		y = x % y;
		x = tmp;
	}
	return y;
}

ll LCM(ll x, ll y) {
	return x * y / GCD(x, y);
}

ll A,B,C,D;
string S;
vector<ll> vec;

void solve() {
	cin >> A >> B >> C >> D;

	ll tmp1 = A - 1;
	ll tmp2 = B;

	ll ans1 = tmp1 - (tmp1 / C) - (tmp1 / D) + (tmp1 / LCM(C, D));
	ll ans2 = tmp2 - (tmp2 / C) - (tmp2 / D) + (tmp2 / LCM(C, D));

	cout << ans2 - ans1;


}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Set<String> hashset = new HashSet<String>();
    for (int i=0; i<N; i++) {
      hashset.add(sc.next());
    }
    if (hashset.size() == 3) {
      System.out.println("Three");
    } else {
      System.out.println("Four");
    }
  }
}

Measured memory_bytes: 20820
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

ll dp[N][105];
ll func(int c, int sum, int D)
{
	if(c == 0)
		return (sum % D == 0);
	if(dp[c][sum] != -1)
		return dp[c][sum];
	ll res = 0;
	for (int i = 0; i <= 9; ++i)
	{
		res += func(c - 1, (sum + i) % D, D);
		res %= MOD;
	}
	return dp[c][sum] = res;
}
ll solve(string s, int D)
{
	int c;
	ll res = 0, sum = 0, d;
	c = (int) s.size();
	for (int i = 0; i < c; ++i)
	{
		d = s[i] - '0';
		for (int digit = 0; digit < d; ++digit)
		{
			res += func(c - i - 1, (sum + digit) % D, D);
			res %= MOD;
		}
		sum = (sum + d) % D;
	}

	if(sum % D == 0)
		res++;
	return ((res - 1) + MOD) % MOD;
}
int main()
{
	string s;
	int d;
	cin >> s >> d;
	memset(dp, -1, sizeof(dp));
	cout << solve(s, d);
}



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

const int maxn = 2e3 + 6;
const int mod = 1e9 + 7;

int n, m, s[maxn], t[maxn], dp[maxn][maxn], ps[maxn][maxn];
int ans = 1;
int main() {
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> s[i];
	for(int i = 1; i <= m; i++)
		cin >> t[i];
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			ans = (ans + (s[i] == t[j]) * (ps[i - 1][j - 1] + 1)) % mod;
			ps[i][j] = (ps[i - 1][j] + ps[i][j - 1] - ps[i - 1][j - 1] + (s[i] == t[j]) * (ps[i - 1][j - 1] + 1)) % mod;
		}
	}
	ans += mod;
	cout << ans % mod;
}

Measured memory_bytes: 16768
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {

    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> h(N);
    rep(i,N) cin >> h[i];

    ll bottom = 1;
    ll top = INF;
    while (bottom < top) {
        ll k = bottom + (top - bottom) / 2;
        ll count = 0;
        rep(i,N) {
            if (h[i] <= k * B) continue;
            count += (h[i] - k * B + (A - B) - 1) / (A - B);
        }
        if (count <= k) top = k;
        else bottom = k + 1;
    }

    cout << bottom << endl;
    
    return 0;
}

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

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

    vector<int> s;
    vector<int> ord(n + 1, -1);

    int cycle = 1, leg = 0;
    {
        int now = 1;
        while (ord[now] == -1)
        { // nowが未訪問ならwhileに入る
            ord[now] = s.size();
            s.push_back(now);
            now = a[now - 1];
        }
        cycle = s.size() - ord[now];
        leg = ord[now];
    }

    if (k < leg)
        cout << s[k] << endl;
    else
    {
        k -= leg;
        k %= cycle;
        cout << s[leg + k] << endl;
    }
    return 0;
}

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

int main() {
    ll N,M; cin >> N >> M;
    if(2*N >= M){
        cout << M/2 << endl;
    }
    else{
        cout << N+(M-N*2)/4 << endl;
    }

    return 0;
}





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

using namespace std;

int main() {
	int n;

	scanf("%d", &n);

	int cnt = 0;
	for(int i = 0; i < n; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		if(a == b) cnt++;
		else cnt = 0;
		if(cnt >= 3) return printf("Yes\n"), 0;
	}
	printf("No\n");
}


Measured memory_bytes: 3768
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, M;
int X[101010], Y[101010];

bool flag[440][440];

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i) {
		scanf("%d%d", X + i, Y + i);
		--X[i]; --Y[i];
	}

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) flag[i][j] = false;

		flag[i][i] = true;
		for (int j = M - 1; j >= 0; --j) {
			int x = X[j], y = Y[j];
			if (flag[i][x] && flag[i][y]) goto fail;
			if (flag[i][x] || flag[i][y]) {
				flag[i][x] = flag[i][y] = true;
			}
		}
		continue;
	fail:
		for (int j = 0; j < N; ++j) flag[i][j] = true;
	}

	int ret = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			bool isok = true;
			for (int k = 0; k < N; ++k) {
				if (flag[i][k] && flag[j][k]) isok = false;
			}
			if (isok) ++ret;
		}
	}
	printf("%d\n", ret);

	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

/*
int main() {
    int n;
    cin >> n;
    int maxv = -1, ans;
    rrep(i, n) {
        int a = i, cnt = 0;
        while(a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        if(maxv < cnt) {
            maxv = cnt;
            ans = i;
        }
    }
    
    cout << ans << endl;

    return 0;
}
*/
int main() {
    int n; cin >> n;
    rrep(i, 7) {
        if(n < (int)pow(2, i)) {
            cout << (int)pow(2, i - 1) << endl; 
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

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

// 第一引数 == 第二引数 ? true : false
template<class T, class U>
bool check(T first, U second) {
    return (first == second);
}

// 約数列挙
vector<int64_t> divisor(int64_t n) {
  vector<int64_t> ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


// 数字和
template<class T>
T digitSum(T num) {
    T dig;
    T sum = 0;
    while (num) {
        dig = num % 10;
        sum += dig;
        num /= 10;
    }
    return sum;
}

string background_black(string s) { return "\x1b[40m" + s; }
string background_red(string s) { return "\x1b[41m" + s + "\x1b[40m"; }
string background_green(string s) { return "\x1b[42m" + s + "\x1b[40m"; }
string background_yellow(string s) { return "\x1b[43m" + s + "\x1b[40m"; }
string background_bleu(string s) { return "\x1b[44m" + s + "\x1b[40m"; }
string background_white(string s) { return "\x1b[47m" + s + "\x1b[40m"; }

string black(string s) { return "\x1b[30m" + s + "\x1b[37m"; }
string red(string s) {return "\x1b[31m" + s + "\x1b[37m"; }
string green(string s) { return "\x1b[32m" + s + "\x1b[37m"; }
string yellow(string s) { return "\x1b[33m" + s + "\x1b[37m"; }
string blue(string s) { return "\x1b[34m" + s + "\x1b[37m"; }
string white(string s) { return "\x1b[37m" + s + "\x1b[37m"; }

const int ten = 10;
const int hundred = 100;
const int thousand = 1000;

typedef long long ll;
typedef unsigned long long ull;

string tolower(string s) {
  string c;
  for (int i = 0; i < s.size(); i++) {
    if ((s[i] >= 'A') && (s[i] <= 'Z')) {
        c.push_back((s[i] + 0x20));
    } else {
        c.push_back(s[i]);
    }
  }
  return c;
}
#include <cstdlib>
string solve() {
  string str = "";
// int->string: to_string, string->int: stoi
//=============================================================================


  int n, m;
  cin >> n >> m;
  if (n == m) {
    str += "Yes";
  } else {
    str += "No";
  }


//=============================================================================
  return str;
}

int main() {	
  std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
  cout << solve() << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = 0;
		int tmp = n;

		while(tmp > 0) {
			sum += tmp % 10;
			tmp /= 10;
		}

		if (n % sum == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int border;
	int a, b, sum, ans;
	bool ok;

	while(cin >> border ,border)
	{
		sum = 0;
		ok = false;
		for(int i = 1; i <= 12; i++)
		{
			cin >> a >> b;
			sum += (a - b);

			if(border <= sum && ok == false)
			{
				ok = true;
				ans = i;
			}
		}

		if(ok == true)
		{
			cout << ans << endl;
		}
		else
		{
			cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int X = sc.nextInt();
    static int N = sc.nextInt();

    public static void main(String[] args) {
        if(N == 0){
            System.out.println(X);
            return;
        }

        int p[] = new int[N];
        for(int i = 0; i < N; i++){
            p[i] = sc.nextInt();
        }
        int num[] = new int[102];
        for(int j = 0; j < 102; j++){
            num[j] = j;
        }

        for(int i = 0; i < 102; i++){
            for(int j = 0; j < N; j++){
                if(num[i] == p[j]){
                    num[i] = 0;
                    break;
                }
            }
        }
        int resultBigger = 1000;
        int resultSmaller = 1000;
        for(int i = 0; i < 102; i++){
            if(X > num[i]){
                if(Math.abs(X - num[i]) < Math.abs(X - resultSmaller)){
                    resultSmaller = num[i];
                }
            } else {
                if(Math.abs(X - num[i]) < Math.abs(X - resultBigger)){
                    resultBigger = num[i];
                }
            }
        }
        int diff = Math.abs(X - resultSmaller) - Math.abs(X - resultBigger);
        if(diff == 0){
            System.out.println(resultSmaller);
        } else if (diff < 0){
            System.out.println(resultSmaller);
        } else {
            System.out.println(resultBigger);
        }
    }
    
}

Measured memory_bytes: 35888
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;

const int MOD = 998244353, N = 3000002;
ll f[N], rf[N];

ll pw(ll x, ll k) {
    ll res = 1;
    for (int i = 30; i >= 0; i--) {
        res = res * res % MOD;
        if (k & (1 << i))
            res = res * x % MOD;
    }
    return res;
}

ll rev(ll x) {
    return pw(x, MOD - 2);
}

ll c(ll n, ll k) {
    if (k > n)
        return 0;
    return f[n] * rf[k] % MOD * rf[n - k] % MOD;
}

ll b(ll n, ll k) {
    return c(n + k - 1, n);
}

int main() {
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0);
    f[0] = rf[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = f[i - 1] * i % MOD;
        rf[i] = rf[i - 1] * rev(i) % MOD;
    }
	ll n, m;
    cin >> n >> m;
    ll ans = b(3 * m, n);
    for (int i = m + 1; i <= min(n, 3 * m); i++) {
        if ((3 * m - i) % 2)
            continue;
        ans = (ans + MOD - c(n, i) * b((3 * m - i) / 2, n) % MOD) % MOD;
    }
    for (int i = 2 * m + 1; i <= 3 * m; i++)
        ans = (ans + MOD - b(3 * m - i, n - 1) * n % MOD) % MOD;
    cout << ans;
}



Measured memory_bytes: 47104
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
int x,y;
int main()
{
	scanf("%d%d",&x,&y);
	printf("%d",x+y/2);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TenkaPBC2019C2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());//石の数Ｎ個
            string S = Console.ReadLine();//文字列　．白　＃黒

            int black = 0;
            int white = S.Replace("#", "").Length;//.の数を数えてみる
            int ans = white;
            if ((white == 0) || (white == N))//.がひとつもない、または全部.なら何もしなくてよい。
            {
                Console.WriteLine(0);
            }
            else
            {
                for (int i = 0; i < N; i++)
                {
                    int counter = 0;
                    if (S.Substring(i, 1) == "#")
                    {
                        black++;
                    }
                    else
                    {
                        white--;
                    }
                    counter = black + white;
                    if (counter < ans)
                    {
                        ans = counter;
                    }
                }
                Console.WriteLine(ans);
            }
            
        }
    }
}


Measured memory_bytes: 16604
#include<stdio.h>

int main(void)

{

int a,b ;

scanf("%d %d",&a,&b) ;


if (a<b) 

{


printf("a < b\n") ;


}


if(a>b)


{


printf("a > b\n") ;


}


if(a==b)


{


printf("a == b\n") ;


}


return 0 ;


}

Measured memory_bytes: 580
#include <stdio.h>

#define N 100

int main()
{
  int m[N][N];
  int n, u, k, v, i, j;

  scanf("%d", &n);

  for(i=0; i<n; i++) {
    for(j=0; j<n; j++) {
      m[i][j] = 0;
    }
  }

  for(i=0; i<n; i++) {
    scanf("%d %d", &u, &k);
    u--;
    for(j=0; j<k; j++) {
      scanf("%d", &v);
      v--;
      m[u][v]= 1;
    }
  }

  for(i=0; i<n; i++) {
    for(j=0; j<n; j++) {
      if(j)
        printf(" ");
      printf("%d", m[i][j]);
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 640
import java.util.*;

class Main{
  static int H,W,i,j;
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      H = sc.nextInt();
      W = sc.nextInt();
      int i = 0;
      if (H == 0 && W == 0) {
        break;
        }
      while (i<H) {
        for (j=0; j<W; j++) {
          System.out.print("#");
        }
          System.out.println("");
          i++;
        }
          System.out.println("");
      }
  }
}




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

int main(){
  int N;
  cin>>N;
  int a[N];
  int b[N];
  for (int i=0;i<N;i++){
    cin>>a[i]>>b[i];
  }
  long long count=0;
  int temp=0;
  for (int i=N-1;i>-1;i--){
    if((a[i]+count)%b[i]==0) continue;
    temp=b[i]-(a[i]+count)%b[i];
    count=count+temp;
    //cout<<b[i]<<" "<<a[i]<<endl;
    //cout<<temp<<endl;//*
  }
  cout<<count<<endl;
}


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

int main() {
    int N; cin >> N;
    int res = 0;
    while(N--) {
        char c; int k; cin >> c >> k;
        if(c == '(') res += k;
        else res -= k;
        if(res < 0) break;
    }
    cout << (res ? "NO" : "YES") << endl;
}

Measured memory_bytes: 1156