akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }


int main(){
    string s=is();
    string t=is();
    REP(i,0,s.length()){
        if(s[i]!=t[i]){
            ose("No");
            return 0;
        }
    }
    ose("Yes");
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
			static long x;
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String array = sc.next();
		x=0;
		for(int i=0;i<array.length();i++) {
			f(i,0,array);
		}
		System.out.println(x);
	}
	
	static void f(int plus,long sum,String str) {
		if(plus!=0) {
			for(int i=1;i<str.length()-plus+1;i++) {
				f(plus-1,Long.parseLong(str.substring(0,i))+sum,str.substring(i,str.length()));
			}
		}else {
			x+=sum+Long.parseLong(str);
		}
	}
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  ll X;
  scanf("%lld", &X);

  ll ans;
  if (X >= 400 && X <= 599) {
    ans = 8;
  }
  if (X >= 600 && X <= 799) {
    ans = 7;
  }
  if (X >= 800 && X <= 999) {
    ans = 6;
  }
  if (X >= 1000 && X <= 1199) {
    ans = 5;
  }
  if (X >= 1200 && X <= 1399) {
    ans = 4;
  }
  if (X >= 1400 && X <= 1599) {
    ans = 3;
  }
  if (X >= 1600 && X <= 1799) {
    ans = 2;
  }
  if (X >= 1800 && X <= 1999) {
    ans = 1;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3760
program main
  implicit none
  integer A, B
  read(*, *) A, B
  if (A < B) then
    write(*, '(i0)') 2*B - 1
  else if (A > B) then
    write(*, '(i0)') 2*A - 1
  else
    write(*, '(i0)') A + B
  end if
end program main

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

const int maxn = 100;
int n, m, dp[maxn + 3][maxn + 3];
char s[maxn + 3][maxn + 3];

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
	dp[1][1] = s[1][1] == '#' ? 1 : 0;
	for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) {
		if (i == 1 && j == 1) continue;
		dp[i][j] = 1e3;
		if (i > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j] + (s[i][j] == '#' && s[i - 1][j] != '#'));
		if (j > 1) dp[i][j] = min(dp[i][j], dp[i][j - 1] + (s[i][j] == '#' && s[i][j - 1] != '#'));
	}
	printf("%d\n", dp[n][m]);
	return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);
    int sum = 0;
    for (int i=0; i<N; i++) sum += A.at(i);
    int border = sum/(4*M);
    if (sum%(4*M) != 0) border++;
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    int count = 0;
    for (int i=0; i<N; i++) {
        if (A.at(i) < border) break;
        else count++;
    }
    if (count >= M) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
n = gets.to_i
line = gets.chomp.split(" ").map(&:to_i)
numbers = []

line.each do |number|
  local_counter = 0
  while true
    if number % 2 == 0
      number /= 2
      local_counter += 1
    else
      break
    end
  end
  numbers.push(local_counter)
end

p numbers.min

Measured memory_bytes: 1788
#include <stdio.h>
int main(void){
    int n,ans=0;
    scanf("%d",&n);
    int d[n];
    for(int i=0; i<n; i++)
        scanf("%d",&d[i]);
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++)
            ans+=d[i]*d[j];
    }
    printf("%d",ans);
}


Measured memory_bytes: 128
/**
 * Created by hiramekun at 20:39 on 2020-05-10.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (a >= k) {
        cout << k << '\n';
    } else { // k > a; 最大a
        k -= a;
        if (b >= k) { // 最大a
            cout << a << '\n';
        } else {
            k -= b;
            cout << a - k << '\n';
        }
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxPosNum = 2e5 + 5, maxRegionNum = 2e5 + 5;
int nodeNum, nbNumber, nbRegion, lef[maxRegionNum], rig[maxRegionNum], pos[maxPosNum], totChos;
bool lim[maxPosNum], vis[maxPosNum], chos[maxRegionNum], can = 1;
struct DOT{
	int pos, state;
	bool operator < (const DOT &d) const {
		return pos < d.pos;
	}
} dot[maxPosNum];
template<const int maxNodeNum, const int maxEdgeNum> struct Graph {
	int tot, head[maxNodeNum], to[maxEdgeNum << 1], next[maxEdgeNum << 1], reg[maxEdgeNum << 1];
	Graph() { memset(head, -1, sizeof(head)); }
	void AddEdge(int u, int v, int regId) {
		to[++tot] = v;
		next[tot] = head[u];
		reg[tot] = regId;
		head[u] = tot;
	}
};
//n+1个点，m条边的图 
Graph<maxPosNum, maxRegionNum> G;
void dfs(int now, int fa, int EId) {
	vis[now] = 1;
	for (int pt = G.head[now]; ~pt; pt = G.next[pt]) {
		int to = G.to[pt];
		if (!vis[to])
			dfs(to, now, pt);
	}
	if (~EId) {
		if (lim[now]) {
			lim[now] ^= 1;
			lim[fa] ^= 1;
			chos[G.reg[EId]] = 1;
			++totChos;
		}
	} else {
		if (lim[now]) {
			can = 0;
		}
	}
}
int main() {
	scanf("%d%d", &nbNumber, &nbRegion);
	for (int i = 1; i <= nbNumber; ++i) {
		scanf("%d%d", &dot[i].pos, &dot[i].state);
		pos[i] = dot[i].pos;
	}
	sort(dot + 1, dot + nbNumber + 1);
	for (int i = 1; i <= nbNumber + 1; ++i)
		lim[i] = dot[i - 1].state ^ dot[i].state;
	for (int i = 1; i <= nbRegion; ++i)
		scanf("%d%d", &lef[i], &rig[i]);
	sort(pos + 1, pos + nbNumber + 1);
	for (int i = 1; i <= nbRegion; ++i) {
		lef[i] = lower_bound(pos + 1, pos + nbNumber + 1, lef[i]) - pos;
		rig[i] = upper_bound(pos + 1, pos + nbNumber + 1, rig[i]) - pos - 1;
		if (lef[i] > rig[i])
			continue ;
		G.AddEdge(lef[i], rig[i] + 1, i);
		G.AddEdge(rig[i] + 1, lef[i], i);
	}
	dfs(nbNumber + 1, 0, -1);
	for (int i = 1; i <= nbNumber; ++i) {
		if (!vis[i]) {
			dfs(i, 0, -1);
			if (!can) {
				printf("-1\n");
				return 0;
			}
		}
	}
	printf("%d\n", totChos);
	for (int i = 1; i <= nbRegion; ++i)
		if (chos[i])
			printf("%d ", i);
	printf("\n");
	return 0;
}


Measured memory_bytes: 13056
n, m, x = map(int, input().split())
C = []
A = []
for _ in range(n):
    c, *a = map(int, input().split())
    C.append(c)
    A.append(a)
ans = float("inf")
for i in range(2**n):
    res = 0
    D = [0]*m
    for j in range(n):
        if i >> j & 1:
            res += C[j]
            for k, a in enumerate(A[j]):
                D[k] += a
    for d in D:
        if d < x:
            break
    else:
        ans = min(ans, res)
if ans == float("inf"):
    print(-1)
else:
    print(ans)

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

#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(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;



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

    ll a,s,d; cin>>a>>s>>d;
    ll as = max(a,s);
    as = max(as,d);
    cout<<a+s+d-as<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k;
  int a[20][20],m,n,o,p,q,r;
  cin>>n>>m;
  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      a[i][j]=200000000;
  for(i=0;i<m;i++){
    int t,u,v,w;
    scanf("%d,%d,%d,%d",&t,&u,&v,&w);
    t--;
    u--;
    a[t][u]=v;
    a[u][t]=w;
  }
  scanf("%d,%d,%d,%d",&o,&p,&q,&r);
  o--;
  p--;
  for(k=0;k<n;k++)
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
  cout<<q-r-a[o][p]-a[p][o]<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main() {
    int n, x;

    int count;
    while (true) {
        cin >> n;
        cin >> x;
        if (n == 0 && x == 0) {
            break;
        }
        count = 0;

        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                for (int k = j + 1; k <= n; k++) {
                    if ((i + j + k) == x) {
                        count++;
                        break;
                    }
                }
            }

        }
        cout << count << endl;

    }

}

Measured memory_bytes: 3092
#include <stdio.h>
  
int rot[5][7] = {
{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];      
int tr['Z'];
  
void dice_init(int *a)
{
    int i;
    int t[5] = {0,'N','E','W','S'};
    for (i = 1; i <= 6; i++) assign[i] = a[i];
    for (i = 1; i <= 4; i++) tr[t[i]] = i;
}
  
char s[102];
int main()
{
    int i, k1, k2;
    int a[7], dice[2][7];
    char *p;
  
    for (i = 1; i <= 6; i++) scanf("%d", a+i);
    dice_init(a);
    scanf("%s", p=s);
    for (i = 1; i <= 6; i++) dice[0][i] = rot[0][i];
    for (k1 = 0, k2 = 1; *p; k1 = k2, k2 = !k2) {
        for (i = 1; i <= 6; i++) dice[k2][i] = dice[k1][rot[tr[*p]][i]];
        p++;
    }
    printf("%d\n", assign[dice[k1][1]]);
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(void){
	double r;

	cin >> r;
	cout << fixed;
	cout << setprecision(6) << r*r*M_PI << " " << 2*r*M_PI << endl;

	return 0;
}



Measured memory_bytes: 3276
#include <stdio.h>

int mp[10][330] = { { 0 } };
int use[10] = { 0 };

void maketable( int num, int sum )
{
        int i;
        for ( i = 0 ; i < 10 ; i++ ) {
                if ( use[i] == 1 ) continue;

                use[i] = 1;
                mp[num+1][sum+i*(num+1)]++;
                maketable( num+1, sum+i*(num+1) );
                use[i] = 0;
        }
}

int main()
{
        int n, s;
        maketable( 0, 0 );
        while ( scanf( "%d", &n ) == 1 ) {
                scanf( "%d", &s );
                if ( s < 331 ) {
                        printf( "%d\n", mp[n][s] );
                } else {
                        printf( "0\n" );
                }
        }

        return 0;
}



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

int main(void) {
    int n, a, b, ans = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        int zohe = 0;
        string s = to_string(i);
        for (int i = 0; i < s.size(); i++) zohe += s[i] - '0';
        if (a <= zohe && zohe <= b) ans += i;
    }
    cout << ans << endl;
}


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

int n,m;
int d[1001],c[1001];

int dp[1001][1001];

int min(int a,int b){
	if(a>b)return b;
	return a;
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&d[i]);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&c[i]);
	}
	memset(dp,-1,sizeof(dp));
	dp[0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(dp[i][j]>=0){
				dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
				if(dp[i][j+1]==-1)dp[i][j+1]=dp[i][j];
				dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+d[i]*c[j]);
				if(dp[i+1][j+1]==-1)dp[i+1][j+1]=dp[i][j]+d[i]*c[j];
			}
		}
	}
	int res=dp[n][n];
	for(int i=n+1;i<=m;i++){
		res=min(res,dp[n][i]);
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 4952
import java.util.*;
import java.io.*;

public class Main {
	static FastReader in = new FastReader();

	public static void main(String[] args) {
		solve();
	}	

	static int[] di = {0, 0, 1, -1};
    static int[] dj = {1, -1, 0, 0};
    static int INF = 100000000;
    static int h, w;
	
	static void solve() {
		h = in.nextInt();
		w = in.nextInt();
		int ch = in.nextInt() - 1;
		int cw = in.nextInt() - 1;
		int dh = in.nextInt() - 1;
		int dw = in.nextInt() - 1;
		
		String[][] arr = new String[h][w];
		for(int i = 0; i < h; i++)
		{
			arr[i] = in.nextLine().split("");
		}
		
		ArrayDeque<int[]> q = new ArrayDeque();
		int[][] dist = new int[h][w];
		for(int i = 0; i < h; i++) Arrays.fill(dist[i], INF);
		q.add(new int[] {ch, cw});
		dist[ch][cw]= 0;
		while(!q.isEmpty()) {
			int[] tmp = q.pollFirst();
			int i = tmp[0];
			int j = tmp[1];
			int curDist = dist[i][j];
			for(int k = 0; k < 4; k++)
			{
				int ni = i + di[k];
				int nj = j + dj[k];
				if(in(ni, nj) && arr[ni][nj].equals(".") && dist[ni][nj] > curDist)
				{
					dist[ni][nj] = curDist;
					q.addFirst(new int[] {ni, nj});
				}
			}
			
			for(int a = -2; a <= 2; a++)
			{
				for(int b = -2; b <= 2; b++)
				{
					int ni = i + a;
					int nj = j + b;
					if(in(ni, nj) && arr[ni][nj].equals(".") && dist[ni][nj] > curDist + 1)
					{
						dist[ni][nj] = curDist + 1;
						q.addLast(new int[] {ni, nj});
					}
				}
			}
			
			
		}
		int ret = dist[dh][dw];
		if(ret >= INF) ret = -1;
		System.out.println(ret);
		
	}
	static boolean in(int a, int b)
	{
		return 0 <= a && a < h && 0 <= b && b < w;
	}
		
	
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readarr(int abc) {
			int[] a = new int[abc];
			for (int i = 0; i < abc; i++)
				a[i] = nextInt();
			return a;
		}
	}
	
}

class Pair
{
	
}







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

// N island, M bridge
long long N, M;

// 橋のペア。生き残った順番にする。
vector<int> A;
vector<int> B;

// 答えが格納される
vector<long long> res;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

void init() {
    cin >> N >> M;
    rep(i, M) {
        int a, b; cin >> a >>b;
        a--; b--;
        A.push_back(a);
        B.push_back(b);
    }
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
}

void solve() {

    UnionFind uf(N);
    long long pre = N * (N - 1) / 2;

    rep(i, M) {
        res.push_back(pre);
        int f = A[i]; int s = B[i];
        if (uf.issame(f, s)) continue;

        long long diff = uf.size(f) * uf.size(s);
        pre -= diff;
        uf.merge(f, s);

    }

    reverse(res.begin(), res.end());

    for (auto r : res) {
        printf("%lld\n", r);
    }

}

int main() {
    init();
    solve();
    return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  string s;
  cin >> s;
  if(s[s.size()-1] == 's') cout << s << "es" <<endl;
  else cout << s << 's' <<endl;
}


Measured memory_bytes: 3648
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

ll _gcd(ll A, ll B) {
	return (B == 0) ? A : gcd(A % B, B);
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
	}
	return res;
}


ll fibs[100] = { 0 };
ll fib(int n) {
	if (fibs[n] == 0) {
		return fibs[n] = fib(n - 1) + fib(n - 2);
	}
	return fibs[n];
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	ll N;
	cin >> N;

	cout << (N - 1) / 2 << endl;

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
#include <iostream>
#define MOD 1000000007

using namespace std;

long long mul_inv(long long a, long long b)
{
    long long  b0 = b, t, q;
    long long  x0 = 0, x1 = 1;
    if (b == 1) return 1;
    while (a > 1) {
        q = a / b;
        t = b, b = a % b, a = t;
        t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0) x1 += b0;
    return x1;
}

int main() {
    long long N, K;
    cin >> N >> K;
    for (int i=1; i<=K; i++) {
        // K-1 C i-1
        long long a = 1;
        for (int x=0; x<i-1; x++) a = (a * (K-1-x)) % MOD;
        long long aa = 1;
        for (int x=1; x<=i-1; x++) aa = (aa * x) % MOD;
        a = (a * mul_inv(aa, MOD)) % MOD;

        // (N-K)-(i-1)+i C i
        // (N-K+1) C i
        long long b = 1;
        for (int x=0; x<i; x++) b = (b * (N-K+1 - x)) % MOD;
        long long bb = 1;
        for (int x=1; x<=i; x++) bb = (bb * x) % MOD;
        b = (b * mul_inv(bb, MOD)) % MOD;

        cout << (a * b) % MOD << endl;
    }

        
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX = 30;
bool like[MAX];

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

  int n, m;
  cin >> n >> m;
  memset(like, true, sizeof(like));

  for (int i = 0; i < n; ++i) {
      int k;
      cin >> k;
      int a[k];
      rep(j, k) cin >> a[j];
      for (int j = 0; j < m; ++j) {
          bool dislike = true;
          for (int l = 0; l < k; ++l) {
              if (j == a[l]-1) dislike = false;
          }
          if (dislike) like[j] = false;
      }
  }

  int ans = 0;
  for (int i = 0; i < m; ++i) if (like[i]) ++ans;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	void main()
	{
		ll h=qread(),w=qread();
		if(min(h,w)==1) write(1);
		else write( h/2*(w)+(h%2)*(w+1)/2 );
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 23680
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    a,b,k=MI()
    if k>=a:
        k-=a
        a=0
        # print(k)
        if k>=b:
            k-=b
            b=0
        else:
            b=b-k
    else:
        a=a-k
    print(a,b)

if __name__ == "__main__":
    main()

Measured memory_bytes: 4208
#include <iostream>
using namespace std;
int main () {
	int a;
	int b = 1;
	cin >> a;
	while (a > 0) {
		cout << "Case" << " " << b << ":" << " " << a << endl;
		b = b+1; 
		cin >> a;
	}
	return 0;
	}


Measured memory_bytes: 3084
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a + b + c - max({a, b, c}) << "\n";
    return 0;
}

Measured memory_bytes: 256
import collections

n = int(input())
words = [input() for _ in range(n)]
c = collections.Counter(words)
max_c = c.most_common()
ans = [max_c[0][0]]

for i in range(1, len(max_c)):
    if max_c[i][1] == max_c[i-1][1]:
        ans.append(max_c[i][0])
    else:
        break

ans_sorted = sorted(ans)
for i in range(len(ans)):
    print(ans_sorted[i])

Measured memory_bytes: 49172
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


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;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

int GCD(int a, int b) {
	if (b == 0) {
		return a;
	}

	return GCD(b, a % b);
}

int LCM(int a, int b) {
	return a * b / GCD(a, b);
}

int main() {
	
	int n, X;
	cin >> n >> X;
	vector<int> x;
	x.resize(n);
	rep(i, n) {
		int input;
		cin >> input;
		x[i] = abs(input - X);
	}
	int ans = x[0];
	for(int i = 1; i < n; i++) {
		ans = GCD(ans, x[i]);
	}
	cout << ans << endl;
	


	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  int  a, b, c, d, X, Y;
//  long long  a, b, c, d, X, Y;
  int D, G;
  //char s[101][101]={};
  char sv[101]={};
  char ss[101]={};
//  char s_temp[101]={};
  char t[101]={};
//  char s[10000000000000000001]={};
  char s[2][100001]={};
  int len=0;
  int N, M;
//  int A[1000000001]={};
  long long  A[101]={};
//  long int A[1001]={};
  long long  B[101]={};
  long long  C[101]={};
  int i,j,k;
  int flag=0;
  int tmp=0;
  int min=0;
  int cnt=0;
  int ans=0;
  int max=0;

  int  Cen_X=0;
  int  Cen_Y=0;
  long long  H=0;
  
  //  int ans=0;
  int str_len=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int ans_o[100001]={};
  int ans_e[100001]={};
  
//  scanf("%lld %lld", &a, &b);
  scanf("%d %d", &a, &b);
        printf("%d\n",a+(b/2));
    
      
//  if(flag==0)   printf("TLE\n");
//  printf("%d\n",ans);
  
return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;



int main(){

    int n;
    cin >> n;
    int count = 0;
    for(int i=0 ; i<n ; i++){
        int i1,i2;
        cin >> i1 >> i2;
        if(i1==i2){
            //cout << "Yes"<<endl;
            count++;
            if(count == 3){
                cout << "Yes"<<endl;
                return 0;

            }

        }
        else{
            count = 0;
        }
        
    }
    cout << "No" << endl; 
    
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,W;
  cin>>N>>W;
  vector<vector<int>> A(N+1,vector<int>(100001,10000000000000));
  A[0][0]=0;
  for(int i=1;i<=N;i++){
    int a,b;
    cin>>a>>b;
    for(int j=0;j<=100000;j++){
      if(j<b)
        A[i][j]=A[i-1][j];
      else
        A[i][j]=min(A[i-1][j],A[i-1][j-b]+a);
    }
  }
  for(int i=100000;i>=0;i--)
    if(A[N][i]<=W){
      cout<<i<<endl;
      return 0;
    }
}

Measured memory_bytes: 83164
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var: ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        b: chars,
    }
    let ans = match b[0] {
        'A' => 'T',
        'C' => 'G',
        'G' => 'C',
        'T' => 'A',
        _ => unreachable!(),
    };
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
template <class T> vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string N;
    cin >> N;
    ll sum = 0;
    rep(i, N.size()) { sum += N[i] - '0'; }
    if(sum % 9 == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3748
n ,m = list(map(int, input().split()))
q = []
for i in range(m):
    q.append(list(map(int, input().split())))
q.sort(key=lambda x: x[1])
ans = 0
last_cut_bridge = -1
for i in range(m):
    a,b = q[i]
    if a <= last_cut_bridge <= b:
        continue
    else:
        last_cut_bridge = b-1
        ans += 1
print(ans)

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

int main() {
    int N;
    cin >> N;
    vector<long long> luka;
    luka = {2, 1};
    
    for(int i = 0; i < N; i++){
        luka.push_back(luka.at(i) + luka.at(i + 1));
    }
    
    cout << luka.at(N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn=1e6+9,mod=998244353,up=5e6;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
LL n;
LL a[maxn];
int main(){
    n=Read();
    for(LL i=1;i<=n;++i) a[i]=Read();
    LL ret(0);
    for(LL i=3;i<=n;++i) ret^=a[i];
    
    LL x(a[1]),y(a[2]),tmp(0);
    for(LL i=0;i<x;i+=up){
    	LL l(i),r(i+up-1);
    	r=std::min(r,x-1);
    	LL L((x-l)^(y+l)),R((x-r)^(y+r));
    	if(L>R) std::swap(L,R);
    	if((L<=ret && ret<=R) || (std::abs(L-ret)<=up || std::abs(R-ret)<=up)){
    		for(LL j=l;j<=r;++j){
    			if(((x-j)^(y+j))==ret){
    				printf("%lld\n",j);
    				return 0;
				}
				++tmp;
				if(tmp>=6e7){
					puts("-1");
					return 0;
				}
			}
		}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 3772
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<ll> a;
    map<ll, int> replacements;
    for(int i=0;i<n;++i)
    {
        ll tmp;
        cin >> tmp;
        a.PB(tmp);
    }
    sort(a.begin(), a.end());
    for(int i=0;i<m;++i)
    {
        ll b, c;
        cin >> b >> c;
        replacements[c] += b;
    }

    auto iter = replacements.rbegin();
    for(int i=0;i<n;++i)
    {
        if(a[i] < iter->first)
        {
            iter->second--;
            a[i] = iter->first;
            if(iter->second == 0)
            {
                ++iter;
                if(iter == replacements.rend()) {
                    break;
                }
            }
        }
    }

    cout << std::accumulate(a.begin(), a.end(), 0ll) << endl;
}

Measured memory_bytes: 7284
N = int(input().strip())

ans = 0

table = [[0 for i in range(10)] for j in range(10)]
for n in range(1,N+1):
  strn = str(n)
  table[int(strn[0])][int(strn[-1])] += 1

for i in range(1,10):
  for j in range(1,10):
    ans += table[i][j] * table[j][i]

print(ans)

Measured memory_bytes: 40812
#include<iostream>
using namespace std;
int main()
{
	string s,s1;
	cin>>s;
	s1="CODEFESTIVAL2016";
	int t=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=s1[i])
		{
			t++;
		}
	}
	cout<<t<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

ll n,a,b;
ll m[100005];

int main() {
	scanf("%lld%lld%lld",&n,&a,&b);
	for(int i = 0; i < n; ++i)
		scanf("%lld",m+i);
	ll lo=0,hi = 1e9;
	a-=b;
	while(hi-lo>1) {
		ll md = (lo+hi)/2;
		ll need = 0;
		for(int i = 0; i < n; ++i) {
			need += max(0LL,((m[i]-b*md)+(a-1))/a);
		}
		if(need > md) lo = md;
		else hi = md;
	}
	printf("%lld\n",hi);
	return 0;
}

Measured memory_bytes: 1152
A, B, C, D = map(int, input().split(' '))
t_div, t_mod = divmod(C, B)
a_div, a_mod = divmod(A, D)
attack_time_takahashi = t_div + ( 1 if t_mod > 0 else 0)
attack_time_aoki = a_div + (1 if a_mod > 0 else 0)

if(attack_time_takahashi <= attack_time_aoki):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61884
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
#define print(n) cout<<n<<endl
const int M=100111;
const int inf=1000000007;
const long long INF=1000000000000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};



int main(){
	int n,a[200200];
	bool in[200200]={};
	cin>>n;
	rep(i,1,n+1)cin>>a[i];
	int m=0;
	for(int i=n;i>=1;i--){
		int sum=0;
		if(i*2>n){
			if(a[i]==1)in[i]=true;
		}else{
			rep(j,2,200010){
				if(i*j>n)break;
				sum+=in[i*j];
			}
			sum%=2;
			if(a[i]==0){
				if(sum==1)in[i]=true;
			}else{
				if(sum==0)in[i]=true;
			}
		}
		if(in[i]==1)m++;
	}
	print(m);
	rep(i,1,n+1){
		if(in[i]==true)cout<<i<<" ";
	}
}

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

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)
#define INF 1000000000
#define MOD 1000000007

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

bool ok[2222];

int main()
{
	ll n;cin >> n;
	vector<pair<ll,ll>> v;
	ll ma = -10000000000000;
	ll place = 0;
	
	REP(i,n)
	{
		ll tmp;
		cin >> tmp;
		v.PB(MP(tmp,i));
		if(ma < tmp)
		{
			ma = tmp;
			place = i;
		}
	}
	
	ll sumA = 0;
	ll sumB = 0;
	
	REP(i,n)
	{
		if(v[i].FI > 0)
		{
			if(i % 2 == 0)sumA += v[i].FI;
			else sumB += v[i].FI;
		}
	}
	
	ll botann = 0;
	if(sumA == 0 && sumB == 0)
	{
		ok[place] = true;
	}
	else
	{
		if(sumA < sumB)botann++;
		
		REP(i,n)if(i % 2 == botann && v[i].FI > 0)ok[i] = true;
	}
	
	vector<ll> sousa;
	
	while(v.size() > 1)
	{
		REP(i,v.size())
		{
			if(i == 0 || i == v.size() - 1)
			{
				if(ok[v[i].SE] == false)
				{
					sousa.PB(i);
					v.erase(v.begin() + i);
					break;
				}
			}
			else
			{
				if(ok[v[i].SE] == false &&(ok[v[i+1].SE] == ok[v[i-1].SE]))
				{
					v[i].FI = v[i-1].FI + v[i+1].FI;
					v[i].SE = v[i+1].SE;
					sousa.PB(i);
					v.erase(v.begin()+i-1);
					v.erase(v.begin()+i);
					break;
				}
			}
		}
	}
	
	cout << v[0].FI << endl;
	cout << sousa.size() << endl;
	
	REP(i,sousa.size())
	{
		cout << sousa[i]+1 << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#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;

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 main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  double PI = 3.14159265358979;
  double h = 2 * PI * (H / 12.) + 2 * PI * (1. / 12.) * (M / 60.);
  double m = 2 * PI * (M / 60.);
  double deg = max(h, m) - min(h, m);
  double anssq = pow(A, 2) + pow(B, 2) - 2 * A * B * cos(deg);
  double ans = sqrt(anssq);
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


Measured memory_bytes: 4204
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    while(1){
        int n;
        cin>>n;
        if(n==0)break;
        int maxx=0,can=0;
        for(int i=0;i<n;i++){
            int a;
            cin>>a;
            if(maxx<a)maxx=a;
            if(a)can++;
        }
        if(maxx<2)puts("NA");
        else printf("%d\n",can+1);
    }
	return 0;
}

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

using namespace std;

using ll = long long;

struct Point {
    ll x, y;
    Point() {}
    Point(ll _x, ll _y) : x(_x), y(_y) {}
    int parity() const { return (abs(x) + abs(y)) % 2; }
};
inline ll Length(const Point &p1, const Point &p2) {
    return abs(p1.x - p2.x) + abs(p1.y - p2.y);
}

bool Same(int n, const auto &p) {
    for (int i = 1; i < n; ++i)
        if (p[0].parity() != p[i].parity())
            return false;
    return true;
}

const ll dx[] = {-1, 0, 1, 0};
const ll dy[] = {0, 1, 0, -1};
const string mv = "LURD";
void Move(const Point &dst, const auto &dd) {
    string op;
    Point cur(0, 0);
    for (auto d : dd) {
        ll bst_dir = -1, len = 0;
        for (int dir = 0; dir < 4; ++dir) {
            Point nxt(cur.x + d * dx[dir], cur.y + d * dy[dir]);
            const ll l = Length(nxt, dst);
            if (bst_dir == -1 || l < len) {
                bst_dir = dir;
                len = l;
            }
        }
        op += mv[bst_dir];
        cur = Point(cur.x + d * dx[bst_dir], cur.y + d * dy[bst_dir]);
    }

    // cur.x = 0;
    // cur.y = 0;
    // const int m = dd.size();
    // for (int i = 0; i < m; ++i) {
    //     for (int dir = 0; dir < 4; ++dir) {
    //         if (op[i] != mv[dir]) continue;
    //         cur.x += dd[i] * dx[dir];
    //         cur.y += dd[i] * dy[dir];
    //         break;
    //     }
    // }
    // if (cur.x != dst.x || cur.y != dst.y)
    //     cout << "Not Same\n";

    cout << op << "\n";
}


void Solve() {
    int n;
    cin >> n;

    vector<Point> p(n);
    for (int i = 0; i < n; ++i)
        cin >> p[i].x >> p[i].y;

    if (!Same(n, p)) { cout << "-1\n"; return ; }

    int m = 31;
    vector<ll> d;
    for (ll i = 0, dd = 1; i < m; ++i) {
        d.push_back(dd); dd *= 2;
    }
    if (p[0].parity() == 0) { ++m; d.push_back(1); }

    reverse(d.begin(), d.end());
    cout << m << "\n";
    for (int i = 0; i < m; ++i)
        cout << d[i] << " \n"[i == m - 1];

    for (int i = 0; i < n; ++i) Move(p[i], d);
}

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

    Solve();

    return 0;
}


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

int main(void) {
	
	char S[4];
	int ret = 0;
	cin >> S;

	for(int i=0; i<4; i++)
		if(S[i] == '+') {
			ret++;
		} else {
			ret--;
		}
	cout << ret;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int a,b,sum=0;
    int c[60];
    cin>>a>>b;
    for(int i=0;i<a;i++)
    {
        cin>>c[i];
    }
    sort(c,c+a);
    int i=a-1;
    while(b--)
    {
        sum=sum+(c[i]);
        i--;
    }
    cout<<sum;
}


Measured memory_bytes: 256
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let NX = lines.shift().trim().split(/\s/).map((v) => v - 0);
    let n = NX[0], x = NX[1];
    let S = lines.shift().trim().split(/\s/).map((v) => v - 0);
    const MOD = 1e9 + 7, MAX_N = 210, MAX_VAL = 1e5 + 10;
    const add = (a, b) => (a + b) % MOD;
    const mul = (a, b) => (a * b) % MOD;
    let dp = new Array(MAX_N).fill(0).map(() => new Array(MAX_VAL).fill(-1));
    const rec = (pos, rem) => {
        if (pos == n) return rem;
        let ret = dp[pos][rem]
        if (ret != -1) return ret;
        ret = 0;
        dp[pos][rem] = add(ret, rec(pos + 1, rem % S[pos]));
        dp[pos][rem] = add(dp[pos][rem], mul(n - pos - 1, rec(pos + 1, rem)));
        return dp[pos][rem];
    }
    S.sort((a, b) => b - a);
    console.log(rec(0, x));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 367292
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

int main(void){
  int n;

  cin>>n;
  vector<long long> a(88);

  a[0] = 2;
  a[1] = 1;
  for(int i = 2; i < 88 ; i ++){
    a[i] = a[i-1] + a[i-2];
    // cout<<a[i]<<endl;
  }
  cout<<a[n]<<endl;
}

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

#define ll long long
#define mod 1000000007
#define f(i, a, b) for (long long i = a; i < b; i++)
#define fm(i, a, b, c) for (long long i = a; i > b; i--)
#define vi vector<i>
#define vl vector<long long>
#define vs vector<string>
#define t     \
    ll t;     \
    cin >> t; \
    while (t--)
#define pb(i) push_back(i)
#define mp(i, j) make_pair(i, j)
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL)
int main()
{
    ll n;
    cin >> n;
    ll total = 0;
    ll m1 = n / 500;
    total += 1000 * m1;
    n = n % 500;
    m1 = n / 5;
    total += 5 * m1;
    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256