akhauriyash/Code-Regression huggingface dataset:
def ReRooting(n, e, identify):
  edges = [[] for _ in range(n)]
  indexedges = [[] for _ in range(n)]
  for u, v in e:
    indexedges[v].append(len(edges[u]))
    indexedges[u].append(len(edges[v]))
    edges[u].append(v)
    edges[v].append(u)
  dp = [identify]*n
  subdp = [len(edges[i])*[identify] for i in range(n)]
  parents = [-1]*n
  order = [0]
  for node in order:
    for mode in edges[node]:
      if mode == parents[node]:
        continue
      order.append(mode)
      parents[mode] = node
  def merge1(a, b):
    return a*b%mod
  def addnode1(a, id):
    return a+1
  for node in order[1::][::-1]:
    parent = parents[node]
    ans = identify
    indexparent = -1
    for j in range(len(edges[node])):
      mode = edges[node][j]
      if parent == mode:
        indexparent = j
        continue
      ans = merge1(ans, subdp[node][j])
    subdp[parent][indexedges[node][indexparent]] = addnode1(ans, node)
  def merge2(a,b):
    return a*b%mod
  def addnode2(a, id):
    return a+1
  for node in order:
    b = [identify]*len(edges[node])
    for i in range(len(edges[node])-1,0,-1):
      b[i-1] = merge2(b[i], subdp[node][i])
    bb = identify
    for i in range(len(edges[node])):
      ans = merge2(bb, b[i])
      subdp[edges[node][i]][indexedges[node][i]] = addnode2(ans, node)
      bb = merge2(bb, subdp[node][i])
    dp[node] = addnode2(bb, node)
  return dp
n,mod=map(int,input().split())
edges=[]*n
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edges.append([a,b])
for i in ReRooting(n,edges,1):print(i-1)

Measured memory_bytes: 68444
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
    int a[3][3];
    vector<vector<bool>> c(3,vector<bool> (3,false));
    rep(i,3){
        rep(j,3){
            cin>>a[i][j];
        }
    }
    int n;
    cin>>n;
    vector<int> b(n);
    rep(i,n){
        cin>>b[i];
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(b[i]==a[j][k]){
                    c[j][k]=true;
                }
            }
        }
    }
    bool ans=false;
    if(c[0][0]==true && c[0][1]==true && c[0][2]==true){
        ans=true;
    }
    if(c[1][0]==true && c[1][1]==true && c[1][2]==true){
        ans=true;
    }
    if(c[2][0]==true && c[2][1]==true && c[2][2]==true){
        ans=true;
    }
    if(c[0][0]==true && c[1][0]==1 && c[2][0]==1){
        ans = true;
    }
    if(c[0][1]==true && c[1][1]==1 && c[2][1]==1){
        ans = true;
    }
    if(c[0][2]==true && c[1][2]==1 && c[2][2]==1){
        ans = true;
    }
    if(c[0][0]==1 && c[1][1]==1 && c[2][2]==1){
        ans = true;
    }
    if(c[0][2]==1 && c[1][1]==1 && c[2][0]==1){
        ans = true;
    }

    if(ans){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

int main() {
  string s;
  cin >> s;

  int c = 0;
  if(s[0] == 'o') c++;
  if(s[1] == 'o') c++;
  if(s[2] == 'o') c++;

  cout << 700 + c * 100 << endl;
}

Measured memory_bytes: 256
from os import sys
n = int(input())
c = 1
while True:
    if n == 0:
        sys.exit(0)
    X = 0
    Y = 0
    ox = 0
    oy = 0
    esquerda = 0
    direita = 0
    for i in range(0,n):
        cx, cy = input().split(' ')
        cx = int(cx)
        cy = int(cy)
        if i == 0:
            X = cx
            Y = cy
        direita += ox * cy
        esquerda += oy * cx
        ox = cx
        oy = cy

    esquerda += X * oy
    direita += Y * cx
    s = direita - esquerda
    if s < 0:
        s = esquerda - direita
    s = s/2
    print("%d %.1f" %(c,s))
    c += 1
    n = input()
    if n == '':
        n = input()
    n = int(n)

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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

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

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

int MOD = (int) 1e9 + 7;


auto solve() {
    int N;
    cin >> N;

    set<pii> edges;
    REP(i, N) {
        FOR(j, i + 1, N) {
            edges.insert({i + 1, j + 1});
        }
    }

    N -= (N % 2);
    REP(i, N / 2) {
        edges.erase({i + 1, N - i});
    }

    cout << edges.size() << endl;
    for(auto&&e:edges) {
        cout << e.first << " " << e.second << endl;
    }
}


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

//    cout << (solve() ? "Heisei" : "TBD") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
//    cout << solve() << endl;
    solve();

    return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(3);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T>
map<T,ll> factorize(T x){
	map<T,ll> res;
	for(ll i=2;i*i<=x;i++){
		while(x%i==0){
			x/=i;
			res[i]++;
		}
	}
	if(x!=1) res[x]++;
	return res;
}
int main(){
ll A,B;
cin>>A>>B;
map<ll,ll> a=factorize(A),b=factorize(B);
map<ll,ll> sum;
for(auto p:a){
   sum[p.fi]++;
}
ll ans=1;
for(auto p:b){
   if(sum[p.fi])ans++;
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

char inv(char c)
{
	char s[]={".ox"};
	return ".xo"[strchr(s,c)-s];
}

int count(const vector<string>& grid,char c,int i,int j,int di,int dj)
{
	if(i<0 || 8<=i || j<0 || 8<=j || grid[i][j]=='.') return -1;
	if(grid[i][j]==c) return 0;
	int res=count(grid,c,i+di,j+dj,di,dj);
	if(res!=-1) res++;
	return res;
}
int count(const vector<string>& grid,char c,int i,int j)
{
	if(grid[i][j]!='.') return 0;
	int di[]={0,-1,-1,-1,0,1,1,1};
	int dj[]={1,1,0,-1,-1,-1,0,1};
	int sum=0;
	for(int k=0;k<8;k++){
		int x=count(grid,c,i+di[k],j+dj[k],di[k],dj[k]);
		if(x!=-1) sum+=x;
	}
	return sum;
}

bool flip(vector<string>& grid,char c,int i,int j,int di,int dj)
{
	if(i<0 || 8<=i || j<0 || 8<=j || grid[i][j]=='.') return false;
	if(grid[i][j]==c) return true;
	bool res=flip(grid,c,i+di,j+dj,di,dj);
	if(res) grid[i][j]=c;
	return res;
}
void flip(vector<string>& grid,char c,int i,int j)
{
	if(grid[i][j]!='.') return;
	grid[i][j]=c;
	int di[]={0,-1,-1,-1,0,1,1,1};
	int dj[]={1,1,0,-1,-1,-1,0,1};
	for(int k=0;k<8;k++)
		flip(grid,c,i+di[k],j+dj[k],di[k],dj[k]);
}

int main()
{
	vector<string> grid(8);
	for(int i=0;i<8;i++)
		cin>>grid[i];
	
	for(int turn=1;turn<=8*8*2;turn++){
		int mx=0,i0=0,j0=0;
		if(turn&1){
			for(int i=0;i<8;i++) for(int j=0;j<8;j++){
				int x=count(grid,'o',i,j);
				if(x>mx) mx=x,i0=i,j0=j;
			}
			if(mx) flip(grid,'o',i0,j0);
		}
		else{
			for(int i=8;i--;) for(int j=8;j--;){
				int x=count(grid,'x',i,j);
				if(x>mx) mx=x,i0=i,j0=j;
			}
			if(mx) flip(grid,'x',i0,j0);
		}
	}
	
	for(int i=0;i<8;i++)
		cout<<grid[i]<<endl;
	
	return 0;
}

Measured memory_bytes: 1184
#include<stdio.h>
int main (void)
{
    for(;;){
    int n,i,j,hyo[12][12]={{0}},w=0,all=0;
        scanf("%d",&n);
        if(n==0) break;
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                scanf("%d",&hyo[i][j]);
                w+=hyo[i][j];
                if(j==n-1){
                    hyo[i][j+1]=w;
                    w=0;
                }
            }
        }
        for(i=0;i<n;i++){
            for(j=0;j<n;j++){
                w+=hyo[j][i];
                if(j==n-1){
                    hyo[j+1][i]=w;
                    all+=w;
                    w=0;
                }
            }
        }
        hyo[n][n]=all;
        for(i=0;i<=n;i++){
            for(j=0;j<=n;j++){
                if(hyo[i][j]>9999) printf("%d",hyo[i][j]);
                else if(hyo[i][j]>999) printf(" %d",hyo[i][j]);
                else if(hyo[i][j]>99) printf("  %d",hyo[i][j]);
                else if(hyo[i][j]>9) printf("   %d",hyo[i][j]);
                else if(hyo[i][j]<10) printf("    %d",hyo[i][j]);
                if(j==n) printf("\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 604
/*input
6 5
1 2 1
2 3 2
1 3 3
4 5 4
5 6 5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int dsu[maxn];
int sz[maxn];

int find(int u){
	if(dsu[u]==u) return u;
	return dsu[u]=find(dsu[u]);
}
void mrg(int u,int v){
	u=find(u);
	v=find(v);
	if(u==v) return ;
	if(sz[u]<sz[v]) swap(u,v);
	sz[u]+=sz[v];
	dsu[v]=u;
}

int main(){
	IOS;
	int n,m;
	cin>>n>>m;
	REP(i,n) dsu[i]=i,sz[i]=1; 
	REP(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		mrg(a,b);
	}
	int ans=0;
	REP(i,n) if(dsu[i]==i) ans++;
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define INF 9003372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
lol n,m,k;
lol a[200010];
lol mem[200020][4];
lol dp(int k,int E){
  if(E<0) return -INF;
  if(mem[k][E]!=-INF) return mem[k][E];
  if(k+E==n-1) return mem[k][E]=a[k];
  lol sum=a[k];
  sum+=max(dp(k+2,E),max(dp(k+3,E-1),dp(k+4,E-2)));
  return mem[k][E]=sum;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,w;
  cin >>n;
  for(int i=0;i<n;i++){
    cin >>a[i];
  }
  for(int i=0;i<=n;i++){
    mem[i][0]=mem[i][1]=mem[i][2]=mem[i][3]=-INF;
  }
  if(n%2!=0) cout <<max(dp(0,2),max(dp(1,1),dp(2,0)))<<'\n';
  else cout <<max(dp(0,1),dp(1,0))<<'\n';
  return (0);
}


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

int main()
{
	int N,sum=0;
	vector<int> C, V;

	cin >> N;

	C.resize(N);
	V.resize(N);

	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}

	for (int i = 0; i < N; i++) {
		sum += V[i] - C[i] > 0 ? V[i] - C[i] : 0;
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      if(n == 1) {
        System.out.println(1);
        return;
      }
      long[] arr = new long[n];
      for(int i = 0; i < n; i++)
        arr[i] = sc.nextInt();

      int cnt = 0;
      long prev = 0;
      for(int i = 1; i < n; i++) {
        if(arr[i] - arr[i-1] == 0) continue;
        if(prev * (arr[i] - arr[i-1]) < 0) {
          cnt++;
          prev = 0;
        } else
            prev = arr[i] - arr[i-1];
      }
      System.out.println(cnt + 1);
  }
}


Measured memory_bytes: 51012
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
const ll INF = 1000000000000007;

using namespace std;

int main(){
  string S,res;
  cin >> S;

  if(S.size() == 4)res = "ABD";
  else res ="ABC";

  cout << res << endl;

  return 0;

}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, v = M() # おに
b, w = M() # にげる
t = I()
ans = 'NO'
if v-w > 0:
    b_hiku_a = abs(b - a)
    v_hiku_w = v - w
    if b_hiku_a <= t * (v-w):
        ans = 'YES'
print(ans)

Measured memory_bytes: 68396
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        int a,b,c;
		// 整数の入力
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
 
        if(a==b && a!=c && b!=c){
            System.out.println("Yes");
        }else if(a==c && a!=b && c!=b){
            System.out.println("Yes");
        }else if(b==c && b!=a && c!=a){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
	}
}

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

const ll MAXN = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;

ll N, ans=0, tmp1=0, tmp2=0;
vector<ll> A;

signed main(){
    cin >> N;
    for(int i=1;i<=N;i++) {
        tmp1 = N/i;
        tmp2 = tmp1*i;
        ans += (tmp2+i)*tmp1/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
import itertools

X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

comb_ab = []
for a, b in itertools.product(A, B):
    comb_ab.append(sum([a, b]))

comb_ab_top = sorted(comb_ab, reverse=True)[:K]

comb_abc = []
for ab, c in itertools.product(comb_ab_top, C):
    comb_abc.append(sum([ab, c]))

ans = sorted(comb_abc, reverse=True)[:K]
print(*ans, sep='\n')


Measured memory_bytes: 140520
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N; cin >> N; vector<int> V;

    if (not N) cout << 0 << endl;
    while (N) {
        V.push_back( (N%(-2)) ? 1 : 0 );
        if (N%(-2)) --N;
        N /= (-2);
    }

    for (int i = 0; i < V.size(); i++) cout << V[V.size()-i-1];

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
  int N, K, sum;
  int a[60];
  
  cin >> N >> K;
  for(int i=0;i<N;++i) cin >> a[i];
  
  sort(a, a+N, greater<int>());
  for(int j=0;j<K;++j) sum+=a[j];
  
  cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll long long
#define ld double
#define pb push_back
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
ll bp(ll a,ll b,ll m=mod)
{
    ll res=1;
    if(b<0)
        return bp(bp(a,m-2),-b);
    while(b>0)
    {
        if(b&1)
        res=(a*res)%m;
        a=(a*a)%m;
        b/=2;
    }
    return res;
}
const int N = 10000000;
int lp[N+1];
vector<int> pr;
main()
{
    IO
    for (int i=2; i<=N; ++i) {
    if (lp[i] == 0) {
        lp[i] = i;
        pr.push_back (i);
    }
    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
        lp[i * pr[j]] = pr[j];
    }
    ll n;
    cin>>n;
    ll ans=0;
    for(int x=1;x<n;x++)
    {
         ll e=1;
         ll w=n-x;
         while(w>1)
         {
             ll r=0;
             ll t=lp[w];
             while(w%t==0)
             {
                 w/=t;
                 ++r;
             }
            e*=(r+1);
         }
         ans+=e;
    }
    cout<<ans;
}


Measured memory_bytes: 89680
#include <bits/stdc++.h> 
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define ld long double
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define pii          pair<int,int>
#define pll          pair<ll,ll>
#define vi           vector<int>
#define vll          vector<long long>
#define all(x)       x.begin(),x.end()
#define mod 1000000007 
#define mx 1000005
#define mii          map<int,int>
#define mumii        multimap<int,int> 
#define mx2 65
#define inf 4e18
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define gt           greater<int>()
//The ASCII value of the lowercase alphabet is from 97 to 122.
//The ASCII value of the uppercase alphabet is from 65 to 90.

void solve()
{
     ll int x,a,b,c,d;
     cin>>x;
     
     a=x/500;
     b=x%500;
     c=b/5;
     d=b%5;
     cout<<((a*1000) + (c*5)); 
     
}
int main()
{
	fast;
	int t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
my ($x, $y) = map {$_-0}split / /, <STDIN>;

my @a = ();
my @r = ();

my $mx = 0;
for(my $n = $x; $n <= $y; $n++){
    my $cnt = 0;
    for(;$n <= $y; $n *= 2) { $cnt++; }
    $mx = $cnt if $cnt > $mx;
}
print $mx;

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
void print(int arr[],int n)
{
    int i;
    for(i=0;i<n-1;i++)
        printf("%d ",arr[i]);
    printf("%d\n",arr[i]);
}
int main()
{
    int n,cnt=0;
    scanf("%d",&n);
    int arr[n+1];
    for(int i=0;i<n;i++)
        scanf("%d",&arr[i]);
    for(int i=0; i<n; i++)
    {
        int mn = arr[i],pos = i;
        for(int k=i+1; k<n; k++)
            if(mn>arr[k])
            {
                pos = k;
                mn = arr[k];
            }
        if(pos!=i)
        {
            swap(arr[pos],arr[i]);
            cnt++;
        }
    }
    print(arr,n);
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 3212
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
import heapq
n=i1()
a=i2()
r=0
right=0
sumx=0
sump=0
for left in range(n):

 while right<n and sumx^a[right]==sump+a[right]:
      sumx^=a[right]
      sump+=a[right]
      right+=1
 r+=right-left
 if left==right:
    right+=1
 else:
    sumx-=a[left]
    sump-=a[left]
print(r)

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

ans = []

for i in range(N-1, -1, -1):
  A[i] = sum(A[i::i+1]) & 1

ans = [i + 1 for i in range(N) if A[i]]

print(len(ans))
if len(ans) > 0: print(*ans)

Measured memory_bytes: 12724
import numpy as np

N = int(input())
s = [input() for _ in range(N)]


ABarray = np.zeros((N, 3), dtype=int)
count = 0
for i, alp in enumerate(s):
    ABarray[i, 0] = 1 if (alp[-1] == 'A') else 0
    ABarray[i, 1] = 1 if (alp[0] == 'B') else 0
    ABarray[i, 2] = 1 if (alp[0] == 'B' and alp[-1] == 'A') else 0
    count += alp.count('AB')

ABsum = np.sum(ABarray, axis=0)
both = ABsum[2]
Aonly = ABsum[0] - both
Bonly = ABsum[1] - both

if Aonly == 0 and Bonly == 0 and both >= 1:
    count += both - 1
else:
    count += min(Aonly, Bonly) + both
print(count)


Measured memory_bytes: 14792
package main

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

func main() {
	scan_init()
	n:= scanInt()
	a:=make([]int, n)
	memo := make(map[int]int)
	for i:= 0; i<n; i++ {
		a[i] = scanInt()
		if _,ok := memo[a[i]]; !ok {
			memo[a[i]] = 0
		}
		memo[a[i]]++
	}
	staticSum := 0
	for _,value := range memo {
		if value == 1 || value == 0 {
			continue
		}
		staticSum += (value*(value-1))/2
	}
	for i:= 0; i<n; i++ {
		pre := memo[a[i]]*(memo[a[i]]-1)/2
		next := (memo[a[i]]-1)*(memo[a[i]]-2)/2
		// memo[a[i]]--
		fmt.Println(staticSum - pre + next)
		// memo[a[i]]++
	}

}

var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 200000)

func readLine() string {
	buf := make([]byte, 0, 200000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
func readLineToNumber() int {
	S := readLine()
	number, _ := strconv.Atoi(S)
	return number
}
func readLineToSlice() []string {
	S := readLine()
	list := strings.Split(S, "")
	return list
}
func readLineToNumberSlice(memo map[string]int) []int {
	// err時は-1を代入
	S := readLine()
	intList := make([]int, len(S))
	for i := 0; i < len(S); i++ {
		if val, ok := memo[string(S[i])]; ok {
			intList[i] = val
		} else {
			intList[i] = -1
		}
	}
	return intList
}

Measured memory_bytes: 14448
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define vi vector<ll>
#define ss second
#define ff first
#define pii pair<int,int>
#define mii map<int,int>
#define mod 1000000007
#define w(x) int x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi 3.1415926535897932384626433832795
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define mod 1000000007
#define lo lower_bound
#define de(n) ll n;cin>>n;
using namespace std;
ll ab(ll a,ll b)
{
    if(a>b)
    return a-b;
return b-a;
}
ll factor(ll n)
{
    ll ans=0;
    for(ll j=1;j*j<=n;j++)
    {
        if(n%j==0)
        {
            if(j*j==n)
            ans++;
            else
            {
                ans+=2;
            }
        }
    }
    return ans;
}
ll power(ll x, ll y,ll p)  
{  
    int res = 1;
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0)  
    {   
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
ll pow(ll x,ll y) 
{ 
    int res = 1; 
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1; 
        x = x*x;   
    } 
    return res; 
}
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); 
    #ifndef ONLINE_JUDGE  
    freopen("input.txt", "r", stdin);  
    freopen("output.txt", "w", stdout); 
  
#endif
}
vector<ll> get_prime_factors_less_than(ll n){
    vector<ll> factor;
    vector<ll> prime(n,1);
    prime[0]=0,prime[1]=0;
    for(ll i = 2 ; i <= n ; i++){
        if(prime[i]==1){
            for(ll j=i*i;j<=n;j=j+i) prime[j]=0; 
            factor.push_back(i);
        }
    }
    return factor;
}
ll digit(ll n)
{
    ll q=0;
    while(n>0)
    {
        q++;
        n/=10;
    }
    return q; 
}
ll sq(ll n)
{
    return n*n;
}
ll NR(ll n, ll r) 
{ 
    long long p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
  
            // gcd of p, k 
            long long m = __gcd(p, k); 
            p /= m; 
            k /= m; 
  
            n--; 
            r--; 
        } 
    } 
  
    else
        p = 1; 
  
    // if our approach is correct p = ans and k =1 
    return p ;
}
int main() 
{
    cp();
    de(n);
    ll k;
    k=n%10;
    if(k==3)
    cout<<"bon";
    else if(k==0||k==1||k==6||k==8)
    {
        cout<<"pon";
    }
    else
    {
        cout<<"hon";
    }
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		while(h != 0 || w != 0){

			StringBuilder sb = new StringBuilder();

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

				for(int j = 0; j < w; j++){
					if((i + j) % 2 == 0 ){
						sb.append("#");
					}else{
						sb.append(".");
					}
				}
				sb.append("\n");

			}
			System.out.println(sb);

			h = sc.nextInt();
			w = sc.nextInt();
		}
	}
}

Measured memory_bytes: 21184
#include <iostream>
#include <queue>
#include <map>
#define INF 10000000
using namespace std;

typedef pair<int, int> P;

int H, W, N;
int d[1000][1000];
char cell[1000][1000];
int si, sj, sum = 0;

void bfs(P start, int search){
	int vi[4] = {0, 0, -1, 1}, vj[4] = {-1, 1, 0, 0};
	int gi, gj;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			d[i][j] = INF;
			if(cell[i][j] == search + '0'){
				gi = i;
				gj = j;
			}
		}
	}
	d[start.first][start.second] = 0;
	queue<P> que;
	que.push(start);
	while(!que.empty()){
		P p = que.front();
		que.pop();
		if(p.first == gi && p.second == gj) break;
		int ni, nj;
		for(int i=0;i<4;i++){
			ni = p.first + vi[i];
			nj = p.second + vj[i];
			if(ni >= 0 && ni < H && nj >= 0 && nj < W && cell[ni][nj] != 'X' && d[ni][nj] == INF){
				que.push(P(ni, nj));
				d[ni][nj] = d[p.first][p.second] + 1;
			}
		}
	}
	sum += d[gi][gj];
	if(search != N) bfs(P(gi, gj), search+1);
}

int main(){
	cin >> H >> W >> N;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> cell[i][j];
			if(cell[i][j] == 'S'){
				si = i;
				sj = j;
			}
		}
	}
	bfs(P(si, sj), 1);
	cout << sum << endl;
}

Measured memory_bytes: 5752
#include<iostream>
using namespace std;
int main() {
	while (1) {
		int H, W;
		cin >> H >> W;
		if (H == 0 && W == 0) { break; }
		for (int i = 0; i<H; i++) {
			for (int j = 0; j<W; j++) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3068
#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 ll;
typedef pair<ll,ll> P;

int main() {
  string s;
  cin>>s; 
  int n=s.size();
  vector<bool>al(26);
  rep(i,n){
    al[s[i]-'a']=true;
  }
  int ans=1001001;
  rep(i,26){
    char c='a'+i;
    if(al[i]){
      int co=-1;
      int dif;
      int ch=0;
      rep(j,n){
        if(s[j]==c){
          dif=j-co;
          co=j;
          ch=max(ch,dif-1);
        }
      }
      ch=max(n-co-1,ch);
      ans=min(ans,ch);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long int
#define hmap        unordered_map
#define pii         pair<int,int>
#define pdd         pair<double, double> 
#define M           1000000007
#define MOD         998244353
#define fast        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test        ll t; cin>>t; while(t--)
#define inp(a,n)    int a[n]; for(int i=0;i<n;i++)  cin>>a[i];
#define inpl(a,n)   ll a[n];  for(ll i=0;i<n;i++)   cin>>a[i];
#define out(a,n)    for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define outl(a,n)   for(ll i=0;i<n;i++)  cout<<a[i]<<" "; cout<<endl;
#define outv(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";  cout<<endl;
#define all(s)      (s).begin(),(s).end()

struct pair_hash {
    template <class T1, class T2>
    std::size_t operator () (const std::pair<T1,T2> &p) const {
        auto h1 = std::hash<T1>{}(p.first);
        auto h2 = std::hash<T2>{}(p.second);
        return h1 ^ h2;  
    }
};
using vote = pair<ll,ll>;
using Unordered_map = unordered_map<vote, ll, pair_hash>;

int main()
{
      fast
      ll n,w;
      cin>>n>>w;
      ll v[n],we[n];
      for(ll i=0;i<n;i++)
            cin>>we[i]>>v[i];
      
      ll dp[n+1][w+1]={};
      
      for(ll i=1;i<=n;i++)
      {
            for(ll j=1;j<=w;j++)
            {
                  dp[i][j] = dp[i-1][j];
                  if(j>=we[i-1])
                        dp[i][j] = max(dp[i][j],dp[i-1][j-we[i-1]]+v[i-1]);
            }
      }
      cout<<dp[n][w];      
      
}

Measured memory_bytes: 79232
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI = 3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM =
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, n;
    cin >> a >> b >> n;
    ll hehe = min(n, b - 1);
    ll one = (a * hehe) / b;
    ll two = a * (hehe / b);
    cout << (one - two);
    return 0;
}


//252908XL

/*
comments:-

*/


Measured memory_bytes: 3648
#include <iostream> 
#include <cmath>
using namespace::std;
int main(){
        double x1, x2, y1, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        double a = sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
        cout.precision(19);
        cout << a << endl;
}



Measured memory_bytes: 3300
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;




void solve(){
    int h, a;
    cin>>h>>a;
    h += (a-1);
    cout<<(h/a);
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  vector<pair<ll,ll>> p(n);
  rep(i,n){
    cin>>p[i].se>>p[i].fi;
  }

  sort(all(p));

  ll sum=0;
  rep(i,n){
    if(sum+p[i].se>p[i].fi) {
      cout << "No" << endl;
      return 0;
    }
    sum+=p[i].se;
  }

  cout << "Yes" << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#ifndef ONLINE_JUDGE
#define show(a) cout<<""#a""<<" is "<<a<<endl;
#define shw(a,b)cout<<"-->"<<a<<" "<<b<<endl;
#define print(arr,xx)for(int i=0;i<xx;i++)cout<<arr[i]<<" \n"[i==xx-1];
#define here cout<<"here\n";
#define fastio ;
#else
#define show(a)  ;
#define shw(a,b) ;
#define print(arr,xx) ;
#define here
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#endif
int caseno = 0;
#define print_case cout<<"Case "<<++caseno<<": ";
#define fout freopen("output.txt","w",stdout);
#define fin freopen("input.txt","r",stdin);
#define pb push_back
#define pi acos(-1.0)
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > vii;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
void yesno(bool okk) {cout << (okk ? "YES" : "NO") << endl; if (!okk)return;}
const int primemod = 1000000007;
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define ass(XX) (if(!XX){cout<<-1<<endl;return;})
const ll maxsize = 1 * 1000000 + 9;
#define fi first
#define se second
#define inf 1<<25
const double eps = 1e-10;
const int N = 210;
ll n, m;
void solve() {
    int a;
    cin >> a;
    cout << a +a*a+ a*a*a << endl;
}
 
int main() {
#ifndef ONLINE_JUDGE
    fin
    fout
#endif
    ///-----
    fastio
    int T;
    T = 1;
    // cin >> T;
    while (T--) {
        // yesno(solve());
        solve();
    }
    ///-----
    return 0 ;
}

Measured memory_bytes: 3640
using System;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		// int a = int.Parse(Console.ReadLine());
		// スペース区切りの整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int T = int.Parse(input[0]);
		int X = int.Parse(input[1]);
		// 文字列の入力
		//string s = Console.ReadLine();

		//出力
    // T*X
    decimal ret = (decimal)T/(decimal)X;
		Console.WriteLine(ret + "");
	}
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(void){
    
    int h, w;
    int A[101][101] = {};
    
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> A[i][j];
            A[i][w] += A[i][j];
            A[h][j] += A[i][j];
            A[h][w] += A[i][j];
        }
    }
    
    for(int i = 0; i <= h; i++){
        for(int j = 0; j <= w; j++){
            cout << A[i][j] << (j != w ? " " : "\n");
        }
    }
    
}



Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    int n, q;
    scanf("%d%d", &n, &q);
    vector<int> s(n), t(n), x(n);
    rep(i, n){
        scanf("%d%d%d", &s[i], &t[i], &x[i]);
        s[i] -= x[i];
        t[i] -= x[i];
    }

    auto cmp_r = [&s](int a, int b){return s[a] > s[b];};
    auto cmp_a = [&t](int a, int b){return t[a] > t[b];};
    priority_queue<int, vector<int>, decltype(cmp_r)> rest(cmp_r);
    priority_queue<int, vector<int>, decltype(cmp_a)> active(cmp_a);
    rep(i, n) rest.push(i);
    multiset<int> S;

    rep(_, q){
        int d;
        scanf("%d", &d);
        while(!rest.empty() && s[rest.top()] <= d){
            int idx = rest.top();
            rest.pop();
            active.push(idx);
            S.insert(x[idx]);
        }
        while(!active.empty() && t[active.top()] <= d){
            int idx = active.top();
            active.pop();
            S.erase(S.find(x[idx]));
        }
        printf("%d\n", S.empty() ? -1 : *S.begin());
    }
}

Measured memory_bytes: 14580
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, k = LI()
A = [0] + LI()
for i in range(1, n + 1):
    A[i] = (A[i] + A[i - 1] - 1) % k

D = defaultdict(int)
ans = 0
for i in range(n + 1):
    if i >= k:
        D[A[i - k]] -= 1
    ans += D[A[i]]
    D[A[i]] += 1

print(ans)

Measured memory_bytes: 124564
#define _USE_MATH_DEFINES
#include<cmath>
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;

int main(){
	int n, m, M, a;
	long sum = 0;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> a;
		sum += a;
		if (i == 0){
			m = a;
			M = a;
		}

		if (a>M)M = a;
		else if (a < m)m = a;

	}
	//cout << fixed << setprecision(5);
	cout << m << " " << M << " " << sum << endl;

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 300003
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  ll X;
  cin>>X;
  ll t=0;
  ll money=100;
  while(money<X){
    t++;
    money=money+money/100;
  }
  cout<<t<<endl;
}


Measured memory_bytes: 3624
import sys
S = input()

tmp = 0

for i in range(len(S)):
    if((i+1)%2 == 1 and S[i]=='L'):
        print('No')
        tmp +=1
        sys.exit()
        
    if((i+1)%2 == 0 and S[i]=='R'):
        print('No')
        tmp +=1
        sys.exit

if(tmp ==0):
    print('Yes')
        

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

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

int digsum(int x){
    int ans=0;
    while(x>0){
        ans += x%10;
        x /= 10;
    }
    return ans;
}

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

    if(n==10 or n==100 or n==1000 or n==10000 or n==100000){
        cout << "10" << endl;
    }else{
        cout << digsum(n) <<endl;
    }

    return 0;
}

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

using namespace std;

struct node {
  map<char, int> nxt;
  int cnt[26] = {0};
  vector<int> end;
};

const int N = 1e6 + 10;
node tr[N];
int sz = 1;

void add(const string& s) {
  int v = 0;
  int cnt[26] = {0};
  for (char c : s) ++cnt[c - 'a'];
  for (int i = 0; i < s.size(); ++i) {
    if (i + 1 == s.size()) {
      tr[v].end.push_back(s[i]);
    }
    //--cnt[s[i] - 'a'];
    for (int j = 0; j < 26; ++j) {
      if (cnt[j]) {
        ++tr[v].cnt[j];
      }
    }
    --cnt[s[i] - 'a'];
    if (!tr[v].nxt.count(s[i])) {
      tr[v].nxt[s[i]] = sz;
      v = sz++;
    } else {
      v = tr[v].nxt[s[i]];
    }
  }
}

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

  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    add(s);
  }
  long long ans = 0;
  for (int i = 0; i < sz; ++i) {
    for (char c : tr[i].end) {
      ans += tr[i].cnt[c - 'a'] - 1;
    }
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 222236
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
    
#pragma endregion library

int main(){
    // vscode-fold=1
    string s; cin >> s;
    bool flag = false;
    rep(i,3) if (s[i]=='7') flag = true;
    if(flag) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
double l;
signed main(){
	l=read();
	printf("%.6lf",(l/3)*(l/3)*(l/3));
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

long long f(long long b, long long n) {
	if (n<b) return n;
	else return f(b,n/b)+n%b;
}

int main() {
	long long B, N, p, q, S;
	scanf("%lld%lld", &N, &S);
	if (N == S) { printf("%lld\n", N+1); return 0; }
	else {
		for (B=2LL;B<400000LL;B++) {
			if (f(B,N) == S) { printf("%lld\n", B); return 0; }
			if (B*B>N) break;
		}
		for (p=400000LL;p>0;p--) {
			if (p*p>N) continue;
			B = (N-S)/p + 1;
			if (B>1LL && f(B,N) == S) { printf("%lld\n", B); return 0; }
		}
	}

	printf("-1\n");
	return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, h;
	cin >> n >>h;
	
	VI a(n), b(n);
	rep(i,n) cin >>a[i] >>b[i];
	vector<pii> vp(n);
	rep(i,n) vp[i] = pii(b[i], a[i]);
	sort(vp.rbegin(), vp.rend());
	
	ll mxa = *max_element(all(a));
	
	int kz=0;
	rep(i,n) if(mxa < vp[i].first){
		kz++; 
		h -= vp[i].first;
		if(h <=0){
			cout << kz <<"\n";
			return 0;
		}
	}
	
	int ans = kz + (h + mxa -1) /mxa;

	cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
bool isprime(int a)
{
    for(int i=2;i<=sqrt(a);i++)
    {
        if(a%i==0)
            return false;
    }
    return true;
}
bool comp(int a,int b)
{
    return a>b;
}
bool prop(string s,string t)
{
    if(s.size()!=t.size()-1)
        return false;
    for(int i=0;i<s.size();i++)
        if(s[i]!=t[i])
        return false;
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    if(s.size()<=10 && prop(s,t))
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    
    if (S == "Y") {
      cout << "Four" << endl;
      break;
    }
  }
  
  if (S != "Y")
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>





int main()
{
    
    
    char S[4];
    int num = 0;
    
    for(int i = 0 ;i<4;i++)
        S[i] = getchar();
    
    for(int i = 0;i<4;i++)
    {
        if(S[i] == '+')
            num++;
        else
            num--;
    
    }
    
    
    printf("%d",num);    return 0;
    
    
    
    
    
}

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

#define sz(a) ((int)a.size())
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forse(i,s,e) for(int i=(int)s;i<(int)e;i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using dbl=double;
using ll=long long;
using pii=pair<int, int>;
using pll=pair<ll, ll>;

dbl PI=3.141592653589793;


void solve(){
	ll n;
	cin >> n;
	string out="";
	while(n){
		n--;
		out+=('a'+n%26);
		n/=26;
	}
	reverse(all(out));
	cout << out;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	for(int c=1;c<=T;c++){
		solve();
	}
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int cnt=0,last=a[0];
  int ans=0;
  for(int i=0;i<n;i++){
    if(last==a[i]){
      cnt++;
    }else{
      ans+=cnt%2;
      last=a[i];
      cnt=1;
    }
  }
  if(last==a[n-1]){
    ans+=cnt%2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3792
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>

int main()
{
  const int n = 100000;
  std::vector<bool> is_prime;
  is_prime.resize(n, true);
  is_prime[1] = false;
  is_prime[2] = true;

  // find out prime
  for(int i=2; i<n; i++) {
    if(is_prime[i] == false) continue;

    for(int j=i+1; j<n; j++) {
      if(j % i == 0) {
        is_prime[j] = false;
      }
    }
  }
  // std::cout << "primes: ";
  // for(int i=2; i<n; i++) {
  //   if(is_prime[i]) {
  //     std::cout << i << ",";
  //   }
  // }
  // std::cout << std::endl;

  std::set<int> primes_like_2017;
  for(int i=3; i<n; i++) {
    if(is_prime[i] == false) continue;

    if(is_prime[(i+1)/2]) {
      primes_like_2017.insert(i);
    }
  }
  // std::cout << "2017 like: ";
  // std::for_each(primes_like_2017.begin(),
  //               primes_like_2017.end(),
  //               [](int x) { std::cout << x << ", "; });
  // std::cout << std::endl;

  int Q;
  std::cin >> Q;
  std::vector<int> l(Q), r(Q);
  for(int i=0; i<Q; i++) {
    std::cin >> l[i] >> r[i];
  }

  for(int i=0; i<Q; i++) {
    int ll = l[i], rr = r[i];
    int c = std::count_if(
        primes_like_2017.begin(),
        primes_like_2017.end(),
        [ll, rr](int x) -> bool
        {
          return ll <= x  && x <= rr;
        });
    std::cout << c << std::endl;
  }


  return 0;
}


Measured memory_bytes: 3992