akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
    int N=0, M=0, ans=0;
    cin >> N >> M;
    bool A[N][M];
    REP(i,N) REP(j,M) A[i][j]=false;

    for(int i=0;i<N;++i){
        int K=0;
        cin >> K;
        for(int j=0;j<K;++j){
            int _=0;
            cin >> _;
            --_;
            A[i][_]=true;
        }
    }

   for(int j=0;j<M;++j){
       bool flg=true;
       for(int i=0;i<N;++i){
           if(!A[i][j]) flg=false;
       }
       if(flg) ++ans;
   }
    
    cout << ans << endl;
}

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

typedef long long ll;
const int N = 1e5 + 100, inF = 1e9 + 100;

ll n, a[N], ps[N];
unordered_map<int, int> cnt;

ll check(ll num) {
	ll res = 0, now = 0;
	cnt.clear();
	cnt[0] = 1;
	for (int i = 0; i < n; i++) {
		ps[i] = (i? ps[i - 1]: 0) + (a[i] <= num? 1: -1);
		if(a[i] <= num)
			now += cnt[ps[i] - 1];
		else
			now -= cnt[ps[i]];
		cnt[ps[i]]++;
		res += now;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll want = (n + 1) * n / 4 + 1;
	ll l = 0, r = inF;
	while(r - l > 1) {
		ll c = (l + r) >> 1;
		if(check(c) >= want)
			r = c;
		else
			l = c;
	}
	cout << r;
	return 0;
}

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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main(){
  int a,b,c;
  cin >> a;
  cout << 3 * a * a <<endl;
}

Measured memory_bytes: 256
class Array
def gcd
  self.inject{|a,b| a.gcd(b)}
end
end

ary =$stdin.readlines
a =ary[0].split.map!(&:to_i)
n = a[0]
x = a[1]
cities = ary[1].chomp.split.map!(&:to_i)

    array = []
    for i in (0..n-1)
      array.push((cities[i] - x).abs)
    end
  answer = array.gcd
puts answer


Measured memory_bytes: 9604
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>

#define WHITE 0
#define GLAY 1
#define BLACK 2

typedef struct{
    int num;
    int *node;
    int *cost;
}List;

List list[101];
int jud[101];
int mat[101][101];
int mincost[101];
int cost[101];
int max;
int sum=0;


void dijkstra(int);
bool judch()
{
    for (int i = 1; i <= max; i++)
    {
        if (!jud[i])
            return true;
    }
    return false;
}
void printall(int n)
{
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            printf("%d ", mat[i][j]);
        }
        printf("\n");
    }
}

int main()
{
    int n;
    int a,b,c,d;
    scanf("%d", &n);
    max = n;

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            mat[i][j]=__INT_MAX__/2;
        }
    }
    for (int i = 0; i <n; i++)
    {
        scanf("%d%d",&a,&b);
        for(int j=0;j<b;j++){
            scanf("%d%d",&c,&d);
            mat[a][c]=d;
        }
    }

    //printall(n);

    dijkstra(0);
    for(int i=0;i<n;i++){
        printf("%d %d\n",i,cost[i]);
    }
    return 0;
}

/*void dijkstra(){
    int v,u;
    int ret=0;
    for(int i=0;i<max;i++){
        mincost[i]=__INT_MAX__;
        jud[i]=false;
    }
    mincost[1]=0;
    while(true){
        v=-1;
        for(u=0;u<max;u++){
            if(!jud[u]&&(v==-1||mincost[u]<mincost[v]))
                v=u;
        }
        if(v==-1)
            break;
            jud[v]=true;
            ret+=mincost[v];
            for(u=0;u<max;u++){
                mincost[u]=mincost[u]<mat[v][u]?mincost[u]:mat[v][u];
            }
    }
    return;
}*/

void dijkstra(int n){
    int x,y,min;
    int buff;
    for(x=0;x<max;x++){
        cost[x]=__INT_MAX__/2;
        jud[x]=WHITE;
    }
    cost[0]=0;
    jud[0]=GLAY;
    while(true){
        //printf("min %d\n",min);
        min=__INT_MAX__/2;
        buff=-1;
        for(x=0;x<max;x++){
            if(jud[x]!=BLACK&&min>cost[x]){
                min=cost[x];
                buff=x;
            }
        }
        if(buff==-1)
            break;
        jud[buff]=BLACK;
        for(int i=0;i<max;i++){
            if(cost[buff]+mat[buff][i]<cost[i]){
                cost[i]=cost[buff]+mat[buff][i];
                jud[i]=GLAY;
            }
        }
    }
}



Measured memory_bytes: 1996
//in the name of god
    #include <bits/stdc++.h>
    using namespace std;
    #define MAX_N (int)2e5+20
    #define INF 2e9+20
    #define pb push_back
    #define F first
    #define S second
    typedef long long LL;
    #define int LL
    typedef pair<int,int> pii;
    const int delta=(int)1e9+7;
    string s;
    main(){
    	ios_base::sync_with_stdio(false); cin.tie(0);
    	cin>>s; s[3]='8'; cout<<s;
    	return cout<<endl,0;
    }

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		// X * 1.08 = N
		// X = N / 1.08
		// X = 432 * 1.08
		BigDecimal X = new BigDecimal(N / 1.08);
		BigDecimal X1Ceil = X.setScale(0, BigDecimal.ROUND_CEILING);
		BigDecimal X1Floor = X.setScale(0, BigDecimal.ROUND_FLOOR);
		BigDecimal N1Ceil = X1Ceil.multiply(new BigDecimal(1.08));
		BigDecimal N1Floor = X1Floor.multiply(new BigDecimal(1.08));
		String ans;
		if (N == N1Ceil.intValue()) {
			ans = String.valueOf(X1Ceil);
		} else if (N == N1Floor.intValue()) {
			ans = String.valueOf(X1Floor);
		} else {
			ans = ":(";
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 23252
#include<iostream>
using namespace std;
int main(){
    int a,b,t;
    while(1){
        cin>>a>>b;
        if(a==0){
            if(b==0){
                break;
            }
        }
        if(a>b){
            t=a;
            a=b;
            b=t;
        }
        cout<<a<<" "<<b<<endl;
    }
    return 0;
}


Measured memory_bytes: 2996
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif
#define REPP(i,j,n) for(LL i=j;i<n;++i)
#define REP(i,n) REPP(i,0,n)
#define F first
//#define S second

using namespace std;
typedef long long LL;
typedef pair<LL,LL> PLL;

auto scan = []{static LL a;scanf("%lld",&a);return a;};
#define MAXN 1000000


int main(){
  LL Q = scan(), H = scan(), S = scan() , D = scan();
  D = min( min (Q * 8, H * 4) , min( S * 2, D) );
  S = min( min (S, H * 2), Q * 4 );
  H = min( H , Q * 2);
  LL N = scan(),ans = 0;
  N *= 4;
  ans += N / 8 * D;
  ans += (N % 8 )/ 4 * S;
  ans += (N % 4) / 2 * H;
  ans += N % 2 * Q;
  printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << 
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " ";} cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
    //input
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    //sort
    sort(ALL(a));

    //sum
    int sum = 0;
    REP(i,n) sum += a[i];

    if(sum%10 != 0){
        cout << sum << endl;
        return 0;
    }
        //sum % 10 == 0
    //昇順にa[i] %10 != 0　を探す
    // ある場合は,それをひくない場合は0

    REP(i,n){
        if(a[i]%10 != 0){
            cout << sum - a[i] << endl;
            return 0;
        }
    }

  cout << 0 << endl;
  return 0;

}

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
//#define for(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}


int32_t  main(){
	IOS;
  int n;cin>>n;
  vi v;
  for(int i=0;i<n;++i){
    int va;cin>>va;
    v.pb(va);
  }
  sort(all(v));
  int large=v[v.size()-1];
  int rest=0;
  for(int i=0;i<v.size()-1;++i)rest+=v[i];
  if(large<rest)puts("Yes");
  else puts("No");


  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n,a,b,c;
  
  scanf("%d", &n);
  
  a=n/100;
  b=(n-100*a)/10;
  c=(n-100*a-10*b);
  
  if(a==7 || b==7 || c==7){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 1648
N, M = map(int, input().split())
i = 1
ans = 0
while i*i<=M:
    if M%i != 0:
        pass
    else:
        j = M//i
        if i*N <= M:
            ans = max(ans, i)
        if j*N <= M:
            ans = max(ans, j)
    i += 1
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int abs(int num) { return num > 0 ? num : -num; }

int main(void)
{
	int count= 0;
	while(1)
	{
		int num;
		cin>>num;
		if(num == 0)
			break;

		long double sum= 0;
		vector<pair<int, int> > pos(num);
		for(int i= 0; i < num; i++)
			cin>>pos[i].first>>pos[i].second;

		for(int i= 0; i < num-1; i++)
			sum+= pos[i].first*pos[i+1].second-pos[i+1].first*pos[i].second;
		sum+= pos[num-1].first*pos[0].second-pos[0].first*pos[num-1].second;

		count++;
		printf("%d %.1lf\n", count, abs(sum)*0.5);
	}

	return 0;
}

Measured memory_bytes: 3076
#include <iostream>

using namespace std;

int main() {
    int r,c;
    cin >> r >> c ;
    int x[r+1][c+1];
    for (int i=0; i<r; i++) {
        for (int j=0; j<c; j++) {
            cin >> x[i][j];
        }
    }
   
    for (int e = 0; e<r; e++) {
        int asum =0;
        for(int f = 0;f<c ; f++){
            asum += x[e][f];
        }
        x[e][c] = asum;
    }
    for (int g=0; g<=c; g++) {
        int bsum =0;
        for (int h=0; h<r; h++) {
            bsum += x[h][g];
        }
        x[r][g]=bsum;
    }
    
    
    for (int a=0; a<=r; a++) {
        for (int b=0 ; b<=c; b++) {
            if (b==0) {
                cout << x[a][b];
            }
            else {
              cout << " "<<x[a][b];
            }
        }
        cout <<endl;
    }
    
}



Measured memory_bytes: 3100
from operator import *
N = int(input())
AB = [list(map(int,input().split())) for n in range(N)]
AB = sorted(AB,key=itemgetter(1))
ans = "Yes"
T = 0

for a,b in AB:
  T+=a
  if b<T:
    ans = "No"

print(ans)

Measured memory_bytes: 48408
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<iomanip>
using namespace std;
int n,x,cnt[100005],res;
int read(){
    int ans=0,f=1;
    char ch=getchar();
    while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){ans=ans*10+ch-'0';ch=getchar();}
    return ans*f;
}
int main(){
	n=read();
	for (int i=0;i<n;i++){
		x=read();cnt[x]++;
	}
	res=cnt[0]+cnt[1];
	for (int i=1;i<100001;i++){
		res=max(res,cnt[i-1]+cnt[i]+cnt[i+1]);
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 640
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define multitest
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
inline ll add(ll a, ll b, ll m)
{
	return (((a % m + b % m) % m + m) % m);
}
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

void solve()
{
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	v64 cl(C, 0);
	priority_queue<p64, vector<p64>> Q;
	ll item;
	for (int i = 0; i < A; i++)
	{
		cin >> item;
		Q.push({item, 0});
	}
	for (int i = 0; i < B; i++)
	{
		cin >> item;
		Q.push({item, 1});
	}
	for (int i = 0; i < C; i++)
		cin >> cl[i];
	sort(cl.begin(), cl.end());
	v64 res;
	ll x = X, y = Y,ans = 0;
	while (true)
	{
		auto itr = Q.top();
		Q.pop();
		if (!x && !y)
			break;
		else if (!x && itr.se == 0)
			continue;
		else if (!y && itr.se == 1)
			continue;
		else if (itr.se == 0)
		{
			ans += itr.fi;
			res.push_back(itr.fi);
			x--;
		}
		else if (itr.se == 1)
		{
			ans += itr.fi;
			res.push_back(itr.fi);
			y--;
		}
	}
	int i = 0, j = 0;
	reverse(cl.begin(), cl.end());
	reverse(res.begin(), res.end());
	//print_container(res);
	//print_container(cl);
	i = 0;
	for (int j = 0; j < sz(cl) && i < sz(res); j++)
	{
		if (ans - res[i] + cl[j] > ans)
		{
			ans = ans - res[i] + cl[j];
			i++;
		}
	}
	cout << ans << ln;
	return;
}

int main()
{
	//FASTIO;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
	return 0;
}


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

int main(){
  int A,B,C,K;
  cin >>A>>B>>C>>K;
  if (A>=K){
   cout << K << endl;
  }
  else if (A+B>=K){
   cout << A << endl;
  }
  else {
   cout << 2*A+B-K << endl;
  }
}

Measured memory_bytes: 3552
n, k = map(int, input().split())
s = {}
for i in range(n):
    a, b = map(int, input().split())
    s[a] = s.get(a,0)+b
s = sorted(s.items(), key=lambda x:x[0])
for i in range(len(s)):
    k -=s[i][1]
    if k<=0:
        print(s[i][0])
        break

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

class Solution{
private :
    typedef unsigned long long ull;
    static const int maxn = 4e3 + 7;
    static const int base = 4007;
    static const int mod1 = 1e9 + 7;
    static const int mod2 = 1e9 + 9;
    
    int n, ans, cnt;
    ull pow1[30], pow2[30], b[maxn * maxn];
    char s1[maxn], s2[maxn];
    //std::map<ull, bool> vis;
    
public :
    Solution() {
        Get();
        Solve();
    }

    void Get() {
        scanf("%s", s1 + 1);
        scanf("%s", s2 + 1);
    }

    void Solve() {
        pow1[0] = pow2[0] = 1;
        for (register int i = 1; i <= 27; i++) {
            pow1[i] = pow1[i - 1] * base % mod1;
            pow2[i] = pow2[i - 1] * base % mod2;
        }
        n = strlen(s1 + 1);
        for (register int i = 1; i <= n; i++) {
            ull hash1 = 0, hash2 = 0;
            for (register int j = i; j <= n; j++) {
                //- sum[x] * pow
                //sum[x]++
                //+ sum[x] * pow
                hash1 = (hash1 + pow1[s1[j] - 'a']) % mod1;
                hash2 = (hash2 + pow2[s1[j] - 'a']) % mod2;
                //vis[hash1 * mod2 + hash2] = 1;
                b[++cnt] = hash1 * mod2 + hash2;
            }
        }
        std::sort(b + 1, b + 1 + cnt);
        n = strlen(s2 + 1);
        for (register int i = 1; i <= n; i++) {
            ull hash1 = 0, hash2 = 0;
            for (register int j = i; j <= n; j++) {
                hash1 = (hash1 + pow1[s2[j] - 'a']) % mod1;
                hash2 = (hash2 + pow2[s2[j] - 'a']) % mod2;
                int pos = std::lower_bound(b + 1, b + 1 + cnt, hash1 * mod2 + hash2) - b;
                if (b[pos] == hash1 * mod2 + hash2) {
                    ans = std::max(ans, j - i + 1);
                }
            }
        }
        printf("%d\n", ans);
    }
};
Solution sol;

int main() {}



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

#define ll long long
#define ld long double
#define F first
#define S second

#define ONLINE_JUDGE 1

using namespace std;

const int mod = 1e9+7;

void solve(){
	int r;
	cin >> r;
	cout << fixed << setprecision(12) << 2.0 * M_PI *  r << "\n";
}

int main(){
	#ifndef ONLINE_JUDGE	
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(NULL);		
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A[3]; cin>>A[0]>>A[1]>>A[2];
  sort(A,A+3);
  string ans="NO";
  if(A[0]==A[1]&&A[1]==5&&A[2]==7) ans="YES";
  cout<<ans<<endl;
}

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

int main() {
	long long k;
	cin >> k;
	
	int n = 50;
	
	long long a = k / n + n - 1;
	int t = k % n;
	
	cout << n << '\n';
	for(int i = 0; i < n-t; i++) 
		cout << a - t << " ";
	for(int i = 0; i < t; i++)
		cout << a + n + 1 - t << " ";
		
	cout << "\n";
	
	return 0;
}

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

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


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

    int n, m, h, w;
    scanf("%d%d%d%d", &n, &m, &h, &w);
    if ((n % h == 0) && (m % w == 0)) {
        printf("No\n");
        return 0;
    }
    int v = ((int)1e9 - 1) / (h * w - 1);
    int V = -v * (h * w - 1) - 1;
    printf("Yes\n");
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if ((i % h == h - 1) && (j % w == w - 1))
                printf("%d ", V);
            else
                printf("%d ", v);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cmath>

using namespace std;

template<class T>
ostream& operator<<(ostream& os, const vector<T>& vs) {
    if (vs.empty()) return os << "[]";
    os << "[" << vs[0];
    for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
    return os << "]";
}
 
const double EPS = 1e-7;

struct Point {
    double x, y;
    Point() {}
    Point(double x, double y) : x(x), y(y) {}
    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }
};
double dot(const Point& a, const Point& b) { return a.x * b.x + a.y * b.y; }
double cross(const Point& a, const Point& b) { return a.x * b.y - a.y * b.x; }
double norm(const Point& a) { return sqrt(dot(a, a)); }
Point rot90(const Point& p) { return Point(p.y, -p.x); } // 時計回りに90度回転 
ostream& operator<<(ostream& os, const Point& p) { return os << "(" << p.x << "," << p.y << ")"; }
istream& operator>>(istream& is, Point& p) { return is >> p.x >> p.y; }

int ccw(Point a, Point b, Point c){
    b = b - a; c = c - a;
    if (cross(b, c) > EPS) return +1;      // a,b,cの順に反時計周り
    if (cross(b, c) < -EPS) return -1;     // a,b,cの順に時計周り
    if (dot(b, c) < 0) return +2;          // c--a--b 直線
    if (norm(b) < norm(c)) return -2;      // a--b--c 直線
    return 0;                              // a--c--b 直線
}

// 頂点は反時計回りで与えられると仮定. 
typedef vector<Point> Polygon;
bool convex(const Polygon& vs) {
    int N = vs.size();
    for (int i = 0; i < N; i++) {
        Point a = vs[(i + N - 1) % N];
        Point b = vs[i];
        Point c = vs[(i + 1) % N];
        if (ccw(a, b, c) == -1) return false;
    }
    return true;
}

int main() {
    int N; cin >> N;
    Polygon P(N);
    for (int i = 0; i < N; i++) cin >> P[i];
    cout << convex(P) << endl;
    return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	string S;
	cin >> S;
	if(S[0] <= 90){
		cout << "A" << endl;
	}else{
		cout << "a" << endl;
	}
	return 0;
}


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

char getGrade(int m, int f, int r) {
    int sum = m + f;
    char grade;
    if(m == -1 || f == -1) {
        grade ='F';
    } else if(80 <= sum) {
        grade = 'A';
    } else if(65 <= sum && sum < 80) {
        grade = 'B';
    } else if(50 <= sum && sum < 65) {
        grade = 'C';
    } else if(30 <= sum && sum < 50) {
        if(50 <= r) {
            grade = 'C';
        } else {
            grade = 'D';
        }
    } else if(sum < 30) {
        grade = 'F';
    }

    return grade;
}

int main() {
    int m, f, r;
    while(1) {
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1)break;
        cout << getGrade(m,f,r) << endl;
    }

    return 0;
}


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

int main(void)
{
    int x;
    cin >> x;

    if(x){
        cout << '0' << endl;
    }else{
        cout << '1' << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
import sys
n = int(input())
s = list(map(int, input().split()))
c = 0
a = 'a'
def merge(A, left, mid, right):
    global c
    L = A[left:mid]
    R = A[mid:right]
    L.append(sys.maxsize)
    R.append(sys.maxsize)
    i = 0
    j = 0
    for k in range(left, right):
        c += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def mergesort(A, left, right):
    if left+1 < right:
        mid = (left+right)//2
        mergesort(A, left, mid)
        mergesort(A, mid, right)
        merge(A, left, mid, right)

mergesort(s, 0, n)

for i in range(n-1):
    print(s[i], end=' ')
print(s[n-1])
print(c)


Measured memory_bytes: 61652
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define abs(a) (a>0?a:(-(a)))
using namespace std;
int a[105],b[105],v[105];
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1;i<n;i++)
	scanf("%d",&b[i]);
	for (int i=1;i<n;i++)
	if (b[i]<=b[i+1]) {
		if (!v[i]) a[i]=a[i+1]=b[i],v[i+1]=1;else
			a[i+1]=b[i],v[i+1]=1;
	}else 
	if (!v[i]) a[i]=b[i];
	a[n]=b[n-1];
	int ans=0;
	for (int i=1;i<=n;i++)
	ans+=a[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

int main()
{
    fastio;

    int n;
    cin>>n;

    int a[n], g[n], r[n];
    forn(i, n)
    {
        cin >> a[i];
    }
    sort(a, a+n);

    g[0]=a[0];
    r[n-1]=a[n-1];
    for(int i=1; i<n; i++)
    {
        g[i] = __gcd(g[i-1], a[i]);
    }

    for(int i=n-2; i>=0; i--)
    {
        r[i] = __gcd(r[i+1], a[i]);
    }

    int maxi=g[n-1];
    if(n>1)
    {
        maxi = max(maxi, r[1]);
        maxi = max(maxi, g[n-2]);
    }
    for(int i=1; i<n-1; i++)
    {
        if(a[i]!=a[i+1])
        {
            maxi = max(maxi, __gcd(g[i-1], r[i+1]));
        }
    }

////    seecontent(a);
////    seecontent(g);
////    seecontent(r);

    cout << maxi << "\n";

    return 0;
}



Measured memory_bytes: 4780
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int N,M=0;
	cin>>N;
	int a[N+1],res[N+1],result[N+1]={0};
	int ans[N+1][50],keta=49;
	for(int i=0;i<N;i++){
		cin>>a[i];
		M=max(M,a[i]);
	}
	keta=49;
	while(M>0){
		int sum=0;
		res[0]=0;
		for(int i=1;i<N;i++)res[i%N]=(res[i-1]+a[i-1]%2-a[i%N]%2+2)%2;
		for(int i=1;i<N;i++)sum+=res[i];
		if(sum%2!=a[0]%2){
			res[0]=1;
			for(int i=1;i<N;i++)res[i%N]=(res[i-1]+a[i-1]%2-a[i%N]%2+2)%2;
		}
		for(int i=0;i<N;i++)ans[i][keta]=res[i];
		for(int i=0;i<N;i++)a[i]/=2;
		M/=2;
		keta--;
	}
	keta+=1;
	for(int i=0;i<N;i++){
		for(int j=keta;j<=49;j++){
			result[i]=result[i]*2+ans[i][j];
		}
	}
	for(int i=0;i<N;i++)cout<<result[i]<<" ";
	return 0;
}

Measured memory_bytes: 44956
//verma_ankit484

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
const int mod = (int) 1e9+7;

using namespace std;
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


int32_t main() {
  IOS
  #ifdef AV
  freopen("input.txt", "r", stdin);
  #endif
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < (int)s1.length(); i++) {
    if (s1[i] != s2[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 3652
def main():
    N = int(input())
    min_v = float('inf')
    for i in range(1, N//2+1):
        s = str(i)
        t = str(N-i)
        v = sum([int(c) for c in s + t])
        min_v = min(min_v, v)
    return min_v


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 41452
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#include<vector>
int main(){
  long long int n,m,c,k=0,sum=0,i;
  cin>>n>>m;
  vector< pair<long int,long int> >p;
  for(i=0;i<n;i++){
    long long int cost,num;
    cin>>cost>>num;
    p.push_back(make_pair(cost,num));
  }
  sort(p.begin(),p.end());
  for(i=0;i<p.size();i++){
    k=k+p[i].second;
    if(k>m){
      k=k-p[i].second;
      //sum=sum-(p[i].first)*(p[i].second);
      break;
    }
    sum=sum+(p[i].first)*(p[i].second);
  }
  long long int z=(m-k)*p[i].first;
  cout<<sum+z;
  return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    int i,n,k;
    vector<int>vec;
    rep0(i,3)
    {
        sf(k);
        vec.pb(k);
    }
    sort(all(vec));
    cout<<vec[0]+vec[1];
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 660000

 struct Seg{
   vector<ll> sum;
   vector<ll> mx;
   Seg(){
     sum.resize(1<<23, 0);
     mx.resize(1<<23, 0);
   }
  
   void add_val(ll l, ll r, ll val, ll bottom=0, ll top=1<<22, ll pos=1){
     if(l <= bottom && top <=r){
       sum[pos] += val;
       return ;
     }
     if(r<=bottom || l>=top)return ;
  
     ll mid = (bottom + top)/2;
     add_val(l, r, val, bottom, mid, pos*2);
     add_val(l, r, val, mid, top, pos*2+1);
     mx[pos] = max<ll>(mx[pos*2] + sum[pos*2],  mx[pos*2+1] + sum[pos*2+1]);
   }
  
   ll max_val(ll l, ll r, ll bottom=0, ll top=1<<22, ll pos=1){
     if(l <= bottom && top <= r) return sum[pos] + mx[pos];
     if(r <= bottom || l>=top)return -INF;
  
     ll mid = (bottom+top)/2;
     return max<ll>(
       max_val(l, r, bottom, mid, pos*2),
       max_val(l, r, mid, top, pos*2+1)
     )+sum[pos];
   }
 };

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

  Seg seg;
  rep(i, n){
    ll l = max(0, a[i]-k);
    ll r = a[i]+k+1;
    ll mx = seg.max_val(l, r);
    ll cv = seg.max_val(a[i], a[i]+1);
    seg.add_val(a[i], a[i]+1, mx+1-cv);
  }

  cout<<seg.max_val(1, MAXN);

  return 0;
}

Measured memory_bytes: 135532
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  ll cnt = 0, minN = INF, sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < 0) cnt++;
    minN = min(minN, ll(abs(a[i])));
    sum += abs(a[i]);
  }
  if (cnt % 2 == 0)
    cout << sum << endl;
  else
    cout << sum - (minN * 2) << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define pb push_back
#define mp make_pair
#define fi(i,start,end) for(int i=start; i < end ; ++i)
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
	int n,x,t;
	cin>>n>>x>>t;
	int temp=x,ans=1;
	while(1)
    {
        if(temp<n)
        {
            temp+=x;
            ans++;
        }
        else
            break;
    }
    cout<<ans*t;

}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
ll inf=1e18;
//LLONG_MIN

//AC

int main(void){
	ll n,a[200010],sum=0,b,ans=inf;
	cin>>n;
	reg(i,1,n){
		cin>>a[i];
		a[i]-=i;
	}
	sort(a+1,a+n+1);
	//中央値を求める
	b=a[(n+1)/2];
	// cout<<b<<endl;
	sum=0;
	reg(i,1,n){
		sum+=abs(a[i]-b);
	}
	ans=min(ans,sum);
	b=a[(n+1)/2+1];
	sum=0;
	reg(i,1,n){
		sum+=abs(a[i]-b);
	}
	ans=min(ans,sum);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
/*
memo for solution
*/
#include <cstdlib> 
#include <numeric>
#include <cstring>
#include <cstdio> 
#include <cfloat> 
#include <map> 
#include <cassert>
#include <cmath> 
#include <climits> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <iomanip>
#include<sys/time.h>
using namespace std; 
double e_time(void){static struct timeval now;gettimeofday(&now, NULL);return (double)(now.tv_sec  + now.tv_usec/1000000.0);}
#define REP(i,b,n) for(int i=b;i<n;i++) 
#define rep(i,n)      REP(i,0,n) 
#define pb push_back  
#define mp make_pair 
#define ALL(C)   (C).begin(),(C).end() 
#define fe(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr != (c).end();itr++)
#define BITSHIFT(X)     ( (1<<(X)) )
#define CONTAIN(S,X) ( ((S)&BITSHIFT(X)) != 0)
typedef complex<double>P; 
typedef long long ll; 
typedef unsigned long long ull; 
typedef pair<int,int> pii; 
typedef vector<int> vint;
template<class T> void vp(T &a,int p){rep(i,p)cout << a[i]<<" ";cout << endl;}  
template<class T> T ceilUp(const T& a,const T& b){return (a+b-1)/b;}
const ll mod =   1000000009;
inline ll modadd(ll a,ll b){a %= mod;b %= mod;return (a+b)%mod;}
inline ll modsub(ll a,ll b){a %= mod;b %= mod;a-=b;a%=mod;if (a<0)a+=mod;return a;}
inline ll modmul(ll a,ll b){a %= mod;b %= mod;return (a*b)%mod;}
inline ll modeq(ll a,ll b,ll m){a = (a%m+m)%m; b = (b%m+m)%m;return a == b;}
//ll modpow(ll n,ll p){if (p == 0)return 1;if (p == 1)return n;ll ret=mypow(n,p/2);ret=ret*ret%mod;if (p&1)ret=ret*n%mod;return ret;}
//ll getinv(ll a){return mypow(a,mod-2);}
ll mypow(ll n,ll p){
  if (p == 0)return 1;
  if (p == 1)return n;
  ll ret=mypow(n,p/2);
  ret=ret*ret;
  if (p&1)ret=ret*n;
  return ret;
}


vector<int> solve(vector<int> & in){
  vector<int> ret;
  int n = in.size();
  rep(_, n){
    int remove = -1;
    for(int i = in.size()-1;i >= 0;i--){
      if (in[i] == i + 1){
	remove = in[i];
	ret.push_back(in[i]);
	in.erase(begin(in) + i);
	break;
      }
    }
    if (remove == -1){
      ret.clear();
      ret.pb(-1);
      break;
    }
  }
  reverse(begin(ret), end(ret));
  return ret;
}
 
  

int main(){
  int n;
  cin >> n;
  vector<int> in(n);
  rep(i,n){
    cin >> in[i];
  }
  vector<int> ans = solve(in);
  rep(i,ans.size()){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()

ans = sum(s)
if ans%10 == 0:
    for i in range(n):
        if s[i]%10 != 0:
            ans -= s[i]
            break
    else:
        ans = 0
    
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)

const ll maxn=1e5+5;
ll n, a[maxn], dp[maxn];

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

    cin>>n;
    rep(i,1,n+1) cin>>a[i];
    dp[1]=0;
    dp[2]=abs(a[1]-a[2]);
    rep(i, 3, n+1) dp[i]=min(abs(a[i]-a[i-1])+dp[i-1], abs(a[i]-a[i-2])+dp[i-2]);
    cout<<dp[n]<<"\n";
}


Measured memory_bytes: 1792
// Author by Md. Jashim Uddin_RMSTU

#include<bits/stdc++.h>
using namespace std;
#define     sf(a)           scanf("%d",&a)
#define     sff(a,b)        scanf("%d %d",&a,&b)
#define     sfff(a,b,c)     scanf("%d %d %d",&a,&b, &c)
#define     pb              push_back
#define     ll              long  long int
#define     fast            ios_base :: sync_with_stdio(false);cin.tie(0)
#define     pi              2*acos(0)
#define     sp              fixed<<setprecision
#define     lcm(a,b)        (a*b)/gcd(a,b)
#define     gcd(a,b)        _gcd(a,b)

#define     forn(i,n)       for(int i=1;i<=n;i++)
#define     min3(a,b,c)     min(a,min(b,c)
#define     M             32000


int main()
{

    map<string,int>m;
    map<string,int> ::iterator it;
    int n;
    cin>>n;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m[s]++;
    }
    int maxi =0;
    for(it=m.begin();it!=m.end();it++)
    {
        if(it->second>maxi)
            maxi = it->second;
    }
    for(it= m.begin();it!=m.end();it++)
    {
        if(maxi==it->second) cout<<it->first<<endl;
    }



    return 0;
}


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

int main(){
  int n;
  cin >> n;
  long long sm = 0;
  
  for (int i = 1; i<=n; i++){
    if (i%3==0 && i%5==0) {
    }else if (i%3==0){
    }else if (i%5==0){
    }else{
      sm = sm + i;
    }
  }
  cout << sm << endl;
  
  return 0;
}


Measured memory_bytes: 3552
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define     ll        long long
#define     N         1e9+9
#define     PI        acos(-1.0)
#define     pb        push_back
#define     mp        make_pair
#define     ff        first
#define     ss        second
#define     gt        getchar()
#define     MOD       1000000007
#define     All(v1)   v1.begin(),v1.end()
#define     DBG(a)    cout<< #a <<" --> "<<(a)<<endl
ll arr[2000007],brr[200007],crr[200007];
char att[1000],m;
string g,h,v,x;
int main()
{
    ll a,b,c,d,e,f,i,j,k,t;
    float l;
    cin>>a;
    printf("%0.12f\n",(float)(a*a*a)/27);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void){
  int a,b;
  int c,d;
  int i=0;
  scanf("%d %d %d %d",&a,&b,&c,&d);

  while( a > 0 || c > 0){
    if ( a <= 0){
      printf("No\n");
      break;
    }else  if ( c <= 0){
      printf("Yes\n");
      break;
    }
    if( i % 2 == 0) c -=b;
    else a -=d;  
    i++;
  }

  

  return 0;
  
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}
 

char arr[400010];
ll up=200005;
void solve(){
    string s; cin>>s;
    rep(s.size()) arr[i+up]=s[i];
    ll l=-1; ll r=s.size();
    bool inv=false;
    //for(ll i=l+1;i<r;i++) cout<<arr[i+up]; cout<<endl;
    ll q; cin>>q; while(q--){
        ll t; cin>>t; if(t==1){
            inv=!inv;
        } else {
            cin>>t;
            if(inv) {
                if(t==1){
                    cin>>arr[r+up]; r++;
                } else {
                    cin>>arr[l+up]; l--;
                }
            } else {
                if(t==1){
                    cin>>arr[l+up]; l--;
                } else {
                    cin>>arr[r+up]; r++;
                }
            }
        }
    }
    if(inv){ for(ll i=r-1;i>l;i--) cout<<arr[i+up]; cout<<endl; }
    else { for(ll i=l+1;i<r;i++) cout<<arr[i+up]; cout<<endl; }
}
 
int main(){
    ffast
    ll t=1;
    //cin>>t;
    rep(t) solve();
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 1104
n, q = map(int, input().split())
s = input()
ac_count = [0]
ac_num = 0
for i in range(n-1):
    if s[i] + s[i+1] == "AC":
        ac_num += 1
    ac_count.append(ac_num)
for i in range(q):
    l, r = map(int, input().split())
    print(ac_count[r-1] - ac_count[l-1])


Measured memory_bytes: 6100
#include<iostream>
#include<algorithm>
using namespace std;
long double x[20][20], m, n, neko[20][20][20], dp[20][100000];
inline long double solve(int pos, int ret) {
	if (pos == n)return 1.0l;
	if (dp[pos][ret] >= -0.1l)return dp[pos][ret];
	long double maxn = 0.0l;
	for (int i = 0; i < m; i++) {
		if ((ret >> i) & 1 == 1)continue;
		long double cnt = 0.0;
		for (int j = pos; j <= n; j++) {
			long double w1 = solve(j, ret + (1 << i))*neko[i][pos][j];
			cnt += w1;
		}
		maxn = max(maxn, cnt);
	}
	dp[pos][ret] = maxn;
	return maxn;
}
int main() {
	for (int i = 0; i < 20; i++) { for (int j = 0; j < 100000; j++)dp[i][j] = -1.0l; }
	cin >> m >> n; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++)cin >> x[i][j]; }
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			neko[i][j][j] = 1.0l; long double cnt = 1.0l;
			for (int k = j; k < n; k++) {
				cnt *= x[i][k]; neko[i][j][k + 1] = cnt;
			}
			for (int k = j; k <= n; k++) {
				neko[i][j][k] = neko[i][j][k] - neko[i][j][k + 1];
			}
		}
	}
	printf("%.12Lf\n", solve(0, 0));
	return 0;
}

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

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  while(1){
    int h, w;
    cin >> h >> w;
    if(h == 0 && w == 0) return 0;

    rep(i, h){
      rep(j, w){
        if(i % 2 == 0){
          if(j % 2 == 0) cout << '#';
          else cout << '.';
        }
        else{
          if(j % 2 == 0) cout << '.';
          else cout << '#';
        }
      }
      cout << endl;
    }
    cout << endl;

  }
}






Measured memory_bytes: 3084
// AtCoder B - Distance
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int N, D; // N個の点, 原点からの距離はD
  cin >> N >> D; 
  long int count = 0;
  long int  X = 0;
  long int  Y = 0;
  
  for (int i = 0; i < N; i++){
    cin >> X >> Y;
    if ((X*X)+(Y*Y) <= D*D){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;
int main(){
    #ifndef ONLINE_JUDGE 
    freopen("i.txt", "r", stdin); 
    freopen("m.txt", "w", stdout); 
    #endif
    int n;
    cin>>n;
    int rem=n%10;
    if(rem==2||rem==5||rem==7||rem==9||rem==4){
        cout<<"hon"<<endl;
    }
    else if(rem==0||rem==1||rem==6||rem==8){
        cout<<"pon"<<endl;
    }
    else{
        cout<<"bon"<<endl;
    }


    }

Measured memory_bytes: 3620
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <iomanip>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
#define fsp(c) fixed << setprecision(c)

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

double cutl(int i,double n,double r) {
  if (i<=0||n<=i) return 0;
  return r*sqrt(1-((double)i-n/2)*((double)i-n/2)*4/n/n);
}

int main(){
  long long n,k,a,b;
  long long c[100001]={},t=0;
  cin >> n >> k;
  REP(i,n){
    cin >> a >> b;
    c[a]+=b;
  }
  REP1(i,100000){
    t+=c[i];
    if(t>=k){
      cout << i;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var r = Console.ReadLine();
            if (r == "ABC")
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("ABC");
            }
        }
        
    }
}

Measured memory_bytes: 25860
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,s,e) for(int i=s;i<e;i++)
#define endl '\n'
int main(){
    string s;cin>>s;
    int res=0;
    rep(i,0,3){
        if(s[i]=='1')res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3568
#include <stdio.h>

int main(void)
{
	int r, x, y;
	scanf("%d %d", &x, &y);
	if (x < y) {
		r = x;
		x = y;
		y = r;
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	printf("%d\n", x);
	return 0;
}

Measured memory_bytes: 592