akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll A[100010];
    cin >> N;
    rep(i,0,N){
        cin >> A[i];
    }
    ll ans = 0;
    if(A[0] % 2 == 0){
        ans += A[0]/2;
        A[0] = 0;
    }else{
        ans += (A[0]-1)/2;
        A[0] = 1;
    }
    // print("--");
    // print(ans);
    rep(i,1,N){
        if(A[i-1] == 0){
            if(A[i] % 2 == 0){
                ans += A[i]/2;
                A[i] = 0;
            }else{
                ans += (A[i]-1)/2;
                A[i] = 1;
            }
        }else{
            if(A[i] % 2 == 0){
                ans += A[i]/2;
                if(A[i] == 0){
                    A[i] = 0;
                }else{
                    A[i] = 1;
                }
            }else{
                ans += (A[i] +1)/2;
                A[i] = 0;
            }
        }
        // print(ans);
        // printa(A,N);
    }
    print(ans);


}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m;

  int ans = 1;
  for(int i=1; i*i<=m; i++) {
    if(m % i == 0) {
      if(i >= n) ans = max(ans, m / i);
      if(m / i >= n) ans = max(ans, i);
    }
  }

  cout << ans << endl;
}


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

int main(){
  int A;
  cin>>A;
  int e=0;
  for(int i=1;i<10;i++){
    for(int j=9;j>=i;j--){
      if(A==i*j)
        e++;
    }
  }
  if(e>0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define cont continue
#define rep(i, n) for(int i = 0 ; i < (n) ; i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 987654321;


int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false); 
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for(int i = 0 ; i < s.size() ; i++) {
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;
} 

Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

class UnionFind {
public:
  vector <ll> par;
  vector <ll> siz;
  UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }
  ll root(ll x) {
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }
  bool merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }
  ll size(ll x) {
    return siz[root(x)];
  }
};

int main() {
  int n,m; cin >> n >> m;
  UnionFind uf(n);
  rep(i,m) {
    int s,t; cin >> s >> t;
    uf.merge(s,t);
  }

  int q; cin >> q;
  vector<int> s(q),t(q);
  rep(i,q) cin >> s[i] >> t[i];
  rep(i,q) {
    if (uf.issame(s[i],t[i])) cout << "yes" << endl;
    else cout << "no" << endl;
  }
}


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

int main() {
  string s;
  cin >> s;
  string t;
  cin >> t;
  int ans = 0;
  int n = s.size();
  rep(i, n) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << '\n';
  return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int n,a,b;
    int sum=0;
    int man=0,sen=0,hyaku=0,juu=0;
    int x,y;
    
    cin >> n >> a >> b;
    
    for(int i=1;i<=n;i++){
        man=0;
        sen=0;
        hyaku=0;
        juu=0;
        x=i;
        for(;;){
            if(x>=10000){
                man++;
                x-=10000;
            }
            else break;
        }
        for(;;){
            if(x>=1000){
                sen++;
                x-=1000;
            }
            else break;
        }
        for(;;){
            if(x>=100){
                hyaku++;
                x-=100;
            }
            else break;
        }
        for(;;){
            if(x>=10){
                juu++;
                x-=10;
            }
            else break;
        }
        
        
        y=man+sen+hyaku+juu+x;
        if(y>=a && y<=b){
            sum+=i;
        }
    }
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#include<bits/stdc++.h>
using namespace std;
#define y1 y11
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
//#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pli pair<LL, int>
#define pii pair<int, int>
#define piii pair<pii, int>
#define pdd pair<double, double>
#define mem(a, b) memset(a, b, sizeof(a))
#define debug(x) cerr << #x << " = " << x << "\n";
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//head

const int N = 205;
vector<int> g[N];
int n, c, mx, st, vis[N], dp[N][N];
char s[N][N];
bool f = true;
void dfs(int u, int c) {
    vis[u] = c;
    for (int v : g[u]) {
        if(vis[v] == -1) dfs(v, c^1);
        else {
            if(vis[v] != (c^1)) f = false;
        }
    }
}
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%s", s[i]+1);
    for (int i = 1; i <= n; ++i) {
        for (int j = i; j <= n; ++j) {
            if(s[i][j] == '1') {
                g[i].pb(j);
                g[j].pb(i);
            }
        }
    }
    mem(vis, -1);
    dfs(1, 0);
    if(!f) printf("-1\n");
    else {
        for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) {
            if(s[i][j] == '1') dp[i][j] = 1;
            else dp[i][j] = 0x3f3f3f3f;
            if(i == j) dp[i][i] = 0;
        }
        for (int k = 1; k <= n; ++k) {
            for (int i = 1; i <= n; ++i) {
                for (int j = 1; j <= n; ++j) {
                    dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
                }
            }
        }
        int ans = 0;
        for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) {
            if(dp[i][j] <= n) ans = max(ans, dp[i][j]);
        }
        printf("%d\n", ans+1);
    }
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int ,int> pi;
typedef pair<ll ,ll> pl;
typedef map<ll ,ll> ml;
#define modulo 1000000007
#define maxN 100001
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve()
{
    int n;
    cin >> n;
    vector<int> arr(n),ans;
    int s=0;
    for(int i=0;i<n;i++)
    {
        cin >> arr[i];
        s=s^arr[i];
    }
    for(int i=0;i<n;i++)
    {
        ans.emplace_back(s^arr[i]);
    }
    for(int i:ans)cout << i << " ";
    cout << endl;
}

int main()
{
    
    fast;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5016
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+10;
int dp[1<<13];
int lim;
int n,m;

void init(){
    lim=(1<<(n));
    for (int i=0;i<lim;++i){
        dp[i]=INF;
    }
    dp[0]=0;
    int state, w, b, c;
    while(m--){
        state=0;
        scanf("%d%d",&w,&b);
        while(b--){
            scanf("%d",&c);
            state+=(1<<(c-1));
        }
        for (int i=0;i<lim;++i){
            if ((i&state)==i){
                dp[i]=min(dp[i],w);
            }
        }
    }
    return ;
}

void sol(){
    for (int i=0;i<lim;++i){
        for (int j=0;j<lim;++j){
            dp[i|j]=min(dp[i|j],dp[i]+dp[j]);
        }
    }
    if (dp[lim-1]==INF){
        cout<<"-1\n";
    }else{
        cout<<dp[lim-1]<<"\n";
    }
    return ;
}

int main(){
    scanf("%d%d",&n,&m);
    init();
    sol();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string a, b;
    cin >> a >> b;
 
    if (a.length() > b.length()) {
        cout << "GREATER" << endl;
    } else if (a.length() < b.length()) {
        cout << "LESS" << endl;
    } else {
        bool equal = true;
        for (int i = 0; i < a.length(); i++) {
            if (a.at(i) > b.at(i)) {
                cout << "GREATER" << endl;
                equal = false;
                break;
            } else if (a.at(i) < b.at(i)) {
                cout << "LESS" << endl;
                equal = false;
                break;
            } else {
                continue;
            }
        }
        if (equal) {
            cout << "EQUAL" << endl;
        }
    }
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;
	auto diff = M - N*2;
	if (diff > 0)
	{
		N += diff / 4;
		M -= diff / 2;
	}

	writeln(min(N, M/2));
	stdout.flush();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,cnt;

int main() {
	cin>>n>>k;
	cnt = 0;
    for (int i = 1,x; i <= n; i++) {
        cin>>x;
        if (x >= k) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
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;


/*
AC
*/

ll n,k;

int main(void){
	cin>>n>>k;
	cout<<((n%2==0 && n/2>=k)||(n%2==1 && n/2+1>=k)?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 1000000;
const int K = 19;
const int mod = 1e9 + 7;
int dp[2][N], s, t, n, m, d[2][N], c[2][N];
map < int, int > mp;
vector < pair < int, int > > a[N];
int res(int x, int y){
    y = abs(y);
    if (x % y == 0) return 0;
    if (x < 0) return (y - abs(x % y)); else return x % y;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, x, d;
    cin >> n >> x >> d;
    set < int > s;
    if (d == 0){
        if (x == 0) cout << 1; else
        cout << n + 1;
        return 0;
    }
    for (int i = 0; i <= n; i++){
        s.insert(res(i * x, d));
    }
    int cnt = 0;
    for (auto i: s){
        mp[i] = cnt;
        cnt++;
    }
    for (int i = 0; i <= n; i++){
        int q = mp[res(i * x, d)];
        int l = i * x + i * (i - 1) / 2 * d;
        int r = -i * (i - 1) /2  * d + i * x + (n - 1) * i * d;
        l -= res(i * x, d);
        r -= res(i * x, d);
        l /= d;
        r /= d;
        if (l > r) swap(l, r);
        a[q].pb(make_pair(l, r));
    }
    int ans = 0;
    for (int j = 0; j < cnt; j++){
        int r = -5 * 1e18 - 2 * 1e14;
        int l = r + 1;
        sort(a[j].begin(), a[j].end());
        for (int i = 0; i < a[j].size(); i++){
            if (a[j][i].F > r){
                ans += r - l + 1;
                l = a[j][i].F;
                r = a[j][i].S;
            } else{
                ans += a[j][i].F - l;
                l = a[j][i].F;
                r = max(r, a[j][i].S);
            }
        }
        ans += r - l + 1;
    }
    cout << ans;
}


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

int main(){
	int N,i=0;
	string s;
	cin>>N>>s;
	for(i=1;i<N;i++){
		if(s[i]=='x'&&s[i-1]=='x')	break;
	}
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
using namespace std;
typedef pair<int,int> pr;

const int MAX_N=1e5+5;
int n,m;
vector<pr> iv[MAX_N];
pr ans[MAX_N];

int main()
{
	scanf("%d%d",&n,&m); 
	int a,b;
	for(int i=1;i<=m;++i)
	{
		scanf("%d%d",&a,&b);
		iv[a].push_back(pr{b,i});
	}
	for(int i=1;i<=n;++i)
	{
		sort(iv[i].begin(),iv[i].end());
		int k=1;
		for(auto c:iv[i])
			ans[c.second]=pr{i,k++};
	}
	for(int i=1;i<=m;++i)
		printf("%.6d%.6d\n",ans[i].first,ans[i].second);
	
	return 0;
}

Measured memory_bytes: 7808
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int n,f[4]={};
  char s[1010];
  scanf("%s",s);
  n=strlen(s);
  for(int i=0;i<n;i++){
    if(s[i]=='N')
      f[0]=1;
    else if(s[i]=='S')
      f[1]=1;
    else if(s[i]=='E')
      f[2]=1;
    else
      f[3]=1;
  }
  if(f[0]==f[1]&&f[2]==f[3])
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 128
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 205;
const int maxm = 1e5 + 5;

int n, x;
int a[maxn], dp[maxn][maxm];

/*
sort them in the increasing order
then for ai (after sorted), if it works,
it must be in front of all the elements that are smaller than it
otherwise it won't cause any influence
so we have dp(i, j) representing if you feed the first i elements with j,
what's the answer:
dp(i, j) = dp(i - 1, j mod a[i]) + dp(i - 1, j) * i
*/

int main(){
	scanf("%d%d", &n, &x);
	FOR(i, 0, n)
		scanf("%d", a + i);
	sort(a, a + n);
	FOR(i, 0, n) FOR(j, 0, maxm){
		if(!i){
			dp[i][j] = j % a[i];
			continue;
		}
		dp[i][j] = (dp[i - 1][j % a[i]] + 1ll * dp[i - 1][j] * i % INF) % INF;
	}
	printf("%d\n", dp[n - 1][x]);
	return 0;
}



Measured memory_bytes: 80128
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    string S; cin >> S;
    if (S[1] == 'R') {
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(void){
        int x,y,i;
        while(1){
                scanf("%d %d",&x,&y);
                if(x>y){
                        i=x;
                        x=y;
                        y=i;
                }
                if(x==0 && y==0)
                        break;
                printf("%d %d\n",x,y);
        }
        return 0;
}


Measured memory_bytes: 2016
#include <algorithm>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
static ll imin = std::numeric_limits<ll>::min() / 10;
static ll imax = std::numeric_limits<ll>::max() / 10;
#define rep(i, n) for (ll i = 0; (i) < (n); ++(i))
#define rep1(i, n) for (ll i = 1; (i) < (n); ++(i))
#define rev_rep(i, n) for (ll i = (n)-1; (i) >= 0; --(i))
#define range(a, i, b) for (ll i = (a); (i) < (b); ++(i))

#ifdef LOCAL
#define dump(x) cout << #x << ":" << x << "\n";
#endif
#ifndef LOCAL
#define dump(x)
#endif

#define all(v) v.begin(), v.end()
#define readl(N) \
  ll N;          \
  cin >> N;
#define readlv(N, vec) \
  vector<ll> vec(N);   \
  rep(i, N) { cin >> vec[i]; }
#define greater_than [](ll l, ll r) { return l > r; }
template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, std::map<T1, T2>& mp);
template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& pair);
template <class T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& vec);
template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& pair) {
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template <class T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& vec) {
  std::size_t n = vec.size();
  if (n == 0) {
    return os;
  }
  os << " ";
  for (ll i = 0; i < n - 1; ++i) {
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, std::map<T1, T2>& mp) {
  std::size_t n = mp.size();
  if (n == 0) {
    return os;
  }
  os << " ";
  for (auto&& x : mp) {
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template <class T>
std::ostream& operator<<(std::ostream& os, std::set<T>& mp) {
  std::size_t n = mp.size();
  if (n == 0) {
    return os;
  }
  os << " ";
  for (auto&& x : mp) {
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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

ll fact(ll n) {
  ll res = 1;
  while (n > 0) {
    res *= n;
    n--;
  }
  return res;
}

ll pow(ll i, ll n) {
  ll res = 1;
  while (n >= 0) {
    res *= i;
    n--;
  }
  return res;
}

ll gcd(ll l, ll r) {
  if (l < r) {
    return gcd(r, l);
  }
  if (r == 0) {
    return l;
  }
  return gcd(r, l % r);
}

template <class T>
vector<T> accum_sum(vector<T> const& a) {
  vector<T> b(a.size() + 1);
  b[0] = 0;
  rep(i, a.size()) { b[i + 1] = b[i] + a[i]; }
  return b;
}
constexpr ll mod = 1e9 + 7;

int main(int argc, char const* argv[]) {
  readl(N);
  ll it = 0;
  rep(i, imax) {
    it += i;
    dump(i);
    if (it >= N) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(c >=a && c <= b)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 21844
import collections
def resolve():
    n = int(input())
    s = [input() for _ in range(n)]
    c = collections.Counter(s)
    max_count = c.most_common()[0][1]
    ans = [i[0] for i in c.items() if i[1]==max_count]
    for i in sorted(ans): print(i)
resolve()

Measured memory_bytes: 49400
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define SREP(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}

int main() {
	int n, x;
	int m,mi=1e9;
	scanf("%d %d", &n, &x);
	REP(i, n) {
		scanf("%d", &m);
		x -= m;
		if (m < mi)mi = m;
	}
	PRINTD(n + x / mi);

}

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

string FILENAME = "template";
#define io ifstream fin(FILENAME + ".in"); ofstream fout(FILENAME + ".out")
#define fwrite(X) fout << X;
#define fwriteln(X) fout << X << endl;

#define forl(V, N) for(int V = 0; V < N; V++)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define rem(X) X.top(); X.pop()
#define setmin(A, B) A = min(A, B)
#define setmax(A, B) A = max(A, B)
#define graph unordered_map<int, unordered_set<int>>
#define vi vector<int>
#define pb push_back
#define ll long long

int dp [3001][3001];

int main() {
    string S, T;
    cin >> S >> T;
    forl(i, S.length()) {
        forl(j, T.length()) {
            if(S[i] == T[j]) dp[i+1][j+1] = dp[i][j] + 1;
            else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
        }
    }
    int i = S.length(), j = T.length();
    string ans = "";
    while(i > 0 && j > 0) {
        if(dp[i][j-1] == dp[i][j]) j--;
        else if(dp[i-1][j] == dp[i][j]) i--;
        else {
            ans = S[i-1] + ans;
            i--; j--;
        }
    }
    println(ans);
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    string s;
    cin>>s;
    ll n=s.size();

    ll ans=INF;

    REP(i,26){
        char t='a'+i;
        ll con=0;
        ll ma=0;
        REP(j,n){
            if(s[j]==t){
                chmax(ma,con);
                con=0;
            }else{
                con++;
            }
        }
        chmax(ma,con);
        chmin(ans,ma);
    }
    cout<<ans<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

readline = sys.stdin.readline

n,q = map(int,readline().split())
a=[[] for i in range(n)]
l=[0 for _ in range(n)]
ans=[0 for _ in range(n)]

def dfs(parent,current,value):
    value += l[current]
    ans[current] = value
    for i in a[current]:
        if i == parent:
            continue
        dfs(current,i,value)


for i in range(n-1):
    t1,t2 = map(int,readline().split())
    a[t1-1].append(t2-1)
    a[t2-1].append(t1-1)
    
for i in range(q):
    t1,t2 = map(int,readline().split())
    l[t1-1]+=t2
dfs(-1,0,0)

print(" ".join(map(str,ans)))

Measured memory_bytes: 237712
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
string s[401];
int b[401][401];
int at = 0;
bool used[401][401];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int h, w;

void dfs(int i, int j){
  used[i][j] = true;
  b[i][j] = at;
  rep(k, 4){
    int nx = i + dx[k];
    int ny = j + dy[k];
    if(nx < 0 || nx >= h || ny < 0 || ny >= w || used[nx][ny])continue;
    if(s[nx][ny] != s[i][j])dfs(nx, ny);
  }
}

ll num[2][200001];

int main(int argc, char const* argv[])
{
  cin >> h >> w;
  rep(i, h)cin >> s[i];
  rep(i, h){
    rep(j, w){
      if(!used[i][j]){
        at++;
        dfs(i, j);
      }
    }
  }
  rep(i, h){
    rep(j, w){
      if(s[i][j] == '#')num[0][b[i][j]]++;
      else num[1][b[i][j]]++;
    }
  }
  ll res = 0;
  rep(i, at+1){
    res += (ll)num[0][i] * (ll)num[1][i];
  }
  cout << res << endl;
	return 0;
}


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

using namespace std;

long long h;

void solve(){
    int i,j;
    string str;
    cin >> h;
    long long ans = 0,n = 1;
    while(h){
        ans += n;
        h /= 2;
        n *= 2;
    }
    cout << ans << endl;
}

int main(){
    solve();
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static int[] arr;
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        arr = new int[300];
        
        while (true) {
            int N = sc.nextInt();
            if (N == 0) break;
            
            System.out.println(coinChange(17, N));
        }
    }
    
    public static int coinChange(int sz, int n) {
        if (n == 0) return 1;
        if (n < 0) return 0;
        if (sz <= 0 && n >= 1) return 0;
        return coinChange(sz-1, n) + coinChange(sz, n - sz * sz);
    }
}




Measured memory_bytes: 26324
import math
# from collections import defaultdict
import time
def steps(n,p):
  c = 0
  while n:
    c += 1
    n = n%p
    p = bin(n).count('1')
  return c

# n = 200000
# x = "1"*n
n = int(input())
x = input()
p = x.count('1')
ans = []
num = int(x,2)
if p==1:
  for i in range(n-1,-1,-1):
    if x[i]=='1':
      ans.append(0)
    else:
      if i==n-1 or x[n-1]=='1':
        ans.append(2)
      else:
        ans.append(1)
else:
  incs = 1
  decs = 1
  inc = num%(p+1)
  dec = num%(p-1)
  start = time.time()
  k = -1
  for i in range(n-1,-1,-1):
    cp = p
    if x[i] == '0':
      cp += 1
      new = (inc+incs)%cp
    else:
      cp -= 1
      new = (dec-decs)%cp
    k -= 1
    incs = (incs*2)%(p+1)
    decs = (decs*2)%(p-1)
    sol = steps(new,cp)
    if sol==0:
      sol=1
    ans.append(sol)
    # steps(new,cp)
  # print(time.time()-start)
ans = ans[::-1]
for x in ans:
  print(x)

Measured memory_bytes: 12616
import java.util.List;
import java.util.Scanner;
import java.util.Vector;

public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ST st = new ST();
		st.init(N);
		int h[] = new int[N];
		int a[] = new int[N];
		for (int i=0;i<N;i++) 
			h[i] = sc.nextInt()-1;
		for (int i=0;i<N;i++) 
			a[i] = sc.nextInt();
		
		for (int i=0;i<N;i++) {
			long m = st.Q(0, h[i]);
			
			st.update(h[i], m+a[i]);
		}
		System.out.println(st.Q(0, N));
	}

}

class ST{
	int MaxN = 1<<18;
	int n;
	long dat[] = new long[2 * MaxN - 1];

	void init(int n_) {
		n = 1;
		while (n < n_)
			n *= 2;
		for (int i = 0; i < 2 * n - 1; i++)
			dat[i] = 0; // Set min value
	}

	void update(int k, long a) {
		k += n - 1;
		dat[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			dat[k] = Math.max(dat[k * 2 + 1], dat[k * 2 + 2]); // Max
		}
	}

	long query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)
			return 0;
		if (a <= l && r <= b)
			return dat[k];
		long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return Math.max(vl, vr); // Max
	}
	
	long Q(int a, int b) {
		return query(a,b,0,0,n);
	}
}


Measured memory_bytes: 114572
import sys
import  math
from heapq import *
import fractions
import bisect
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
A=nl()
A.sort(reverse=True)

ans=0
c=(N-2)//2
m=(N-2)%2
ans+=A[0]
for i in range(1,c+1):
    ans+=(A[i]*2)
if(m==1):
    ans+=A[c+1]

print(ans)


Measured memory_bytes: 34148
N, Y = map(int, input().split())
ans = [-1]
flg = False

a = Y//10000
for i in range(a + 1):
    if flg: break
    reg = Y - 10000 * i
    b = reg // 5000
    for j in range(b + 1):
        if flg: break
        reg2 = reg - 5000 * j
        c = reg2 // 1000
        if reg2 % 1000 == 0 and i + j + c == N:
            ans = [i, j, c]
            flg = True
            break
if -1 not in ans:
    print(*ans)
else:
    print(-1, -1, -1)

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;  
    vector<int> e[n];
    for (int i = 0; i < n-1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        e[a].emplace_back(b);
        e[b].emplace_back(a);
    }
    auto dfs = [&e](auto f, int curr, int prev) -> int {
        int ret = 0;
        for (auto &to: e[curr]) {
            if (prev == to) continue;
            ret ^= f(f, to, curr);
        }
        return ret + 1;
    };
    int ok = dfs(dfs, 0, -1) - 1;
    if (ok) cout << "Alice\n";
    else cout << "Bob\n";
    return 0;
}

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

int main(){
  int n,anst[4],ans;
  cin>>n;
  rep(i,0,4){anst[i]=0;}
  
  rep(i,0,n){
    string tmp;
    cin>>tmp;
    if(tmp=="P"){anst[0]=1;}
    if(tmp=="W"){anst[1]=1;}
    if(tmp=="G"){anst[2]=1;}
    if(tmp=="Y"){anst[3]=1;}
  }
  
  rep(i,0,4){ans+=anst[i];}
  
  if(ans==4){cout<<"Four"<<endl;}
  else{cout<<"Three"<<endl;}

  return 0;
}


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

int main() {
    int N;
    cin >> N;
    int S = N;
    string s = "No";

    for (int i = 1; i <= 9; i++) {
        if (S % i != 0) {
            continue;
        }

        S = S / i;
        if (S < 10) {
            s = "Yes";
            break;
        }
        S = N;
    }

    cout << s << endl;


}

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

string S;

int main(){
    cin >> S;
    int ret;
    if(S == "SUN"){
        cout << 7 << endl;
    }else if(S == "MON"){
        cout << 6 << endl;
    }else if(S == "TUE"){
        cout << 5 << endl;
    }else if(S == "WED"){
        cout << 4 << endl;
    }else if(S == "THU"){
        cout << 3 << endl;
    }else if(S == "FRI"){
        cout << 2 << endl;
    }else{
        cout << 1 << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    string S;
    string V="AB";
    cin>>S;
    if(S.length()==3){
        if((S[0]==V[0]||S[1]==V[0]||S[2]==V[0])&&(S[0]==V[1]||S[1]==V[1]||S[2]==V[1])){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
   return 0;
}

Measured memory_bytes: 3604
#encdong utf-8

l = int(input())

#最大の２のn乗
for i in range(21):
    if 2**i >l:
        n = i
        break

m = (n-1)*2

s = l-2**(n-1)
value = 2**(n-1)

path_add = [0 for i in range(n-1)]
path_add_value = [0 for i in range(n-1)]

for i in range(n-1):
    if s >= 2**(n-2-i):
        s -= 2**(n-2-i)
        path_add[-(i+1)] = 1
        path_add_value[-(i+1)]=value
        value += 2**(n-2-i)

print(n,m+sum(path_add))
for i in range(n-1):
    print(i+1,i+2,0)
    print(i+1,i+2,2**i)

for i in range(n-1):
    if path_add[i] == 1:
        print(i+1, n, path_add_value[i])

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

using namespace std;

int main()
{
    int n, q, b, e, k;
    cin >> n;
    vector<int> query(n);
    for (int i = 0; i < n; i++)
    {
        cin >> query[i];
    }
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        cin >> b >> e >> k;
        auto itb = query.begin() + b;
        auto ite = query.begin() + e;
        cout << count(itb, ite, k) << endl;
    }
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using p = pair<int,int>;

int main(){
  ll a;
  cin >> a;
  ll b = 100;
  bool jdg=1;
  ll ans=0;
  while(jdg){
    ans ++;
    b += b*0.01;
    if(b >= a) jdg = 0;
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main (void)
{
    int k ,s;
    int ans = 0;


    scanf("%d %d" ,&k ,&s);

    for(int i = 0; i <= k; i++) {
        for(int j = 0; j <= k; j++) {
            if (0 <= s-i-j && s-i-j <= k) {
                ans++;
            }
        }
    }

    printf("%d\n" ,ans);

    return 0;
}

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

int main()
{
    int h,a;
    cin >> h >> a;

    int q = h / a; // h÷a の商
    int r = h % a; // h÷a の余り

    if(r == 0)
    {
        cout << q << endl;
    }
    else
    {
        cout << q + 1 << endl;
    }
}

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

void swap(int *x,int *y){
	int tmp;
	if(*x > *y){
		tmp = *x;
		*x = *y;
		*y = tmp;
	}
}

int main(){
	int a,b;
	while(1){
		cin >> a >> b;
		if(a==0 and b==0){
			return 0;
		}
		swap(&a,&b);
		cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 2992
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    string s,t;
    cin >> s >> t;
    vector<char> str;
    rep(i,s.size() + t.size() - 1){
        str.push_back(s[i%s.size()]);
    }
    bool ans = false;
    rep(i,s.size()){
        bool res = true;
        rep(j,t.size()){
            if(t[j] != str[i+j]) res = false;
        }
        if(res) ans = true;
    }
    cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3240
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	
	vector<int> v(3,0);
	for (int i = 0; i < 3; i++) {
		cin >> v[i];
	}

	sort(v.begin(), v.end());

	int ans = 0;
	for (int i = 0; i < 2; i++) {
		ans += abs(v[i]  - v[i+1]);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  double sum = 0.0;
  rep(i,n){
    sum += 1.0/a[i];
  }
  double ans = 1.0/sum;
  
  printf("%10f\n",ans);
  return 0;
}


Measured memory_bytes: 256
import numpy as np


N, M = list(map(int, input().split()))
students = [list(map(int, input().split())) for i in range(N)]
checkpoints = [list(map(int, input().split())) for i in range(M)]

for s in students:
    measure = []
    for c in checkpoints:
        tmp = abs(c[0]-s[0]) + abs(c[1]-s[1])
        measure.append(tmp)
    print(np.argmin(measure) + 1)


Measured memory_bytes: 12448
#include <stdio.h>
    long long gcd(long long a,long long b){
        return b ? gcd(b,a % b) : a;
    }
    int check(long long a,long long b,long long c,long long d){
        if(a < b || d < b)return 0;
        if(c + 1 >= b)return 1;
        long long g = gcd(b,d);
        return (a - c - 1) / g - (a - b) / g <= 0;
    }
    int main() {
        int t;
        long long a,b,c,d;
        scanf("%d",&t);
        while(t --){
            scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
            if(check(a,b,c,d)){
                printf("Yes\n");
            }
            else{
                printf("No\n");
            }
        }
    }

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

long long ans = 0, x, num = 0;

int main(){
	cin >> x;

	ans = x / 11 * 2;

	num = x % 11;

	if (num > 0){
		ans++;

		if (num > 6){
			ans++;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
input_num=input().split()# 2 4のような入力
input_num=[int(num) for num in input_num]#intへ変換

K=input_num[0]#連続する数
X=input_num[1]#確実に黒い

min_cons=-10**6
max_cons=10**6

max_num=X+K-1
min_num=X-(K-1)

if min_num<min_cons:
    min_num=min_cons

if max_num>max_cons:
    max_num=max_cons

num_list=[i for i in range(min_num,max_num+1)]
print(*num_list)


Measured memory_bytes: 3060
#include "iostream"
#include "algorithm"
#include "string"
using namespace std;

int main() {
	int n;
	cin >> n;
	long long h[100005];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	bool ans = 1;
	for (int i = 0; i < n - 1; i++) {
		if (h[i] - h[i + 1] >= 2)ans = 0;
		else if (h[i] - h[i + 1] == 1) {
			h[i + 1]++;
		}
	}
	if (ans)cout << "Yes";
	else cout << "No";
	cout<<endl;
}

Measured memory_bytes: 1024
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
from collections import deque
from math import ceil

h,w,k=map(int,input().split())
MAP=[]
for i in range(h):
    s=list(input().strip())
    for j,t in enumerate(s):
        if t=='S':
            sx,sy=i,j
    MAP.append(s)
delta=[[1,0],[0,1],[-1,0],[0,-1]]
q=deque()
q.append((sx,sy,k))
dist=float('inf')
Visited=[[False]*w for _ in range(h)]
Visited[sx][sy]=True
while len(q)>0:
    x,y,t=q.popleft()
    dist=min(dist,x,y,h-1-x,w-1-y)
    if dist==0:
        break
    if t>0:
        t-=1
        for dx,dy in delta:
            if MAP[x+dx][y+dy]=='.' and not Visited[x+dx][y+dy]:
                q.append((x+dx,y+dy,t))
                Visited[x+dx][y+dy]=True
print(1+ceil(dist/k))

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

using namespace std;

#define endl '\n'

int main(){

  ios_base :: sync_with_stdio(false);
  cin.tie(NULL);

 int x,n;
 cin >> x >> n;
 int vet[n];
 for(int i=0;i<n;i++)
  cin >> vet[i];

 int ans = x;
 int mn = INT_MAX;

 for(int i=-100;i<=1000;i++){
   if(abs(x-mn) > abs(x-i)){
     bool contain = false;
     for(int j=0;j<n;j++){
       if(vet[j] == i)
        contain = true;
     }
     if(!contain){
       ans = i;
       mn = i;
     }
   }  
 }

 cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
   int a,b;
   string s;cin>>a>>b>>s;
   int n = s.size();
   bool f = true;;
   rep(i,n){
       if(i==a){if(s[i]!='-')f = false;}
       else {
           if(s[i]<'0' || s[i]>'9')f = false;
       }
   }
   cout<<(f?"Yes":"No");
}



Measured memory_bytes: 256
package main

import(
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	x := []int{}
	var max = 0
	var sum = 0
	for i := 0; i < 3; i++ {
		x = append(x, nextInt())
		sum += x[i]
		if (x[i] > max) {
			max = x[i]
		}
	}
	fmt.Println(sum - max)
}

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

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

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            for (int i = 1; i <= b; i++) {
                if (a * i % b == c) {
                    out.println("YES");
                    return;
                }
            }
            out.println("NO");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

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

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tr(container, it) \
	for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c,x) ((c).find(x) != (c).end())   //O(log n) 
#define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);


int arr[4];
int main()
{
	string s;
	std::cin >> s;
	for(auto c : s)
	{
		if (c == 'N')arr[0]=1;
		if (c == 'S')arr[1]=1;
		if (c == 'W')arr[2]=1;
		if (c == 'E')arr[3]=1;
	}
	if(arr[0]^arr[1] || arr[2] ^arr[3])std::cout << "No";
	else { std::cout << "Yes"; }


}











Measured memory_bytes: 256