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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

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

//実行部
void Main()
{
  ll n; cin >> n;
  str s; cin >> s;
  ll front = 0, back = 0, flag = MAX;
  rep(i, s.size())
  {
    if(s[i] == 'E') back++;
  }
  if(s[0] == 'E') back--;
  flag = back + front;
  for(ll i = 1;i < s.size();i++)
  {
    if(s[i - 1] == 'W') front++;
    if(s[i] == 'E') back--;
    flag = min(flag, back + front);
  }
  fin(flag);
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    int N, K, C;
    cin >> N >> K >> C;
    string S;
    cin >> S;
    vector<int> dp1(N, 0), dp2(N, -1), ok(4 * N, -1);
    dp1[N - 1] = S[N - 1] == 'o' ? 1 : 0;
    // dp1[N - 1] = S[N - 1] == 'o' ? N - 1 : -1;
    ok[N - 1] = S[N - 1] == 'o' ? N - 1 : -1;
    for (int i = N - 2; i >= 0; --i) {
        if (S[i] == 'o') {
            ok[i] = i;
            int next_day = ok[i + C + 1];
            if (next_day >= 0) {
                dp1[i] = dp1[next_day] + 1;
                // dp2[i] = dp2[next_day];
            } else {
                dp1[i] = 1;
                // dp2[i] = i;
            }
        } else {
            ok[i] = ok[i + 1];
        }
    }
    // for (const auto d : dp1) { cout << d << " "; }
    // cout << endl;
    
    int last = -C - 1, nwd = 0;
    vector<int> res;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'x') {
            continue;
        }
        // cout << i << ":" << last << " " << nwd << endl;
        int next_day = ok[max(last + C + 1, i + 1)];
        if (next_day >= 0) {
            if (nwd + dp1[next_day] < K) { res.push_back(i); }
        } else {
            if (nwd < K) { res.push_back(i); }
        }
        if (i - last >= C + 1 && S[i] == 'o') {
            last = i; nwd++;
        }
    }
    for (const auto r : res) {
        cout << r + 1 << endl;
    }
}

Measured memory_bytes: 7288
#include<iostream>              //因为给出的数据不大，所以这是暴力方法 
using namespace std;
int main()
{
	int c[4][4];
	for(int i=1;i<=3;i++)
	{
		for(int j=1;j<=3;j++)
		cin>>c[i][j];
	}
	int flag=1;
	for(int k=-1000;k<=1000;k++)
	{
		int a2,a3,b1,b2,b3;
		int a1=k;
		b1=c[1][1]-k;
		b2=c[1][2]-k;
		b3=c[1][3]-k;
		a2=c[2][1]-b1;
		a3=c[3][1]-b1;
		if(c[2][2]!=a2+b2)flag=0;
		if(c[2][3]!=a2+b3)flag=0;
		if(c[3][2]!=a3+b2)flag=0;
		if(c[3][3]!=a3+b3)flag=0;
		if(flag)break; 
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

string S;

void solve() {
    string dream = "dream", dreamer = "dreamer", erase = "erase", eraser = "eraser";
    reverse(dream.begin(), dream.end());
    reverse(dreamer.begin(), dreamer.end());
    reverse(erase.begin(), erase.end());
    reverse(eraser.begin(), eraser.end());
    int idx = 0;
    string T;
    while (idx < S.length()) {
        if (S[idx] == 'r') {
            if (S[idx + 2] == 's') {
                REP(i, 6) {
                    if (eraser[i] != S[idx + i]) {
                        cout << "NO" << endl;
                        return;
                    }
                }
                idx += 6;
            } else {
                REP(i, 7) {
                    if (dreamer[i] != S[idx + i]) {
                        cout << "NO" << endl;
                        return;
                    }
                }
                idx += 7;
            }

        } else if (S[idx] == 'e') {
            REP(i, 5) {
                if (erase[i] != S[idx + i]) {
                    cout << "NO" << endl;
                    return;
                }
            }
            idx += 5;

        } else if (S[idx] == 'm') {
            REP(i, 5) {
                if (dream[i] != S[idx + i]) {
                    cout << "NO" << endl;
                    return;
                }
            }
            idx += 5;

        } else {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main() {
    cin >> S;
    reverse(S.begin(), S.end());
    solve();
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main() {
  int n,A,B;
  int cnt2 = 0;
  int cnt1 = 0;
  cin >> n >> A >> B;
  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'a') {
      if (cnt1+cnt2 < A+B) {
        cout << "Yes" << endl;
        cnt2++;
      }
      else cout << "No" << endl;
    }
    if (s.at(i) == 'b') {
      if (cnt1+cnt2 < A+B && cnt1 < B) {
        cout << "Yes" << endl;
        cnt1++;
      }
      else cout << "No" << endl; 
    }

    if (s.at(i) == 'c') {
      cout << "No" << endl;
    }
  }
}  

Measured memory_bytes: 896
m, k = map(int, input().split())

if m == 0:
    if k == 0:
        print('0 0')
    else:
        print('-1')
elif m == 1:
    if k == 0:
        print('0 0 1 1')
    elif k >= 1:
        print('-1')
else:
    if k < 2 ** m:
        l = []
        for i in range(2 ** m):
            if i != k:
                l.append(i)

        ans = l + [k] + l[::-1] + [k]

        ans2 = ''
        for a in ans:
            ans2 += str(a) + ' '
        print(ans2[:-1])
    else:
        print(-1)


Measured memory_bytes: 16524
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    long long int n;
    int x;
    vector<int> v;
    cin>>n;
    if(n==0){
      cout<<0<<endl;
      return 0;
    }
    while (n!=0) {
      x = n%(-2);
        n /= -2;
        if (x<0){
            x+=2;
            n++;
        }
        v.pb(x);
    }
    repb(i,v.size()-1){
      cout<<v[i];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#include <list>
#include <set>
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
using namespace std;
using ll = long long;
const int INF = 1e9 + 1;
ll MOD = 1e9+7;

string N;
ll ans = 0;

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

    string S, T;
    map<char, char> sm, tm;
    
    cin >> S >> T;
    REP(i, S.size()){
        if(sm.find(S[i]) == sm.end() && tm.find(T[i]) == tm.end()){
            sm[S[i]] = T[i];
            tm[T[i]] = S[i];
        }else if(sm[S[i]] != T[i] || tm[T[i]] != S[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 916
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *prev;
  struct node *next;
  long key;
};
typedef struct node * NP;
NP MN(long);
void IN(NP);
void DN(NP);
void FI(long);
NP dummy;

int main(){
  long int val,i,n;
  char op[12];
  NP roop;

  scanf("%ld",&n);
  dummy = MN(0);

  for(i=0;i<n;i++){
    scanf("%s",op);
    
    if(strcmp(op,"insert") == 0){
      scanf("%ld",&val);
      IN(MN(val));
    }
    else if(strcmp(op,"delete") == 0){
      scanf("%ld",&val);
      FI(val);
    }
    else if(strcmp(op,"deleteFirst") == 0){
      DN(dummy->next);
    }
    else if(strcmp(op,"deleteLast") == 0){
      DN(dummy->prev);
    }
  }

  for(roop=dummy->next;roop!=dummy;roop =roop->next){
    printf("%ld",roop->key);
    if(roop->next != dummy)printf(" ");
  }  
  printf("\n");

  return 0;
}


void FI(long value){
  NP n;
  dummy->key = value;
  for(n = dummy->next;;n=n->next){
    if(n->key == value)break;
  }
  if(n != dummy)DN(n);
    
}


void DN(NP th){
  th->prev->next = th->next;
  th->next->prev = th->prev;
  th->prev = th->next = th;
  free(th);
  //delete th;
}


void IN(NP newn){
  newn->next = dummy->next;
  newn->next->prev = newn;
  dummy->next = newn;
  newn->prev = dummy;
}

NP MN(long key){
  NP no = (NP)malloc(sizeof(struct node));
  //n = new struct node();
  no->prev = no;
  no->next = no;
  no->key = key;
  return no;
} 

Measured memory_bytes: 15000
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

class UnionFind{

private:
    vector<int> data;

  public:
      UnionFind(){};
      UnionFind(int size){
          data = vi(size, -1);
      }

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

    bool unite(int x, int y){
        if(same(x,y)) return(false);
        x = find(x);
        y = find(y);
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return(true);
    }

    int find(int x){
        if(data[x] < 0) return(x);
        return(data[x] = find(data[x]));
    }

    int size(int x){
        return(-data[find(x)]);
    }

};

signed main(void) {
    int n,m;
    cin >> n >> m;
    vi a(m),b(m),ans(m,n*(n-1)/2);
    rep(i,m) cin >> a[i] >> b[i], a[i]--, b[i]--;
    UnionFind uf(n);
    for(int i = m-1; i > 0; i--){
        int t = 0;
        if(!uf.same(a[i],b[i])){
            t = uf.size(a[i]) * uf.size(b[i]);
            uf.unite(a[i],b[i]);
        }
        ans[i-1] = ans[i] - t;
    }
    rep(i,m)cout << ans[i] << endl;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  if (S.at(S.size() - 1) == '<')
    S = S + '>';
  else
    S = S + '<';
  ll ans = 0, p = 0, m = 0, M = 0;
  char op = '>';
  for (int i = 0; i < S.size(); i++) {
    if (op == '>' && S.at(i) == '<') {
      ans += ((m * (m + 1)) / 2);
      ans -= min(M, m);
      M = 0;
      m = 1;
      op = '<';
      // cout << ans << endl;
    } else if (op == '<' && S.at(i) == '>') {
      ans += ((m * (m + 1)) / 2);
      M = m;
      m = 1;
      op = '>';
      // cout << ans << endl;
    } else if (op == S.at(i)) {
      m++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1820
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) puts("error")
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;GG(e<0);
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}
        return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=4e3+10;

    int C[N][N],bin[N];
    void main()
    {
        C[0][0]=1;for(int i=1;i<N;i++){C[i][0]=1;for(int j=1;j<=i;j++)C[i][j]=mm(C[i-1][j-1]+C[i-1][j]);}
        bin[0]=1;for(int i=1;i<N;i++) bin[i]=mm(bin[i-1]<<1);

        int k=qread(),n=qread();
        for(int m=2;m<=k+k;m++)
        {
            int a=0,b=0,c=0;
            for(int i=1;i<=k;i++)
            {
                if(m-i>=1 and m-i<=k)
                {
                    int oth=m-i;
                    if(oth==i) c++;//0/1
                    else if(i<oth) a++;//any
                }
                else b++;//any
            }
            // printf("m=%d %d %d %d\n",m,a,b,c);
            ll sum=0;
            for(int i=0;i<=a;i++)
                add(sum, 1ll*bin[i]*C[a][i]%MOD*C[n+b-1][i+b-1]%MOD );
                // for(int j=0;j<=b;j++) add(sum,1ll*bin[i]*C[a][i]%MOD*C[b][j]%MOD*C[n-1][i+j-1]%MOD );
            if(c) for(int i=0;i<=a;i++)
                add(sum, 1ll*bin[i]*C[a][i]%MOD*C[n+b-2][i+b-1]%MOD );
                // for(int j=0;j<=b;j++) add(sum,1ll*bin[i]*C[a][i]%MOD*C[b][j]%MOD*C[n-2][i+j-1]%MOD );
            write2(sum);
        }
    }//(ans+MOD)%MOD
};
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 61568
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    vec b(m);
    rep(i, m) cin >> b[i];
    mat a(n, vec(m));
    rep(i, n) {
        rep(j, m) {
            cin >> a[i][j];
        }
    }

    int res = 0;

    rep(i, n) {
        int dt = inner_product(all(a[i]), b.begin(), c);
        if (dt > 0) res++;
    }

    cout << res << endl;
    return 0;
}

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

#define rep(i,n) for(int (i) = 0;i < (int)(n);(i)++)
int main(){
    int n,num;
    cin >> n;
    char suit;
    vector<char> deck(52,'x');
    rep(i,n){
        cin >> suit >> num;
        if(suit == 'H') num += 13;
        else if(suit == 'C') num += 26;
        else if(suit == 'D') num += 39;
        deck[num-1] = 'o';
    }
    rep(i,52){
        if(deck[i] == 'x'){
            if(i / 13 == 0) suit = 'S';
            else if(i / 13 == 1) suit = 'H';
            else if(i / 13 == 2) suit = 'C';
            else if(i / 13 == 3) suit = 'D';
            num = i % 13 + 1;
            cout << suit << " " << num << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pii pair <int,int>
ll m=1000000007;

int main()
{
	fast;
	map<int,char>m;
	for(int i=0;i<26;i++)
		m[(i+1)%26]=(char)(97+i);
	ll n;cin>>n;
	stack<char>s;
	while(n>0)
	{
		int rem=n%26;
		s.push(m[rem]);
		if(rem)
			n-=rem;
		else
			n-=26;
		n/=26;
	}
	while(!s.empty())
	{
		cout<<s.top();
		s.pop();
	}
}

Measured memory_bytes: 3604
n=int(input())
S=[input() for _ in range(n)]

ans,acnt,bcnt,abcnt=0,0,0,0
for s in S:
  ans+=s.count('AB')
  if s[-1]=='A' and s[0]=='B': abcnt+=1
  elif s[-1]=='A': acnt+=1
  elif s[0]=='B': bcnt+=1
if abcnt:
  ans+=abcnt-1
  if acnt:
    ans+=1
    acnt-=1
  if bcnt:
    ans+=1
    bcnt-=1
ans+=min(acnt,bcnt)
print(ans)

Measured memory_bytes: 3700
from collections import Counter
def solve():
  N = int(input())
  A = list(map(int, input().split()))
  c = Counter(A)
  Q = int(input())
  ans = [0]*Q
  total = sum(A)
  for i in range(Q):
    x,y = map(int, input().split())
    total += c[x]*(y-x)
    c[y] += c[x]
    c[x] = 0
    ans[i] = total
  return ans
print(*solve(),sep='\n')

Measured memory_bytes: 96828
import java.io.*;
import java.util.Arrays;

class Main
{
    public static void main (String[ ] args) throws Exception
    {
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        StringBuilder sb = new StringBuilder();
        int[][][] room = new int[4][3][10];
        
        int n = Integer.parseInt(br.readLine());
        
        for(int i = 0; i < n; i++)
        {
            String[] strArr = (br.readLine()).split(" ");
            int b = Integer.parseInt(strArr[0]);
            int f = Integer.parseInt(strArr[1]);
            int r = Integer.parseInt(strArr[2]);
            int v = Integer.parseInt(strArr[3]);
            
            room[b-1][f-1][r-1] += v;
        }
        
        for(int i = 0; i < 4; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                for(int k = 0; k < 10; k++)
                {
                    sb.append(" ").append(room[i][j][k]);
                }
                sb.append("\n");
            }
            if(i != 3)
            {
                sb.append("####################\n");
            }
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 24576
#include <iostream>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0;
  int ans = 0;
  rep(i, n){
    if(s[i] == 'I') x++;
    if(s[i] == 'D') x--;
    ans = max(ans, x);
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;



int n, m;

int main() {

	cin >> n >> m;

	if (n != m)cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

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

#define lld long long

int gcd(int a, int b) {
    int t;          // 補助変数
    while(b != 0) { // 他方が0になるまで
        t = a % b;
        a = b;
        b = t; // 一方を剰余に置き換える
    }
    return a; // 他方が0になったときの一方がGCD
}

int gcd3(int a, int b, int c) {
    int s, t;
    s = gcd(a, b);
    t = gcd(c, s);
    return t;
}

int main() {
    lld K;
    lld sum = 0;
    cin >> K;

    for(size_t i = 1; i <= K; i++) {
        for(size_t j = 1; j <= K; j++) {
            for(size_t k = 1; k <= K; k++) {
                sum += gcd3(i, j, k);
            }
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3636
def choose(n,r):
    res = 1
    fac = 1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac,MOD-2,MOD)%MOD        

n,a,b = list(map(int,input().split()))
MOD = 10**9+7
t=0
ans = pow(2,n,MOD)-1


ans -= choose(n,a)
ans -= choose(n,b)

ans = ans % MOD
print(int(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        vector<int> V(n);
        for(int i=0;i<n;i++){
            string s;
            cin>>s;
            V[i]=s.size();
        }
        for(int i=0;i<n;i++){
            int j=i;
            int cnt=0;
            while(cnt<5&&j<n)cnt+=V[j++];
            if(cnt!=5) continue;
            cnt=0;
            while(cnt<7&&j<n)cnt+=V[j++];
            if(cnt!=7) continue;
            cnt=0;
            while(cnt<5&&j<n)cnt+=V[j++];
            if(cnt!=5) continue;
            cnt=0;
            while(cnt<7&&j<n)cnt+=V[j++];
            if(cnt!=7) continue;
            cnt=0;
            while(cnt<7&&j<n)cnt+=V[j++];
            if(cnt!=7) continue;
            else{
                cout<<i+1<<endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3184
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iterator>
#include <utility>
#include <iomanip>
#include <cmath>
#include <climits>
#include <cassert>
#include <stdio.h>
#include <string.h>
#include <numeric>

using namespace std;

void solve() {
  int l;
  cin >> l;
  std::vector<long long> vv(l);    for (int i = 0; i < l; i++) { cin >> vv[i]; }

  sort( vv.begin(), vv.end() );
  reverse( vv.begin(), vv.end() );
  auto sum = std::accumulate( vv.begin(), vv.end(), 0 );

  bool ret = vv[0] < sum-vv[0];

  std::cout << (ret ? "Yes" : "No") << std::endl;
}

int main(int argc, char *argv[])
{
  solve();
  return 0;
}


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

int main() {
  int n;
  int a[200];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  } 
  sort(a, a + n);
  reverse(a, a+ n);
  int A = 0, B = 0;
  for (int i = 0; i < n; i++){
    if(i % 2 == 0) A += a[i];
    else B += a[i];
  }
  cout << A - B;
}


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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int h,w,k;
    cin>>h>>w>>k;
    vector<vector<char>> f(h,vector<char>(w));
    for(int i=0;i<h;++i)for(int j=0;j<w;++j){
        cin>>f[i][j];
    }
    int ret = inf;
    for(int mask = 0;mask<1<<10;++mask){
        vector<int> ind(h);
        int reti = 0;
        for(int i=0,tmp=0;i<h;++i){
            ind[i] = tmp;
            if(mask&1<<i)tmp++;
        }
        reti = __builtin_popcount(mask);
        bool ok = true;
        vector<int> nums(h);
        int div = 0;
        for(int j=0;j<w;++j){
            bool over = false;
            vector<int> ones(h);
            for(int i=0;i<h;++i){
                if(f[i][j] == '1'){
                    ones[ind[i]]++;
                    nums[ind[i]]++;
                    if(ones[ind[i]] > k)ok =false;
                    if(nums[ind[i]] > k)over = true;
                }
            }
            if(over)div++,swap(ones,nums);
        }
        if(ok)ret = min(ret,reti+div);
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 384
# coding: utf-8

N = int(input())

ANS = [0] * (N+1)

for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a <= N:
                ANS[a] += 1

for i in range(1,N+1):
    print(ANS[i])

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

#define MAX 1000

int N;
long long T, A;
long long H[MAX];

int main() {
	cin >> N >> T >> A;
	for( int i = 0; i < N; i++ ) {
		cin >> H[i];
	}

	long long mi = INT64_MAX;
	int ans = 0;
	for( int i = 0; i < N; i++ ) {
		long long d = abs( (T * 1000 - H[i] * 6 ) - (A * 1000) );
		if( mi > d ) {
			mi = d;
			ans = i;
		}
	}

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


Measured memory_bytes: 256
n = list(input())
m = len(n)

for i in range(m):
    del n[-1]
    if len(n)%2 == 0:
        if n[0:(len(n)//2)] == n[(len(n)//2):(len(n)+1)]:
            print(len(n))
            break
    else:
        continue

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

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

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

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

using ll = long long;

int main() {
  int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
  int ans = 0;
  if (x < y) { swap(x, y); swap(a, b); }
  if (a+b > 2*c) {
    ans += 2*y*c;
    if (a > 2*c) ans += 2*(x-y)*c;
    else ans += (x-y)*a;
  } else {
    ans += y*b;
    ans += y*a;
    if (a > 2*c) ans += 2*(x-y)*c;
    else ans += (x-y)*a;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#define SIZE 1000000007
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;

int main(){
    long long N,M,num=0,ans=0;
    long long A[100000],B[100000];
    cin>>N>>M;
    priority_queue<pair<long long ,long long>,vector<pair<long long,long long>>,greater<pair<long long,long long>>> p;
    rep(i,N){
        cin>>A[i]>>B[i];
        p.push(make_pair(A[i],B[i]));
    }
    while(num<M){
        if(p.top().second+num>=M){
            ans+=(M-num)*p.top().first;
            num=M;
        }
        else{
            ans+=p.top().first*p.top().second;
            num+=p.top().second;
        }
        p.pop();
    }
    cout<<ans<<endl;
    return 0;
}

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

const double eps = 1e-9;
const double pi = acos(-1);
bool same(double a, double b) { return abs(a - b) < eps; }

struct P {
    double x, y;
    P() : x(0), y(0) {}
    P(double x, double y) : x(x), y(y) {}
    P operator + (P b) { return P(x + b.x, y + b.y); }
    P operator - (P b) { return P(x - b.x, y - b.y); }
    P operator * (double b) { return P(x * b, y * b); }
    P operator / (double b) { return P(x / b, y / b); }
    double operator * (P b) { return x * b.x + y * b.y; }
    double operator ^ (P b) { return x * b.y - y * b.x; }
    double abs() { return hypot(x, y); }
    P unit() { return *this / abs(); }
    P spin(double o) {
        double c = cos(o), s = sin(o);
        return P(c * x - s * y, s * x + c * y);
    }
};

struct L {
    // ax + by + c = 0
    double a, b, c, o;
    P pa, pb;
    L() : a(0), b(0), c(0), o(0), pa(), pb() {}
    L(P pa, P pb) : a(pa.y - pb.y), b(pb.x - pa.x), c(pa ^ pb), o(atan2(-a, b)), pa(pa), pb(pb) {}
    P project(P p) { return pa + (pb - pa).unit() * ((pb - pa) * (p - pa) / (pb - pa).abs()); }
    P reflect(P p) { return p + (project(p) - p) * 2; }
    double get_ratio(P p) { return (p - pa) * (pb - pa) / ((pb - pa).abs() * (pb - pa).abs()); }
};

struct C {
    P c;
    double r;
    C() : r(0) {}
    C(P c, double r) : c(c), r(r) {}
};

bool parallel(L x, L y) { return same(x.a * y.b, x.b * y.a); }

P intersect(L x, L y) { return P(-x.b * y.c + x.c * y.b, x.a * y.c - x.c * y.a) / (-x.a * y.b + x.b * y.a); }

vector<L> tangent(C c, P p) {
    vector<L> res;
    double d = (p - c.c).abs();
    if (same(d, c.r)) {
        P i = (p - c.c).spin(pi / 2);
        res.emplace_back(p, p + i);
    } else if (d > c.r) {
        double o = acos(c.r / d);
        P i = (p - c.c).unit(), j = i.spin(o) * c.r, k = i.spin(-o) * c.r;
        res.emplace_back(c.c + j, p);
        res.emplace_back(c.c + k, p);
    }
    return res;
}

int main() {
    P p; C c; cin >> p.x >> p.y >> c.c.x >> c.c.y >> c.r;
    vector<L> ls = tangent(c, p);
    vector<P> ps;
    for (L l : ls) ps.push_back(l.project(c.c));
    sort(ps.begin(), ps.end(), [&] (const P &a, const P &b) { return same(a.x, b.x) ? a.y < b.y : a.x < b.x; });
    for (P p : ps) cout << fixed << setprecision(10) << p.x << " " << p.y << endl;
}



Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    long X = scanner.nextLong();
    long Y = scanner.nextLong();
    long sum = X;
    int count = 1;
    while(true){
      X *= 2;
      sum += X;
      if (X > Y){break;}
      count++;
    }
    System.out.println(count);
  }
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll a, b, q; cin >> a >> b >> q;
    vector<ll>slis(a), tlis(b), nslis(a, 0), ntlis(b, 0);
    REP(i, 0, a){cin >> slis[i];}
    REP(i, 0, b){cin >> tlis[i];}
    REP(i, 0, a){
        auto it = lower_bound(ALL(tlis), slis[i]);
        int k = it - tlis.begin();
        ll mi = 1e17;
        if(k - 1 >= 0){
            mi = min(mi, abs(tlis[k-1] - slis[i]));
        }
        if(k < b){
            mi = min(mi, abs(tlis[k] - slis[i]));
        } 
        if(k+1 < b){
            mi = min(mi, abs(tlis[k+1] - slis[i]));
        }
        nslis[i] = mi;
    }
    REP(i, 0, b){
        auto it = lower_bound(ALL(slis), tlis[i]);
        int k = it - slis.begin();
        ll mi = 1e17;
        if(k - 1 >= 0){
            mi = min(mi, abs(slis[k-1] - tlis[i]));
        }
        if(k < a){
            mi = min(mi, abs(slis[k] - tlis[i]));
        } 
        if(k+1 < a){
            mi = min(mi, abs(slis[k+1] - tlis[i]));
        }
        ntlis[i] = mi;
    }
    REP(i, 0, q){
        ll x; cin >> x;
        auto it = lower_bound(ALL(slis), x);
        int k = it - slis.begin();
        ll mi1 = 1e17, mi2 = 1e17;
        if(k - 1 >= 0){
            mi1 = min(mi1, abs(slis[k-1]-x) + nslis[k-1]);
        }
        if(k < a){
            mi1 = min(mi1, abs(slis[k]-x) + nslis[k]);
        } 
        if(k+1 < a){
            mi1 = min(mi1, abs(slis[k+1]-x) + nslis[k+1]);
        }
        auto it1 = lower_bound(ALL(tlis), x);
        int k1 = it1 - tlis.begin();
        if(k1 - 1 >= 0){
            mi2 = min(mi2, abs(tlis[k1-1]-x) + ntlis[k1-1]);
        }
        if(k1 < b){
            mi2 = min(mi2, abs(tlis[k1]-x) + ntlis[k1]);
        } 
        if(k1+1 < b){
            mi2 = min(mi2, abs(tlis[k1+1]-x) + ntlis[k1+1]);
        }
        cout << min(mi1, mi2) << endl;
    }
}

Measured memory_bytes: 4480
K=int(input())
ans=-1
count=1
a=7
amari=[0]*K
while 1:
    b=a%K
    if b==0:
        ans=count
        break
    if amari[b]==1:
        break
    amari[b]=1
    count+=1
    a=10*b+7
print(ans)

Measured memory_bytes: 16708
##C
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
max = max(c.values())
 
max_k_list = [kv[0] for kv in c.items() if kv[1] == max]
max_k_list.sort()
for l in max_k_list:
    print(l)

Measured memory_bytes: 35480
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

long long A[100001] = {};
int main() {
	long long N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		A[tmp]++;
	}
	long long  ans = 1;
	for (int i = 0; i < 100001; i++) {
		if (A[0]>=2||A[i]>=3) {
			cout << "0" << endl;
			return 0;
		}
		else {
			if (A[i] == 2) {
				ans *= 2;
				ans %= 1000000007;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        boolean state = true;
        ArrayList<Integer> list = new ArrayList<Integer>();

        while (state) {
            int input = scanner.nextInt();
            if ( input != 0) list.add(input);
            else state = false;
        }

        for (int i=0;i<list.size();i++){
            System.out.println("Case "+ (i+1) + ": " + list.get(i));
        }

    }
}


Measured memory_bytes: 43772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    map<int, int> mp;
    for(int i=2;i<=n;i++){
        int t;cin>>t;
        mp[t]++;
    }
    for(int i=1; i<=n; i++){
        cout<<mp[i]<<endl;
    }
}

Measured memory_bytes: 12996
#include<bits/stdc++.h>
using namespace std;
const int N=200006;
int a[N];
int b[N];
bool vis[N];
int k;
int n;
int main(){
	while(cin>>k>>n){
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		int temp=-1;
		for(int i=0;i<n;i++){
			if(i!=n-1){
				b[i]=(abs(a[i+1]-a[i]));
				if(temp<b[i]){
					temp=b[i];
				}
			}else{
				b[i]=k+a[0]-a[i];
				if(temp<b[i]){
					temp=b[i];
				}
			}
			vis[b[i]]=1;
		}
		bool swi=true;
		int sum=0;
		for(int i=0;i<n;i++){
			if(b[i]!=temp){
				sum+=b[i];			
			}else{
				if(swi==1){
					swi=0;
					continue;
				}else{
					sum+=b[i];
				}
			}
	}
		cout<<sum<<endl;
	}
	return 0;
} 

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveA();
	}

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int maxMin = s.length();
		for (char c = 'a'; c <= 'z'; c++) {
			int max = 0;
			int current = 0;
			for (int i = 0; i < s.length(); i++) {
				if (s.charAt(i) == c) {
					if (max < current) {
						max = current;
					}
					current = 0;
				} else {
					current++;
				}
			}
			if (max < current) {
				max = current;
			}
			if (maxMin > max) {
				maxMin = max;
			}
		}
		System.out.println(maxMin);
	}
}

Measured memory_bytes: 23764
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int quantity = scanner.nextInt();
        Integer[] cakes = new Integer[givenNumber];
        int sumCakesQuantity = 0;
        for(int i=0; i<givenNumber; i++) {
            cakes[i] = scanner.nextInt();
            sumCakesQuantity += cakes[i];
        }

        int quantityLeft = quantity - sumCakesQuantity;
        int maxCakes = 0;
        if(quantityLeft > 0) {
            maxCakes = quantityLeft / Collections.min(Arrays.asList(cakes));;
        }
        System.out.println(givenNumber + maxCakes);
    }
}


Measured memory_bytes: 23892
from heapq import heappush, heappop


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

all_freq = {}

cnt_b = [0] * 220000
for num in b:cnt_b[num] += 1


for num in a:
    if num not in all_freq:
        all_freq[num] = 0
    all_freq[num] += 1

for num in b:
    if num not in all_freq:
        all_freq[num] = 0
    all_freq[num] += 1

heap = []

for num, freq in all_freq.items():
    if freq > n:
        print("No")
        exit()
    if cnt_b[num] > 0:
        heappush(heap, (-freq, num))

ans = []

def get_max():
    (freq, num) = heappop(heap)
    freq = -freq
    while all_freq[num] != freq:
        (freq, num) = heappop(heap)
        freq = -freq

    return num

for num in a:
    most_freq_num = get_max()
    if most_freq_num != num:
        ans.append(most_freq_num)
        all_freq[most_freq_num] -= 1
        cnt_b[most_freq_num] -= 1
        if cnt_b[most_freq_num] > 0:
            heappush(heap, (-all_freq[most_freq_num], most_freq_num))
    else:
        second_freq_num = get_max()
        heappush(heap, (-all_freq[most_freq_num], most_freq_num))
        ans.append(second_freq_num)
        all_freq[second_freq_num] -= 1
        cnt_b[second_freq_num] -= 1
        if cnt_b[second_freq_num] > 0:
            heappush(heap, (-all_freq[second_freq_num], second_freq_num))
    all_freq[num] -= 1
    if cnt_b[num] == 0:continue
    heappush(heap, (-all_freq[num], num))

print("Yes")
print(*ans)
    

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  string s,t="Good";
  cin >>s;
  rep(i,s.size()-1)
    if(s[i]==s[i+1])t="Bad";
  cout <<t;
}

Measured memory_bytes: 3628
class UnionFind:
    def __init__(self, n):
        self.root = list(range(n + 1))
        self.size = [1] * (n + 1)

    def Find_Root(self, x):
        if (self.root[x] == x):
          return x
        else:
          self.root[x] = self.Find_Root(self.root[x])
          return self.root[x]

    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if (x == y):
            return
        elif (self.size[x] > self.size[y]):
            self.size[x] += self.size[y]
            self.root[y] = x
        else:
            self.size[y] += self.size[x]
            self.root[x] = y

    def isSameGroup(self, x, y):
      return self.Find_Root(x) == self.Find_Root(y)

N, M, K = map(int, input().split())

A = UnionFind(N)

F = [0] * (N + 1)
for _ in range(M):
    a, b = map(int, input().split())
    F[a] += 1
    F[b] += 1
    A.Unite(a, b)
    
B = [0] * (N + 1)
for _ in range(K):
    c, d = map(int, input().split())
    if A.isSameGroup(c, d):
        B[c] += 1
        B[d] += 1
        
ans = []
for i in range(1, N + 1):
    size = A.size[A.Find_Root(i)]
    block = B[i]
    friends = F[i]
    res = size - block - friends - 1
    ans.append(str(res))

print(" ".join(ans))


Measured memory_bytes: 17328
#include<bits/stdc++.h>
using namespace std;
const int maxn = 110;
double a[maxn], sum;
int n;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		scanf("%lf", &a[i]);
		sum += 1.0 / a[i];
	}
	cout << 1.0 / sum;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt, log, ceil, floor

def main():
    X = int(input())

    current = 100
    year = 0
    while current < X:
        current += floor(current * 0.01)
        year += 1
    print(year)


if __name__ == '__main__':
    main()

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

int main(){
  int n,t,a;
  cin >>n >>t >> a;
  int ans=0;
  double d=10000;
  for(int i=0;i<n;i++){
    int x;
    cin >>x;
    double q= abs(t-x*0.006-a);
    if(d>q){ans=i;
           d=q;}
  }
  cout << ans+1 << endl;
}

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

using vi = vector<int>; 
using vvi = vector<vi>;

bool hantei(int64_t t, int64_t x, int64_t y) {
  if ((t -(x + y)) >= 0 && ((t -(x + y)) % 2) == 0) {
    return true;
  }
  else {
    return false;
  }
}

int main() {
  int64_t n;
  cin >> n;
  bool possible;
  int64_t now_t=0, next_t, now_x=0, now_y=0, next_x, next_y, t, x, y;
  for(int64_t i = 0; i<n; i++) {
    cin >> next_t >> next_x >> next_y;
    t = next_t - now_t;
    x = next_x - now_x;
    y = next_y - now_y;
    possible = hantei(t,x,y);
    if (possible == false)
      break;
    now_t = next_t;
    now_x = next_x;
    now_y = next_y;
  }
  if (possible)
    cout << "Yes" << endl;  
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N,A,B,C,D = mint()
S = input()

def f(m,n):
    block2 = space3 = False
    b = s = 0
    for i in range(m-1,n):
        (b,s) = (b+1,0) if S[i]=='#' else (0,s+1)
        if not block2 and b==2:
            block2 = True
        if not space3 and s==3:
            space3 = True
    return block2, space3

if D<C:
    judge(not f(A,C)[0] and f(B-1,D+1)[1])
else:
    judge(not f(A,C)[0] and not f(B,D)[0])

Measured memory_bytes: 74204
#include<bits/stdc++.h>
using namespace std;
int main(void){
    string a,b;
    int ab;
    cin>>a>>b;
    ab=stoi(a+b);
    for(int i=1;i<=1000;i++){
        if(i*i==ab){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define modulo 1000000007
using namespace std;
///solution created by: Ahmadsm2005
int DP[10001][101][2];
int32_t main()
{
//freopen("output.txt","w", stdout);
//freopen("rect.in","r", stdin);
iostream::sync_with_stdio(0);
cin.tie(0);
string s;
cin>>s;
int m;
cin>>m;
for(int i=0;i<s.size();i++){
for(int l=0;l<m;l++){
for(int x=0;x<=(s[i]-'0');x++){
DP[i+1][(l+x)%m][(x<(s[i]-'0')?1:0)]=(DP[i+1][(l+x)%m][(x<(s[i]-'0')?1:0)]+DP[i][l][0]+((i|l)?0:1))%modulo;
}
for(int x=0;x<=9;x++){
DP[i+1][(l+x)%m][1]=(DP[i+1][(l+x)%m][1]+DP[i][l][1])%modulo;
}
}
}
cout<<((DP[s.size()][0][0]+DP[s.size()][0][1]-1)%modulo+modulo)%modulo;
return 0;
}


Measured memory_bytes: 8192
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
	string s;
	char get_type, to_type;
	while (cin >> s >> to_type) {
		if (to_type == 'X')return 0;
		if ((int)s[0] < 95)get_type = 'U';
		else {
			get_type = 'L';
			for (char i : s)if (i == '_')get_type = 'D';
		}
		if (get_type == to_type)cout << s << endl;
		else {
			for (int i = 0; i < s.size(); i++) {
				if (i == 0) {
					if (to_type == 'U')cout << (char)(s[0] - 32);
					else if (get_type != 'U')cout << s[0];
					else cout << (char)(s[0] + 32);
				}
				else if (s[i] == '_') {
					i++;
					cout << (char)(s[i] - 32);
				}
				else if (s[i] < 95 && to_type == 'D')cout << '_' << (char)(s[i] + 32);
				else cout << s[i];
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
 const int mod = 1000000007;
 // a^n mod を計算する
 long long modpow(long long a, long long n, long long mod) {
     long long res = 1;
     while (n > 0) {
         if (n & 1) res = res * a % mod;
         a = a * a % mod;
         n >>= 1;
     }
     return res;
 }
 vector<int> f = {1},fi = {1};
 int fact(int x){
     while((int)f.size() <=x)f.push_back((f.back()*f.size())%mod);
     return f[x];
 }
 int ifact(int x){
     return modpow(fact(x),mod-2,mod);
 }
 int C(int x,int y){
     if(x < y)return 0;
     return fact(x)*ifact(y)%mod*ifact(x-y)%mod;
 }
//#########################################
signed main(){
    int n,k;cin >> n >> k;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    sort(a.begin(),a.end());
    int ret = 0;
    {
        int tmp = 0;
        for(int i = k-1;i < n;i++){
            // trace(i-1,k-1);
            tmp = (tmp + a[i]*C(i,k-1)%mod)%mod;
        }
        ret = (ret + tmp)%mod;
    }
    reverse(a.begin(),a.end());
    {
        int tmp = 0;
        for(int i = k-1;i < n;i++){
            tmp = (tmp + a[i]*C(i,k-1)%mod)%mod;
        }
        ret = (ret - tmp)%mod;
    }
    cout << (ret%mod + mod)%mod << endl;
    return 0;
}

Measured memory_bytes: 5036