akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >>n;
    vector<ll> d(n);
    
    
    for (ll i = 0; i < n; i++){
        cin >> d[i];
    }
    ll ans = 0;
    for (ll i = 0; i < n; i++){
        for (ll j = i+1; j < n; j++){
            ans += d[i]*d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
console.log((args=>{
  const [H,W] = args.trim().split` `.map(v=>v|0);
  let min = Math.min( H%3&&W, W%3&&H );
  if ( !min ) return min;
  const Hmin = ((H-min*2)/3)|0, Hmax = min+((H-min)/3)|0;
  for ( let i = Hmin; i < Hmax; i++ ) {
    const Wmin = W>>1, Wmax = W-Wmin;
    const s = Math.max( (H-i) * Wmax, i * W ) - Math.min( (H-i) * Wmin, i * W )
    if ( s < min ) min = s;
  }
  const Wmin = ((W-min*2)/3)|0, Wmax = min+((W-min)/3)|0;
  for ( let i = Wmin; i < Wmax; i++ ) {
    const Hmin = H>>1, Hmax = H-Hmin;
    const s = Math.max( (W-i) * Hmax, i * H ) - Math.min( (W-i) * Hmin, i * H )
    if ( s < min ) min = s;
  }
  return min;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  
  if ( a.at(a.size()-1) == b.at(0) && b.at(b.size()-1) == c.at(0) ){
    cout << "YES";
  }
  else {
    cout << "NO";
  }
  
}

Measured memory_bytes: 256
N=int(input())
from collections import deque
l=deque(map(int,input().split()))
l.appendleft(0)
l.append(0)
S=[abs(l[i]-l[i+1]) for i in range(N+1)]
S_sum=sum(S)
for i in range(N):
   print(S_sum-S[i]-S[i+1]+abs(l[i]-l[i+2]))

Measured memory_bytes: 13544
#include<iostream>
#include<cstring>
using namespace std;
int a,b,c,x;
int sum=0;
int k[10001][4];
int z[51][51][51];
int dfs(int t1,int t2,int t3)
{
	if(z[t1][t2][t3]==1) return 0;
	z[t1][t2][t3]=1;
	if(t1>a||t2>b||t3>c) return 0;
	if(t1*500+t2*100+t3*50>x) return 0;
	if(t1*500+t2*100+t3*50==x)
	{
	/*	int ok=1;
		for(int i=0;i<=sum;i++)
		{
			if(t1==k[i][1]&&t2==k[i][2]&&t3==k[i][3])
			{
				ok=0;
				break;
			}
		}
		if(ok)
		{
			t1=k[sum][1];
			t2=k[sum][2];
			t3=k[sum][3];*/
			sum++;
		/*}
		return 0;*/
	}
	dfs(t1+1,t2,t3);
	dfs(t1,t2+1,t3);
	dfs(t1,t2,t3+1);
}
int main()
{
	cin>>a>>b>>c>>x;
	memset(k,0,sizeof(k));
	memset(z,0,sizeof(z));
	dfs(0,0,0);
	cout<<sum<<endl;
	return 0;
 } 

Measured memory_bytes: 896
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
const ll mod = 998244353;
 
#define mp make_pair
#define pb push_back
#define lb lower_bound

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 != 0) return binpow(a, n-1)*a; else {
		ll b = binpow(a, n/2);
		return b*b;
	}
}

ll gcd(ll a, ll b) {
	while(b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

void solve() {
	int k, n;
	cin >> k >> n;
	vector<int> a(n);

	for (int i = 0; i < n; i++)
		cin >> a[i];

	int ans = 2000000000;
	ans = min(ans, k-a[1]+a[0]);
	ans = min(ans, a[n-1]-a[0]);
	ans = min(ans, k-a[n-1]+a[n-2]);
	ans = min(ans, a[n-1]-a[0]);
	for (int i = 2; i < n-2; i++) {
		ans = min(ans, k-a[i+1] + a[i]);
		ans = min(ans, k-a[i] + a[i-1]);
	}
	cout << ans << endl;
}
 
int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 1024
x, y = [int(i) for i in input().split()]

mod = 10 ** 9 + 7
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, 670000):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


# 以下のcom関数を用いて組み合わせを計算
def com(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod


if (2*x-y) % 3 == 0 and (2*y-x) % 3 == 0:
    a = (2*x-y) // 3
    b = (2*y-x) // 3
    #a+bC(min(a,b))
    ans = 0
    n = a + b
    r = min(a, b)
    print(com(n, r, mod))

else:
    print(0)


Measured memory_bytes: 118892
/* Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define debug(x) cout << #x << " " << x <<endl;
#define set_bits __builtin_popcount
typedef long long ll;
typedef unsigned long long ull;
/*---------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod)
{ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll combination(ll n, ll r, ll m, ll* fact) {ll val1 = fact[n]; ll val2 = mminvprime(fact[r], m); ll val3 = mminvprime(fact[n - r], m); return ((val1 * val2) % m * val3) % m;}
/*--------------------------------------------------------------------------------------------------------------------------*/
ll helper(int *ans, int index, int end, int n, int m, int k, string *arr)
{
	// debug(index);
	if (index == end)
	{
		int count_of_black = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				if (arr[i][j] == '#' && ans[i] == 0 && ans[j + n] == 0)
					count_of_black++;
			}
		}
		if (count_of_black == k)
			return 1;
		else
			return 0;
	}
	ans[index] = 1;
	ll ans1 = helper(ans, index + 1, end, n, m, k, arr);
	ans[index] = 0;
	ll ans2 = helper(ans, index + 1, end, n, m, k, arr);
	return ans1 + ans2;
}
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	int n, m, k;
	cin >> n >> m >> k;
	string *arr = new string[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int *ans = new int[n + m]();
	cout << helper(ans, 0, n + m, n, m, k, arr) << endl;
	return 0;
}


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

int main() {
  int N,K;
  cin >> N>>K;

  int z=0;

  for(int i =0; i<N; i++){
    int x;
    cin>>x;

    if (x<K-x)
    z+=x*2;
    else
    z+=(K-x)*2;
  }

  cout <<z<<endl;

}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
int main()
{
    int n;
    cin >> n;
    vector<int> c(n),s(n),f(n);
    for(int i = 0; i < n-1; i++) cin >> c[i] >> s[i] >> f[i];
    for(int i = 0; i < n-1; i++){
        int res = s[i]+c[i];
        for(int j = i+1; j < n-1; j++){
            if(res <= s[j]) res = s[j];
            else res = s[j]+((res-s[j])+f[j]-1)/f[j]*f[j];
            res += c[j];
        }
        cout << res << endl;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353

n = I()
x = S()
rx=x.replace("1","2").replace("0","1").replace("2","0")
D = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        if n // i % 2:
            D += [i]
        if i != n // i and i % 2:
            D += [n // i]

D.sort()
bx=int(x,2)
cnt = [0] * len(D)
ans = 0
for k in range(len(D)):
    t=x[:D[k]]
    rt=rx[:D[k]]
    f=(t+rt)*(n//D[k]//2)+t
    cnt[k]=cnt[k]+int(f<=x)+int(t,2)
    cnt[k]%=mod
    ans += cnt[k]*D[k]*2
    for kk in range(k + 1, len(D)):
        if D[kk] % D[k] == 0:
            cnt[kk] -= cnt[k]
            cnt[kk]%=mod
    ans %= mod

print(ans % mod)


Measured memory_bytes: 108568
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> q(n);
  rep(i,n){
    cin >> p[i];
  }
  rep(i,n){
    cin >> q[i];
  }
  vector<int> a(n);
  rep(i,n){
    a[i] = i + 1;
  }
  map<vector<int>, int> mp;
  do{
    mp[a] = mp.size();
  } while (next_permutation(a.begin(), a.end()));
  
  int ans = abs(mp[p]-mp[q]);
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 8572
#pragma GCC optimize(2,3)
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define re register
#define int long long
using namespace std;
int n,m,k,ans,a[1000002];
char s[1000002];
signed main(){
scanf("%s",s+1);
n=strlen(s+1);
for(re int i=1;i<=n;++i)a[i]=s[i]-'0';
for(re int i=n;i>=1;--i){
	if(a[i]>=10){
		a[i-1]+=a[i]/10;
		a[i]%=10;
	}
if(a[i]<5)ans+=a[i];
else if(a[i]>5)ans+=10-a[i],++a[i-1];
else if(a[i-1]>=5){ans+=10-a[i],++a[i-1];
}
else ans+=a[i];
}
if(a[0]<=5)ans+=a[0];
else ans+=11-a[0];
cout<<ans<<endl;
}


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

int main(){
  string s, t;
  cin >> s >> t;
  for(int i=0; i<t.length(); i++){
    if(s==t){
      cout << "Yes" << endl;
      return 0;
    }
    char tmp=t[0];
    for(int j=1; j<t.length(); j++)t[j-1]=t[j];
    t[t.length()-1]=tmp;
  }
  cout << "No" << endl;
  return 0;
}
      


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRepsept solver = new CRepsept();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRepsept {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int k = s.nextInt();
            if (k % 2 == 0 || k % 5 == 0) {
                out.println(-1);
                return;
            }

            long curr = 7;
            for (int i = 0; i < k; i++) {
                if (curr % k == 0) {
                    out.println(i + 1);
                    return;
                }
                curr *= 10L;
                curr %= k;
                curr += 7L;
                curr %= k;
            }

            out.println(-1);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

int main(){
    int n;
    cin >> n;
    auto h = vector<int>(n+1,0);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    long long ans =0;
    for (int l = 0; l < n; l++)
    {
        while(h[l]>0){
          int r=l;
          while(h[r]>0){
              r++;
          }
          r--;
          auto _min = *min_element(h.begin()+l,h.begin()+r);
          for (int i = l; i <= r; i++)
          {
              h[i] -= _min;
          }

          ans+=_min;
        }
    }
  
    cout<< ans;
    
    
}

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

int main(){

  int i,j,k;
  int N;
  int A;
  
  A = 1;
  scanf("%d",&N);
  /*for(i=(N-1);i>=1;i--){
    A *= i;
    printf("%d\n",A);
  }*/
  A = N-1;
  int zahyo[N+1][2];
  double kyori;
  double length;
  
  k = 0;
  for(i=1;i<=N;i++){
    scanf("%d %d2",&zahyo[i][0],&zahyo[i][1]);
  }
  for(i=1;i<=N;i++){
    for(j=i+1;j<=N;j++){
      kyori = sqrt( pow((zahyo[i][0]-zahyo[j][0]),2.0)+pow((zahyo[i][1]-zahyo[j][1]),2.0) );
      length += A*kyori;
      k++;
    }
  }
  
  double ans;
  ans = length/k;
  printf("%f\n",ans);

  /*double length;
  for(i=2;i<=N;i++){
    for(j=i+1;j<=N;j++){
      
    }
  }*/
    
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use proconio::{fastout, input};
use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        k: u64,
        a: [u64; n],
        b: [u64; m],
    }
    let a = std::iter::once(0).chain(a.into_iter()).cumsum::<u64>().take_while(|&x| x <= k).collect_vec();
    let b = std::iter::once(0).chain(b.into_iter()).cumsum::<u64>().collect_vec();
    let mut ans: usize = 0;
    let mut j: usize = m;
    for i in 0 as usize .. a.len() {
        while a[i] + b[j] > k {
            j -= 1;
        }
        ans = std::cmp::max(ans, i + j);
    }
    println!("{}", ans);
}


Measured memory_bytes: 9400
A, B, C = map(int, input().split())

# 1. 3つとも違う数字
#  => 小さいふたつを + 1
# 2. 2つ同じ数字
#  => 1つだけの数字が小さい
#     小さい数字を + 2
#  => 1つだけの数字が大きい
#     小さいふたつを + 1
result = 0
while True:
    if A == B and B == C:
        break
    elif A != B and B != C and A != C:
        if A < B:
            if B < C:
                A += 1
                B += 1
            else:
                A += 1
                C += 1
        else:
            if A < C:
                A += 1
                B += 1
            else:
                B += 1
                C += 1
    else:
        if A == B:
            if A > C:
                C += 2
            else:
                A += 1
                B += 1
        elif B == C:
            if A > B:
                B += 1
                C += 1
            else:
                A += 2
        else:
            # A == C
            if A > B:
                B += 2
            else:
                A += 1
                C += 1
    result += 1
print(result)


Measured memory_bytes: 3064
#include <iostream>
 
using namespace std;
 
int main(){
  int A,B,C = 0;
  int tmp = 0;
  
  cin >> A >> B >> C;

  tmp = A;
  A = B;
  B = tmp; 

  tmp = A;
  A = C;
  C = tmp;
  
  cout << A << " " << B << " " << C << endl;
  
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    if((a * b) % 2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
 
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define ll long long

const int MOD = 1e9 + 7;

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

    int x = 0;
    int max = 0;
    REP(i, n)
    {
        if(s[i] == 'I') x++;
        else if(s[i] == 'D')x--;
        max = MAX(x, max);
    }
    cout << max << endl;

}

Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
N,x = inputlist()
a = inputlist()
a.sort()
count=0
for i in range(N):
    x -=a[i]
    if x < 0:
        print(count)
        exit()
    count +=1
if x >0:
    count -=1
print(count)

Measured memory_bytes: 3316
#include <stdio.h>
int main() {
    int n,m,t,p = 1,sum = 0;
    scanf("%d %d",&n,&m);
    t = m * 1900 + (n - m) * 100;
    for(int i = 0;i < m;i++) p *= 2;
    printf("%d",t * p);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

int main() {

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

	Int N;
	cin >> N;

	map<Int, Int> num;
	Int temp;
	for (Int i = 0; i < N; i++) {
		cin >> temp;
		num[temp]++;
	}

	Int ans = 0;
	for (auto itr = num.begin(); itr!=num.end(); ++itr) {
		if (itr->first < itr->second) {
			ans += itr->second - itr->first;
		}
		else if (itr->first > itr->second) {
			ans += itr->second;
		}
	}

	cout << ans << endl;
}

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

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

int main()
{
  int D, T, S;
  cin >> D >> T >> S;
  if( D <= T*S ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3604
#include <stdio.h>

int main()
{
    int x, y;
    scanf("%d %d", &x, &y);
    while (x != 0 || y != 0)
    {
        for (int i = 0; i < x; i++)
        {
            for (int j = 0; j < y; j++)
            {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d", &x, &y);
    }
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int n,W,w[109],v[109],dp[100009],ans;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	cin>>n>>W;
	for(int i=0;i<n;i++) cin>>w[i]>>v[i];
	for(int i=0;i<n;i++)
		for(int j=100008;j>=v[i];j--)
			dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
	for(int i=100008;i>=0;i--)
		if(dp[i]<=W) {
			cout<<i<<endl;
			return 0;
		}
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int N, M;
vector<vector<int> > E;
vector<int> res;
bool use[100100];

bool dfs(int n, bool f = false) {
	if(use[n]) return false;
	use[n] = true;
	res.push_back(n+1);
	rep(i,E[n].size()) {
		if(f && dfs(E[n][i])) {
			f = false;
			reverse(all(res));
		}
		if(!f && dfs(E[n][i])) return true;
	}
	return true;
}

int main() {
	cin >> N >> M;
	E.resize(N);
	rep(i,M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	dfs(0, true);
	cout << res.size() << endl;
	rep(i,res.size()) {
		if(i) cout << " ";
		cout << res[i];
	} cout << endl;
	return 0;
}


Measured memory_bytes: 12536
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int N, a[110] = {}, amax, amin, cost[250] = {}, ans = 1000000000;

  cin >> N;

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

  amax = a[0];
  amin = a[0];

  for(int i = 0;i < N;i++){
    amax = max(amax, a[i]);
    amin = min(amin, a[i]);
  }

  for(int i = amin + 100;i <= amax + 100;i++){
    for(int j = 0;j < N;j++){
      cost[i] += ((i-100) - a[j]) * ((i-100) - a[j]);
    }
  }

  for(int i = amin + 100;i <= amax + 100;i++){
    ans = min(ans, cost[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
 public class Main {
     public static void main(String args[] ) throws Exception {
		 Scanner sc = new Scanner(System.in);
		 int K = Integer.valueOf(  sc.nextLine() ) ;

		List<Long> list00 = new ArrayList<>();
		 Deque<Long> queue = new ArrayDeque<>() ;
		 for ( int j=1 ; j<10 ; j++ ) {
			 list00.add ( (long)j ) ;
			 queue.add ( (long)j  ) ; 
		 }

		 while ( list00.size() < K ) {
			Deque<Long> queue2 = new ArrayDeque<>() ;
			for ( Long v : queue ) {
				Long x = v  % 10 ;
					
				Long v2 ;
				if ( x > 0 ) {
					v2 = v * 10 + ( x -1 ) ;
					queue2.add ( v2 ) ;
					list00.add ( v2 ) ; 
					if ( list00.size() >= K ) break ;
				}

				v2 = v * 10 + x ;
				queue2.add ( v2 ) ;
				list00.add ( v2 ) ; 
				if ( list00.size() >= K ) break ;
					
				if ( x < 9 ) {
					v2 = v * 10 + x + 1 ;
					queue2.add ( v2 ) ;
					list00.add ( v2 ) ; 
					if ( list00.size() >= K ) break ;
				}
			}
			if ( list00.size() >= K ) break ;
			queue = queue2 ;
		 }
			
		Collections.sort( list00 ) ;	
		System.out.println( list00.get( K -1 ) ) ;
	 }
}

Measured memory_bytes: 27476
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int main()
{
    ios::sync_with_stdio(false);
    cin>>s1>>s2;
    reverse(s1.begin(),s1.end());
    if(s1==s2) printf("YES\n");
    else printf("NO\n"); 
}

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

int main(void) {
	int n;
	cin >> n;
	int t;
	int sum = 0;
	for (t = 1;;t++) {
		sum += t;
		if(sum >= n) break;
	} 
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 768
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <string.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;

#define MAX_N 64

typedef struct node_st {
	int left, right;
	int pre, in;
} node_t;

int n;
int preorder[MAX_N];
int inorder[MAX_N];
node_t nd[MAX_N];

void recons(int id, int base , int n) {
	int pre, in, remain_left, remain_right;
	if (id == 0) return;

	pre = nd[id].pre;
	in = nd[id].in;
	remain_left = (in - base);
	remain_right = n - remain_left - 1;

	if (remain_left > 0) {
		nd[id].left = preorder[pre+1];
		recons(nd[id].left, base, remain_left);
	}

	if (remain_right > 0) {
		nd[id].right = preorder[pre+remain_left+1];
		recons(nd[id].right, in+1, remain_right);
	}
}

void postorder(int id) {
	static const char *sp = "";
	if (!id) return;
	if (nd[id].left) postorder(nd[id].left);
	if (nd[id].right) postorder(nd[id].right);
	printf("%s%d", sp, id);
	sp = " ";
}

int main(int argc, char **argv)
{
	int i;

	memset(nd, 0, sizeof(node_t) * MAX_N);
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &preorder[i]);
		nd[preorder[i]].pre = i;
	}
	for (i = 0; i < n; i++) {
		scanf("%d", &inorder[i]);
		nd[inorder[i]].in = i;
	}

	recons(preorder[0], 0, n);
	postorder(preorder[0]);
	puts("");

	return 0;
}

Measured memory_bytes: 608
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <cmath>
#include <bitset>
#include <random>
#include <regex>


using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(10)
#define int int_fast64_t
using pii = pair<int,int>;
using Graph = vector<vector<pii> >;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;

int n, k;
vector<vector<int> > abc, dp;

int rec(int k, int x){
    if(k == 0) return (abc[k][x]);
    if(~dp[k][x]) return (dp[k][x]);
    int maxv = 0;
    rep(i,3){
        if(x == i) continue;
        chmax(maxv, rec(k - 1, i));
    }

    return (dp[k][x] = maxv + abc[k][x]);
}

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cin >> n;

    abc.resize(n, vector<int>(3, 0));
    dp.resize(n, vector<int>(3, -1));
 
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < 3; ++j){
            cin >> abc[i][j];
        }
    }

    cout << max({rec(n-1, 0), rec(n-1, 1), rec(n-1, 2)}) << '\n';

    return 0;
}  

Measured memory_bytes: 18768
X,Y,A,B,C = map(int,input().split())
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)

p = p[:X]
q = q[:Y]
s = sorted(p+q+r,reverse=True)[:X+Y]
print(sum(s))

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

vii G(200010);
string s;


int main() {
  int n, m;
  cin >> n >> m;
  cin >> s;
  vii ok(n, vi(2));
  rep (i, m) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  rep (i, n) {
    sort(all(G[i]));
    UNIQUE(G[i]);
  }
  vii num(n, vi(2));
  rep (i, n) {
    rep (j, G[i].size()) {
      int u = i, v = G[i][j];
      num[u][s[v]-'A']++;
    }
  }
  queue<int> qu;
  set<int> st;
  rep (i, n) {
    if (num[i][0] * num[i][1] == 0) qu.push(i);
    st.insert(i);
  }
  while (!qu.empty()) {
    int u = qu.front();
    qu.pop();
    st.erase(u);
    char c = s[u];
    rep (i, G[u].size()) {
      int v = G[u][i];
      if (st.count(v) == 0) continue;
      num[v][c - 'A']--;
      if (num[v][c - 'A'] == 0) {
        qu.push(v);
      }
    }
  }
  if (st.size() == 0) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


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

using namespace std;
static const int MAX = 2000000;

int H, A[MAX + 1];

void maxHeapify(int i)
{
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	largest = i;
	if (l <= H && A[l] > A[i])
	{
		largest = l;
	}
	if (r <= H && A[r] > A[largest])
	{
		largest = r;
	}
	if (largest != i)
	{
		int temp = A[i];
		A[i] = A[largest];
		A[largest] = temp;
		maxHeapify(largest);
	}
}

void solve()
{
	cin >> H;
	for (int i = 1; i <= H; ++i)
	{
		cin >> A[i];
	}
	for (int i = H / 2; i >= 1; --i)
	{
		maxHeapify(i);
	}
	for (int i = 1; i <= H; ++i)
	{
		cout << " " << A[i];
	}
	cout << endl;
}

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

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}


int main(){
    string str; cin >> str;
    map<string,int> y;
    y["MON"] = 6;
    y["TUE"] = 5;
    y["WED"] = 4;
    y["THU"] = 3;
    y["FRI"] = 2;
    y["SAT"] = 1;
    y["SUN"] = 7;
    
    pr(y[str]);
    return 0;
}


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

int main(){
    int K,X;
    cin >> K >> X;
    for (int i = X-K+1; i < X+K; i++)
    {
        cout << i;
        if(i!=X+K-1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

H, W, K = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())

G = [['#'] * (W + 2)]
for _ in range(H):
    tmp = ['#'] + list(input()) + ['#']
    G.append(tmp)

G.append(['#'] * (W + 2))
INF = 10 ** 6+ 10
dp = [[INF] * (W + 2) for _ in range(H + 2)]

que = deque()
que_append = que.append
que_popleft = que.popleft

que_append((x1, y1))
dp[x1][y1] = 0
while que:
    xy = que_popleft()
    x = xy[0]
    y = xy[1]
    tmp = dp[x][y] + 1
    # print ('x, y', x, y)
    if dp[x][y] == dp[x + 1][y] and dp[x][y] != INF:
        pass
    else:
        for k in range(1, K + 1):
            if G[x + k][y] == '.':
                if dp[x + k][y] > tmp:
                    dp[x + k][y] = tmp
                    que_append((x + k, y))
            else:
                break
    if dp[x][y] == dp[x - 1][y] and dp[x][y] != INF:
        pass
    else:
        for k in range(1, K + 1):
            if G[x - k][y] == '.':
                if dp[x - k][y] > tmp:
                    dp[x - k][y] = tmp
                    que_append((x - k, y))
            else:
                break
    if dp[x][y] == dp[x][y + 1] and dp[x][y] != INF:
        pass
    else:
        for k in range(1, K + 1):
            if G[x][y + k] == '.':
                if dp[x][y + k] > tmp:
                    dp[x][y + k] = tmp
                    que_append((x, y + k))
            else:
                break

    if dp[x][y] == dp[x][y - 1] and dp[x][y] != INF:
        pass
    else:
        for k in range(1, K + 1):
            if G[x][y - k] == '.':
                if dp[x][y - k] > tmp:
                    dp[x][y - k] = tmp
                    que_append((x, y - k))
            else:
                break

if dp[x2][y2] != INF:
    print (dp[x2][y2])
else:
    print (-1)

# for tmp in dp:
#     print (tmp)

Measured memory_bytes: 173880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<19;
const ll INF=1LL<<60;

bool compare(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first+a.second==b.first+b.second) return a.first>b.first;
    return a.first+a.second<b.first+b.second;
}

int main(){
    
    int N;cin>>N;
    vector<pair<ll,ll>> A(N);
    for(int i=0;i<N;i++) cin>>A[i].first>>A[i].second;
    
    sort(all(A),compare);
    
    vector<vector<ll>> dp(N+3,vector<ll>(N+3,INF));
    dp[0][0]=0;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=i;j++){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            if(dp[i][j]<=A[i].first) dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+A[i].second);
        }
    }
    
    for(int j=0;j<=N+2;j++){
        if(dp[N][j]==INF){
            cout<<j-1<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 196096
#include<iostream>
#include<cstdio>
#define MAXAMOUNT 100000
int MAXNUM = 100000;
int MAXWEIGHT = 10000;
int amount,num;
long long list[MAXAMOUNT];

int check(int value){
    int sum = 0;
    int checkNum = 1;
    for(int i = 0;i<amount;i++){
        if(list[i] > value){
            return 0;
        }
        sum += list[i];
        if(sum > value){
            checkNum++;
            sum = list[i];
            if(checkNum > num){
                return 0;
            }
        }
    }
    return 1;
}

int binarySearch(){
    int min = 0;
    long long max = MAXAMOUNT * MAXWEIGHT;
    while(max-min > 1){
        int center = (min + max) / 2;
        if(check(center)==1){
            max = center;
        }
        else{
            min = center;
        }
    }
    return max;
}

int main(){
    scanf("%d%d",&amount,&num);
    int temp;
    for(int i=0;i<amount;i++){
        scanf("%d",&temp);
        list[i] = temp;
    }
    printf("%d\n",binarySearch());
}


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


int main() {
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	while(true){
		C-=B;
		if(C<=0){
			C=1;
			break;
		}
		A-=D;
		if(A<=0){
			A=2;
			break;
		}
	}
	if(C==1 && A!=2){
		cout<<"Yes"<<endl;
	}
	if(A==2){
		cout<<"No"<<endl;
	}
		

}


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

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1e9+7;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;

int main(){
    fast   

    lli n,sum=0;
    cin>>n;
    
    vector<lli>v(n);
    vector<lli>p(n);
    for(int i=0;i<n;i++) {
        cin>>v[i];
    }

    p[n-1]=v[n-1];
    for(int i=n-2;i>=0;i--) p[i]=v[i]+p[i+1];

    lli ans=0;
    for(int i=0;i<n-1;i++){
        ans=(ans + (v[i]%MOD)*(p[i+1]%MOD)%MOD)%MOD;
    }
    cout<<ans%MOD<<"\n";

    return 0;
}

Measured memory_bytes: 6280
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  long long N,M;
  cin>>N>>M;
  
  long long ans=0;
  
  
  if(N==1&&M==1){
    ans=1;
  }
  else if(N==1||M==1){
    ans=N*M-2;
  }
  else{
    ans=(N-2)*(M-2);
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std; long long a[1000010];
int main()
{
	int n, m;
	cin >> n >> m;
	long long sum = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i]; sum += a[i];
	}
	if (sum > n) cout << -1;
	else
	{
		cout <<n - sum;
	}
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int num[4];
  num[0]=n/1000;
  num[1]=(n-num[0]*1000)/100;
  num[2]=(n-num[0]*1000 -num[1]*100)/10;
  num[3]=(n-num[0]*1000 -num[1]*100 -num[2]*10);
  if(num[1]==num[2] && (num[0] == num[1] || num[1] == num[3])){
  	cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int a[200005];
    cin >> n;
    for(int i = 0 ; i < n;i++)cin >> a[i];
    int ma = -1e9,mi = a[0];
    for(int i = 1 ; i < n;i++){
        ma = max(ma,a[i] - mi);
        mi = min(mi,a[i]);
    }
    cout << ma << endl;

    return 0;
}



Measured memory_bytes: 3864
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    ll N,K; cin >> N >> K;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    ll l=0, r=LNF;
    ll mid=0;
    ll cnt=0;
    while(r-l>1){
        mid=(l+r)/2;
        cnt = 0;
        for(int i=0;i<N;i++){
            cnt += (A[i]+mid-1)/mid;
        }
        cerr << l << " " << r << " = " << mid << "\t" << cnt << endl;
        if(cnt>K+N) l = mid;
        else r = mid;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=266666,mod=998244353;
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,el,head[maxn],to[maxn],nxt[maxn],w[maxn];
ll lim,pre[maxn];
struct item{
	ll in,out;
};
vector<item> v[maxn];
inline bool cmp1(item i1,item i2){return i1.in<i2.in;}
inline bool cmp2(item i1,item i2){return i1.out<i2.out;}
inline void add(int u,int v,int w_){
	to[++el]=v;nxt[el]=head[u];head[u]=el;w[el]=w_;
}
void dfs(int u,int f){
	int ls=0,rs=0,dyls=0,dyrs=0;	// nice variable
	for(int i=head[u];i;i=nxt[i]){
		int v=to[i];
		if(v==f) continue;
		dfs(v,u);
		if(!ls) ls=v,dyls=w[i];
		else rs=v;dyrs=w[i];
	}
	if(!ls && !rs){
		v[u].push_back((item){0,0});
		return;
	}
	vector<item> &l=v[ls],&r=v[rs],&ans=v[u];
	if(l.empty() || r.empty()) return;
	FOR(i,0,l.size()-1) l[i].in+=dyls,l[i].out+=dyls;
	FOR(i,0,r.size()-1) r[i].in+=dyrs,r[i].out+=dyrs;
	if(l.size()>r.size()) swap(l,r);
	sort(l.begin(),l.end(),cmp2);
	sort(r.begin(),r.end(),cmp1);
	pre[0]=r[0].out;
	FOR(i,1,(int)r.size()-1) pre[i]=min(pre[i-1],r[i].out);
	int cur=r.size()-1;
	FOR(i,0,(int)l.size()-1){
		while(cur>=0 && l[i].out+r[cur].in>lim) cur--;
		if(cur>=0) ans.push_back((item){l[i].in,pre[cur]});
		else break;
	}
	sort(l.begin(),l.end(),cmp1);
	sort(r.begin(),r.end(),cmp2);
	pre[0]=r[0].in;
	FOR(i,1,(int)r.size()-1) pre[i]=min(pre[i-1],r[i].in);
	cur=r.size()-1;
	FOR(i,0,(int)l.size()-1){
		while(cur>=0 && l[i].in+r[cur].out>lim) cur--;
		if(cur>=0) ans.push_back((item){pre[cur],l[i].out});
		else break;
	}
}
int main(){
	n=read();
	FOR(i,1,n-1){
		int u=read(),w=read();
		add(u,i+1,w);add(i+1,u,w);
	}
	ll l=0,r=1e11;
	while(l<r){
		lim=(l+r)>>1;
		FOR(i,1,n) v[i].clear();
		dfs(1,0);
		if(!v[1].empty()) r=lim;
		else l=lim+1;
	}
	printf("%lld\n",l);
}

Measured memory_bytes: 32504