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

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double container_s = a * b;
  double water_s = x / a;
  double theta;
  if (water_s * 2 > container_s) {
    // 半分以上入っている場合
    double c = ((container_s - water_s) * 2) / a;
    theta = atan(c / a);
  }
  else {
    // 半分未満の場合
    double c = (water_s * 2) / b;
    theta = atan(b / c);
  }
  cout << fixed;
  cout << setprecision(10);
  cout << theta * 180.0 / M_PI << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

int main(){
	cin>>n;
	int m=0,res=0;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		if(m<=x) res++,m=x;
	}
	cout<<res<<endl;
}

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

int main(){
  int n;
  cin>>n;
  cout<<"ABC"<<n<<endl;

  return 0;
}

Measured memory_bytes: 256
import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
A = [i for i in range(1,N+1)]
count = 1
for i in itertools.permutations(A):
    flg = True
    for k in range(N):
        if i[k] != P[k]:
            flg = False
            break
    if flg:
        a = count
    flg = True
    for k in range(N):
        if i[k] != Q[k]:
            flg = False
            break
    if flg:
        b = count
    count += 1
print(abs(a-b))

Measured memory_bytes: 43504
N = int(input())
h = list(map(int, input().split()))

ans = [100000000000] * N
ans[0] = 0
for i in range(N-1):
    ans[i+1] = min(ans[i+1], ans[i] + abs(h[i] - h[i+1]))
    if i + 2 > N - 1:
        continue
    ans[i+2] = min(ans[i+2], ans[i] + abs(h[i] - h[i+2]))
print(ans[-1])  

Measured memory_bytes: 52208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(begin(a),end(a));
    cout<<a.back()-a.front()<<endl;
}

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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	int n;
	cin >> n;
	int a[n+1];
	std::vector<int> v;
	int count=0;
	bool sol[n+1];
	FOR(i,n){
		cin >> a[i+1];
	}
	int sum=0;
	for(int i=n;i>=1;i--){
		sum=0;
		int j=2*i;
		while(j<=n) {
			sum+=sol[j];
			j+=i;
		}
		sol[i]= (a[i]-sum) %2 ;
		if(sol[i]){
			count++;
			v.PB(i);
		} 
	}
	cout << count <<"\n";
	for(auto x: v){
		cout << x <<" ";
	}

	return 0;
}

// 3
//1 0 1
//0 0 1

Measured memory_bytes: 4616
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const double PI = acos(-1);

void solve(){
    string a,b,c;
    cin>>a>>b>>c;
    cout<<(a.back()==b.front()&&b.back()==c.front()?"YES":"NO")<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}


Measured memory_bytes: 3612
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		TreeMap<Integer, Integer> map = new TreeMap<>();
		int m = n;
		for (int i = 2; i <= Math.sqrt(n); i++) {
			int count = 0;
			while (m % i == 0) {
				count++;
				m /= i;
			}
			if (count > 0) {
				map.put(i, count);
			}
		}
		if (m != 1) {
			map.put(m, 1);
		}
		System.out.print(n + ":");
		for (int key: map.keySet()) {
			System.out.print(" ");
			for (int i = 0; i < map.get(key); i++) {
				System.out.print(key);
				if (i != map.get(key) - 1) {
					System.out.print(" ");
				}
			}
		}
		System.out.println();
	}
}


class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 24556
#include<stdio.h>
#include<string.h>


int main(void){

	int sum1=0,sum2=0;
	char word1[101],word2[101];
	int n;
	int i;

	scanf("%d",&n);

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

		scanf("%s %s",word1,word2);

		if(strcmp(word1,word2)>0)
			sum1 += 3;
		else if(strcmp(word1,word2) == 0){
			sum1++;
			sum2++;
		}
		else
			sum2 += 3;

	}

	printf("%d %d\n",sum1,sum2);

	return 0;

}

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

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

    std::vector<int> t(n+1), x(n+1), y(n+1);
    t[0] = 0, x[0] = 0; y[0] = 0;
    for(int i = 1; i <= n; i++){
        std::cin >> t[i] >> x[i] >> y[i];
    }

    bool check = true;
    for(int i = 0; i < n; i++){
        int difference_of_time = t[i+1] - t[i];
        int dist = std::abs(x[i+1] - x[i]) + std::abs(y[i+1] - y[i]);

        if(difference_of_time < dist){
            check = false;
            break;
        }

        if((difference_of_time - dist) % 2 != 0){
            check = false;
            break;
        }
    }

    if(check){
        std::cout << "Yes" << std::endl;
        return 0;
    }
    else{
        std::cout << "No" << std::endl;
        return 0;
    }
}

Measured memory_bytes: 1408
#include"bits/stdc++.h"
using namespace std;

int dp[100000];
int req[10] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

void Main() {
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  sort(a, a + m);

  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++) {
      if (i - req[a[j]] < 0) continue;
      if (dp[i - req[a[j]]] < 0) dp[i] = max(dp[i], dp[i - req[a[j]]]);
      else dp[i] = max(dp[i], dp[i - req[a[j]]] + 1);
    }
  }
  for (int i = n; i > 0;) {
    for (int j = m - 1; j >= 0; j--) {
      if (i - req[a[j]] >=0 && dp[i - req[a[j]]] == dp[i] - 1) {
        cout << a[j];
        i -= req[a[j]];
        break;
      }
    }
  }
  cout << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define Min(x,y)((x) < (y) ? (x) : (y))
int main(void){
  int magic_point[10][10];
  int h,w;
  cin>>h>>w;
  for(int i=0;i<=9;i++){
    for(int j=0;j<=9;j++){
      cin>>magic_point[i][j];
    }
  }
  for(int k=0;k<=9;k++){
    for(int i=0;i<=9;i++){
      for(int j=0;j<=9;j++){
        magic_point[i][j]=Min(magic_point[i][j],magic_point[i][k] + magic_point[k][j]);
      }
    }
  }
  int ans=0;
  for(int j=0;j<h;j++){
    for(int i=0;i<w;i++){
      int a=0;
      cin>>a;
      if(a==-1)continue;
      ans+=magic_point[a][1];
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> v(M);
    for (int i = 0; i < M; ++i) cin >> v[i];
    sort(v.begin(), v.end());
    if (N >= M) {
        cout << 0 << endl;
    }
    else {
        vector<ll> A;
        for (int i = 0; i < M - 1; i++) {
            A.push_back(v[i + 1] - v[i]);
        }
        ll sum = 0;
        sort(A.begin(), A.end());
        for (int i = 0; i < M - N; i++) {
            sum += A[i];
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 4940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(a,b,c) for(int i=a;i<b;i+=c)  
typedef pair<ll , pair<ll, ll> > pi;
int pow(int x,int y){
    int res=1;
    while(y){
        if(y&1) res*=x;
        y>>=1;
        x*=x;
    }
    return res;
}   
struct Compare {
    constexpr bool operator()(pi const & a,
                              pi const & b) const noexcept
    { return a.first < b.first || (a.first == b.first && a.second.first > b.second.first); }
 
};
void prefix_function( string s,ll arr[] )
{
     long long border=0; arr[0]=0;
    for(long long i=1;i<s.size();i++)
    {
      while(border>0 && s[i]!=s[border])
        border=arr[border-1];
     
     if(s[i]==s[border])
         border++;
      else
       border=0;
      
      arr[i]=border;
    }
}
ll mod=998244353;
ll add( ll a , ll b)
{
    return (((a%mod)+(b%mod))%mod);
}
ll mul(ll a,ll b)
{
  return (((a%mod)*(b%mod))%mod);
}
//send mod-2 for a^-1 if mod is a prime number
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}
ll dsu_arr[100000];
ll dsu_sz[100000];
void dsu(ll n)
{
    for(ll i=0;i<=n;i++)
    {
        dsu_arr[i]=i;
        dsu_sz[i]=1;
    }
}
ll find(ll x)
{
     ll root=x;
    while (root!=dsu_arr[root])
    {
        root=dsu_arr[root];
    }
    while(x!=dsu_arr[x])
    {
        dsu_arr[x]=root;
        x=dsu_arr[x];
    }
    return root;
}
ll merge(ll x,ll y)
{
    ll root1=find(x);
    ll root2=find(y);
    
    if(root1==root2)
    return 0ll;
 
    if(dsu_sz[x]>dsu_sz[y]){
    dsu_arr[root2]=root1;
    dsu_sz[x]+=dsu_sz[y];
    }
    else
    {
         dsu_sz[y]+=dsu_sz[x];
        dsu_arr[root1]=root2;
    }
    return 1ll;
}


int main()
{
ll m,n;
cin>>m>>n;
if(n==0)
{
    cout<<m<<endl;
    return 0;
}
ll m_dif=m-101;
ll l_dif=m+101;
set<ll>sura;
for(ll i=0;i<n;i++)
{
    ll k;
    cin>>k;
    sura.insert(k);

  

}
ll ans1,ans2;
for(ll i=m;i>=m_dif;i--)
{
    if(sura.find(i)==sura.end())
    {
        ans1=i;
        break;
    }

}
for(ll i=m;i<=l_dif;i++)
{
    if(sura.find(i)==sura.end())
    {
        ans2=i;
        break;
    }

}
if(abs(ans2-m)<abs(ans1-m))
{
    cout<<ans2<<endl;
}
else
cout<<ans1<<endl;


}



   
      
    
        



Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int 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;
}


signed main() {
	int n;
	cin >> n;
	double a[102], lc = 1;
	rep(i, n) {
		cin >> a[i];
		lc = lcm(a[i], lc);
	}
	double x = 0;
	rep(i, n) {
		x += lc / a[i];
	}
	double ans = lc / x;
	printf("%.12lf\n", ans);

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] p = new int[n];
        for(int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        Arrays.sort(p);
        int ans = 0;
        for(int j = 0; j < k; j++) {
            ans += p[j];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 38896
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpii = vector<pll>;

int main(){
  ll a, b, c;
  cin >> a >> b >> c;

  ll left = 4 * a * b;
  ll right = (c - a - b) * (c - a - b);

  if((left >= right) || (c - a - b < 0)){
    cout << "No" << endl;
  } else{
    cout << "Yes" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
  int N,i,j,tmp,ans=0,cp,count=0;
  scanf("%d",&N);
  cp=N/2;
  int d[N];
  for(i=0;i<N;i++){
    scanf("%d",&d[i]);
  }
  
 quick_sort(d,0,N-1);
  ans=d[cp]-d[cp-1];
  printf("%d",ans);
  return 0;
}


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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    string S;
    cin >> S;
    if(S == "Sunny") cout << "Cloudy" << endl;
    else if (S == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int cnt=0,n,x;
	cin>>n;
	x=n;
	while(x)
	{
		cnt+=x%10;
		x/=10;
	}
	if(n%cnt==0)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<math.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define rg register
#define il inline
using namespace std;
int a;
int main(){
	scanf("%d",&a);
	if((a/100)%11==0)return puts("Bad")&0;
	if(((a%1000)/10)%11==0)return puts("Bad")&0;
	if((a%100)%11==0)return puts("Bad")&0;
	puts("Good");
	return 0;
}


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

typedef long long ll;

const ll t[3]={2,3,5};

ll c[3],d;
unordered_map<ll,ll> memo;
ll solve(ll n){
	if(n==0)return 0;
	if(n==1)return d;
	if(memo.find(n)!=memo.end())return memo[n];
	ll ret=1000000000000000000;
	if((long double)d*(long double)n<=ret){
		ret=d*n;
	}
	for(int k=0;k<3;k++){
		ll a=n/t[k];
		ll b=n%t[k];
		if(k==0){
			ret=min(ret,solve(a)+c[k]+b*d);
			if(a+1!=n)ret=min(ret,solve(a+1)+c[k]+(t[k]-b)*d);
		}
		else {
			if(b<=t[k]-b){
				ret=min(ret,solve(a)+c[k]+b*d);
			}
			else {
				ret=min(ret,solve(a+1)+c[k]+(t[k]-b)*d);
			}
		}
	}
	memo[n]=ret;
	return ret;
}

int main(){
	int T;
	scanf("%d",&T);
	for(;T>0;T--){
		ll n;
		cin>>n>>c[0]>>c[1]>>c[2]>>d;
		cout<<solve(n)<<endl;
		memo.clear();
	}
}

Measured memory_bytes: 4276
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
def_Bsum = sum(B)
 
for i in range(N+1):
    if(i==0):                  #倒せたら０にする。最後に引いたら残るように
        if (A[i] < B[i]):
            B[i] -= A[i]
            A[i] = 0
        else:
            A[i] -= B[i]
            B[i] = 0
 
    if(0<i<N):
        if(A[i] < B[i-1]):
            B[i-1] -= A[i]
            A[i] = 0
        else:
            A[i] -= B[i-1]
            B[i-1] = 0
 
            if (A[i] < B[i]):
                B[i] -= A[i]
                A[i] = 0
            else:
                A[i] -= B[i]
                B[i] = 0
 
    if(i==N):
        if (A[i] < B[i-1]):
            B[i-1] -= A[i]
            A[i] = 0
        else:
            A[i] -= B[i-1]
            B[i-1] = 0
 
 
ans = def_Bsum - sum(B)

print(ans)

Measured memory_bytes: 19648
from decimal import *
import math

getcontext().prec = 50

a, b, c = map(int, input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

a = Decimal.sqrt(a)
b = Decimal.sqrt(b)
c = Decimal.sqrt(c)

if a + b < c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
using Int = long long unsigned;
Int const INF = 1e10;
typedef vector<pair<Int,Int>> pvec;

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

    int n; cin>>n; int v[n];
    for (int i = 0; i < n; i++) cin>>v[i];
    int ma=*max_element(v,v+n);
    bool key=false;
    cout<<*max_element(v+1,v+n)<<'\n';
    for (int i = 1; i < n-1; i++){
        if(v[i]==ma){
            if(key)cout<<ma<<'\n';
            else{
                cout<<max(*max_element(v,v+i),*max_element(v+i+1,v+n))<<'\n';key=true;
            }
        }else cout<<ma<<'\n';
    }
    cout<<*max_element(v,v+n-1)<<'\n';
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll dp[105][4][4][4];

void Main() {
    int N;
    cin >> N;
    dp[0][3][3][3] = 1;
    rep(i, N) {
        rep(j, 4) {
            rep(k, 4) {
                rep(m, 4) {
                    rep(d, 4) {
                        if (d == 1 && m == 2 && k == 0) continue;
                        if (d == 1 && m == 2 && j == 0) continue;
                        if (d == 2 && m == 1 && k == 0) continue;
                        if (d == 1 && k == 2 && j == 0) continue;
                        if (d == 1 && m == 0 && k == 2) continue;
                        dp[i + 1][d][m][k] += dp[i][m][k][j];
                        dp[i + 1][d][m][k] %= MOD;
                    }
                }
            }
        }
    }
    ll ans = 0;
    rep(i, 4) {
        rep(j, 4) {
            rep(k, 4) {
                ans += dp[N][i][j][k];
                ans %= MOD;
            }
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main(){
    char str[1001];
    long len;
    int i;
    gets(str);
    len = strlen(str);
    for (i = 0; i < len - 4; i++) {
        if (str[i]=='a' && str[i+1]=='p' && str[i+2]=='p' && str[i+3]=='l' &&str[i+4]=='e') {
            str[i]='p';
            str[i+1]='e';
            str[i+2]='a';
            str[i+3]='c';
            str[i+4]='h';
        }
        else if (str[i]=='p' && str[i+1]=='e' && str[i+2]=='a' && str[i+3]=='c' &&str[i+4]=='h') {
            str[i]='a';
            str[i+1]='p';
            str[i+2]='p';
            str[i+3]='l';
            str[i+4]='e';
        }
    }
    puts(str);
    return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <algorithm>

int main()
{
	while(true)
	{
		int N;
		scanf("%d", &N);
		if(N == 0) break;
		std::pair<int, int> a[30];
		for(int i = 0; i < N; i++)
		{
			scanf("%d %d", &a[i].second, &a[i].first);
		}
		std::sort(a, a + N);
		int sum = 0;
		bool flag = true;
		for(int i = 0; i < N; i++)
		{
			sum += a[i].second;
			if(sum > a[i].first)
			{
				flag = false;
				break;
			}
		}
		if(flag)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}

	return 0;
}

Measured memory_bytes: 2492
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=b-1;i>=a;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll N,A[200007],ans[200007];
vector<vector<ll>> E(200007);
vector<ll> V;
vector<ll> dp(200007,INF);

ll binaly(ll key,vector<ll> &V,vector<ll> &dp){
  ll ok=0,ng=V.size();
  while(ok<ng){
    ll mid = (ok+ng)/2;
    if(dp[mid]<key){ 
      ok = mid+1; 
    }
    else{
      ng = mid;
    }
  }
  return ok;
}

void dfs(ll key,ll mae, vector<ll> &dp,vector<ll> &V){
  V.pb(A[key]);
  ll X,Y;
  X=binaly(A[key],V,dp);
  Y=dp[X];
  dp[X] = A[key];
  ans[key]=lower_bound(dp.begin(), dp.end(), INF ) - dp.begin();
  rep(i,E[key].size()){
    if(E[key][i]!=mae){
      dfs(E[key][i],key,dp,V);
    }
  }
  V.pop_back();
  dp[X]=Y;
}

int main(){
  cin >> N;
  rep(i,N){
    cin >> A[i+1];
  }
  V.clear();
  rep(i,N-1){
    ll X,Y;
    cin >> X >> Y;
    E[X].pb(Y);
    E[Y].pb(X);
  }
  dfs(1,0,dp,V);
  rep(i,N){
    cout << ans[i+1] << endl;
  }
}

Measured memory_bytes: 37444
//aea ctmr
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846
 
typedef long double ld;
typedef long long ll;
const ll N = 400500;
const ll mod = 1e9 + 7;
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif

map <ll, ll> m;
vector <ll> xd;

int main(){
    fastio;
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
    	ll a;
    	cin >> a;
    	m[a]++;
    	xd.push_back(a);
    }

    for(auto x: m){
    	ll w = x.ss;
    	ans += ((w * w - w) / 2);
    }

    for(ll i = 0; i < n; i++){
    	ll a = m[xd[i]];

    	cout << ans - a + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 12912
#include<stdio.h>

main(void)
{
  int n,i;
  double money,gokei=0.000;
  char moji[100];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
  {
    scanf("%lf %s",&money,moji);
    if(moji[0]=='J')
    {
      gokei = gokei + money;
    }
    else
    {
      money = money*380000.0;
      gokei = gokei + money;
    }
  }
  printf("%lf",gokei);
  
  return 0;
}

Measured memory_bytes: 128
h, w = map(int, input().split())
if h % 2 == 0:
  if w % 2 == 0:
    ans = (h * w) // 2 
if h % 2 == 0:
  if w % 2 != 0:
    ans = (w // 2 + 1) * (h // 2) + (w // 2) * (h // 2)
if h % 2 != 0:
  if w % 2 == 0:
    ans = (h // 2 + 1) * (w // 2) + (h // 2) * (w // 2)
if h % 2 != 0:
  if w % 2 != 0:
    ans = (h * (w - 1) // 2) + (h // 2 + 1)
if h == 1 or w == 1:
  ans = 1
print(ans)

Measured memory_bytes: 3064
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int n,i,r=0,b;
	scanf("%d",&n);
	vector<int>A(n),B(n);
	for(i=0;i<n;i++)scanf("%d",&A[i]);
	for(i=0;i<n;i++)scanf("%d",&B[i]);
	for(b=0;b<29;b++){
		int r0=0,t=1<<b;
		vector<int>a;
		transform(A.begin(),A.end(),back_inserter(a),
			[&](int e){return -(e%(2*t));}
		);
		sort(a.begin(),a.end());
		for(auto &e_:B){
			int e=e_%(2*t),sgn=-1,q;
			for(q=1;q<=4;sgn=-sgn,q++){
				r0+=sgn*distance(a.begin(),upper_bound(a.begin(),a.end(),-q*t+e));
			}
		}
		r^=(r0&1)*t;
	}
	printf("%d\n",r);
}

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

#define vpp vector<pair<int,int>>
#define ll long long int
#define ull unsigned long long
#define ld long double
#define fi(i,a,b) for(ll i=a;i<b;i++)
#define fj(j,a,b) for(ll j=a;j<b;j++)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define mpi map<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define pb push_back
#define MOD 1000000007
#define ub upper_bound
#define lb lower_bound
#define itr(v) for(auto it:v)
#define all(v) v.begin(),v.end()  
#define w(t)  int t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fast_pow(ll k, ll p)
{
if (p == 0)
        return 1;
 
    ll P = fast_pow(k, p/2);
    P = (P * P) % MOD;
 
    if (p % 2 == 1)
        P = (P * k) % MOD;
 
    return P;
}
ll invmod(ll a,ll m)
{
    return fast_pow(a,m-2);
}

bool isPrime(ll n) 
{ 
   
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
       if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll nextPowerOf2(ll n)
{
    n>>=1;
    ll count = 0;

    if (n && !(n & (n - 1)))
        return n;

    while( n != 0)
    {
        n >>= 1;
        count += 1;
    }

    return 1 << count;
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
  
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 


//////////////////////*********CODE***********/////////////////////
int main(){
    int n,d;
    cin>>n>>d;
      int ans=0;
    for(int i=0;i<n;i++){
         double x,y;
         cin>>x>>y;
         double t=sqrt((x*x)+(y*y));
        //  cout<<t<<endl;
         if(t<=d){
             ans++;
         }
    }
    cout<<ans<<endl;
    
}

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

	int main() {
	#ifdef LOCAL_DEFINE
		// freopen("data.in", "rt", stdin);
		// freopen("data.out", "w", stdout);
		auto _start = chrono::high_resolution_clock::now();
	#endif

		ios::sync_with_stdio(false);
		cin.tie(0);
		cout << fixed << setprecision(15);
		int n;
		cin >> n;
		vector<double> p(n);
		for(int i = 0; i < n; i++) {
			cin >> p[i];
		}
		vector<vector<double>> dp(n + 1, vector<double>(n + 1));
		dp[0][0] = 1;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				dp[i + 1][j + 1] += dp[i][j] * p[i];
				dp[i + 1][j] += dp[i][j] * (1 - p[i]);
			}
		}
		double ans = 0;
		for(int i = (n + 1) / 2; i <= n; i++) {
			ans += dp[n][i];
		}
		cout << ans << '\n';

	#ifdef LOCAL_DEFINE
		auto _end = chrono::high_resolution_clock::now();
		cerr << "elapsed time: " << chrono::duration<double, milli>(_end - _start).count() << " ms\n";
	#endif
		return 0;
	}

Measured memory_bytes: 70784
class Node:
    def __init__(self, key):
        self.key = key
        self.parent = None
        self.left = self.right = None
    def preorder(self):
        L = [self.key]
        if self.left: L += self.left.preorder()
        if self.right: L += self.right.preorder()
        return L
    def inorder(self):
        L = []
        if self.left: L += self.left.inorder()
        L.append(self.key)
        if self.right: L += self.right.inorder()
        return L

def insert(t, z):
    y = None
    x = t
    while x:
        y = x # 親を設定
        x = x.left if z.key < x.key else x.right
    z.parent = y
    if not y: # t が空の場合
        return z
    if z.key < y.key:
        y.left = z # z を y の左の子にする
    else:
        y.right = z # z を y の右の子にする
    return t

def find(t, k):
    x = t
    while x:
        if x.key == k:
            return True
        x = x.left if k < x.key else x.right
    return False

t = None
m = int(input())
for _ in range(m):
    cmd = list(input().split())
    if cmd[0] == 'insert':
        t = insert(t, Node(int(cmd[1])))
    if cmd[0] == 'find':
        print('yes' if find(t, int(cmd[1])) else 'no')
    if cmd[0] == 'print':
        print('', *t.inorder())
        print('', *t.preorder())



Measured memory_bytes: 96056
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

tabecol = {}
for n in range(N):
    for tabe in A[n][1:]:
        if tabe in tabecol:
            tabecol[tabe] += 1
        else:
            tabecol[tabe] = 1

print( list(tabecol.values()).count(N) )

Measured memory_bytes: 3060
N = int(input())
A=[int(x) for x in input().split()]
H= True
A.sort()
if N%2==0:
  for i in range(N):
    if A[i] != 2*(i//2)+1:
      H=False
else:
  if A[0]!=0:
    H=False
  for i in range(1,N):
    if A[i]!=2*((i-1)//2)+2:
      H=False
print(2**(N//2)%(10**9+7) if H else '0')

Measured memory_bytes: 13880
import sys,collections as cl,bisect as bs
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))


r,b,g,n = m()
co = 0
for i in range(n//r+1):
	for j in range((n-r*i)//b+1):
		if ((n - (i*r + j * b)) % g) == 0:
			co += 1
print(co)



Measured memory_bytes: 40432
import sys
input = sys.stdin.readline

N = int(input())
A = [int(item) for item in input().split()]
B = [int(item) for item in input().split()]

killed = 0
for i in range(N):
    kill_l = min(A[i], B[i])
    kill_r = min(A[i + 1], B[i] - kill_l)
    A[i + 1] -= kill_r
    killed += (kill_l + kill_r)

print(killed)


Measured memory_bytes: 73316
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define INF 1e18
#define vec vector<int>
#define REP(i,a,b) for(i=a;i<b;i++)
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  while(b<=a&&k>0)
    b*=2,k--;
  while(c<=b&&k>0)
    c*=2,k--;
  if(b>a && c>b)
    cout<<"Yes\n";
  else
    cout<<"No\n";
}


Measured memory_bytes: 3632
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll T; cin >> T;
    rep(_, T){
        ll a, b, c, d; cin >> a >> b >> c >> d;
        if(a < b || b > d) {cout << "No" << endstr; continue;};
        if(c >= b){cout << "Yes" << endstr; continue;};
        ll g_bd = gcd(b, d);
        ll mx = a - (a-b+1 + g_bd-1)/g_bd*g_bd;
        if(c < mx && mx < b){
            cout << "No" << endstr;
        }
        else{
            cout << "Yes" << endstr;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  vector<double> b(a);
  vector<string> c(a);
  rep(i,a)
    cin>>b[i]>>c[i];
  double d=0;
  rep(i,a){
  if(c[i]=="JPY")
    d+=b[i];
    else
     d+=b[i]*380000; 
  }
  out(d);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#define ll long long
using namespace std;

ll N, K, bit[200010];
void add(ll a, ll w){
    for(ll i=a; i<=N+1; i += (ll) i&(-i)){
        bit[i] += w;
    }
}
ll sum_bit(ll s){
    if(s<1) return 0;
    return bit[s]+sum_bit(s-(s&(-s)));
}

int main() {
	cin >> N >> K;
	vector<ll> a(N), sum(N+1, 0);
	vector<pair<ll, ll>> z(N+1);
	z[0]=make_pair(0, 0);
	for(ll i=0; i<N; ++i){
	    cin >> a[i];
	    a[i] -= K;
	    sum[i+1]=sum[i]+a[i];
	    z[i+1]=make_pair(sum[i+1], i+1);
	}
	sort(z.begin(), z.end());
	sum[z[0].second]=1;
	for(ll i=1; i<=N; ++i){
	    if(z[i-1].first<z[i].first) sum[z[i].second]=sum[z[i-1].second]+1;
	    else sum[z[i].second]=sum[z[i-1].second];
	}
	ll ans=N*(N+1)/2;
	for(ll i=0; i<=N; ++i){
	    ans -= (ll) i-sum_bit(sum[i]);
	    add(sum[i], 1);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
// using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n;
  cin >> n;
  int cnt = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    if (a == b)
      cnt++;
    else
      cnt = 0;
    if (cnt == 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] vi = new int[n];
        for(int i=0; i<n; i++) {
            vi[i] = in.nextInt();
        }
        int[] ci = new int[n];
        for(int i=0; i<n; i++) {
            ci[i] = in.nextInt();
        }
        int result = 0;
        for(int i=0; i<n; i++) {
            if(vi[i] > ci[i]) {
                result += vi[i] - ci[i];
            }
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 22608
import collections
n=int(input())
a=list(map(int,input().split()))
l=list(set(a))
m=collections.Counter(a)
ans=0
for i in range(len(l)):
    if m[l[i]]<l[i]:
        ans+=m[l[i]]
    else:
        ans+=m[l[i]]-l[i]
print(ans)

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

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

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

	char A, B, C, D; cin >> A >> B >> C >> D;

	for (int i = 0;i < (1<<3);i++){
		int sum = A-'0';
		if(i&1) sum += B-'0';
		else sum -= B-'0';
		if(i&2) sum += C-'0';
		else sum -= C-'0';
		if(i&4) sum += D-'0';
		else sum -= D-'0';
		if(sum == 7){
			cout << A << (i&1?'+':'-') << B << (i&2?'+':'-') << C << (i&4?'+':'-') << D << "=7" << endl;
			return 0;
		}
	}

	return 0;

}


Measured memory_bytes: 256
n, k = map(int, input().split())
x = tuple(map(int, input().split()))

md = 20**8 + 1
for l in range(n-k+1):
    r = l+k-1
    md = min(md, abs(x[l]) + abs(x[l] - x[r]))
    md = min(md, abs(x[r]) + abs(x[l] - x[r]))
print(md)


Measured memory_bytes: 14696
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


X = int(input())

p = X
ans = 0
while True:
    if (is_prime(p)):
        ans = p
        break
    else:
        p += 1

print(ans)


Measured memory_bytes: 3060