akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& stream, const mint& n){
  stream << n.x;
  return stream;
};

struct comb{
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll n;
  cin >> n;
  mint p = mint(9).pow(n); //ai = 0が存在しない
  mint q = p; //ai = 9が存在しない
  mint r = mint(8).pow(n); //ai = 0,9が存在しない
  mint ans = mint(10).pow(n) - (p+q-r);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std; 
typedef long long ll;
typedef unsigned long long ull;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/

int main() {
  int count=0;
  int d1,d2,n;
  int d1b=0,d2b=0;
  cin>>n;
  rep(i,n){
    cin>>d1>>d2;
    if(d1==d2){
      count++;
    }else{
      count=0;
    }
    if(count==3){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
  return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>
#include <limits.h>
#define Max INT_MAX
#define Min INT_MIN

int main(void)
{
  int n;
  int i,j;
  int R[200000];
  int max=Min;
  int min=Max;
  int maxi=0,mini=0;
  int dif;

  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%d",&R[i]);
    dif = R[i] - min;
    if(dif>max)max=dif;
    if(R[i]<min)
    {
      min = R[i];
    }
  //  printf("min:%d\n",min);

  }
/*
  for(i=n-1;i>0;i--)
  {
    for(j=i-1;j>=0;j--)
    {
      dif = R[i]-R[j];
      if(dif>max) max = dif;
    }
  }
*/
  printf("%d\n",max);

  return 0;
}

Measured memory_bytes: 1376
from itertools import *

H, W = map(int, (input().split()))

S = ["?" * (W + 2)]
for i in range(H):
    S += ["?" + input()+ "?"]
S += ["?" * (W + 2)]

ans = []
for h in range(1, H+1):
    line = ""
    for w in range(1, W+1):
        
        def near_mine(h, w):
            nears = []
            for i, j in product(*[(1, 0, -1)] * 2):
                nears += S[h+i][w+j]

            return nears.count("#")
        
        line += str(near_mine(h, w)) if S[h][w] == "." else S[h][w]

    ans += [line]

for i in ans:
    print(i)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    long   a, b;
    long   d;
    long   r;
    double f;

    do {
        cin >> a >> b;
    } while ((a < 1 || a > 1000000000) || (b < 1 || b > 1000000000));

    d = a / b;
    r = a % b;
    f = (double)a / b;
 
    cout << fixed << d << " " << r << " " << setprecision(8) << f << endl;
   
    return (0);
}

Measured memory_bytes: 1248
#include <stdio.h>

int main(void)
{
    int a,b,c,x;
    
    scanf("%d %d %d",&a,&b,&c);
    
    if(a>b)

    {
        x=a;
        a=b;
        b=x;
    }
    
    if(b>c)

    {
        x=b;
        b=c;
        c=x;
    }
    
    if(a>b)

    {
        x=a;
        a=b;
        b=x;
    }
    
    printf("%d %d %d\n",a,b,c);
    
    return 0;
}

Measured memory_bytes: 596
n = int(input())
w = list(map(int, input().split()))
ans = 100
for i in range(n-1):
    sum_low = 0
    sum_high = 0
    for j in range(i+1):
        sum_low += w[j]
    for k in range(i+1,n):
        sum_high += w[k]
    if abs(sum_high - sum_low) <= ans:
        ans = abs(sum_high - sum_low)
print(ans)

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

int main() {
    int n; 
    cin >> n;
    vi l(n);
    rep(i, n) cin >> l.at(i);
    int ans = 0;
    rep(i, n)rep(j, n)rep(k, n) {
        if(i < j && j < k) {
            if(l.at(i) == l.at(j)) continue;
            if(l.at(j) == l.at(k)) continue;
            if(l.at(k) == l.at(i)) continue;
            if((ll)l.at(i) + l.at(j) + l.at(k) <= max({l.at(i), l.at(j), l.at(k)}) * 2) continue;
            ans++;
        }

    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int b;
  cin >> a >> b;
  if ((a % 2) > 0 && (b % 2) > 0){
  cout << "Odd" << endl;
}
else{
  cout << "Even" << endl;
}
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

bool dislike[15];

int main()
{
    int number, numbercopy, n, aux, digit;
    bool liked;

    scanf("%d %d\n", &number, &n);

    for(int i=1; i<=n; i++)
    {
        scanf("%d", &aux);
        dislike[aux] = true;
    }

    while(1)
    {
        liked = true;
        numbercopy = number;

        do
        {
            digit = numbercopy%10;
            if(dislike[digit])
                liked = false;

            numbercopy = numbercopy/10;
        }while(numbercopy);

        if(liked == true)
        {
            printf("%d\n", number);
            break;
        }
        else
            number++;
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<long long, null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
//s.find_by_order(index) returns iterator to the index-th element
//in O(logn) time.



typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<string> vss;
typedef vector<pair<ll, ll> > vpll;
typedef unordered_map<ll ,ll> mpll;
typedef unordered_map<int ,int> mpii;
typedef unordered_map<char ,ll> mpcl;
typedef pair<ll , ll> pll;
typedef complex<double> cd;
typedef vector< complex<double> > vcd;


#define fore(i,n) for(i=0;i<n;i++)
#define forz(i,s,f) for(i=s;i<f;i++)
#define forer(i,n) for(i=n-1;i>=0;i--)
#define forzr(i,s,f) for(i=s;i>=f;i--)
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define pvec(i,vec) fore(i,vec.size())cout<<vec[i]<<" ";cout<<"\n";

const ll mod=1e9+7;
const ll modulo=998244353;
const double pi = 3.14159265358979323846;


ll power(ll x,ll y,ll m)//gives (x^y)%m
{
    ll ans=1;
    while (y>0)
    {
        if(y & 1)
        {
            ans=(ans*x)%m;
        }
        y=y/2;
        x=(x*x)%m;
    }
    return ans;
}

bool sortbysec(pll &a,pll &b)
{
    return(a.ss<b.ss);
}

ll gcd(ll a,ll b)
{
	if(a==0)
		return b;
	else
		return(gcd(b%a,a));
}

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

long double logn(long double a,long double n)
{
	return(log(n)/log(a));
}

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
    
	ll te=1,test,i,j,n,m,flag,k,p,temp;
	//cin>>te;
	for(test=1;test<=te;test++)
	{
		cin>>n;

		n=n%1000;
		if(n==0)
			cout<<"0\n";
		else
			cout<<(1000-n)<<"\n";
		/*vll a(n);
		fore(i,n)
		{
			cin>>a[i];
		}*/
		
		//cout<<"hello\n";
		//cout<<"Case #"<<test<<": ";
	}

	return 0;
}

Measured memory_bytes: 3692
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
char a[100006];
int main(){
	scanf("%s",a);
	int p = strlen(a),f=1;
	for(int i = p-1; i>=0 ;){
		if(a[i]=='r'){
			if(a[i-1]=='e'&&a[i-2]=='s'&&a[i-3]=='a'&&a[i-4]=='r'&&a[i-5]=='e'){
				i=i-6;
			}
			else if(a[i-1]=='e'&&a[i-2]=='m'&&a[i-3]=='a'&&a[i-4]=='e'&&a[i-5]=='r'&&a[i-6]=='d'){
				i=i-7;
			}
			else{
				printf("NO\n");
				f=0;
				break;
			}
		}
		else if(a[i]=='e'){
			if(a[i-1]=='s'&&a[i-2]=='a'&&a[i-3]=='r'&&a[i-4]=='e'){
				i=i-5;
			}
			else{
				printf("NO\n");
				f=0;
				break;
			}
		}
		else if(a[i]=='m'){
			if(a[i-1]=='a'&&a[i-2]=='e'&&a[i-3]=='r'&&a[i-4]=='d'){
				i=i-5;
			}
			else{
				printf("NO\n");
				f=0;
				break;
			}
		}
		else{
			printf("NO\n");
			f=0;
			break;
		}
	}
	if(f==1)
	printf("YES\n");
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 200010, mod = 998244353;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n, 0);
    vector<int> b(m, 0);
    for (int d = 0; d < n; d++) {
        cin >> a[d];
    }
    for (int d = 0; d < m; d++) {
        cin >> b[d];
    }
    int ans = 0;
    int r = 0;
    int tek = 0;
    for (int d = 0; d < m; d++) {
        tek += b[d];
        if (tek > k) {
            tek -= b[d];
            break;
        }
        r++;
    }
    ans = r;
    for (int d = 0; d < n; d++) {
        tek += a[d];
        while (r > 0 && tek > k) {
            tek -= b[r - 1];
            r--;
        }
        if (tek > k) {
            break;
        }
        ans = max(ans, d + 1 + r);
        //cout << d << " " << d + 1 + r << "\n";
    }
    cout << ans;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using i64 = long long;

std::string s;
i64 dp[101][10][2];

i64 rec(int d, int r, int f) {
    if (d < 0) return r == 0;
    if (r == 0) return 1;
    if (dp[d][r][f] >= 0) return dp[d][r][f];

    i64 ret = rec(d - 1, r, f || s[d] != '0');
    for (int i = 1; i < 10; i++) {
        if (f) ret += rec(d - 1, r - 1, f);
        else if (i < s[d] - '0') ret += rec(d - 1, r - 1, 1);
        else if (i == s[d] - '0') ret += rec(d - 1, r - 1, f);
    }

    return dp[d][r][f] = ret;
}

int main() {
    int k;
    std::cin >> s >> k;

    std::reverse(s.begin(), s.end());

    for (int i = 0; i <= 100; i++) for (int j = 0; j < 10; j++) dp[i][j][0] = dp[i][j][1] = -1;

    i64 ret = rec(s.size() - 1, k, 0);
    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x, y;
    cin, x, y;
    REP(i, 0, x + 1) {
        int xx = x - i;
        if (i * 2 + xx * 4 == y) {
            print("Yes");
            return 0;
        }
    }
    print("No");
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout<<#x<<"="<<(x)<<endl;
typedef long long LL;
typedef pair<int, int> P;
const LL inf = 1LL << 61;
const LL mod = 1000000007;
const int max_n = 20010;


int ao[max_n], bo[max_n], p[max_n];
int main()
{
    int i = 0, j = 0, k = 0;
    int n;
    scanf("%d", &n);
    for(i = 1; i <= n; i++)
    {
        ao[i] = 30000*i;
        bo[i] = 30000*(n-i);
    }
    for(i = 1; i <= n; i++)
    {
        scanf("%d", &p[i]);
        bo[p[i]] += i;
    }


    for(i = 1; i <= n; i++)
        printf("%d%c", ao[i], i==n?'\n':' ');
    for(i = 1; i <= n; i++)
        printf("%d%c", bo[i], i==n?'\n':' ');


    return 0;
}











Measured memory_bytes: 896
n, c, k = STDIN.gets.split(' ').map(&:to_i)
arrival_times = []
n.times do
  arrival_times << STDIN.gets.to_i
end

arrival_times = arrival_times.sort.reverse
#p arrival_times

number_of_buses = 0

while !arrival_times.empty?
  arrive_at = arrival_times.shift
  current_capacity = c - 1

  index = -1
  arrival_times.each_with_index do |t, i|

    if (arrive_at - k) <= t && current_capacity > 0
      #p "arrivate_at: #{arrive_at} t: #{t} capa: #{current_capacity} i: #{i} index: #{index}"
      current_capacity -= 1
      index = i
    else
      break
    end
  end

  if index != -1
    #p "index+1: #{index+1} #{arrival_times}"
    arrival_times = arrival_times[index + 1..-1]
  end

  #p arrival_times
  # puts "index: #{index}"
  number_of_buses += 1
end

puts number_of_buses


Measured memory_bytes: 4472
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 5100000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


//UF木
struct UnionFind {
private:
	vector<int> par, ran, sz;
public:
	UnionFind(int n) {
		par.resize(n, 0);
		ran.resize(n, 0);
		sz.resize(n, 1);
		rep(i, n) {
			par[i] = i;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y)return;
		if (ran[x] < ran[y]) {
			par[x] = y; sz[y] += sz[x];
		}
		else {
			par[y] = x; sz[x] += sz[y];
			if (ran[x] == ran[y])ran[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int num(int x) { return sz[find(x)]; }
};

int n, m, k;


int main() {

	cin >> n >> m >> k;

	vector<set<int>> dame(n);
	UnionFind uf(n);

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		dame[a].insert(b);
		dame[b].insert(a);
		uf.unite(a, b);
	}

	rep(i, k) {
		int c, d;
		cin >> c >> d;
		c--; d--;
		if (!uf.same(c, d))continue;
		dame[c].insert(d);
		dame[d].insert(c);
	}

	rep(i, n) {
		int mem = uf.num(i) - 1;

		mem -= dame[i].size();
		cout << mem << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 25472
#include<bits/stdc++.h>
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

vector<int> par; // 親ノード
vector<int> depth; // ランク

void init(int n = 1) {
    par.resize(n); depth.resize(n);
    for (int i = 0; i < n; ++i) par[i] = i, depth[i] = 0;
}

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

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

bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (depth[x] < depth[y]) swap(x, y);
    if (depth[x] == depth[y]) ++depth[x];
    par[y] = x;
    return true;
}
int main(){


    int N, M, K;
    cin >> N >> M >> K;
    init(N);
    set<int> S[N];
    set<int> T[N];
    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        S[a].insert(b);
        S[b].insert(a);
        merge(a,b);
    }

    rep(i, K){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (issame(a, b)) {
            T[a].insert(b);
            T[b].insert(a);
        }
    }

    int d[N];
    rep(i, N){
        d[i] = 0;
    }
    rep(i, N){
        d[root(i)]++;
    }

    rep(i, N){
        int ans = d[root(i)]-1;
        ans -= S[i].size();
        ans -= T[i].size();
        cout << ans << endl;

    }


}

Measured memory_bytes: 30080
n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

import itertools
X= []
a = 0
b = 0
for p in itertools.permutations(range(1, n+1)):
    for i in range(n):
        if p[i] < P[i]:
            a += 1
            break
        elif p[i] > P[i]:
            break
        else:
            continue
    for i in range(n):
        if p[i] < Q[i]:
            b += 1
            break
        elif p[i] > Q[i]:
            break
        else:
            continue

print(abs((a+1)-(b+1)))


Measured memory_bytes: 43504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define fi first
#define se second
const int N = 3e5+6;
const int mod = 1e9+7;
const int inf = 1e8;
void solve(){
    int k;
    int a,b;
    cin>>k>>a>>b;
    int xa = (a-1)/k;
    int xb = (b)/k;
    if(xa==xb)cout<<"NG"<<endl;
    else cout<<"OK"<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 3664
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+17;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    vector<vector<ll>> dp(N+1,vector<ll>(2,0));
    dp[0][0]=0;
    dp[0][1]=0;
    dp[1][0]=0;
    dp[1][1]=A[0];
    
    REP2(i,1,N){
        if(i%2==1){
            dp[i+1][0]=max(dp[i][1],dp[i-1][0]+A[i]);
        }else{
            dp[i+1][0]=max(dp[i][0],dp[i-1][0]+A[i]);
            dp[i+1][1]=dp[i-1][1]+A[i];
        }
    }
    cout<<dp[N][0]<<endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    ll i,j,k,l,r,x,y;
    bool exit = false;
    ll N;
    cin>>N;
    if(N==0){cout<<"0"<<endl;return;}

    ll sho,s;
    int amari;
    vector <int> S;
    s=N;
    while(true){
        if(abs(s)%2==0){
            amari=0;
        }else{
            amari=1;
        }
        sho= abs(s-amari) / 2;
        if(s-amari > 0){
            sho *= -1;
        }
        S.push_back(amari);
        if(sho==0) break;
        s = sho;
//        cout<<"sho"<<sho<<"amari"<<amari<<endl;
    }
    reverse(ALL(S));
    FORR(s,S) cout<<s;
    cout<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
def main():
  a,b,c,k = list(map(int,input().split()))
  
  if k<=a:
    print(k)
  elif k<=a+b:
    print(a)
  elif k < a+b+c:
    print(a-(k-(a+b)))
  else:
    print(a-c)
  
main()

Measured memory_bytes: 9136
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <algorithm>
#include <numeric>  
#include <map>
#include <set>
#include <vector>
#include <queue>
#define  N  1000011 
using namespace std;

int main()
{
	int n , k; 
	while (~scanf ("%d%d",&n,&k))
	{
		int i;
		int a[111];
		for (i=0; i<n; i++)  scanf ("%d",&a[i]);
		sort(a,a+n);
		
		cout << accumulate(a+n-k,a+n,0) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
from heapq import heappop, heappush


class Graph(object):

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, From, To, cost=1):
        self.graph[From].append((To,cost))

    def get_nodes(self):
        return self.graph.keys()
class Dijkstra(object):

    def __init__(self, graph, start):
        self.g = graph.graph
        self.dist = defaultdict(lambda:float('inf'))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)
        self.Q = []
        heappush(self.Q,(self.dist[start], start))

        while  self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, cost in self.g[u]:
                alt = dist_u + cost
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q,(alt, v))

    def shortest_distance(self, goal):
        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]

        return path[::-1]


N = int(input())
g = Graph()
d = {}
for i in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    d[(min(a,b),max(a,b))] = i
    g.add_edge(a,b)
    g.add_edge(b,a)

M = int(input())
l = [0]*M
for i in range(M):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    dij = Dijkstra(g,u)
    path = dij.shortest_path(v)
    for j in range(len(path)-1):
        a,b = path[j],path[j+1]
        l[i] += 2**d[(min(a,b),max(a,b))]

c = [0]*(M+1)
p2 = [2**i for i in range(50)]
for n in range(2**M):
    cnt = 0
    x = 0
    for i in range(M):
        if n&p2[i]==p2[i]:
            cnt += 1
            x |= l[i]
    y = 0
    for i in range(N-1):
        if x&p2[i]==p2[i]:
            y += 1
    c[cnt] += p2[N-1-y]

ans = 0
for i in range(M+1):
    if i%2==0:
        ans += c[i]
    else:
        ans -= c[i]

print(ans)

Measured memory_bytes: 45192
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int k = int.Parse(Console.ReadLine());
        var L = new List<long>();
        //L = Enumerable.Range(1, 9).ToList();
        for(int i=1; i < 10; i++)
        {
            L.Add(i);
        }
        int index = 0;
        while (L.Count < k)
        {
            L = Add(L[index], L);
            index++;
        }
        Console.WriteLine(L[k - 1]);
    }
    static List<long> Add(long x, List<long> L)
    {
        long y = x % 10;
        if(y!=0) L.Add(x * 10 + (y - 1));
        L.Add(x * 10 + y);
        if (y != 9) L.Add(x * 10 + (y + 1));
        return L;
    }
}


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

public class Main{
	final static int MOD = 1000000007;
	final static int INF = 1000000000;

	public static void main(String[] args) throws IOException{
		//final double PI = 3.14159265;
		NScanner sc = new NScanner(System.in);
		double r = sc.nextDouble();
		System.out.printf("%.6f %.6f\n", r*r*Math.PI, 2*r*Math.PI);
		
	}
	

}

class NScanner {

	private BufferedReader br;
	private StringTokenizer tok;

	public NScanner(InputStream is) throws IOException{
		br = new BufferedReader(new InputStreamReader(is));
		getLine();
	}

	private void getLine() throws IOException{
		while(tok == null || !hasNext()){
			tok = new StringTokenizer(br.readLine());
		}
	}

	private boolean hasNext(){
		return tok.hasMoreTokens();
	}

	public String next() throws IOException{
		if(hasNext()){
			return tok.nextToken();
		}else{
			getLine();
			return tok.nextToken();
		}
	}

	public int nextInt() throws IOException{
		if(hasNext()){
			return Integer.parseInt(tok.nextToken());
		}else{
			getLine();
			return Integer.parseInt(tok.nextToken());
		}
	}

	public long nextLong() throws IOException{
		if(hasNext()){
			return Long.parseLong(tok.nextToken());
		}else{
			getLine();
			return Long.parseLong(tok.nextToken());
		}
	}

	public double nextDouble() throws IOException{
		if(hasNext()){
			return Double.parseDouble(tok.nextToken());
		}else{
			getLine();
			return Double.parseDouble(tok.nextToken());
		}
	}
}


Measured memory_bytes: 24672
#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>;
const int MAX = 100005;
vector<int> to[MAX], F, S;
int n;
void dfs(int cur, int prev, int dep, int mode) {
    if(mode) F[cur] = dep;
    else S[cur] = dep;
    for(int v : to[cur]) {
        if(v == prev) continue;
        if(mode==1&&v==n) continue;
        if(mode==0&&v==1) continue;
        dfs(v, cur, dep+1, mode);
    }
}
int main() {
    cin >> n;
    F.resize(n+1); S.resize(n+1);
    rep(i, n) F[i+1] = S[i+1] = 1001001001;
    rep(i, n-1) {
        int a, b; cin >> a >> b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    dfs(1, -1, 0, 1);
    dfs(n, -1, 0, 0);
    /*rep(i, n) {
        cout << F[i+1] << endl;
    }*/
    int max_F=0, max_S=0;
    for(int i=2;i<=n-1;i++) {
        if(F[i] <= S[i]) max_F++;
        else max_S++;
    }
    if(max_F <= max_S) cout << "Snuke";
    else cout << "Fennec";
    puts("");
    /*rep(i, n) {
        printf("i:%d %d %d\n", i+1, F[i+1], S[i+1]);
    }*/
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
const int N = 200;

int main ()
{
	long long n, t[N], m, p[N], x[N];
	cin >> n;
	long long sum = 0;
	for (int i = 0 ; i < n; i++) {
		cin >> t[i];
		sum += t[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> p[i] >> x[i];
		cout << sum - t[p[i]-1] + x[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine().Split(' ');
        var a = int.Parse(s[0]);
        var b = int.Parse(s[1]);
        var c = int.Parse(s[2]);

        if (a == b) Console.WriteLine(c);
        else if (b == c) Console.WriteLine(a);
        else if (c == a) Console.WriteLine(b);
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  ll n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  vl d(n + 1);
  // vl a(n + 1, INF);
  rep(i, n + 1) d[i] = s[i] - '0';
  ll cur = n;
  vector<ll> ans;
  while (cur > 0) {
    ll ok = false;
    for (ll x = min(m, cur); x > 0; x--) {
      if (d[cur - x] == 0) {
        // cerr << x << endl;
        cur = cur - x;
        ans.push_back(x);
        ok = true;
        break;
      }
    }
    if (!ok) {
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(ALL(ans));
  for (auto& x : ans) {
    cout << x << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2360
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")

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

#define int long long

using namespace std;
using namespace __gnu_pbds;

template <class T> using ordered_set =
tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;

const int N = (int)(1e6 + 5);
const int M = (int)(1e9 + 7);
const int INF = (int)(1e18 + 9);
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

signed main() {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  map <char, int> mp;
  for (int i = 0; i < 4; ++i)
    mp[s[i]]++;
  if (mp.size() == 2)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int bubblesort(int a[],int n)
{
  int sw = 0;
  bool flag = 1;
  for(int i = 0;flag;i++)
  {
    flag = 0;
    for(int j = n-1;j>=i+1;j--)
    {
      if(a[j]<a[j-1])
       {
         swap(a[j],a[j-1]);
         flag = 1;
         sw++;
       }
    }
  }
  return sw;
}
int main ()
{
     int a[100],n,sw;
     scanf("%d",&n);
     for(int i =0;i<n;i++)
        scanf("%d",&a[i]);
    sw = bubblesort(a,n);
    for(int i = 0;i<n;i++)
    {
      if(i)cout<<" ";
      cout<<a[i];
    }
    cout<<endl;
    cout<<sw<<endl;
    return 0;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >>a >>b;
  
  if (a < b)
    cout << "a < b" << endl;
    
  else if (a > b)
    cout << "a > b" << endl;
    
  else
    cout << "a == b" << endl;
}


Measured memory_bytes: 3112
#include <iostream>
#include <cmath>

using namespace std;

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

    if (a + b < c - 2 * sqrtl(a * b))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n, x;
	cin >> n >> x;
	int a[n]; zip(i, 0, n) cin >> a[i];
	set<int>s;
	zip(i, 0, n) s.insert(a[i]);
	s.insert(x);
	//
	vi v;
	for (int i : s)
	{
		v.pb(i);
		//cout << i << " ";
	}
	//cout << en;
	int x1 = v[1] - v[0];
	zip(i, 2, v.size())
	{
		x1 = __gcd(x1, v[i] - v[i - 1]);
	}
	cout << x1 << en;

	return 0;
}



Measured memory_bytes: 6908
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;

int main() {
  int N, s;
  string n;
  cin >> N;
  vector<tuple<string, int, int>> rest(N);

  for (int i = 0; i < N; i++) {
    cin >> n >> s;
    rest[i] = make_tuple(n, s, i + 1);
  }
  sort(rest.begin(), rest.end(), [](auto r1, auto r2) {
    return get<0>(r1) == get<0>(r2) ? get<1>(r1) > get<1>(r2)
                                    : get<0>(r1) < get<0>(r2);
  });

  for (auto &[name, score, ind] : rest) {
    cout << ind << endl;
  }
}


Measured memory_bytes: 3244
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n, m, x, y; cin >> n >> m;
    int a[100010]; rep(i,0,n) a[i] = 1;
    bool p[100010] = {};
    p[0] = true;
    rep(i,0,m) {
        cin >> x >> y; x--; y--;
        a[y]++; if(p[x]) p[y] = true;
        a[x]--; if(a[x] == 0) p[x] = false;
    }
    int ans = 0;
    rep(i,0,n) if(p[i]) ans++;
    cout << ans << endl;
    return 0;
}

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

signed main() {
	string s; cin >> s;
	int cnt = 0;
	rep(i, s.size()) {
		if (s[i] == '+')cnt++;
		else cnt--;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
ans = []
i = 0
l = 0
while i < N - 1:
    if H[i] >= H[i + 1]:
        l += 1
    else:
        ans.append(l)
        l = 0
    i += 1
ans.append(l)
print(max(ans))

Measured memory_bytes: 14252
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int quantity = scanner.nextInt();
        scanner.nextLine();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);
        int count = 0;
        for(int i=0; i<array.length; i++) {
            if(i == array.length-1) {
                if(quantity - array[i] == 0) {
                    count += 1;
                }
            } else {
                if(quantity - array[i] >= 0) {
                    count += 1;
                    quantity -= array[i];
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21716
bt = {"A":0, "B":0, "AB":0, "O":0}
while True:
    try:
        i, _bt = raw_input().split(",")
    except EOFError as e:
        break
    bt[_bt] += 1
print("%d\n%d\n%d\n%d" % (bt["A"], bt["B"], bt["AB"], bt["O"]))

Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n; cin >> n;
  int curr = 0;

  for(int i=0;i<n;i++){
    curr = (curr * 10 + 7)%n;
    if(curr==0){
      cout << i+1 << '\n';
      return 0;
    }
  }
  
  cout << -1 << '\n';

  return 0;
}

Measured memory_bytes: 3636
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), I[1:].reshape(-1, 3)), axis=0).T

def main():
    dt = t[1:] - t[:-1]
    dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
    ans = 'Yes' if np.all((dt >= dd) & (dt & 1 == dd & 1)) else 'No'
    print(ans) 

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 34208
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll n;
    cin>>n;
    vector <ll> p(n);
    for (ll i = 0; i<n; i++){
        cin>>p[i];
    }
    ll ans = 0;
    for (ll i = 0; i < n-2; i++){
        if(p[i] < p[i+1] && p[i+1]< p[i+2] )ans++;
        else if (p[i] > p[i+1] && p[i+1] > p[i+2])ans++;
    }
    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;
const int MOD = 998244353;

int main() {
	cin.tie(0)->sync_with_stdio(false);
	int n, k; cin >> n >> k;
	vector<int> l(k), r(k);
	REP(i, k) cin >> l[i] >> r[i];
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	dp[1] = -1;
	REP(i, n) {
		dp[i + 1] = (dp[i + 1] + dp[i]) % MOD;
		REP(j, k) {
			if (i + l[j] < n) {
				dp[i + l[j]] += dp[i];
				dp[i + l[j]] %= MOD;
			}
			if (i + r[j] + 1 < n) {
				dp[i + r[j] + 1] -= dp[i];
				dp[i + r[j] + 1]  = ((dp[i + r[j] + 1] % MOD) + MOD) % MOD;
			}
		}
	}
	cout << dp[n - 1] << '\n';
	return 0;
}


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

int main()
{
   int n, k;
   cin >> n >> k;
   ll ans = 0;

   // ①　bを固定してaを0からnまでずらすと
   // 0%b, 1%b, 2%b, .........n%b　となる
   // ↑をb = 5 で考える
   // 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, ......となる
   // bに戻すと
   // 0, 1, ..., b-1, 0, 1, ..., b-1, 0, 1, ..., b-1となる
   // ②  10 = 3 * 3 + 1 　　10を３で割ると　3余り1となる
   // a = qb + r　と置ける
   // ①と②よりaをずらしていった時の余りは
   // 0, 1, ..., b-1, 0, 1, ..., b-1, .......... ,0, 1, ....., r　となる
   // 0, 1 ..., b-1の数は　q個、残りはr個となる
   // kより大きい余りは 0, 1, .... b-1の中でいつくあるかを求め、さらに　q個かけると求められる
   // 0, 1, ...., k-1, .... b-1 すなわち　b > kの時は　b - k 個
   // 0, 1, ...., b-1, ...k-1 すなわち　b < kの時は　0個ある
   // 式としてはmax(b-k,0)となる
   // ③残りの部分(余りの部分)は余り rが　k-1より大きい時はその数分だけk以上の個数がある
   // すなわち  max(0, r − k + 1)　となる
   for(int b = k + 1; b <= n; b++){
      //各ブロックのk以上の数
      int base = b -k;
      int r = n%b;
      int ex = max(0,r-k +1);
      ans += base * (n/b) + ex;
      //printf("b:%d base:%d r:%d ex:%d \n",b, base, r, ex);
   }
   if(k ==0) ans -=n;
   cout << ans << endl;
   
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int calculation(int, int, int, int);
int a, b, c, x;

int main()
{
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;
	cout << calculation(a, b, c, x)  << endl;

	return 0;
}

int calculation(int a, int b, int c, int x)
{
	int sum = 0, count = 0;
	for(int i = 0; i <= a; i++)
	{
		
		for(int j = 0; j <= b; j++)
		{
			for(int l = 0; l <= c; l++)
			{
				sum += i * 500 ;
				sum += j * 100;
				sum += l * 50;
				
				if(x == sum)
				{
					count++;
					
				}
				sum = 0;
			}
		}
	}
	return count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  int a,b,c;
  int i,j,k;
  if(n==2){
    cin >> a >> b;
    for(i=1;i<=min(a,b);i++) if(a%i==0&&b%i==0) cout << i << endl;
  }else{
    cin >> a >> b >> c;
    for(i=1;i<=min(a,min(b,c));i++) if(a%i==0&&b%i==0&&c%i==0) cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
def com(n,m):
    if(n-m < m):
        m=n-m
    result=1
    mylist=[i for i in range(1,m+1)]
    j=1
    for i in range(1,m+1):
        result*=(n+1-i)
        if(j<m):
            while(result%mylist[j]==0):
                result//=mylist[j]
                j+=1
                if(j>=m):
                    break
    return result

def yakusuu(i,m):
    _i=i
    while(i**2<=m):
        if(m%i==0):
            return i
        else:
            i+=1
    for j in range(_i-1,0,-1):
        if(m%j==0):
            break
    return m//j
    

N,M=map(int,input().split())
soinsuubunkai={}
tmp=2
i=2
_M=M
while(tmp <=M):
    tmp=yakusuu(tmp,M)

    if(tmp in soinsuubunkai):
        soinsuubunkai[tmp]+=1
    else:
        soinsuubunkai[tmp]=1
    M//=tmp
    if(M==1):
        break


tmp=1
for k in list(soinsuubunkai.values()):
    tmp*=com(k+N-1,k)
    tmp%=10**9+7
print(tmp)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
const int INF = 1001001001;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/

bool isPrime(int x){
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}
ll f(string s){
    ll sum=0;
    int tmp =s[0]-'0';
    sum += tmp;
    int n = s.length();
    rep(i,n){
        if(s[i]=='+'){
            sum+=s[i+1]-'0';
        }else if(s[i]=='-'){
            sum-=s[i+1]-'0';
        }
    }
    return sum;
}

int main(){ 
    string s;
    cin >> s;
    int n = s.length()-1;
    rep(bit,1<<n){
        string tmp = "";
        tmp = s[0];
        rep(i,n){
            if(bit & (1 << i)){
                tmp += "+";
            }else{
                tmp +="-";
            }
            tmp += s[i+1];
        }
        ll hantei = f(tmp);
        if(hantei==7){
            cout << tmp+"=7"<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(x,y,z) for((x)=(y);(x)<=(z);(x)++)
int cnt[1001] = { 0 },n, m, N[1001], M[1001];
int input() {
	int i;
	cin >> n >> m;
	rep(i, 1, n) {
		cin >> N[i];
	}
	rep(i, 1, m) {
		cin >> M[i];
	}
	return 0;
}
int main() {
	int temp, i, j;
	input();
	rep(i, 1, m) {
		rep(j, 1, n) {
			if (M[i] >= N[j]) {
				cnt[j]++;
				break;
			}
		}
	}
	rep(i, 1, n) {
		if (cnt[m] < cnt[i])m = i;
	}
	cout << m << endl;
	return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<algorithm>
#include<array>
#include<vector>

using namespace std;

typedef array<int,3> Time;

void print_time(Time t){
  printf("%02d:%02d:%02d",t[0],t[1],t[2]);
}

int main(){
  for(int n;scanf("%d",&n),n;){
    vector<vector<Time> > v(n);
    const Time HT{999,0,0};
    for(auto &e:v){
      int s,t,u;
      scanf("%d%d%d",&s,&t,&u);
      for(int i=0;i<60;i++){
	Time ct{(s+i)%60,(t+i)%60,(u+i)%60};
	sort(begin(ct),end(ct));
	do{
	  Time cct=ct;
	  if(cct[0]%5==cct[1]/12){
	    cct[0]/=5;
	    e.push_back(cct);
	  }
	}while(next_permutation(begin(ct),end(ct)));
      }
      e.push_back(HT);
      sort(begin(e),end(e));
    }
    Time start,end,p=HT;
    for(int i=0;i<12;i++){
      for(int j=0;j<60;j++){
	for(int k=0;k<60;k++){
	  Time q{i,j,k};
	  Time cp{0,0,-1},ce;
	  for(auto &e:v){
	    //Time lb=*lower_bound(begin(e),end(e),q);
	    Time lb=*lower_bound(e.begin(),e.end(),q);
	    Time cd=lb;
	    for(int l=0;l<3;l++){
	      cd[l]-=q[l];
	    }
	    if(cd[2]<0){
	      cd[2]+=60;
	      cd[1]--;
	    }
	    if(cd[1]<0){
	      cd[1]+=60;
	      cd[0]--;
	    }
	    if(cp<cd){
	      cp=cd;
	      ce=lb;
	    }
	  }
	  if(cp<p){
	    start=q;
	    end=ce;
	    p=cp;
	  }
	}
      }
    }
    print_time(start);
    putchar(' ');
    print_time(end);
    putchar('\n');
  }
}

Measured memory_bytes: 1072