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

//AC

int main(void){
	ll n,a[200010],sum[200010],l=1,r=3,ans=inf,s[4];
	double b;
	cin>>n;
	sum[0]=0;
	reg(i,1,n){
		cin>>a[i];
		sum[i]=a[i]+sum[i-1];
	}
	sum[n+1]=sum[n];
	reg(c,2,n-2){
		while(abs(sum[l]-(sum[c]-sum[l])) > abs(sum[l]+a[l+1]-(sum[c]-sum[l]-a[l+1])) && l+1<c){
			l++;
		}
		while(
			(
			r<=c ||
			abs(sum[r]-sum[c]-(sum[n]-sum[r])) > abs(sum[r]-sum[c]+a[r+1]-(sum[n]-sum[r]-a[r+1]))
			)
			&& r+1<n+1
			){
			r++;
		}
		// printf("%lld,%lld,%lld\n",l,c,r);
		s[0]=sum[l];
		s[1]=sum[c]-sum[l];
		s[2]=sum[r]-sum[c];
		s[3]=sum[n]-sum[r];
		sort(s,s+4);
		ans=min(ans,s[3]-s[0]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<iomanip>
using namespace std;
#include<vector>
#include<algorithm>
int main(){
  long long int n,k,i;
  cin>>n>>k;
  vector<long long int>a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  vector<long long int>::iterator least=lower_bound(a.begin(),a.end(),k);
  long long int before=least-(a.begin());
  cout<<(n-before)<<"\n";
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define de_x(x) cout<<"debug_val: "<<x<<endl;
#define de_ve(x) for(auto it: x) cout<<it<<" ";
#define rep(i,a,n) for (int i=a;i<n;i++)
#define _rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
std::mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x ; }
const ll mod=1e7;
ll ksm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int _,n,m;
/***********************/
void run(){
}
int a[8];
int main(){
//    for(scanf("%d",&_);_;_--) run();
    memset(a,-1,sizeof(a));
    cin>>n>>m;
    int x,y;
    while(m--)
    {
        cin>>x>>y;
        if(a[x]!=-1&&a[x]!=y) return cout<<"-1",0;
        a[x]=y;
    }
    if(n!=1&&a[1]==0) return cout<<"-1",0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]!=-1) cout<<a[i];
        else if(n==1||i!=1) cout<<0;
        else cout<<1;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  int n; cin >> n;
  vector<vector<pii>> G(n);

  rep(i,n) {
    int a; cin >> a;
    rep(j,a) {
      int x,y; cin >> x >> y;
      x--;
      G[i].pb(mp(x,y));
    }
  }
  

  int ans = 0;
  rep(bit,(1<<n)){
    int cnt = 0;
    bool ok = true;
    rep(j,n){
      if(bit & (1 << j)){
        cnt++;
        for(auto c : G[j]) {
          int x = c.first;
          int y = c.second;
          if((bit & (1 << x))){
            //if(bit == 4) printf("%d %d %d\n", j, x, y);
            if(y == 0) ok = false;
          }
            
          else{
            //if(bit == 4) printf("%d %d %d\n", j, x, y);
            if(y == 1) ok = false; 
          }
        }
      }
    }
    //if(cnt == 1 && ok) cout << bit << endl;
    if(ok) chmax(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#n,kが小さい
#xi,yi全て試す

#for ループ変更
import itertools
n,k = map(int, input().split( ))

p = []
x = []
y = []
for i in range(n):
    xi,yi = map(int, input().split( ))
    p.append((xi,yi))
    x.append(xi)
    y.append(yi)

y = list(set(y))
x = list(set(x))
x.sort()
y.sort()
lx = len(x)
ly = len(y)
ans = 10**20
for xi,xj in itertools.combinations(x,2):
    for yi,yj in itertools.combinations(y,2):
        cnt = 0
        for xk,yk in p:
            if xi <= xk and xk<=xj and yi <=yk and yk<=yj:
                        cnt += 1
        if cnt >= k:
            ans = min(ans, (xj-xi)*(yj-yi))
print(ans)
                    



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

int main()
{
	int a, b;
	string s;
	cin >> a >> b >> s;
	bool ans = true;
	for(auto i = 0; i < (int)s.size(); ++i){
		if(i == a) continue;
		char c = s[i];
		if(c < '0' || '9' < c){
			ans = false;
			break;
		}
	}
	cout << (ans && s[a] == '-' ? "Yes" : "No") << endl;
	return 0;
}

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  while(1) {
    string s; cin >> s;
    if (s=="-") break;
    int n; cin >> n;
    vector <int> sf(n);
    rep(i,n) cin >> sf[i];
    
    rep(i, sf.size()) {
      string str = s.substr(0,sf[i]);
      s.erase(0, sf[i]);
      s+=str;
    }
    cout << s << endl;
  }
}



Measured memory_bytes: 3204
import java.util.Scanner;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        calcurate(values);
    }

    private static void calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {
            switch (values[i]) {
            case "+":
                stack.push(stack.pop() + stack.pop());
                break;
            case "-":
                stack.push(-(stack.pop() - stack.pop()));
                break;
            case "*":
                stack.push(Long.valueOf(stack.pop() * stack.pop()));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        System.out.println(stack.pop());
    }
}



Measured memory_bytes: 26212
N = int(input())
A = list(map(int, input().split()))

money = 1000
kabu = 0
while A[-1] <= A[-2]:
    A.pop()
    if len(A) == 1:
        break
t = [0] * len(A)
for i in range(1, len(A)):
    if A[i] > A[i-1]:
        t[i] = 1
    elif A[i] < A[i-1]:
        t[i] = -1
    else:
        t[i] = 0

n_move = 1

for i in range(len(A) - 1):
    if n_move == 1 and t[i] != 1 and t[i+1] == 1:
        kabu += money // A[i]
        money -= A[i] * (money // A[i])
        
        n_move = 1 - n_move
    elif n_move == 0 and t[i] != -1 and t[i+1] == -1:
        money += A[i] * kabu
        kabu = 0
        n_move = 1 - n_move
print(money + kabu * A[-1])

Measured memory_bytes: 9252
#include <cstdio>
#include <iostream>

bool jdg(int a, int b, int c)
{
    if (a == b && a != c)
        return true;
    else
        return false;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    int a, b, c;
    std::cin >> a >> b >> c;
    if (jdg(a, b, c))
    {
        std::cout << "Yes";
        return 0;
    }
    if (jdg(a, c, b))
    {
        std::cout << "Yes";
        return 0;
    }
    if (jdg(b, a, c))
    {
        std::cout << "Yes";
        return 0;
    }
    if (jdg(b, c, a))
    {
        std::cout << "Yes";
        return 0;
    }
    if (jdg(c, a, b))
    {
        std::cout << "Yes";
        return 0;
    }
    if (jdg(c, b, a))
    {
        std::cout << "Yes";
        return 0;
    }
    std::cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		vector<int>ansa,ansb;int Asum=0,Bsum=0,asum,bsum;
		int a[102]={0},b[100]={0};
		for(int i=0;i<n;i++){cin>>a[i];Asum+=a[i];}
		for(int i=0;i<m;i++){cin>>b[i];Bsum+=b[i];}
		asum=Asum;
		bsum=Bsum;
		for(int i=0;i<n;i++){
			asum=Asum;
			bsum=Bsum;
			for(int j=0;j<m;j++){
				if(asum-a[i]+b[j]==bsum-b[j]+a[i]){
					ansa.push_back(a[i]);
					ansb.push_back(b[j]);
				}
			}
		}
		for(int i=0;i<ansa.size();i++){
			for(int j=0;j<ansb.size()-1;j++){
				if(ansa[i]+ansb[i]>ansa[j+1]+ansb[j+1]){
					swap(ansa[i],ansa[j+1]);
					swap(ansb[i],ansb[j+1]);
				}
			}
		}
		if(ansa.empty())cout<<-1<<endl;
		else cout<<ansa[0]<<" "<<ansb[0]<<endl;
		}
	return 0;
}

Measured memory_bytes: 1344
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
template <typename T>
T pow(T a, ll n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}
 
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
 
using mint = ModInt<1000000007>;
using Graph = vector<vector<int>>;
Graph G;
/*------------------------------------------------------------------*/
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];

    vector<vector<ll>> dp(n + 1, vector<ll>(3));
    rep(i, n + 1)rep(j, 3) dp[i][j] = 0;

    rep(i, n){
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i]);
        dp[i + 1][0] = max(dp[i + 1][0], dp[i][2] + a[i]);
        dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i]);
        dp[i + 1][1] = max(dp[i + 1][1], dp[i][2] + b[i]);
        dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i]);
        dp[i + 1][2] = max(dp[i + 1][2], dp[i][1] + c[i]);
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

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

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

    string s; 
    cin >> s; 

    for (int i = 0; i < s.length(); ++i)
    {
        if (s[i] + n <= 90)
            s[i] = s[i] + n; 
        else
            s[i] = s[i] + n - 26;
    }

    cout << s << endl; 
    return 0; 
}

Measured memory_bytes: 256
def main():

    N = int(input())

    H = [int(v) for v in input().split()]

    h = H[0]

    max_h = h

    count = 1
    for h in H[1:]:
        if h >= max_h:
            count += 1
        max_h = max(max_h, h)

    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {

	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	
	ll mn = a;
	mn = min(mn, b);
	mn = min(mn, c);
	mn = min(mn, d);
	mn = min(mn, e);

	ll ans = (n + mn - 1) / mn + 4;

	cout << ans << endl;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 1e9

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 (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main(int argc, char const *argv[])
{
  int N, T;
  cin >> N >> T;
        
  vector<int> c(N);
  vector<int> t(N);

  REP(i, N) cin >> c[i] >> t[i];

  vector<pair<int,int>> p(N);
  REP(i, N) p[i] = make_pair(c[i], t[i]);

  sort(ALL(p));

  REP(i, N)
  {
    if (p[i].second <= T)
    {
      cout << p[i].first << endl;
      goto END;
    }
  }

  cout << "TLE" << endl;

END:
  return 0;
}


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

const ll MAXN = 200000;

ll H1, M1, H2, M2, K, ans=0, tmp=0;
vector<ll> A(MAXN, 0);

signed main(){
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    ll time1 = 60*H1+M1;
    ll time2 = 60*H2+M2;
    if(time1>=time2) time2 += 24*60;
    ans = time2-time1-K;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4692
#include<cstdio>
using namespace std;
int n;
char st1[110],st2[110];
bool check(int x)
{
	for (int i=1;i<=x;i++)
		if (st1[n-x+i]!=st2[i])
			return false;
	return true;
}
int main()
{
	scanf("%d",&n);
	scanf("%s%s",st1+1,st2+1);
	for (int i=n;i>=0;i--)
		if (check(i))
		{
			printf("%d",n+n-i);
			return 0;
		}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
int n;
ll ans = 0;
void dfs(ll now, ll a, ll b, ll c) {
    if(now > n) return;
    if(a && b && c) ans++;
    dfs(now*10+3, 1, b, c);
    dfs(now*10+5, a, 1, c);
    dfs(now*10+7, a, b, 1);
}

int main() {
    cin >> n;
    dfs(0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3548
#include <stdio.h>
#include <algorithm>
int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    int a[n+1];a[n]=0;
    scanf("%d",&a[0]);
    a[0]=a[0]%m;
    for(int i=1;i<n;i++){
        scanf("%d",&a[i]);
        a[i]=(a[i]+a[i-1])%m;
    }
    std::sort(a,a+n+1);
    long long ans=0;
    long long x=0;
    for(int i=1;i<n+1;i++){
        if(a[i]!=a[i-1]){
            ans+=x*(x+1)/2;
            x=0;
        }
        else x++;
    }
    ans+=x*(x+1)/2;
    printf("%lld\n",ans);
}

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

#define endl '\n'

using namespace std;

int node[51][51];

int N,M;

int used[51];

bool judge=0;

void dfs(int i,int j){
  
  if(i==j){
    judge=1;
  }

  used[i]=1;
  
  for(int k=1;k<=N;k++){
    if(node[i][k]==1&&used[k]!=1){
      dfs(k,j);
    }
  }

  return;

}

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  cin>>N>>M;

  int a[51],b[51];
  
  for(int i=0;i<M;i++){
    cin>>a[i]>>b[i];

    node[a[i]][b[i]]=1;
    node[b[i]][a[i]]=1;

  }

  int cnt=0;
  
  for(int i=0;i<M;i++){
    node[a[i]][b[i]]=0;
    node[b[i]][a[i]]=0;

    memset(used,0,sizeof(used));

    judge=0;
    
    dfs(a[i],b[i]);
    
    if(judge==0){
      cnt++;
    }
    
    node[a[i]][b[i]]=1;
    node[b[i]][a[i]]=1;

  }

  cout<<cnt<<endl;
  
  return 0;

}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  ll n;
  cin >> n;
  if(n == 3){
    printf("3 5 22\n");
    return 0;
  }
  for(int i = 1;(i+1)*2 <= 30000;i+=3){
    if(n <= 3)break;
    printf("%d %d ",i*2,(i+1)*2);
    n -= 2;
  }
  for(int i = 1;(i+2)*3 <= 30000;i+=4){
    if(n <= 1)break;
    printf("%d %d ",i*3,(i+2)*3);
    n -= 2;
  }
  for(int i = 1;;i++){
    if(n == 0)break;
    printf("%d ",i*6);
    n--;
  }
  printf("\n");




  return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
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; }

string s;
int main() {
    cin >> s;
    if(s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    a=[int(input()) for _ in range(n)]
  
    s=sum(a[0:k])
    ss=[s]
 
    for i in range(k,n):
            
        s=s+a[i]-a[i-k]
        ss.append(s)
    print(max(ss))

            
        


Measured memory_bytes: 11704
#include <stdio.h>

int main(void){
	int n, a, num[50] = {0};
	long sum = 0;
	long dp[51][2501] = {0};

	scanf("%d%d", &n, &a);
	for(int i=0; i < n; i++) {
		scanf("%d", &num[i]);
	}

	dp[0][0] = 1;
	for(int i=1; i <= n; i++) {
		for(int j=i; j > 0; j--) {
			for(int k=num[i-1]; k <= j*50; k++) {
				dp[j][k] += dp[j-1][k-num[i-1]];
			}
		}
	}

	for(int i=1; i <= n; i++) {
		sum += dp[i][i*a];
	}
	printf("%ld", sum);

	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define M 100005
#define pb push_back
#define mod 1000000007
#define rep(i,a,b) for(lli i=a;i<b;i++)

#define PI 3.14285714286
#define db double
#define fs first
#define sc second
#define pii pair<lli,lli>
void fast()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
}

/*db ans,sum=0;
vector<db> a;
vector<pair<db,db> > vec;
lli sz,fact=0;
db dist(lli i,lli j)
{
	db s1 = (vec[i].fs-vec[j].fs)*(vec[i].fs-vec[j].fs) + (vec[i].sc-vec[j].sc)*(vec[i].sc-vec[j].sc) ;
	s1=sqrt(s1);
	return s1;
}

void permute(lli k,lli n)
{
	if(k==n)
	{
		//sum=0;
		fact++;
		rep(i,1,sz)
		{
			sum+=dist(a[i],a[i-1]);
		}
		return;
	}
	for(lli i=k;i<n;i++)
	{
		swap(a[i],a[k]);
		permute(k+1,n);//k+1
		swap(a[i],a[k]);
	}
}
*/
lli fact[1000005],invf[1000005];

lli modpow(lli a,lli n) 
{
	lli res=1;
	while(n)
	{
		if(n&1)res=res*a%mod;
		n>>=1;
		a=a*a%mod;
	}
	return res;
}
void sieve()
{
	fact[0]=1;
	invf[0]=1;
	rep(i,1,1000005)
	{
		fact[i]=i*fact[i-1]%mod;
		invf[i]=modpow(fact[i],mod-2);
	}
}
void solve()
{
	lli n;
	lli x,y,u,v,m;
	cin>>x>>y;
	if((2*x-y)%3!=0)
	{
		cout<<"0";
		return;
	}
	n = (2*x-y)/3;
	m = x-2*n;
	if(n<0 || m<0)
	{
		cout<<"0";
		return;
	}
	lli res;
	res=fact[n+m];
	res=res*invf[n]%mod;
	res=res*invf[m]%mod;
	cout<<res;
}
int main()
{
	fast();
	sieve();
	lli t=1;
	//cin>>t;
	while(t--)solve();
	
	return 0;
}

Measured memory_bytes: 15872
from sys import stdin
from math import factorial

n,k = [int(x) for x in stdin.readline().rstrip().split()]
point = 0
point2 = 0
if k % 2 == 1:
    for i in range(1,n+1):
        if i%k == 0:
            point += 1
else:
    for i in range(1,n+1):
        if i % k == 0:
            point += 1
        elif i%k == k//2:
            point2 += 1

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

print(point**3+point2**3)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

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

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

int x;
int n;
int main(){
	cin >> n;
	bool bo = true;
	for(int i = 0; i < n; i++){
		cin >> x;
		if(x % 2 == 0 && !(x % 3 == 0 || x % 5 == 0)) {cout << "DENIED\n"; return 0;}
	}
	cout << "APPROVED\n";
}


Measured memory_bytes: 256
/* Don't quit suffer now and live the rest of your live as a champion */
#include <bits/stdc++.h>
#define int long long
#define lp(i , N) for(ll i = 0; i < ll (N) ; i++)
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
using namespace std;
typedef long long ll;
typedef long double ld;
const long double EPS = 1e-6;
const long double pi = acos(-1);
const long long MOD = 1e9 + 7;
signed main(){
    FAST
    int n , k;
    cin >> n >> k;
    string s = "";
    while(n != 0){
        s+=to_string(n % k);
        n/=k;
    }
    cout << s.size() << endl;
    return 0;
}


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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){for(int i=0;i<n;i++) cin>>f[i];}

template<typename T,typename U>
void Printarray(T f,U n){for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];}
template<typename T,typename U>
void Printarray2(T f,U n){for(int i=0;i<n;i++) cout<<f[i]<<endl;}
template<typename T,typename U,typename V>
void Printarray3(T f,U a,V b){
  rep(i,a){
    rep(j,b){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}
template<typename T,typename U>
void Printarray4(T f,U n){
  rep(i,n){
    rep(j,n){
      cout<<f[i][j];
    }
    cout<<endl;
  }
}

void flagfunc(bool flag,string A,string B){flag ? cout<<A<<endl : cout<<B<<endl;}
void flag2func(bool flag){flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;}
void flag3func(bool flag){flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  ll cnt=0;
  rep2(i,1,n+1){
    if(i%3!=0 && i%5!=0){
      cnt+=i;
    }
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ull unsigned long long int
using namespace std;
ull f(ull a) {
     ull res[] = {a,1,a+1,0};
     return res[a%4];
}

ull getXor(ull a, ull b) {
     return f(b)^f(a-1);
}
int main()
{
    ull a,b;
    cin>>a>>b;
    ull sum=getXor(a,b);
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <set>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multi_array.hpp>

using namespace std;


int main()
{
    std::string SS, T;

    cin >> SS;
    cin >> T;

    std::set<std::string> answers;
    bool match = false;
    for (int i = 0; i <= (int)SS.size() - (int)T.size(); ++i)
    {
        bool b = true;
        for (size_t j = 0; j < T.size(); ++j) {
            if (SS[j+i] != '?' && T[j] != SS[j+i]) {
                b = false;
                break;
            }
        }

        if (b) {
            match = true;
            std::string S = SS;
            S.replace(i, T.size(), T);
            std::replace(S.begin(), S.end(), '?', 'a');

            answers.insert(S);
        }
    }

    if (answers.empty()) {
        cout << "UNRESTORABLE" << endl;
    }
    else {
        cout << *answers.begin() << endl;
    }

    return 0;
}


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

int main(void){
    int a,b;
    cin >> a >> b;

    int wa, sa, seki;
    wa = a+b; sa = a-b; seki = a*b;

    if(sa<=wa && seki<=wa) cout << wa;
    else if(wa<=sa && seki<=sa) cout << sa;
    else if(wa<=seki && sa<=seki) cout << seki;
    
    return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e18)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

using Edge = pair<int, ll>;

int main(){
    int v, e, r;
    cin >> v >> e >> r;
    vector<vector<Edge>> g(v);
    rep(i, e) {
        int s, t, d;
        cin >> s >> t >> d;
        g[s].emplace_back(t, d);
    }
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
    vll dist(v, INF);
    q.emplace(0, r);
    dist[r] = 0;
    while (!q.empty()) {
        auto p = q.top(); q.pop();
        ll d = p.first; int cv = p.second;
        if (dist[cv] < d) continue;
        for (Edge t : g[cv]) {
            ll nd = d + t.second;
            int nv = t.first;
            if (dist[nv] <= nd) continue;
            q.emplace(nd, nv);
            dist[nv] = nd;
        }
    }
    rep(i, v) {
        if (dist[i]!=INF) cout << dist[i] << endl;
        else cout << "INF" << endl;
    }
    return 0;
}



Measured memory_bytes: 19384
#include <stdio.h>

int main(void)
{
  int a,b,c,r;

  scanf("%d %d", &a, &b);

    if(a < b) {
        c = b;
        b = a;
        a = c;
    }
    while(b > 0) {
        r = a % b;
        a = b;
        b = r;
    }


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

  return 0;
}

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

string s;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	if(s[1] == 'R') s[1] = 'B';
	else s[1] = 'R';
	cout << s << endl;
	return 0;
}


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

int main(){
	int n,m,a,i,j;
	for( ; cin >> n , n ; cout << a << endl ){
		a=0;
		for(
			i=n/2 ;
			j=m=i ;
			i-- )
			for( ; m < n ; m==n?a++:0 )
				m += ++j;
	}
}

Measured memory_bytes: 0
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Char
import           Data.Foldable
import           Data.Maybe
import qualified Data.Sequence         as Seq

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  n <- getInt

  let dfs s mx | Seq.length s == n = putStrLn $ toList s
               | otherwise = do
                   forM_ ['a'..mx] $ \c ->
                     dfs (s Seq.|> c) (if c == mx
                                        then chr (ord mx + 1)
                                        else mx)
  dfs (Seq.fromList "") 'a'

Measured memory_bytes: 2172
#if defined(__GNUC__)
#include <bits/stdc++.h>
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))
#define ACM(x, y) std::accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {if(b == 0){return 1;} int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {if(b == 0){return 1;} int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)

itn main() {
	std::ios::sync_with_stdio(false);

	int n , k , s;

	cin >> n >> k >> s;

	REP(i, k) {
		cout << s << ' ';
	}

	if (s == 1) {
		REP(i, n - k) {
			cout << 2 << ' ';
		}
	}
	else {
		REP(i, n - k) {
			cout << s - 1 << ' ';
		}
	}

	return 0;
}


Measured memory_bytes: 1280
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;
const ll FINAL = 0x0ba9876543210ll;

struct Data
{
	ll s;
	int d;
	bool f;
	Data(ll s, int d, bool f) : s(s), d(d), f(f) {}
};

int bfs(ll init)
{
	if(init == FINAL)
		return 0;
	
	const int move[13][5] = {
		{2, -1},
		{2, 5, -1},
		{0, 1, 3, 6, -1},
		{2, 7, -1},
		{5, -1},
		{1, 4, 6, 9, -1},
		{2, 5, 7, 10, -1},
		{3, 6, 8, 11, -1},
		{7, -1},
		{5, 10, -1},
		{6, 9, 11, 12, -1},
		{7, 10, -1},
		{10, -1}
	};
	
	set<ll> visited[2];
	queue<Data> Q;
	Q.push(Data(init, 0, false));
	Q.push(Data(FINAL, 0, true));
	visited[0].insert(init);
	visited[1].insert(FINAL);
	int now[2] = {0};
	
	while(!Q.empty()){
		Data data = Q.front();
		Q.pop();
		now[data.f] = data.d + 1;

		for(int i=0, cnt=2; cnt; ++i){
			if(((data.s>>(i*4)) & 0xfll) == 0){
				for(int j=0; move[i][j]!=-1; ++j){
					ll next = data.s;
					next &= ~((0xfll << (i*4)) | (0xfll << (move[i][j]*4)));
					next |= ((data.s >> (move[i][j]*4)) & 0xfll) << (i*4);
					
					if(visited[!data.f].find(next) != visited[!data.f].end())
						return now[0] + now[1];

					if(visited[data.f].find(next) == visited[data.f].end()){
						visited[data.f].insert(next);
						if(data.d < 9)
							Q.push(Data(next, data.d+1, data.f));
					}
				}
				--cnt;
			}
		}
	}
	return -1;
}

int main()
{
	for(;;){
		int input[13];
		rep(i, 13){
			scanf("%d", &input[i]);
			if(input[i] == -1)
				return 0;
		}

		ll init = 0;
		rep(i, 13)
			init = (init << 4) | input[12-i];

		int ans = bfs(init);
		if(ans == -1 || ans > 20)
			puts("NA");
		else
			printf("%d\n", ans);
	}
}

Measured memory_bytes: 2500
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

h,w = nm()
if h == 1 or w == 1:
    print(1); exit()
ans = w * (h // 2)
if h%2: ans += (w+1)//2
print(ans)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    if(n == 2){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    for(ll i = 1; i * i <= n * 2; i++){
        if((n - i) % i == 0){
            ll num = (n - i) / i;
            if(n / num == n % num){
                ans += num;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main()
{
    char N[3];
    int checker = 0;
    for(int i = 0; i < 3; i++){
         cin >> N[i];
         if(N[i] == '7')checker++;
    } 
    if(checker >= 1)cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(){
    int a,b,c,d;
    cin >> a >> b >>c >> d;
    if ((abs(a-b)<=d&&abs(c-b)<=d) || abs(a-c) <=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

int main() {
  ll N, K;
  cin >> N >> K;

  if (1 + 2 * (K - 1) <= N) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }    
    return ans;    
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*ここから*/
int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0;i<N;i++){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    int df,da;
    df = d[N/2-1];
    da = d[N/2];
    cout << da-df << endl;
}

Measured memory_bytes: 3788
from collections import deque
N=int(input())
d=deque()
d.append("a")
dall=deque()
dall.append(d)
i=0
while i<N-1:
    length=len(dall)
    j=0
    while j<length:
        l=dall.popleft()
        llen=len(set(l))
        for k in range(llen+1):
            q = deque()
            for m in range(len(l)):
                c = l.popleft()
                q.append(c)
                l.append(c)
            q.append(chr(ord("a")+k))
            dall.append(q)
        #print(dall)
        #input()
        j=j+1
    i=i+1
    #print(dall)
    #input()
#print(len(dall))
ans=[]
for i in range(len(dall)):
    ans.append("".join(dall[i]))
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 148952
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int N = 1e6+5;
long long gcd(long long a,long long b){
	return !b?a:gcd(b,a%b);
}
int prime[N], phi[N], vis[N], sz;
void get_phi(){  //素数线性筛和欧拉函数 
    vis[1] = 1;
    for(int i = 2; i < N; i ++){
        if(!vis[i]){
            prime[++ sz] = i;
            phi[i] = i - 1;
        }
        for(int j = 1; j <= sz && prime[j] * i < N; j ++){
            vis[prime[j] * i] = 1;
            if(i % prime[j] == 0){
                phi[i * prime[j]] = phi[i] * prime[j];
                break;
            }
            phi[i * prime[j]] = phi[i] * (prime[j] - 1);
        }
    }
}
int p[N];
int c[N];
long long divide(long long n){
    int m = 0;
    long long nn = n;
    for(int i = 1;prime[i]<=sqrt(n);i++){  //注意这里的n其实是一直在变化的，但是因为传了参数n，所以不影响主函数中的n
        if(n%prime[i]==0){
            //i是质数
            p[++m] = prime[i];
            c[m] = 0;
            while(n%prime[i]==0){
                n/=prime[i];
                c[m]++;
            }
        } 
    }
    if(n>1)m++;
    return m;
}
int main(){
	long long a,b;
	get_phi();
	scanf("%lld%lld",&a,&b);
	long long num = gcd(a,b);
	printf("%lld\n",divide(num)+1);
	return 0;
} 

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

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////
int a[100005];
int main(){
    int n;
    cin >> n;
    int ans = 0,sum = 0;
    for (int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }

    cout << sum - n << endl;

}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    int res = 0;
    for (int i = 0; i < n; i++)
    {
        ll x;
        cin >> x;
        bool f = true;
        for (ll i = 2; i * i <= x; i++)
        {
            if (x % i == 0)
                f = false;
        }
        if (f)
            res++;
    }
    cout << res << endl;
}



Measured memory_bytes: 3176
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

h=int(input())
def f(n):
    if n==1:
        return 1
    return 1+f(n//2)*2
print(f(h))

Measured memory_bytes: 38448
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    ll K,S;
    cin >> K >> S;
    ll ans = 0;
    for(int i=0;i<=K;i++){
        for(int j=0;j<=K;j++){
            if((S-(i+j))<=K&&0<=(S-(i+j))){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int a[100005];
int asc(const void* x, const void* y)
{
	if (a[*(int*)x] > a[*(int*)y])return 1;
	if (a[*(int*)x] < a[*(int*)y])return -1;
	return 0;
}
int b[100005];
int asc2(const void* x, const void* y)
{
	if (b[*(int*)x] < b[*(int*)y])return 1;
	if (b[*(int*)x] > b[*(int*)y])return -1;
	return 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	for (i = 1; i < n; i++)
	{
		scanf("%d", &a[i]);
		a[i]--;
	}
	a[0] = -1;
	int c[100005];
	for (i = 0; i < n; i++)
		c[i] = i;
	qsort(c, n, sizeof(int), asc);
	int min, mid, max;
	int q[100005], qq;
	q[0] = 0;
	qq = 1;
	j = 0;
	while (j < qq)
	{
		i = q[j];
		j++;
		min = 0;
		max = n;
		while (max - min > 1)
		{
			mid = (max + min) / 2;
			if (a[c[mid]] < i)
				min = mid;
			else
				max = mid;
		}
		if (max < n)
		{
			while (a[c[max]] == i)
			{
				q[qq] = c[max];
				qq++;
				max++;
				if (max == n)
					break;
			}
		}
	}
	for (i = 0; i < n; i++)
		b[i] = 0;
	int d[100005], l;
	while (qq > 0)
	{
		qq--;
		i = q[qq];
		min = 0;
		max = n;
		while (max - min > 1)
		{
			mid = (max + min) / 2;
			if (a[c[mid]] < i)
				min = mid;
			else
				max = mid;
		}
		if (max < n)
		{
			l = 0;
			while (a[c[max]] == i)
			{
				d[l] = c[max];
				l++;
				max++;
				if (max == n)
					break;
			}
			qsort(d, l, sizeof(int), asc2);
			for (j = 0; j < l; j++)
				if (b[i] < b[d[j]] + j + 1)
					b[i] = b[d[j]] + j + 1;
		}
	}
	printf("%d\n", b[0]);
	return 0;
}

Measured memory_bytes: 2360
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#define sq(x) ((x) * (x))
using namespace std;
const int BUF = 8;


int nPt;
int pt[BUF][2];

void read() {
    cin >> nPt;
    for (int i = 0; i < nPt; ++i) {
        cin >> pt[i][0] >> pt[i][1];
    }
}


void work() {
    int order[BUF];
    for (int i = 0; i < nPt; ++i) order[i] = i;


    double ans = 0;
    
    do {
        double sum = 0;
        for (int i = 0; i + 1 < nPt; ++i) {
            sum += sqrt(sq(pt[order[i]][0] - pt[order[i + 1]][0]) + sq(pt[order[i]][1] - pt[order[i + 1]][1]));
        }
        ans += sum;
    } while(next_permutation(order, order + nPt));

    for (int i = 1; i <= nPt; ++i) ans /= i;

    printf("%.10lf\n", ans);
}


int main() {
    read();
    work();
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<double> x(n);
	for (int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	vector<double> y(n);
	for (int j = 0; j < n; ++j) {
		cin >> y[j];
	}
	double d1 = 0;
	double d2 = 0;
	double d3 = 0;
	double dinf = -1;
	for (int k = 0; k < n; ++k) {
		double diffe = sqrt(pow((x[k] - y[k]), 2));
		d1 += diffe;
		d2 += pow(diffe, 2);
		d3 += pow(diffe, 3);
		if (dinf < diffe) {
			dinf = diffe;
		}
	}
	printf("%.5f\n", d1);
	printf("%.5f\n", sqrt(d2));
	printf("%.5f\n", pow(d3, 1.0 / 3.0));
	printf("%.5f\n", dinf);
	return 0;
}

Measured memory_bytes: 3404
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int64_t N,D;
    cin >> N >> D;
    vector<int64_t> X(N);
    vector<int64_t> Y(N);
    for(int i=0; i<N; i++)
    {
        cin >> X.at(i) >> Y.at(i);
    }
    int count=0;
    for(int i=0; i<N; i++)
    {
        if(sqrt(X.at(i)*X.at(i)+Y.at(i)*Y.at(i))<=D)
        {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 6484
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset> 
#include <cstdio> 
#include <vector>
using namespace std;
struct res{
	int number;
	int score;
	string str;
	bool operator <(const struct res tt)const{
		return str<tt.str||(str==tt.str&&score>tt.score);
	}		
}re[101];
int N,ans[101];
int main(){
	cin>>N;
	memset(re,0,sizeof(0));
	for(int i=1;i<=N;i++){
		cin>>re[i].str>>re[i].score;
		re[i].number=i;
	}
	sort(re+1,re+N+1);
	for(int i=1;i<=N;i++){
		cout<<re[i].number<<'\n';
	}
	return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import Counter
import itertools
import fractions
import datetime
from decimal import Decimal
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

s=II()
l=[s]
cnt = 1
while True:
    cnt += 1
    if s%2==0:
        s/=2
    else:
        s = 3*s+1
    if s in l:
        print(cnt)
        exit()
    else:
        l.append(s)

Measured memory_bytes: 5432
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    c = collections.Counter(a)
    s = 0
    for v in c.values():
        s += v * (v-1) // 2
    r = []
    for i in range(n):
        v = c[a[i]]
        r.append(s - v*(v-1)//2 + (v-1)*(v-2)//2)

    return JA(r, "\n")


print(main())





Measured memory_bytes: 42236