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

using namespace std;
/*
const long long MaxSize = 1e5 + 17;
long long n;

long long solve(vector<long long>& v)
{
    vector<long long> answer(n, 0);

    answer[n / 2] = v[0];

    long long mmx = n - 1, mmn = 2;
    for(long long i = n / 2 + 1, j = 1; i < n; ++i, ++j)
    {
        if(j & 1)
        {
            answer[i] = v[mmx];
            mmx -= 2;
        }
        else
        {
            answer[i] = v[mmn];
            mmn += 2;
        }
    }


    for(long long i = n / 2 - 1, j = 1, mx = n - 2, mn = 1; i >= 0; --i, ++j)
    {
        if(j & 1)
        {
           // cout << mx << '\n';
            answer[i] = v[mx];

            if(mx - 2 < mmx)
                --mx;
            else
                mx -= 2;

        }
        else
        {
           // cout << mn << '\n';
            answer[i] = v[mn];

            mn += 2;

        }

    }

    long long ans = 0;


    for(long long i = 0; i < n; ++i)
        cout << answer[i] << ' ' ;
    cout << '\n';
    for(long long i = 1; i < n; ++i)
        ans += abs(answer[i] - answer[i - 1]);

    return ans;
}

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

    cin >> n;

    vector<long long> v(n, 0);
    vector<long long> vv(n, 0);
    for(long long i = 0; i < n; ++i)
        cin >> v[i];

    for(long long i = 0; i < n; ++i)
        vv[i] = -v[i];

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

    cout << max(solve(v), solve(vv)) << '\n';


}*/

main()
{
 //   ios_base::sync_with_stdio(false);
   // cin.tie(NULL);

    long long n;
    cin >> n;

    long long nn = n * 2;

    for(long long i = 1; i * (i - 1) <= nn; ++i)
    {
        if(i * (i - 1) == nn)
        {
            cout << "Yes\n";

            cout << i << '\n';

            vector<vector<long long> > answer;

            vector<long long> v;

            for(long long j = 1; j <= i - 1; ++j)
                v.push_back(j);

            answer.push_back(v);


            long long last = i - 1;

            for(long long j = 1; j < i; ++j)
            {
                vector<long long> vv;
                for(long long k = 0; k < answer.size(); ++k)
                    vv.push_back(answer[k][j - 1]);

                for(long long k = answer.size(); k < i - 1; ++k)
                    vv.push_back(++last);

                answer.push_back(vv);
            }

            for(long long j = 0; j < answer.size(); ++j)
            {
                cout << answer[j].size() << ' ';
                for(long long k = 0; k < answer[j].size(); ++k)
                    cout << answer[j][k] << ' ';
                cout << '\n';
            }

            return 0;
        }
    }

    cout << "No\n";
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,f=0;
    cin>>n;
    while(n)
    {
        if(n%10==7)
        {
            f=1;
            break;
        }
        n/=10;
    }
    if(f==0)
    {
        cout<<"No"<<endl;
    }
    else
        cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
 
using namespace std;
 
#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009
#define pi 3.141592653589793238
 
typedef pair<int, int> P;
 
 
signed main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    long long X;
    scanf("%lld",&X);
    vector<int> table;
    REP(i,1000){
        table.push_back(pow(i,5));
    }
    REP(i,999){
        FOR(j,i,999){
            if(table[j]-table[i]==X){
                cout<<j<<" "<<i<<endl;
                break;
            }
            if(table[j]+table[i]==X){
                cout<<j<<" "<<-i<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 4136
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int dp[220000];
Int h[220000];
Int a[220000];
P flowers[220000];
Int n;

Int bit[220000];

void set_val(Int *bit, int ind, Int val){
    ind++;
    while(ind < 220000){
        bit[ind] = max(bit[ind], val);
        ind += ind & -ind;
    }
}

Int max_val(Int *bit, int ind){
    Int res = 0;
    ind++;
    while(ind){
        res = max(res, bit[ind]);
        ind -= ind & -ind;
    }
    return res;
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> h[i];
        flowers[i] = P(h[i], i);
    }
    for(int i = 0;i < n;i++)cin >> a[i];
    
    sort(flowers, flowers + n);

    Int ans = 0;
    for(auto p:flowers){
        int i = p.second;
        dp[i] = a[i];
        dp[i] = max_val(bit, i-1) + a[i];
        set_val(bit, i, dp[i]);
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10368
program ABC_063_B_Varied
    implicit none
	character(26) S
	integer i, j
	read(*, *) S
	do j = 1, len_trim(S)
	    do i = j + 1, len_trim(S)
		    if(S(j:j) == S(i:i)) then
			    write(*, *) 'no'
				goto 1
			end if
		end do
	end do
	write(*, *) 'yes'
1 continue
end program ABC_063_B_Varied

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

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

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

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

  printf("%d %d %f", a/b, a%b, 1.0*a/b);
}



Measured memory_bytes: 3208
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	S, _ := r.ReadString('\n')
	S = strings.TrimRight(S, " \t\n")
	T, _ := r.ReadString('\n')
	T = strings.TrimRight(T, " \t\n")

	if len(S)+1 == len(T) && strings.HasPrefix(T, S) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main() {
  int N,A ;
 
  cin >> N ;
  cin >> A ;
  
    
    
   if( N % 500 > A){ 
    cout << " No " << endl;
   }  
   else{
    cout << " Yes " <<endl;
   }
  /*if (op == "+") {
    cout << A + B << endl;
  }
  else if (op =="-"){
    cout << A - B << endl;
  }
  else if(op == "*"){
    cout << A * B << endl;
  }
  else if(op == "/" && B! = 0){
  	cout << A / B << endl;
  }
  else {
  	cout << "error" << endl;
  }*/
}


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

int main(){
  double A, B;
  cin >> A >> B;
  vector<int> C;
  int ans;
  bool not_exist;
  rep(i, 1300){
    double k = i * 0.08;
    double l = i * 0.1;
    if (floor(k) == A && floor(l) == B) {
      ans = i;
      break;
    }
  }
  
  if (ans != 0) cout << ans << endl;
  else cout << -1 << endl;
  
}

Measured memory_bytes: 256
N = int(input())
sp = []
for i in range(N):
    s, p = input().split()
    sp.append([i+1, s, int(p)])

sp = sorted(sp, key=lambda x: x[2], reverse=True)
sp = sorted(sp, key=lambda x: x[1])

for a in sp:
    print(a[0])

Measured memory_bytes: 3060
import sys
import numpy as np


def main():
    h, w = map(int, input().split())
    if w == 1 or h == 1:
        print(1)
        sys.exit(0)

    if w % 2 == 0:
        a = w // 2
        b = a

    else:
        a = int(np.ceil(w / 2))
        b = a - 1

    if h % 2 == 0:
        ans = (h//2)*(a+b)
    else:
        ans = (h//2)*(a+b)+a

    print(ans)


if __name__ == "__main__":
    main()


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int H, W, K;
bool fail(VVI& tab){
  bool res = false;
  for(int x=0;x<W;++x){
	for(int y=H-1;y>=0;--y){
	  if(tab[y][x] == 0){
		int ty;
		for(ty=y-1;ty>=0;--ty)
		  if(tab[ty][x])
			break;
		if(ty >= 0){
		  swap(tab[y][x], tab[ty][x]);
		  res = true;
		}
	  }
	}
  }
  return res;
}

int disapp(VVI& tab){
  int res = 0;
  REP(y,H){
	int prv = -1, n = 0;
	REP(x,W){
	  if(tab[y][x] != prv){
		if(n >= K && prv != 0){
		  for(int tx=x-1;tx>=0;--tx){
			if(tab[y][tx] != prv) break;
			res += prv;
			tab[y][tx] = 0;
		  }
		}
		prv = tab[y][x];
		n = 1;
	  }
	  else
		++n;
	}
	if(n >= K && prv != 0){
	  for(int tx=W-1;tx>=0;--tx){
		if(tab[y][tx] != prv) break;
		res += prv;
		tab[y][tx] = 0;
	  }
	}
  }
  return res;
}

int calc(int x, int y, VVI tab){
  int res = 0;
  tab[y][x] = 0;
  for(int i=0;fail(tab);++i){
	res += disapp(tab) * (1<<i);
  }
  return res;
}

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

  cin >> H >> W >> K;
  VVI xs(H, VI(W));
  REP(y,H){
	string s; cin >> s;
	REP(x,W)
	  xs[y][x] = s[x] - '0';
  }

  int ans = -1;
  REP(y,H) REP(x,W){
	ans = max(ans, calc(x,y,xs));
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn = 300010;

int ans[maxn];
int n, a, b, pres, t, cnt;

int main() {
    cin >> n >> a >> b;
    if (a+b-1 > n) {
        puts("-1");
        return 0;
    }
    if (1ll*a*b < 1ll*n) {
        puts("-1");
        return 0;
    }
    if (a+b-1 == n) {
        for (int i = 1; i <= a - 1; i++) printf("%d ", i);
        printf("%d ", n);
        for (int i = a+1; i <= n; i++) printf("%d ", n-i+a);
        return 0;
    }
    for (int i = 1; i <= a; i++) ans[i] = n - a + i;
    cnt = a;
    t = n-a;
    -- b;
    while (b) {
        pres = min(n-cnt-b+1, a);
        for (int i = 1; i <= pres; i++) ans[cnt+i] = t-pres+i;
        cnt += pres; --b; t -= pres;
    }
    if (cnt != n) {
        puts("-1");
        return 0;
    }
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>

int main(void){
  int n,ans;
  scanf("%d",&n);
  for(int i = (int)((n - 1) /1.08);;i++){
    if((int)(i * 1.08)==n){
      printf("%d\n",i);
      break;
    }else if((int)(i * 1.08)>n){
      printf(":(\n");
      break;
    }
  }
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  cout << (n/100 == n%10 ? "Yes" : "No") << endl;
  
}


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

struct edge {
    int u, v, cost;
    bool operator<(edge const& other) const {
        return cost < other.cost;
    }
};

class union_find {
public:
    union_find(int n)
        : par_(n, -1)
    {}
    void init(int n) {
        par_.assign(n, -1);
    }

    int root(int x) {
        return par_[x] < 0 ? x : par_[x] = root(par_[x]);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) {
            return false;
        } else {
            if(par_[x] < par_[y]) {
                par_[x] += par_[y];
                par_[y] = x;
            } else {
                par_[y] += par_[x];
                par_[x] = y;
            }
            return true;
        }
    }

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

    int size(int x) {
        return -par_[root(x)];
    }

private:
    std::vector<int> par_;
};

int main() {
    int n;
    while(cin >> n, n) {
        int m;
        cin >> m;
        vector<edge> es;
        for(int i=0; i<m; ++i) {
            int a, b, d;
            scanf("%d,%d,%d", &a, &b, &d);
            es.push_back((edge){a, b, d / 100 - 1});
        }
        sort(es.begin(), es.end());
        union_find uf(n);
        int res = 0;
        for(int i=0; i<m; ++i) {
            if(!uf.same(es[i].u, es[i].v)) {
                res += es[i].cost;
                uf.unite(es[i].u, es[i].v);
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        int n; cin >> n;
        vector<int> pf;
        while (n%2== 0) {
                pf.push_back(2);
                n/= 2;
        }
        for (int i = 3; i* i<= n; i++) {
                while (n%i== 0) {
                        pf.push_back(i);
                        n/= i;
                }
        }
        if (n> 1) pf.push_back(n);
        int cnt= 0, wh= 1;
        map<int, int> mp;
        lp(i, pf.size()) {
                if (mp.count(pf[i])) {
                        mp[pf[i]]++;
                        if (mp[pf[i]]== wh) {
                                mp[pf[i]]= 0;
                                wh++;
                                cnt+= 1;
                        }
                } else {
                        cnt++;
                        wh= 2;
                        mp[pf[i]]= 0;
                }
        }
        cout << cnt<< "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        lp(i, t) {
                solve();
        }
return 0;
}


Measured memory_bytes: 3640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            long k = in.nextLong();
            int[] A = new int[n], B = new int[m];

            for (int i = 0; i < n; i++)
                A[i] = in.nextInt();
            for (int i = 0; i < m; i++)
                B[i] = in.nextInt();

            long[] a = new long[n + 1];
            for (int i = 0; i < n; i++)
                a[i + 1] = A[i] + a[i];

            long[] b = new long[m + 1];
            for (int i = 0; i < m; i++)
                b[i + 1] = B[i] + b[i];

            int j = m;
            long res = 0;
            for (int i = 0; i <= n; i++) {
                if (a[i] > k)
                    break;
                while(b[j] + a[i] > k)
                    j--;
                res = Math.max(res, i + j);
            }

            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 63244
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

bool is_prime(int a)
{
    if(a<2) return false;
    else if(a==2) return true;
    else if(a%2==0) return false;

    int d = int(sqrt(a));
    for(int i=3;i<=d;i+=2)
        if(a%i==0) return false;
    
    return true;
}

int main()
{   
    int q;
    cin >> q;
    vector<int> l(q);
    vector<int> r(q);
    rep(i,q) cin >> l[i] >> r[i];

    const int n = 100001;
    vector<int> ac(n,0);

    rep2(i,1,n)
    {
        ac[i] = ac[i-1];
        if(is_prime(i) && is_prime((i+1)/2))
            ac[i]++;
    }

    rep(i,q)
        cout << ac[r[i]] - ac[l[i]-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    std::vector<int64_t> A;
    for (int64_t i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        A.push_back(t);
    }

    int64_t count = 0;
    for (int64_t i = 0; i < N - 1; ++i) {
        // 自分と右隣りでペア作る
        count += A[i] / 2;

        bool remain = A[i] & 1;

        if (remain && A[i+1] > 0) {
            count++;
            A[i+1]--;
        }
    }

    count += A[N-1] / 2;

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>

using namespace std;

int main() {
  char grid[111][111];
  char ans[111][111] = {0};  // 終端文字で埋める!!!

  int h, w;
  cin >> h >> w;

  for (int i = 0; i < h; i++) {
    cin >> grid[i];
  }

  for (int i = 0; i < h+2; i++) {
    for (int j = 0; j < w+2; j++) {
      if (i == 0 || i == h+1) {
        ans[i][j] = '#';
      } else if (j == 0 || j == w+1) {
        ans[i][j] = '#';
      } else {
        ans[i][j] = grid[i-1][j-1];
      }
    }
  }

  for (int i = 0; i < h+2; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,x,y;
vector<int>v[100002];
int in_deg[100002],vis[100002],dis[100002];
void dfs(int a)
{
    vis[a]=1;
    for(int i=0;i<v[a].size();i++)
    {
        int f=v[a][i];
        dis[f]=max(dis[f],dis[a]+1);
        in_deg[f]--;

        if(in_deg[f]==0)dfs(f);
    }
}
int main()
{
    cin>>n>>m;
    int mx=0;
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
       in_deg[y]++;
    }
   for(int i=1;i<=n;i++)
   {
       if(vis[i]==0&&in_deg[i]==0)dfs(i);
   }
   for(int i=0;i<=n;i++)mx=max(mx,dis[i]);
   cout<<mx<<endl;

}


Measured memory_bytes: 11520
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            if (s.Length % 2 == 0)
            {
                int ret = 0;
                char hikaku = s[s.Length / 2 - 1];
                for (int i = 0; i < s.Length / 2; i++)
                {
                    if (s[s.Length / 2 - (1 + i)] == hikaku && s[s.Length / 2 + i] == hikaku)
                    {
                        ret++;
                    }
                    else
                    {
                        break;
                    }
                }
                Console.WriteLine(s.Length / 2 + ret);
            }
            else
            {
                int ret = 0;
                char hikaku = s[(s.Length - 1) / 2];
                for (int i = 1; i <= (s.Length - 1) / 2; i++)
                {
                    if (s[(s.Length - 1) / 2 - i] == hikaku && s[(s.Length - 1) / 2 + i] == hikaku)
                    {
                        ret++;
                    }
                    else
                    {
                        break;
                    }
                }
                Console.WriteLine((s.Length + 1) / 2 + ret);
            }
        }
    }
}

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X,Y=MI()
    flag=0
    for i in range(X+1):
        temp=2*i+(X-i)*4
        if temp==Y:
            flag=1
            break
        
    if flag==1:
        print("Yes")
    else:
        print("No")

main()


Measured memory_bytes: 61776
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


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

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

struct xy{
    int x, y;
};


int a[100+10];
xy p[100+10];

int main(){

    //ちょっとちがうのでかえって修正

    int W,H, n;
    cin >> W >> H >> n;
    for(int i=0; i<n; i++){
        cin >> p[i].x >> p[i].y >> a[i];
    }
    xy left,right;

    //左端の点を記録
    left.x = left.y = 0;
    right.x = W; right.y = H;

    for(int j=0; j<n; j++){
        if(a[j] == 1){
            if(left.x < p[j].x) left.x = p[j].x;
        }else if(a[j] == 2){
            if(right.x > p[j].x) right.x = p[j].x;
        }else if(a[j] == 3){
            if(left.y < p[j].y) left.y = p[j].y;
        }else if(a[j] == 4){
            if(right.y > p[j].y) right.y = p[j].y;
        }
    }

    if(right.x > left.x && right.y > left.y){
        cout << (right.x - left.x)*(right.y - left.y) << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int main() {
	double sum,x,y,b,c;
	int a, d;
	a = 0;
	x = 0;
	y = 0;
	sum = 0;
	while (scanf("%d,%d",&d,&a)) {
		if (a == 0 && d == 0) break;
		b = (double)a;
		c = (double)d;
		x += c*cos(sum*3.1416/180);
		y += c*sin(sum*3.1416/180);
		sum += b;
	}
	cout << (int)y << endl;
	cout << (int)x << endl;
	return 0;
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    ll n;
    cin >> n;

    vector<ll> nums(n, 0);
    rep(i, n){
        cin >> nums[i];
    }

    ll out = 1e18;
    rep(idx, 2){
        ll sum = 0, base = idx, ans = 0;
        rep(i, n){
            if(base == 0 && sum + nums[i] < 0){
                ans += abs(sum + nums[i] - 1);
                sum = 1;
            }else if(base == 1 && sum + nums[i] > 0){
                ans += abs(sum + nums[i] + 1);
                sum = -1;
            }else if(sum + nums[i] == 0){
                sum = (base == 0 ? 1 : -1);
                ans += 1;
            }else{
                sum += nums[i];
            }
            base = 1 - base;
        }

        out = min(out, ans);
    }

    cout << out << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int x,y;
    cin>>x>>y;
    if(x==1&&y==1||x==3&&y==3||x==5&&y==5||x==7&&y==7||x==8&&y==8||x==10&&y==10||x==12&&y==12){
        cout<<"Yes";
    }
       else if(x==1&&y==3||x==1&&y==3||x==1&&y==5||x==1&&y==7||x==1&&y==8||x==1&&y==10||x==1&&y==12){
        cout<<"Yes";
    } 
    else if(x==3&&y==1||x==3&&y==3||x==3&&y==5||x==3&&y==7||x==3&&y==8||x==3&&y==10||x==3&&y==12){
        cout<<"Yes";
    }
    else if(x==5&&y==1||x==5&&y==3||x==5&&y==5||x==5&&y==7||x==5&&y==8||x==5&&y==10||x==5&&y==12){
        cout<<"Yes";
    }
    else if(x==7&&y==1||x==7&&y==3||x==7&&y==5||x==7&&y==7||x==7&&y==8||x==7&&y==10||x==7&&y==12){
        cout<<"Yes";
    }
    else if(x==8&&y==1||x==8&&y==3||x==8&&y==5||x==8&&y==7||x==8&&y==8||x==8&&y==10||x==8&&y==12){
        cout<<"Yes";
    }
   else if(x==12&&y==1||x==12&&y==3||x==12&&y==5||x==12&&y==7||x==12&&y==8||x==12&&y==10||x==12&&y==12){
        cout<<"Yes";
    }
    else if (x==6&&y==4||x==6&&y==6||x==6&&y==9||x==6&&y==11 ){
        cout<<"Yes";
    }
    else if (x==4&&y==4||x==4&&y==6||x==4&&y==9||x==4&&y==11 ){
        cout<<"Yes";
    }
    else if (x==9&&y==4||x==9&&y==6||x==9&&y==9||x==9&&y==11 ){
        cout<<"Yes";
    }
    else if (x==11&&y==4||x==11&&y==6||x==11&&y==9||x==11&&y==11 ){
        cout<<"Yes";
    }
    else if(x==2&&y==2){
        cout<<"Yes";
    }
    else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int n,k,a[100005],ans;
int main()
{
	cin>>n>>k;
	for (int i=0;i<n;++i) cin>>a[i];
	int x=min_element(a,a+n)-a;
	ans+=(x+k-1)/(k-1);x=ans*(k-1);
	ans+=(n-1-x+k-2)/(k-1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int min = Integer.MAX_VALUE;
	int max = 0;
	int val = 0;
	for(int i=0;i<N;i++){
	    val = sc.nextInt();
	    if(val > max) max = val;
	    if(val < min) min = val;
	}
	System.out.print(max-min);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define oset tree < int ,  null_type ,  less ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define endl '\n'
#define int long long int
#define db long double
#define str string
#define mod 1000000007
#define ff first
#define ss second
#define pqi priority_queue<int>
#define vi vector<int>
#define si set<int>
#define li list<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define For(i,s,n) for(int i=s;i<n;i++)
#define read(a) {for(auto &x:a)cin >> x;}
#define print(x) cout<<x<<endl
#define mat2D(T,r,c) vector<vector<int> > T(r,vector<int>(c))
#define vec2D vector<vector<int> >
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug(x) {for(auto i :x) cout << i << " ";cout << endl;}
#define debPair(x) {for(auto i :x) cout << i.ff << " " << i.ss << endl;}

void solve() {
	int k;
	cin >> k;
	for (int i = 0; i < k; i++) cout << "ACL";
}

int32_t main() {
	fastIO;
	/*
	int t;
	cin >> t;
	For(i, 1, t + 1) {
	  // cout << "Case " << i << ": ";
	  solve();
	}*/
	solve();
	return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int ans=0,i;
  cin>>s;
  for(i=0;i<4;i++){
    if(s[i]=='+'){
      ans+=1;
    }
    else{
      ans-=1;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
# import itertools
# import math

import sys
input = sys.stdin.readline


def solve(N, P):
    PP = sorted(P)
    cnt = 0
    for l1, l2 in zip(P, PP):
        if l1 != l2:
            cnt += 1

    return 'YES' if cnt <= 2 else 'NO'


N = int(input())
# S = input()
# A, B = map(int, input().split())
P = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, P))


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

using namespace std;

int main(){
    string s_old,t_old;
    string s,t,ans="";
    cin>>s_old>>t_old;

    s = " " + s_old;
    t = " " + t_old;
    

    vector<vector<int>>dp(s.length(),vector<int>(t.length(),0));
    //vector<vector<string>>dp(s.length(),vector<string>(t.length(),""));
    
    for(int i=1; i < static_cast<int>(s.length()); i++){
        for(int j=1;j < static_cast<int>(t.length()); j++){
            
            if(s[i]==t[j]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            dp[i][j]=max({dp[i][j],dp[i-1][j],dp[i][j-1]});
            /* 
            if(s[i]==t[j]){
                dp[i][j] = dp[i-1][j-1] + s[i];
            }
            if(dp[i-1][j].length()>dp[i][j].length())
                dp[i][j] = dp[i-1][j];
            if(dp[i][j-1].length()>dp[i][j].length())
                dp[i][j] = dp[i][j-1];
            */
        }
    }
    //int index = dp[s.length()-1][t.length()-1];

    string lcs = "";
    int m = static_cast<int>(s.length())-1;int n = static_cast<int>(t.length())-1;
    while(m>0 && n>0){
        if(s[m]==t[n]){
            //cout<<s[m]<<endl;
            lcs = s[m] + lcs;
            m--;n--;
        }

        else if (dp[m-1][n] >= dp[m][n-1]) 
            m--; 
        else
            n--; 
    } 

    

    cout<<lcs;
    return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const ll max_co = 3234600000;
vl ans;
int main(){
    std::cout<<std::fixed<<std::setprecision(10);
    ld n,k;
    cin>>n>>k;
    ld ans =0;
    rep2(i,1,n+1){
        if(i>=k){
            ans+=1./n;
            continue;
        }
        ld a = i;
        int b=ceil(log2((ld)k/a));
        ans+=(1./n)*pow(0.5,b);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N,K;
	cin>>N>>K;
	
	int ans = 0;
	while(N!=0){
		ans++;
		N/=K;
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int N; cin >> N;
    for(int i = 0; i <= N; ++i){
        double e = i * 1.08;
        if((int)e == N){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}


Measured memory_bytes: 256
a,b,c,k = gets.chomp.split(' ').map(&:to_i)
sum = 0

def result(sum)
  puts sum
  exit
end

if k < a
  sum += k
  result(sum)
else
  k -= a
  sum += a
end

if k-b <= 0
  result(sum)
else
  k -= b
  sum += k*-1
  result(sum)
end

Measured memory_bytes: 14276
#include<stdio.h>
#include<stdlib.h>

#define MAX 10001
#define INFTY (1<<20)
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define NIL -1

struct node{
	struct node *next;
	int v;
	int h;
};

typedef struct node *NodePointer;
NodePointer nil;

NodePointer data[MAX];
int d[MAX];
int color[MAX];
int pi[MAX];

void create_node(int r, int v, int c){
	NodePointer n;
	n =(NodePointer)malloc(sizeof(struct node));
	n->v = v;
	n->h = c;
	n->next = data[r]->next;
	data[r]->next = n;

}

int main( void ){
	
	int ex;
	int i , j;
	int n , u , k , v , c , r;
	int uid;
	int mc;
	
	for( i = 0; i < MAX; i++ ){
		data[i] = (NodePointer)malloc(sizeof(struct node));
		data[i]->v = INFTY;
		data[i]->h = INFTY;
		data[i]->next  = NULL;
	}
	
	scanf( "%d" , &n );
	
	for( i = 1; i <= n; i++ ){
		
		d[i] = INFTY;
		color[i] = WHITE;
		pi[i] = NIL;
		
		scanf( "%d%d" , &uid , &k );
		r = uid;
		for( j = 0; j < k; j++ ){
		scanf( "%d%d" , &v , &c );
		create_node( r , v , c );
	    }
	}
	
	d[0] = 0;
	
	for( ex = 0; ; ex++ ){
		mc = INFTY;
		for( j = 0; j < n; j++ ){
			if( color[j] != BLACK && d[j] < mc ){
				mc = d[j];
				u = j;
			}
		}
		
		if( mc == INFTY ){
			break;
		}

		color[u] = BLACK;
		    
		nil = data[u]->next; 
		    
		while(nil != NULL){
			if(color[nil->v] != BLACK && d[u]+nil->h<d[nil->v]){
				pi[nil->v] = u;
				d[nil->v] = nil->h+d[u];
			}
			nil = nil->next;
		}
	}
	
	for( i = 0; i < n; i++ ){
		printf("%d %d\n",i,d[i]);
	}
		
	return 0;
}


Measured memory_bytes: 17744
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> s;
    s = s.substr(0, 4) + " " + s.substr(4, 8);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

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

using namespace std;
using namespace __gnu_pbds;

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

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth (1 based indexing) smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

int main()
{
	FAST_IO;

    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    ll ra[a], ga[b], ca[c], pref = 0, rr = 0, gg = 0, cc = 0;
	vector<pair<ll,ll>>v;
    for(int i=0;i<a;i++) cin >> ra[i], v.pb(mp(ra[i], 0));
    for(int i=0;i<b;i++) cin >> ga[i], v.pb(mp(ga[i], 1));
    for(int i=0;i<c;i++) cin >> ca[i], v.pb(mp(ca[i], 2));
    sort(v.rbegin(), v.rend());
	for(int i=0;i<sz(v);i++)
	{
		if(rr == x && v[i].second == 0 || gg == y && v[i].second == 1) continue;
		pref += v[i].first;
		if(v[i].second == 0) rr += 1;
		else if(v[i].second == 1) gg += 1;
		else cc += 1;
		if(x + y - rr - gg <= cc)
		{
			cout << pref << endl;
			return 0;
		}
	}
    return 0;
}

Measured memory_bytes: 12268
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

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

	int k = M / N;
	FORR(i, k, 1) {
		if (M%i == 0) {
			cout << i << endl;
			break;
		}
	}


	return 0;
}

Measured memory_bytes: 256
import numpy as np
n,k,q=map(int,input().split()) 
a=[int(input()) for _ in range(q)]

ans=np.zeros(n)

for i in range(q):
    ans[a[i]-1]+=1

for i in range(n):
    if k+ans[i]>q:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 18276
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const int MAXN = 200005;
const ll MOD = 998244353;
char str[MAXN];
int y[MAXN];
struct Mint {
	int val;
	Mint() { val = 0; }
	Mint(const ll& x) {
    val = (-MOD <= x && x <= MOD) ? x : x % MOD;
		if (val < 0) val += MOD;
  }
	friend bool operator==(const Mint& a, const Mint& b) { return a.val == b.val; }
	friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
	friend bool operator<(const Mint& a, const Mint& b) { return a.val < b.val; }
	Mint& operator+=(const Mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
  Mint& operator-=(const Mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
  Mint& operator*=(const Mint& m) { val = (ll)val * m.val % MOD; return *this; }
  friend Mint pow(Mint a, ll p) {
		Mint ans = 1;
		for (; p; p >>= 1, a *= a) if (p & 1) ans *= a;
		return ans;
	}
  Mint& operator/=(const Mint& m) { return *this *= pow(m, MOD - 2); }
  Mint& operator++() { return *this += 1; }
  Mint& operator--() { return *this -= 1; }
  Mint operator++(int) { Mint result(*this); *this += 1; return result; }
  Mint operator--(int) { Mint result(*this); *this -= 1; return result; }
  Mint operator-() const { return Mint(-val); }
  friend Mint operator+(Mint a, const Mint& b) { return a += b; }
	friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
	friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
	friend Mint operator/(Mint a, const Mint& b) { return a /= b; }
	friend ostream& operator<<(ostream& os, const Mint& x) { return os << x.val; }
};
Mint g[MAXN * 2], p2[MAXN * 2];
int main() {
	p2[0] = 1;
	for (int i = 1; i < MAXN * 2; ++i) p2[i] = p2[i - 1] * 2;
	int n;
	scanf("%d%s", &n, str);
	for (int d = 1; d < 2 * n; ++d) {
		if (2 * n % d || n % d == 0) {
			g[d] = 0;
			continue;
		}	
		assert(d % 2 == 0);
		// y[i] = y[i + d]
		for (int i = 0; i < d / 2; ++i) {
			if (str[i] == '1') {
				g[d] += p2[d / 2 - i - 1];
			}
			y[i] = str[i] - '0';
		}
		bool same = true;
		for (int i = d / 2; i < n; ++i) {
			y[i] = 1 - y[i - d / 2];
			if (y[i] < str[i] - '0') {
				break;
			}
			if (y[i] > str[i] - '0') {
				same = false;
				break;
			}
		}
		if (same) ++g[d];
		for (int e = d + d; e <= 2 * n; e += d) {
			g[e] -= g[d];
		}
	}
	++g[2 * n];
	for (int i = 0; i < n; ++i) {
		if (str[i] == '1') {
			g[2 * n] += p2[n - i - 1];
		}
	}
	Mint ans = 0;
	for (int d = 1; d <= 2 * n; ++d) {
		ans += g[d] * d;
	}
	printf("%lld\n", ans.val);
}


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

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

    int C[N], S[N], F[N];
    for (int i = 0; i < N - 1; ++i) {
        std::cin >> C[i] >> S[i] >> F[i];
    }

    for (int i = 0; i < N; ++i) {
        int t = 0;
        for (int j = i; j < N - 1; ++j) {
            if (t < S[j]) {
                t = S[j] + C[j];
            } else if (t % F[j] == 0) {
                t += C[j];
            } else {
                t += (F[j] - t % F[j]);
                t += C[j];
            }
        }

        std::cout << t << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wsign-compare"

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, A) for (auto & a : A)
#define all(a) (a).begin (), (a).end ()
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+6+7;

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	int tc = 1; //cin >> tc;
	while (tc--)
	{
		int i, j, n, b;
		cin >> n >> b;
		cout << floor (log (n)/log (b)) + 1 << '\n';
	}

	return 0;
}



Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    int h_input, w_input, d_min;
    while (true) {
        bool has_output = false;
        cin >> h_input >> w_input;
        if (h_input == 0) {
            break;
        }
        d_min = h_input*h_input+w_input*w_input;
        for (int d=d_min; !has_output; d++) {
            int h_begin = (d_min==d? h_input+1: 1);
            for (int h=h_begin; 2*h*h<d; h++) {
                int w;
                for (w=h+1; h*h+w*w<d; w++);
                if (h*h+w*w == d) {
                    cout << h << ' ' << w << endl;
                    has_output = true;
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 1160
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	d := 2
	ans := 0

	for d*d <= n {
		if n%d != 0 {
			d++
			continue
		}
		z := d
		for n%z == 0 {
			n /= z
			z *= d
			ans++
		}
		for n%d == 0 {
			n /= d
		}
	}
	if n != 1 {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1780
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

int f(int n, int m) {
  n %= m;
  while (n < 0) n += m;
  int ret = 1;
  while (n) n = n % __builtin_popcount(n), ret++;
  return ret;
}

int main() {
  int N;
  string S;
  cin >> N >> S;
  int cnt = count(S.begin(), S.end(), '1');
  int mod1 = max(1, cnt - 1);
  int mod2 = cnt + 1;
  vector<int> V1(N), V2(N), X(N), Y(N);
  int acc1 = 0, acc2 = 0;
  for (int i = N - 1, now1 = 1, now2 = 1; i >= 0; i--, (now1 *= 2) %= mod1, (now2 *= 2) %= mod2) {
    (acc1 += (V1.at(i) = (S.at(i) - '0') * now1) %= mod1) %= mod1;
    (acc2 += (V2.at(i) = (S.at(i) - '0') * now2) %= mod2) %= mod2;
    X.at(i) = now1 % mod1;
    Y.at(i) = now2 % mod2;
  }
  for (int i = 0; i < N; i++) {
    int ans;
    if (S.at(i) == '1' && cnt == 1) ans = 0;
    else if (S.at(i) == '1') ans = f(acc1 - X.at(i), mod1);
    else ans = f(acc2 + Y.at(i), mod2);
    cout << ans << "\n";
  }
}


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


int main(){
    ll n,x;cin>>n>>x;
    ll a[100010],cn=0;
    rep(i,0,n)cin>>a[i];
    rep(i,0,n-1){
        if(a[i]+a[i+1]>x){
            ll de=a[i]+a[i+1]-x;
            if(a[i+1]<de){
                ll ov=de-a[i+1];
                a[i+1]=0;
                a[i]-=ov;
            }
            else a[i+1]-=de;
            cn+=de;
        }
    }
    cout<<cn<<endl;
}







Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;


int main()
{
	fast;
	ll n, k;
	cin >> k >> n;
	ll a[n + 2];
	for (int i = 0; i < n ; i++ ) cin >> a[i];
	ll dist = 0;
	for (int i = 0; i < n; i++) {
		ll d  = 0;
		if (i != n - 1) {
			d = a[i + 1] - a[i];
		}
		else {
			d = k - a[n - 1] + a[0];
		}
		//cout << d << endl;
		dist = max(dist, d);
	}

	cout << k - dist << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	string sa,sb,sc;cin>>sa>>sb>>sc;
	int ai=0,bi=-1,ci=-1,an=sa.size(),bn=sb.size(),cn=sc.size();
	char now=sa[0];
	while(1){
		//game
		if(now=='a'){
			ai++;
			now=sa[ai];
		}
		else if(now=='b'){
			bi++;
			now=sb[bi];
		}
		else if(now=='c'){
			ci++;
			now=sc[ci];
		}
		//cout<<ai<<" "<<bi<<" "<<ci<<"\n";
		//ans
		if(ai==an){
			cout<<'A'<<"\n";
			return 0;
		}
		else if(bi==bn){
			cout<<'B'<<"\n";
			return 0;
		}
		else if(ci==cn){
			cout<<'C'<<"\n";
			return 0;
		}
	}
}

Measured memory_bytes: 256