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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    int ans = 0, a = 0, b = 0, ba = 0;
    FOR(i,0,n-1){
        string s; cin >> s;
        bool f = 0;
        for (auto& c : s) {
            if (c == 'A') f = 1;
            else {
                if (f and c == 'B') ++ans;
                f = 0;
            }
        }

        if (s[0] == 'B' and s.back() == 'A') ++ba;
        else if (s[0] == 'B') ++b;
        else if (s.back() == 'A') ++a;
    }
    if (ba) {
        ans += ba-1;
        if (a) ++ans, --a;
        if (b) ++ans, --b;
    }
    cout << ans+min(a,b) << '\n';
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define pd(x) printf("%lf\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

int compare_long(const void *a, const void *b) {
	return *(long*)a - *(long*)b;
}

int main() {
	long N;
	long a;
	long b[100001] = {0};
	long cnt = 0;
	long i, j;
	long ans = 0;
	
	sl(N);
	for(i=1;i<=N;i++) {
		sl(a);
		b[a]++;
	}
	
	for(i=1;i<=100000;i++) {
		if(b[i] > 0) {
			cnt += b[i] - 1;
			ans++;
		}
	}
	
	pl(cnt % 2 ? ans - 1 : ans);
	
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
    int R[MAX],n;

    cin >> n;
    for (int i = 0; i < n;i++){
        cin >> R[i];
    }
    int maxv = -2000000000;
    int minv = R[0];

    for (int i=1;i<n;i++){
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);
    }
    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
int A[maxn];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>A[i];
    int flag=1;
    for(int i=0;i<n-1;i++)
    {
        if(!i||A[i]>A[i-1])
            A[i]-=1;
        if(A[i]>A[i+1])
        {
            flag=0;
            break;
        }
    }
    cout<<(flag?"Yes":"No")<<endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include <stdbool.h>
/*
boolは、ブーリアン型(Boolean datatype)で、真理値の２つの値
bool true falseのシンボルが定義
*/
#define N 8
int row[N];
bool col[N],dpos[2*N-1],dneg[2*N-1];
bool X[N][N];
void initialize(){
    for(int i = 0;i < N;i++){
        row[i] = -1;
        col[i] = -1;
    }
    for(int i = 0;i < 2*N-1;i++){
        dpos[i] = -1;
        col[i] = -1;
    }
}
void printBoard(){
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            if(X[i][j]){
                if(row[i] != j) return;
            }
        }
    }
        for (int i = 0; i < N;i++){
            for (int j = 0; j < N;j++){
                printf("%c",(row[i] == j) ? 'Q' : '.');
            }
		printf("\n");
	}
}
void recursive(int i){
    if (i == N){
        printBoard();
        return;
    }
    for (int j = 0; j < N;j++){
        if(!col[j] && !dpos[i + j] && !dneg[i - j + N - 1]){
            row[i] = j;
			col[j] = dpos[i + j] = dneg[i - j + N - 1] = true;
            recursive(i + 1);
			row[i] = -1;
			col[j] = dpos[i + j] = dneg[i - j + N - 1] = false;
        }
    }
}

int main(){
    int i,k,r,c;
    initialize;
    for(i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            X[i][j] = false;
        }
    }
    scanf("%d",&k);
    for (i = 0; i < k;i++){
        scanf("%d %d",&r,&c);
        X[r][c] = true; 
    }
    recursive(0);
    return 0;
}



Measured memory_bytes: 2148
#include<stdio.h>

int main () 
{
  int x,y,z,a;
  
  scanf("%d %d %d",&x,&y,&z);
  
  a=x;
  x=y;
  y=a;
  
  a=x;
  x=z;
  z=a;
  
  printf("%d %d %d",x,y,z);
  return 0;
}

Measured memory_bytes: 2068
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

    string s;
    cin >> s;

    int ans = 0;
    int cnt = 0;
    int n = s.size();
    REP(i, n) {
        if (s[i] == 'B') cnt++;
        else ans += cnt;
    }
    cout << ans << '\n';
}

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

int main(){
    tolong N = 0;
    tolong ans = 0;
    tolong tmp = 0;
    tolong i;
  
  	cin >> N;
    vector<tolong> A(N,0);
    
    for(i = 0;i < N;i++){
        cin >> A[i];
    }

    for(i = 1;i < N;i++){
        if(A[i - 1] > A[i]){
            tmp = A[i];
            A[i] = A[i - 1];
            ans = ans + A[i] - tmp;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4844
# 解答みた
N=int(input())
A=[int(x) for x in input().split()]
X={}
Y={}
for i in range(N):
  L=i+A[i]
  R=i-A[i]
  X[L]=X[L]+1 if L in X else 1
  Y[R]=Y[R]+1 if R in Y else 1
ans=0
for n in X:
  if n in Y:
    ans+=X[n]*Y[n]
print(ans)


Measured memory_bytes: 56544
n = int(input())

M, A, R, C, H = 0, 0, 0, 0, 0
for i in range(n):
  s = input()
  if s[0] == 'M':
    M += 1
  elif s[0] == 'A':
    A += 1
  elif s[0] == 'R':
    R += 1
  elif s[0] == 'C':
    C += 1
  elif s[0] == 'H':
    H += 1

print(M*A*R + M*A*C + M*A*H + M*R*C + M*R*H + M*C*H + A*R*C + A*R*H + A*C*H + R*C*H)


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

using namespace std;

const int mod = (int)1e9 + 7;

int n,m,dp[1005][1005];

char a[1005][1005];                 

int main(){
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
    	for(int j = 1; j <= m; j++){
    		cin >> a[i][j];
    	}
    }
    dp[1][1] = 1;
    for(int i = 1; i <= n; i++){
    	for(int j = 1; j <= m; j++){
    		if(i + 1 <= n && a[i + 1][j] == '.'){
    			dp[i + 1][j] += dp[i][j];
    			if(dp[i + 1][j] >= mod) dp[i + 1][j] -= mod;
    		}
    		if(j + 1 <= m && a[i][j + 1] == '.'){
    			dp[i][j + 1] += dp[i][j];
    			if(dp[i][j + 1] >= mod) dp[i][j + 1] -= mod;
    		}
    	}
    }
    cout << dp[n][m];
	return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ll h, w; scanf("%lld%lld", &h, &w);
	if(h > w) swap(h, w);
	ll ans;
	if(h == 1) ans = 1;
	else ans = (h * w + 1) / 2;
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n=s.size();
  vector<bool> e(26);
  for(int i=0;i<n;i++){
    e[s[i]-'a']=true;
  }
  if(n!=26){
    for(int i=0;i<26;i++){
      if(!e[i]){
        s+='a'+i;
        break;
      }
    }
    cout << s << endl;
  }
  else{
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 << endl;
      return 0;
    }
    int c;
    for(int i=n-1;i>=1;i--){
      e[s[i]-'a']=false;
      if(s[i-1]<s[i]){
        c=s[i-1]-'a';
        s=s.substr(0,i-1);
        break;
      }
    }
    for(int i=c+1;i<26;i++){
      if(!e[i]){
        s+='a'+i;
        break;
      }
    }
    cout << s << endl;
  }
}

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

using namespace std;

typedef long long ll;

ll mod = 1e9 + 7;

int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h, w;
  cin >> h >> w;
  char a[h + 1][w + 1];
  ll dp[h + 1][w + 1];
  for (ll i = 1; i <= h; i++)
  {
    for (ll j = 1; j <= w; j++)
    {
      cin >> a[i][j];
      dp[i][j] = 0;
    }
  }
  for (ll i = 0; i <= w; i++)
  {
    dp[0][i] = 0;
  }
  for (ll i = 0; i <= h; i++)
  {
    dp[i][0] = 0;
  }
  dp[1][1] = 1;
  for (ll i = 1; i <= h; i++)
  {
    for (ll j = 1; j <= w; j++)
    {
      if (i == 1 && j == 1) continue;
      if (a[i][j] == '#') dp[i][j] = 0;
      else dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
    }
  }
  cout << dp[h][w];
}


Measured memory_bytes: 12372
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int N;
    cin >> N;
    vector<int> a(N), tmp(N, 0);

    rep(i, N) cin >> a[i];
    int ans = 0, st = 0;
    while (1) {
        if (a[st] == 2) {
            ans++;
            break;
        }
        else if (tmp[a[st] - 1] == 1) {
            ans = -1;
            break;
        }
        st = a[st] - 1;
        tmp[st] = 1;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s,t;
  cin >> s >> t;
  int size = s.size();
  int ans = 0;
  rep(i,size) {
    if(s == t) ans++;
    s = s.substr(1,size-1) + s[0];
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

signed main() {
  string S;
  cin >> S;
  cout << S.substr(0, 3) << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    int x, a, b;
    cin >> x  >> a >> b;
    a = abs(x-a);
    b = abs(x-b);

    if (a > b) cout << "B" << endl; 
    else cout << "A" << endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll x;cin>>x;
    ll now=100;
    rep(i,1,100000){
        ll u=now/100;
        now+=u;
        if(now>=x){
            cout<<i<<endl;
            return 0;
        }
    }
}


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

int main(){
  int n;
  cin >> n;
  vector<int> bn(n);
  for(int i=0; i<n; ++i) cin >> bn[i];
  vector<int> ans;
  for(int i=0; i<n; ++i){
    int j = bn.size()-1;
    for( ; j>=0; --j){
      if(bn[j] > j+1){
        cout << -1 << endl;
        return 0;
      }
      if(bn[j] == j+1){
        ans.push_back(j+1);
        break;
      }
    }
    for( ; j<(int)bn.size()-1; ++j){
      bn[j] = bn[j+1];
    }
    bn.pop_back();
  }
  for(int i=n-1; i>=0; --i){
    cout << ans[i] << endl;
  }
}

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

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

int GCD(int a,int b){return b? GCD(b,a%b):a;}

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

    vector<int> left(N+1,0),right(N+1,0);
    for(int i=0;i<N;i++)left[i+1]=GCD(left[i],a[i]);
    for(int i=N-1;i>=0;i--)right[i]=GCD(right[i+1],a[i]);

    int res=0;
    for(int i=0;i<N;i++){
        int l=left[i];
        int r=right[i+1];
        chmax(res,GCD(l,r));
    }
    cout<<res<<endl;
}

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

using namespace std;

#define int long long

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

typedef pair<int, int> PII;

//--------



signed main(){
    string s;
    cin >> s;
    int month;
    if(s[5] == '1'){
        cout << "TBD" << endl;
        return 0;
    }
    month = s[6] - '0';
    if(month <= 4){
        cout << "Heisei" << endl;
        return 0;
    }
    else if(month > 4){
        cout << "TBD" << endl;
    }
    return 0;
}


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

#define rep(i, n)     for(int i = 0;      i < int(n); ++i)
#define rep3(i, a, b) for(int i = int(a); i < int(b); ++i)
#define all(x)        (x).begin(),(x).end()
#define sz(x)         int(x.size())
#define mp            make_pair
#define pb            push_back


typedef long long ll;

using namespace std;

int main(){
  int x1, y1, x2, y2, dx, dy;
  cin >> x1 >> y1 >> x2 >> y2;
  dx = x2 - x1;
  dy = y2 - y1;
  
  int x3 = x2 - dy;
  int y3 = y2 + dx;
  int x4 = x3 - dx;
  int y4 = y3 - dy;
 
  cout << x3 << " ";
  cout << y3 << " ";
  cout << x4 << " ";
  cout << y4 << endl;

  return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll D;
	cin >> D;

	ll N = 26;
	vector <ll> c(N);
	for (ll ii = 0; ii < N; ++ii){
		cin >> c[ii];
	}
	vector<vector<ll>> s(D, vector <ll> (N));
	for (ll ii = 0; ii < D; ++ii){
		for (ll jj = 0; jj < N; ++jj){
			cin >> s[ii][jj];
		}
	}

	//貪欲法
	vector <int> ans(D, 0);
	vector <int> last(N, -1);
	for (ll d = 0; d < D; ++d){
		//d日目の最適解を選ぶ
		ll val = 0;
		ll idx = 0;
		for (int ii = 0; ii < N; ++ii){
			ll tmp = s[d][ii] + c[ii]*(d - last[ii]);
			if (tmp > val){
				val = tmp;
				idx = ii;
			}
		}
		ans[d] = idx + 1;
		last[idx] = d;
	}

	for (ll d = 0; d < D; ++d){
		cout << ans[d] << "\n";
	}


	return 0;
}


Measured memory_bytes: 3704
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long x = sc.nextLong();

		long count500;
		long count5;

		count500 = x / 500;
		x -= count500 * 500;
		count5 = x /5;

		System.out.println((count500 * 1000) + (count5 * 5));
	}
}

Measured memory_bytes: 23508
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;
int ans=0;
int field=0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}


ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int ctoi(const char c)
{
    if ('0' <= c && c <= '9')
        return (c - '0');
    return -1;
}

int count_3(string s){
    int count =0;

    REP(i,s.size()){
        if(s[i]=='3')  {
            count++;
        }
    }
    return count;
}
int count_5(string s)
{
    int count = 0;

    REP(i, s.size())
    {
        if (s[i] == '5'){
            count++;
        }
    }
    return count;
}
int count_7(string s)
{
    int count = 0;

    REP(i, s.size())
    {
        if (s[i] == '7'){
            count++;
        }
    }
    return count;
}

int fn(int rest, string s, int n)
{
    if (rest == 0)
    {
        if (s.size() > 2)
        {
            if (count_3(s)>=1 && count_5(s)>=1 && count_7(s)>=1)
            {
                //cout << s << endl;
                int res = 0;
                REP(i, s.size())
                {
                    res += ctoi(s[i]) * pow(10, s.size() - i - 1);
                }
                //cout << "res is " << res << endl;
                if (res <= n)
                {
                    ans++;
                }
                //cout << "Ans is " << ans << endl;
                if(field < ans){
                    field = ans;
                }
            }
        }
    }
    else
    {
        for (char c = '3'; c <= '7'; c = c + 2)
        {
            fn(rest - 1, s + c, n);
        }
    }
}

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

    REP(i,to_string(N).size()+1){
        fn(i,"",N);
    }

    cout << field << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>
#include <queue>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> num(n + 1);
	rep(i, 0, n) {
		int a;
		cin >> a;
		num[a]++;
	}
	descSort(num);
	ll ans = 0;
	rep(i, k, n) {
		ans += num[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
d = input()
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

res = r*g*b
for i in range(len(s)-2):
    for j in range(i,len(s)-1):
        k = 2 * j - i
        if k < len(s) and s[i] != s[k] and s[i] != s[j] and s[j] != s[k]:
            res -= 1
print(res)


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

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long llint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double pi = 3.14159265358979323846;

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

set<string> ans;
int n;
int rec(string s, int c) {
  if (s.size() == n) {
    ans.insert(s);
    return 0;
  }

  for (int i = 0; i <= c + 1; i++) {
    char d = (char)('a' + i);
    s += d;
    int nc = max(c, i);
    rec(s, nc);
    s.pop_back();
  }
}

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

  cin >> n;
  string s = "";
  s += 'a';
  rec(s, 0);
  for (auto& v : ans) {
    cout << v << endl;
  }

  return 0;
}

Measured memory_bytes: 13824
from functools import reduce
N = int(input())
A = list(range(2,N+1))
sqrt = N**(1/2)
idx = 0
if N == 1:
    print(1)
    exit()
while True:
    p = A[idx]
    if p > sqrt:
        break
    check_numbers = A[idx+1:]
    for check_number in check_numbers:
        if check_number % p == 0:
            A.remove(check_number)
    idx += 1

ans = 1
B = [1] * 1001
for n in range(2, N+1):
    for a in A:
        if n == 1:
            break
        while True:
            if n % a == 0:
                B[a] += 1
                n //= a
            else:
                break
MOD = 10**9+7
print(reduce(lambda a,b: a*b , B)%MOD)


Measured memory_bytes: 3684
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int a[105];
	int n,ans = 0;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		scanf("%d",&a[i]);
	}
	sort(a + 1, a + n + 1);
	int cnt = 0;
	for(int j = n; j>= 1; j--){
		if(cnt % 2 == 0) ans += a[j];
		else ans -= a[j];
		cnt++;
	}		
	printf("%d\n",ans);	
	return 0;
}


Measured memory_bytes: 128
def answer(n, a, b):
    if (a > b): return 0
    if n == 1 and a != b: return 0
    n = n-2
    small = a*n
    big = b*n
    return big - small + 1

n, a, b = map(int, input().split())
print(answer(n, a, b))

Measured memory_bytes: 3060
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
import math
import time
ts=time.time()
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n,l=MI()
a=LI()
ans='Impossible'
an=[]
for i in range(n-1):
    if a[i]+a[i+1]>=l:
        ans='Possible'
        an+=[i+1]
        break

print(ans)
if ans=='Possible':
    an+=list(range(an[0]+1,n))
    an+=list(range(1,an[0]))[::-1]
    for i in an[::-1]:
        print(i)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int a, b;
  cin >> a >> b;
  cout << a - (a > b);
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3604
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

N=I()
C=[0]*N
S=[0]*N
F=[0]*N

for i in range(N-1):
    C[i],S[i],F[i]=MI()
      
ans=[0]*N


#a秒後に，c,s,fな駅にいるとして，次の駅につく時間
def calc(a,c,s,f):
    st=s
    if a>s:
        st=((a+f-1)//f)*f
    return st+c
        
    

for i in range(N-1):
    for j in range(i+1):
        ans[j]=calc(ans[j],C[i],S[i],F[i])

for i in range(N):
    print(ans[i])

Measured memory_bytes: 40048
#include<stdio.h>

int main(){

	int h, w, i, e;

	scanf("%d %d", &h, &w);

	while (h != 0 && w != 0){

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

			for (e = 0; e<w; e++){

				printf("#");

			}

			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &h, &w);
		
	}

	return 0;
}

Measured memory_bytes: 572
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

int ans[1 << 17];
struct edge {
	int to, cost;

};
vector<edge> G[1 << 17];

void solve() {
	int n; cin >> n;
	rep(i, n-1) {
		int u, v, w; cin >> u >> v >> w;
		u--; v--;
		G[u].push_back({ v,w % 2 });
		G[v].push_back({ u,w % 2 });
	}
	int root = 0;
	rep(i, n) {
		if (G[i].size()==1)root = i;
	}
	queue<P> q;
	vector<bool>used(n);
	ans[root] = 0; q.push({ root,0 }); used[root] = true;
	while (!q.empty()) {
		P p = q.front(); q.pop();
		int id = p.first, col = p.second;
		rep(j, G[id].size()) {
			int to = G[id][j].to;
			int cost = G[id][j].cost;
			if (used[to])continue;
			used[to] = true;
			q.push({ to,col^cost });
			ans[to] = col ^ cost;
		}
	}
	rep(i, n) {
		cout << ans[i] << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 7552
#include "bits/stdc++.h"
#include <chrono> 
 
using namespace std;
using namespace std::chrono; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
#define gcd(a,b) __gcd(a,b)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vc vector<char>
#define pb(n) push_back(n)
#define pp pop_back()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define type(a) typeid(a).name();
#define print(arr) cout << "[" ;for(unsigned int i=0;i<(unsigned int) arr.size();i++){ (i==arr.size()-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define Arr(arr,l) cout << "[" ;for(unsigned int i=0;i<(unsigned int) l;i++){ (i==l-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define console(arr) cout << "["<<endl; for(ll i=0;i<(ll)arr.size();++i){cout << " [";for(ll j=0;j<(ll)arr[i].size();++j){(j==(int)arr[i].size()-1)?cout << arr[i][j]:cout << arr[i][j] << ",";}cout << "]"<<endl;} cout << "]"<<endl
#define starting() auto start = high_resolution_clock::now()
#define ending() auto stop = high_resolution_clock::now();auto duration = duration_cast<microseconds>(stop - start);cout << endl << endl << "Execution Time : "<<duration.count()/1000 << " ms" << endl
 
template <typename T1,typename T2>
void mapped(map<T1,T2>m){for(auto ite=m.begin();ite!=m.end();++ite){cout << "'" << ite->first << "'"<<" : "<<ite->second <<endl;}}
 
template <typename T1 , typename T2>
void mappedArr(map<T1,vector<T2>>m){for(auto ity=m.begin();ity!=m.end();++ity){cout << "'"<< ity->first <<"'"<<" : "<<"[";
for(int i=0;i<(int)ity->second.size();++i){(i==(int)ity->second.size()-1)?cout << ity->second[i]:cout << ity->second[i] << ",";}cout << "]"<<endl;}}
 
string int_to_string(int x){ stringstream ss; ss << x; string ni = ss.str(); return ni;}
int char_to_int(char c){ int n = (int)c - 48; return n; }
int string_to_int(string x){ int n; stringstream s(x); s >> n; return n; }
 
template <typename T1,typename T2>
void ArrPair(vector<pair<T1,T2>>vp){for(int i=0;i<(int)vp.size();++i){
cout << "(" << vp[i].first << "," << vp[i].second << ")"<<endl ;}}
 
const int MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
 
int main(){
  int x,y,z;
  cin >> x >> y >> z;
  if( ((x == 5) && (y == 5) && (z == 7)) ||  ((x == 5) && (z == 5) && (y==7)) || ((z == 5) && (y == 5) && (x == 7))){
	  cout << "YES";
  }else{
	   cout << "NO"; 
	}
 
}














Measured memory_bytes: 256
import sys
c1 = 0
c2 = 0
for line in sys.stdin.readlines():
  a,b,c = map(int,line.split(','))
  if a**2 + b**2 == c ** 2:
    c1 += 1
  if a == b:
    c2 += 1
print(c1)
print(c2)

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

using namespace std;

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

	int ans = 0;

	for (int i=0; i<n; ++i) {
		if (v[i] - c[i] > 0) {
			ans += v[i] - c[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#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;

int main(void){
  ll n, k;
  cin >> n >> k;
  vector<ll> v(n);
  REP(i, n) cin >> v[i];
  ll ans = -INF;
  ll r = min(n, k);
  FORe(a, 0, r){
    for(ll b = 0; a+b <= r; b++){
      vector<ll> p;
      ll now = 0;
      REP(i, a) p.emplace_back(v[i]), now += v[i];
      REP(i, b) p.emplace_back(v[n-i-1]), now += v[n-i-1];
      sort(ALL(p));
      ll c = min(k-a-b, (ll)p.size());
      REP(i, c){
        if(p[i] < 0) now -= p[i];
      }
      chmax(ans, now);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int gcl(int a, int b) {
	int x, y;
	if (a>b){
		x = a;
		y = b;
	}
	else {
		x = b;
		y = a;
	}
	int z = x % y;
	while(z != 0){
		x = y;
		y = z;
		z = x % y;
	}
	return y;
}

int main() {
	long A, B;
	cin>>A>>B;
	long ans;
	ans = A * B/gcl(A, B);
	cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const double EPS = 1e-10;
int sgn(double d) { return d > EPS ? 1 : d < -EPS ? -1 : 0; }

struct Point {
  double x, y;
  Point() {}
  Point (const double& x, const double& y) : x(x), y(y) {}
  Point& operator += (const Point& other) { x += other.x; y += other.y; return *this; }
  Point& operator -= (const Point& other) { x -= other.x; y -= other.y; return *this; }
  Point& operator *= (const double& factor) { x *= factor; y *= factor; return *this; }
  Point& operator /= (const double& factor) { x /= factor; y /= factor; return *this; }
};
using Vector = Point;
using Polygon = vector<Point>;

Point operator + (const Point&lhs, const Point& rhs) { return Point(lhs.x + rhs.x, lhs.y + rhs.y); }
Point operator - (const Point& lhs, const Point& rhs) { return Point(lhs.x - rhs.x, lhs.y - rhs.y); }
Point operator * (const Point& lhs, const double& factor) { return Point(lhs.x * factor, lhs.y * factor); }
Point operator * (const double& factor, const Point& rhs) { return Point(factor * rhs.x, factor * rhs.y); }
Point operator / (const Point& lhs, const double& factor) { return Point(lhs.x / factor, lhs.y / factor); }
double operator * (const Point& lhs, const Point& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y; }
double operator ^ (const Point& lhs, const Point& rhs) { return lhs.x * rhs.y - lhs.y * rhs.x; }
bool operator == (const Point& lhs, const Point& rhs) { return sgn(lhs.x - rhs.x) == 0 && sgn(lhs.y - rhs.y) == 0; }
bool operator != (const Point& lhs, const Point& rhs) { return !(lhs == rhs); }
bool operator < (const Point& lhs, const Point& rhs) { return sgn(lhs.x - rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool operator > (const Point& lhs, const Point& rhs) { return rhs < lhs; }
bool operator <= (const Point& lhs, const Point& rhs) { return !(lhs > rhs); }
bool operator >= (const Point& lhs, const Point& rhs) { return !(lhs < rhs); }
istream& operator >> (istream& is, Point& point) { return is >> point.x >> point.y; }
ostream& operator << (ostream& os, Point& point) { return os << "(" << point.x << "," << point.y << ")"; }
double norm(const Point& point) { return point.x * point.x + point.y * point.y; }
double abs(const Point& point) { return sqrt(norm(point)); }
double arg(const Point& point) { return atan2(point.y, point.x); }
Point polar(const double& a, const double& r) { return Point(cos(r) * a, sin(r) * a); }
bool sort_x(Point lhs, Point rhs) { return sgn(lhs.x - rhs.x) ? lhs.x < rhs.x : lhs.y < rhs.y; }
bool sort_y(Point lhs, Point rhs) { return sgn(lhs.y - rhs.y) ? lhs.y < rhs.y : lhs.x < rhs.x; }

bool isOrthogonal(const Vector& a, const Vector& b) {
  return !sgn(a * b);
}
bool isOrthogonal(const Point& a1, const Point& a2, const Point& b1, const Point& b2) {
  return isOrthogonal(a1 - a2, b1 - b2);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  Point A, B, C, D;
  while (cin >> A >> B >> C >> D) {
    cout << (isOrthogonal(A, B, C, D) ? "YES" : "NO") << endl;
  }

  return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };




int main() {
	fastIO;
	ll n;
	cin >> n;
	ll total = 1000*(n / 500) + 5 * ((n%500) / 5);
	cout << total;


}


Measured memory_bytes: 256
import numpy

N = int(input())
X = list(map(int, input().split()))

ave = numpy.average(X)

if 0 <= (ave % 1) < 0.5:
    plot = int(ave)
else:
    plot = int(ave) + 1

ans = 0
for i in X:
    ans += (i - plot) ** 2

print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<int> B(N-1);
  for(int i = 0; i < N-1; i++) cin >> B.at(i);
  B.push_back(B.at(N-2));
  long ans = 0;
  int pre;
  int now = B.at(0);
  ans += now;
  for(int i = 0; i < N-1; i++){
    pre = now;
    now = B.at(i+1);
    ans += min(pre, now);
  }
  cout << ans << endl;
  
}

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

int main(){
  int N;
  cin >> N;
  vector<int> ans(N,0);
  vector< vector<int> > A(N,vector<int>(3)), C(101,vector<int>(3));
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 3; ++j){
      cin >> A[i][j];
      ++C[A[i][j]][j];
    }
  }
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < 3; ++j)
      if(C[A[i][j]][j] == 1) ans[i] += A[i][j];
    cout << ans[i] << endl;
  }
}



Measured memory_bytes: 3124
n,x=map(int,input().split())
a=list(map(int,input().split()))
c=0
if a[0]>x:c+=a[0]-x;a[0]=x
for i in range(n-1):
    if a[i]+a[i+1]>x:c+=a[i]+a[i+1]-x;a[i+1]=x-a[i]
print(c)

Measured memory_bytes: 14588
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

const ll MOD = INF;


int main(){
    int w;
    cin>>w;
    
    string s = "";
    while(w>0){
        if(w%3==0)s+='0';
        if(w%3==1)s+='+';
        if(w%3==2){
            s+='-';
            w+=1;
        }
        w/=3;
    }
    
    reverse(all(s));
    cout<<s<<endl;
}

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

class Program {
    static void Main(string[] args) {
        int K, X;
        Input(out K, out X);
        if(500 * K >= X) {
            Console.WriteLine("Yes");
        } else {
            Console.WriteLine("No");
        }
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
}

Measured memory_bytes: 11220
x,y,z,k=gets.split.map(&:to_i)
aarray=gets.split.map(&:to_i).sort
barray=gets.split.map(&:to_i).sort
carray=gets.split.map(&:to_i).sort

def returnArray(array1,array2,limit,mode)
    count1=array1.count
    count2=array2.count
    indexarray=Array.new(count1,-1)
    ansarray=[]
    
    limit.times{
        i=count1-1
        max=0
        maxindex=0
        
        count1.times{
        if indexarray[i]<-count2
            i-=1
            next
        end
        
        if array1[i]+array2[indexarray[i]] > max
            max=array1[i]+array2[indexarray[i]]
            maxindex=i
        end
        
        if indexarray[i]==0
            break
        end
        i-=1
         }
        if mode==1
            ansarray.push(max)
        else
            ansarray.unshift(max)
        end
        
        indexarray[maxindex]-=1
        
    }
    
    return ansarray
    
end

longarray=returnArray(aarray,barray,k,2)
ans=returnArray(carray,longarray,k,1)

ans.map{|value|
    puts value
}

Measured memory_bytes: 2040
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main (int argc, char*argv[]) {
  int n;
  cin >> n;
  int tmp = n;
  int count = 0;
  while(tmp > 0) {
    count += tmp % 10;
    tmp /= 10;
  }
  if(n % count == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;



int main(){FIN

    ll n,x;cin>>n>>x;
    vll a(n); REP(i,n) cin>>a[i];
    vll b(0);
    REP(i,n) b.push_back(abs(x-a[i]));
    ll ans = b[0];
    REP(i,n) ans = __gcd(ans,b[i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2168
#![allow(non_snake_case)]
#![allow(unused_imports)]
use ascii::AsciiChar;
use ascii::AsciiStr;
use itertools::Itertools as _;
use permutohedron::LexicalPermutation as _;
use petgraph::algo::dijkstra;
use petgraph::algo::min_spanning_tree;
use petgraph::data::FromElements;
use petgraph::graph::NodeIndex;
use petgraph::graph::UnGraph;
use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use superslice::Ext as _;

#[fastout]
fn main() {
    input! {
        R: i64,
        G: i64,
    }

    // (R + P) / 2 = G
    // P = 2 * G - R)
    let ans = 2 * G - R;
    println!("{}", ans);
}


Measured memory_bytes: 2184
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define ull unsigned long long
#define y1 asjdlfaskavslbcjasndscf
#define endl '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter vector< pair<int,int> >::iterator
#define iter1 multiset<int>::iterator
#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>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1000+7;
const int inf=1e18+1e9;
const int mod=998244353;
const ld eps=1e-9;

//const int MAX_MEM=1e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    assert(mpos<=MAX_MEM);
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

char a[N][N];
int dp[N][N];
int n,m;

int get_ans()
{
    for (int i=0;i<=n;++i){
        for (int j=0;j<=m;++j){
            dp[i][j]=inf;
        }
    }
    if (a[1][1]=='#')dp[1][1]=1;
    else dp[1][1]=0;
    for (int i=1;i<=n;++i){
        for (int j=1;j<=m;++j){
            if (i==1 && j==1)continue;
            if (a[i][j]=='#'){
                dp[i][j]=min(dp[i][j],dp[i][j-1]+(a[i][j]!=a[i][j-1]));
                dp[i][j]=min(dp[i][j],dp[i-1][j]+(a[i][j]!=a[i-1][j]));
            }
            else {
                dp[i][j]=min(dp[i][j],dp[i][j-1]);
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
            }
        }
    }
    return dp[n][m];
}

main ()
{
    ios;
    cin>>n>>m;
    for (int i=1;i<=n;++i){
        for (int j=1;j<=m;++j){
            cin>>a[i][j];
        }
    }
    int ans=get_ans();
    for (int i=1;i<=n;++i){
        for (int j=1;j<=m;++j){
            if (a[i][j]=='.'){
                a[i][j]='#';
            }
            else {
                a[i][j]='.';
            }
        }
    }
//    ans=min(ans,get_ans()+1);
    cout<<ans<<endl;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

const ll MAX = 10000;

ll gcd(ll x,ll y){
  if(x == 0)return y;
  return gcd(y%x,x);
}

int main(){
  ll x,y;
  cin >> x >> y;
  if(x > y)swap(x,y);
  cout << gcd(x,y) << endl;
}



Measured memory_bytes: 3100