akhauriyash/Code-Regression huggingface dataset:
#Union Find
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
 
#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)
 
#xが属する集合の個数
def size(x):
    return -par[find(x)]
 
N,M,K = map(int,input().split())
#初期化
#根なら-size,子なら親の頂点
par = [-1]*(N+1)
 
friends = [[]for i in range(0,N+1,1)]
block = [[]for i in range(0,N+1,1)]
for i in range(0,M,1):
    a,b = map(int,input().split())
    friends[a].append(b)
    friends[b].append(a)
    unite(a,b)
for i in range(0,K,1):
    a,b=map(int,input().split())
    block[a].append(b)
    block[b].append(a)
 
countmem = [0]*N
for i in range(1,N+1,1):
    count = size(i)-1
    mem = []
    ma = mem.append
    for j in range(0,len(friends[i]),1):
        if same(i,friends[i][j]):
            count -=1
            ma(friends[i][j])
    for j in range(0,len(block[i]),1):
        if same(i,block[i][j]) and not(block[i][j] in mem):
            count -=1
    countmem[i-1]=count
 
print(*countmem)

Measured memory_bytes: 128032
package main

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

func main() {
	i, _ := IntStdin()
	x := IntMultiplier(i)
	fmt.Println(x)
}

//文字列入力
func StrStdin() (stringInput string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput = scanner.Text()

	stringInput = strings.TrimSpace(stringInput)
	return
}

//数値入力
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

func IntMultiplier(i int) int {
	i = i * i * i
	return i
}


Measured memory_bytes: 1088
#include <iostream>

using namespace std;

int main(void){


  int p[8];
  int mgr[8] = {1,2,1,2,1,4,1,4};

  while( cin >> p[0] ){

    for( int i = 1 ; i < 8 ; i++ ){
      cin >> p[i];
    }
    int s = 0;
    int min = 9999999;
    int i = 0;
    int a[8] = {0,2,6,4,1,3,7,5};
    int b[8] = {1,3,7,5,2,4,0,6};
    int c[8] = {2,4,0,6,3,5,1,7};
    int d[8] = {3,5,1,7,4,6,2,0};
    int e[8] = {4,6,2,0,5,7,3,1};
    int f[8] = {5,7,3,1,6,0,4,2};
    int g[8] = {6,0,4,2,7,1,5,3};
    int h[8] = {7,1,5,3,0,2,6,4};
    int ans;
    
    while(1){
      s = 0;
      if( p[0] - mgr[a[i]] > 0 ) s = s + p[0] - mgr[a[i]];
      if( p[1] - mgr[b[i]] > 0 ) s = s + p[1] - mgr[b[i]];
      if( p[2] - mgr[c[i]] > 0 ) s = s + p[2] - mgr[c[i]];
      if( p[3] - mgr[d[i]] > 0 ) s = s + p[3] - mgr[d[i]];
      if( p[4] - mgr[e[i]] > 0 ) s = s + p[4] - mgr[e[i]];
      if( p[5] - mgr[f[i]] > 0 ) s = s + p[5] - mgr[f[i]];      
      if( p[6] - mgr[g[i]] > 0 ) s = s + p[6] - mgr[g[i]];
      if( p[7] - mgr[h[i]] > 0 )s = s + p[7] - mgr[h[i]];    
      //cout << "---" << s << "---" << endl;
      if( min > s ){
	min = s;
	ans = i;
      }
      if( i == 7 )break;
      i++;
    }
 
    cout << mgr[a[ans]] << " " << mgr[b[ans]] << " " << mgr[c[ans]] << " " << mgr[d[ans]] << " " << mgr[e[ans]] << " " << mgr[f[ans]] << " " << mgr[g[ans]] << " " << mgr[h[ans]] << endl;
    
    
  }
  
  return 0;
}

Measured memory_bytes: 1164
N=int(input())
A=list(map(int,input().split()))
 
mul=1
if 0 in A:print("0")
else:
    for i in range(N):
        mul*=A[i]
        if mul>pow(10,18):
            print("-1")
            break
        elif i==N-1:print(mul)

Measured memory_bytes: 21588
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

typedef long long ll;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a + b == 15)
        cout << "+" << endl;
    else if (a * b == 15)
        cout << "*" << endl;
    else
        cout << "x" << endl;

    return 0;
}


Measured memory_bytes: 256
#A=int(input())
#A=list(map(int,(input().split())))
import math
a,b,x=list(map(int,(input().split())))
mmax=a*a*b
if(mmax/2<=x):#半分以上
	kakudo=math.atan((mmax-x)*2/(a**3))
	print(math.degrees(kakudo))
else:
	kakudo=math.atan(x*2/(a)/(b**2))
	print(90-math.degrees(kakudo))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    int n = S.length();

    if (n == 2){
        cout << S << endl;
    }
    else {
        for (int i = n-1; i >= 0; i--){
            cout << S[i];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int i,j,k,n,m,a[200007];
int main()
{
    multiset<int>st;
    multiset<int>::	iterator it;
	cin>>n;
    for(i=0;i<n;i++)
      cin>>a[i];
    st.insert(a[0]);
    for(i=1;i<n;i++)
    {
      it = st.upper_bound(a[i]-1);
      if(it == st.begin())
      {
      	st.insert(a[i]);
      }
      else
      {
      	it--;
        st.erase(it);
        st.insert(a[i]);
      }
    }
  cout<<st.size()<<endl;
}

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}
// -------------------------------------------------------------------

using P = pair<int, int>;

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

    string s;
    cin >> s;
    reverse(all(s));

    bool ans = true;
    while (s.length()) {
        if (s.substr(0, 5) == "maerd")
            s = s.substr(5);
        else if (s.substr(0, 7) == "remaerd")
            s = s.substr(7);
        else if (s.substr(0, 5) == "esare")
            s = s.substr(5);
        else if (s.substr(0, 6) == "resare")
            s = s.substr(6);
        else {
            ans = false;
            break;
        }
    }

    print(ans ? "YES" : "NO");

    return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean cantReducedAnyMore = false;
        int previous = sc.nextInt();
        int current ;
        String result = "Yes";
        while (sc.hasNext()){
            current = sc.nextInt();
            int diff = current - previous;
            if(diff > 0){
                cantReducedAnyMore = false;
            } else if(diff == -1){
                if(cantReducedAnyMore){
                    result = "No";
                    break;
                }else {
                    cantReducedAnyMore = true;
                }
            }else if(diff < -1){
                result = "No";
                break;
            }
            previous = current;
        }
        System.out.println(result);
    }

}


Measured memory_bytes: 53392
using System;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var ave = a.Average();
        double min = int.MaxValue;
        int mincount = -1;
        for (int i = 0; i < a.Length; i++)
        {
            if (Abs(ave - a[i]) < min)
            {
                min = Abs(ave - a[i]);
                mincount = i;
            }
        }
        Console.WriteLine(mincount);
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define pb push_back
#define inf 1e16
#define mod 998244353
#define en '\n'
#define ld long double
ll pw(ll b, ll r){
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%mod;
		b = (b*b)%mod;
		r>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;string s;cin>>n>>s;
	ll ans = 0 ; 
	for(int i = 0 ; i < n-2 ; i ++ ){
		if(s.substr(i,3)=="ABC")ans++;
	}
	cout<<ans<<en;
	return 0 ; 
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int N;
	scanf("%d", &N);

	double res = 0;
	for(int n=0; n<N; n++){
		double c;
		char s[4];
		scanf("%lf %s", &c, s);
		if(s[0] == 'B'){
			c *= 380000;
		}
		res += c;
	}
	printf("%f\n", res);
	return 0;
}


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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

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


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}

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

	string s, t;
	cin>>s>>t;
		// int n;
	// cin>>n;	
	int f = 0;
	for(int i = 0; i < t.size()-1; i++)
	{
		if(s[i]!=t[i])
		{
			f=1;
			break;
		}
	}
	if(f) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 3676
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
class Combination {
    int powmod(int a, int p) {
        int ans = 1;
        int mul = a;

        for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }

        return ans;
    }
public:
    int N;
    int mod;
    vector<int> fact;
    vector<int> revFact;

    Combination(int n, int m) : N(n), mod(m), fact(n+1), revFact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }

        // Fermat's little theorem
        revFact[N] = powmod(fact[N], mod - 2);

        for (int i = N-1; i >= 0; i--) {
            revFact[i] = revFact[i+1] * (i+1);
            revFact[i] %= mod;
        }
    }

    int get(int a, int b) {
        return (((fact[a] * revFact[b]) % mod) * revFact[a-b]) % mod;
    }
};

signed main() {
    int H, W, A, B;
    cin >> H >> W >> A >> B;

    int ret = 0;
    Combination comb = Combination(H + W, MOD);

    for (int i = 0; i <= H - A - 1; i++) {
        ret += comb.get(i + B - 1, i) * comb.get((H - 1 - i) + (W - 1 - B), H - 1 - i);
        ret %= MOD;
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int M, D;
  std::cin >> M >> D;
  ll count= 0;
  for(int i=1;i<=M;i++){
    for(int j=1;j<=D;j++){
      if((j/10)>=2&&(j%10)>=2&&(j/10)*(j%10)==i) count++;
    }
  }
  std::cout << count << '\n';
  return 0;
}


Measured memory_bytes: 888
#include <iostream>

using namespace std;

void print(int *data, int N){
    
    cout << data[0];
    for(int i = 1; i < N; i++){
        cout << " " << data[i];
    }
    cout << endl;
    return;
}

int main(){
    int N, A[1000];
    
    // input
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    for(int i = 1; i < N ; i++){
        int v = A[i];
        int j = i - 1;
        print(A, N);
        while( (j >= 0) && (A[j] > v) ){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
    }
    print(A, N);
    
    return 0;

}


Measured memory_bytes: 3108
import java.util.*;

class Main {
    Scanner sc = new Scanner(System.in);

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

    private void run() {
        int n = sc.nextInt();
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0 || i % 5 == 0) continue;
            sum += i;
        }
        System.out.println(sum);
    }
}


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

int a[1000],x,sum;
int main()
{
    int n,l;    cin>>n>>l;
    for(int i=1;i<=n;i++)
    {
        a[i]=i+l-1;
        sum+=a[i];
    }

    if(l<0 && (l+n-1)>=0)
        x=0;
    else if(l>=0)
        x=l;
    else x=l+n-1;

    cout<<sum-x;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
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 dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
#define rSORT(v) std::sort(v.begin(), v.end(),std::greater<int>())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N >> K;
    string s;
    cin >> s;
    if (count(s.begin(), s.end(), s[0]) == N) {
        cout << N << endl;
        return 0;
    }
    vector<int> a;
    int id = 0;
    int zero = 0; int one = 0;
    for (int i = 0; i < N; ++i) {
        if (s[i] != s[0]) {
            id = i;
            break;
        }
        if (s[i] == '0') zero++;
        if (s[i] == '1') one++;
    }
    for (int i = id; i < N; i++) {
        if (s[i] == '0') {
            if (one) {
                a.push_back(one);
                one = 0;
            }
            zero++;
        }

        if (s[i] == '1') {
            if (zero) {
                a.push_back(-zero);
                zero = 0;
            }
            one++;
        }

    }

    if (one) { a.push_back(one); }
    if (zero) { a.push_back(-zero); }
    vector<int> v;
    v.push_back(0);
    for (size_t i = 0; i < a.size(); i++) {
        v.push_back(a[i]);
    }
    vector<int> ruiseki = v;
    for (size_t i = 0; i < ruiseki.size(); i++) {
        ruiseki[i] = abs(ruiseki[i]);
    }
    for (size_t i = 1; i < ruiseki.size(); ++i) {
        ruiseki[i]+=ruiseki[i-1];
    }

    int ans = 0;
    queue<int> que;
    int ii = 0;
    for (size_t i = 1; i < ruiseki.size(); ++i) {
        if (v[i] < 0) que.push(i);

        if (que.size() > K) {
            ii = que.front(); que.pop();
        }
        ans = max(ans, ruiseki[i] - ruiseki[ii]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1720
#include <stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int matrix[MAX+1][MAX+1];
int color[MAX+1];
int d[MAX+1];
int f[MAX+1];
int n;
int time;

void visit(int u){

    int v;

    color[u] = GRAY;
    d[u] = ++time;

    for( v = 1 ; v <= n ; v++ ){

        if( matrix[u][v] == 0 ){
            continue;
        }
        if( color[v] == WHITE ){
            visit(v);
        }
    }

    color[u] = BLACK;
    f[u] = ++time;


}

void dfs(){

    int u;

    for( u = 0 ; u <= n ; u++ ){
        color[u] = WHITE;
    }

    time = 0;

    for( u = 1 ; u <= n ; u++ ){
        if( color[u] == WHITE ){
            visit(u);
        }
    }

    for( u = 1 ; u <= n ; u++ ){
        printf("%d %d %d\n",u,d[u],f[u]);
    }

}



int main(){

    int i,j;
    int row,col;
    int num;

    scanf("%d",&n);

    for( i = 0 ; i <= n ; i++ ){
        for( j = 0 ; j <= n ; j++ ){
            matrix[i][j] = 0;
        }
    }

    for( i = 1 ; i <= n ; i++ ){

        scanf("%d",&row);
        scanf("%d",&col);

        for( j = 0 ; j < col ; j++ ){
            scanf("%d",&num);
            matrix[row][num] = 1;
        }

    }
    

    dfs();

    return 0;

}

Measured memory_bytes: 640
#include <iostream>

template <int MOD>
class ModInt {
    using lint = long long;

public:
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // assignment
    ModInt& operator=(const ModInt& x) {
        if (this != &x) { this->val = x.val; }
        return *this;
    }

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt operator~() const { return *this ^ (MOD - 2); }

    // increment / decrement
    ModInt& operator++() { return *this += 1; }
    ModInt& operator--() { return *this -= 1; }
    ModInt operator++(int) {
        ModInt before = *this;
        ++(*this);
        return before;
    }
    ModInt operator--(int) {
        ModInt before = *this;
        --(*this);
        return before;
    }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator%(const ModInt& x) const { return ModInt(*this) %= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt operator^(const ModInt& x) const { return ModInt(*this) ^= x; }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator%=(const ModInt& x) {
        val %= x.val;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= ~x; }
    ModInt& operator^=(const ModInt& x) {
        int n = x.val;
        ModInt b = *this;
        if (n < 0) n = -n, b = ~b;

        *this = 1;
        while (n > 0) {
            if (n & 1) *this *= b;
            n >>= 1;
            b *= b;
        }
        return *this;
    }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
    bool operator<(const ModInt& b) const { return val < b.val; }
    bool operator<=(const ModInt& b) const { return val <= b.val; }
    bool operator>(const ModInt& b) const { return val > b.val; }
    bool operator>=(const ModInt& b) const { return val >= b.val; }

    // I/O
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
};

using mint = ModInt<998244353>;

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

    mint ans = 0;
    for (int i = 1; i <= n; ++i) {
        mint x;
        std::cin >> x;
        ans += x * ((x + 1) ^ (i - 1)) * (mint(2) ^ (n - i));
    }

    std::cout << ans << std::endl;
    return 0;
}



Measured memory_bytes: 3116
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    size_t N, H[20];

    scanf("%zu\n", &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%zu", &(H[i]));
        if (i < N - 1) {
            scanf(" ");
        }
    }

    size_t max = 0;
    size_t count = 0;

    for (size_t i = 0; i < N; i++) {
        if (max <= H[i]) {
            count++;
            max = H[i];
        }
    }

    printf("%zu", count);

    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;
void y(bool cond) {
	if (cond)print("Yes");
	else print("No");
}

void solve() {
	ll X, Y; cin >> X >> Y;
	int ans = 0;
	int now = X;
	while (now <= Y) {
		now *= 2;
		ans++;
	}
	print(ans);
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define repr(i,a,b) for (int i = (a); i >= int(b); --i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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; }


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  ll n; cin >> n;
  vector<ll> a(n);
  rep(i,0,n)  cin >> a[i]; 
  map<ll,ll> cnt;
  ll ans=0;
  repr(i,n-1,0){
    ans+=cnt[a[i]+i];
    cnt[i-a[i]]++;
  }
  cout << ans << endl;
}

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

const int maxn=5e5+10;

void read(int &x)
{
	char c=getchar(); x=0;
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
}

int n,k,p[maxn],q[maxn],deg[maxn];
int tote,FIR[maxn],TO[maxn<<1],NEXT[maxn<<1];
priority_queue<int> pq;

namespace SegTree{
	int mn[maxn<<2];
#define lc (nd<<1)
#define rc (nd<<1|1)
#define mid ((s+t)>>1)

	void init()
	{
		memset(mn,0x3f3f3f3f,sizeof(mn));
	}

	void update(int nd,int s,int t,int id,int val)
	{
		if (s==t) {mn[nd]=val; return;}
		if (id<=mid) update(lc,s,mid,id,val);
		else update(rc,mid+1,t,id,val);
		mn[nd]=min(mn[lc],mn[rc]);
	}

	int query(int nd,int s,int t,int l,int r)
	{
		if (l<=s&&t<=r) return mn[nd];
		int Ans=0x7fffffff;
		if (l<=mid) Ans=min(Ans,query(lc,s,mid,l,r));
		if (r> mid) Ans=min(Ans,query(rc,mid+1,t,l,r));
		return Ans;
	}
}

void addedge(int u,int v)
{
	TO[++tote]=v;
	NEXT[tote]=FIR[u];
	FIR[u]=tote;
	deg[v]++;
}

int main()
{
	//freopen("permutation.in","r",stdin);
	//freopen("permutation.out","w",stdout);
	int i,x;
	read(n); read(k);
	for (i=1;i<=n;i++)
		read(p[i]),q[p[i]]=i;
	SegTree::init();
	for (i=n;i>=1;i--)
	{
		x=SegTree::query(1,1,n,q[i]-k+1,q[i]);
		if (x<=n) addedge(q[x],q[i]);
		x=SegTree::query(1,1,n,q[i],q[i]+k-1);
		if (x<=n) addedge(q[x],q[i]);
		SegTree::update(1,1,n,q[i],i);
	}
	for (i=1;i<=n;i++)
		if (!deg[i]) pq.push(i);
	for (i=n;i>=1;i--)
	{
		int u=p[i]=pq.top(); pq.pop();
		for (int p=FIR[u];p;p=NEXT[p])
			if (!(--deg[TO[p]])) pq.push(TO[p]);
	}
	for (i=1;i<=n;i++) q[p[i]]=i;
	for (i=1;i<=n;i++) printf("%d\n",q[i]);
}

Measured memory_bytes: 27764
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const ll inf=1e15+7;
int main()
{
	ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    if (k >= x/d) {
        k -= x/d;
        x -= x/d * d;
        k = k%2;
    }
    cout << abs(x - d*k) << endl;
    return 0;
}

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

int main(){
  ll s; cin>>s;
  if(s/1000000000!=1000000000){
    cout<<0<<' '<<0<<' '<<1000000000<<' '<<1000000000-s%1000000000<<' '<<1<<' '<<(s/1000000000)+1<<endl;
  }else{
    cout<<0<<' '<<0<<' '<<1000000000<<' '<<0<<' '<<0<<' '<<1000000000<<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int i, n, x;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      printf(" %d", i);
      continue;
    }
    for (;;) {
      if (x % 10 == 3) {
        printf(" %d", i);
        break;
      }
      x /= 10;
      if (!x) break;
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define maxn 55
#define pli pair<long long,int>
using namespace std;
string s[maxn<<1];
bool cmp(int idx1,int st1,int idx2,int st2,int L) {
	for(int i=0;i<L;i++)
		if(s[idx1][st1 + i] != s[idx2][st2 + i])
			return false;
	return true;
}
int cost[maxn<<1];
struct edge {
	int v,cost;
};
vector<edge> G[maxn*2*21 + 5];
void build_graph(int N) {
	for(int i=1;i<=2*N;i++) {
		int a = (i <= N ? N + 1 : 1) , b = (a == 1 ? N : 2 * N);
		for(int j=a;j<=b;j++) {
			int sz1 = (int)s[i].size() , sz2 = (int)s[j].size();
			for(int k=0;k<sz1;k++) {
				int L = min(sz1 - k, sz2);
				if(cmp(i,k,j,0,L)) {
					int u = (i - 1) * 21 + k , v;
					if(L == sz2)
						v = (i - 1) * 21 + k + L;
					else
						v = (j - 1) * 21 + L;
					G[u].push_back(edge{v,cost[j]});
				}
			}
		}
	}
	int st = N * 2 * 21 + 1;
	for(int i=1;i<=2*N;i++) {
		int v = (i - 1) * 21 + 0;
		G[st].push_back(edge{v,cost[i]});
	}
}
long long dis[maxn*2*21 + 5];
void dijkstra(int N) {
	int st = N * 2 * 21 + 1;
	
	memset(dis,-1,sizeof dis);
	dis[st] = 0;
	priority_queue<pli> pq;
	pq.push({-dis[st],st});
	
	while(!pq.empty()) {
		pli now = pq.top();
		pq.pop();
		int u = now.second;
		if(-now.first != dis[u])	continue;
		for(edge e : G[u]) {
			int v = e.v , cost = e.cost;
			if(dis[v] == -1 || dis[u] + cost < dis[v]) {
				dis[v] = dis[u] + cost;
				pq.push({-dis[v],v});
			}
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N;
	cin >> N;
	for(int i=1;i<=N;i++) {
		cin >> s[i] >> cost[i];
		s[i + N] = s[i];
		
		reverse(s[i + N].begin(), s[i + N].end());
		cost[i + N] = cost[i];
	}
	
	build_graph(N);
	dijkstra(N);
	
	long long ans = -1;
	for(int i=1;i<=2*N;i++) {
		int state = (i - 1) * 21;
		for(int j=0;j<(int)s[i].size();j++,state++) {
			if(dis[state] == -1)	continue;
			int l = j , r = (int)s[i].size() - 1;
			bool flag = true;
			for(;l<=r;l++,r--)
				if(s[i][l] != s[i][r]) {
					flag = false;
					break;
				}
			if(flag && (ans == -1 || dis[state] < ans))
				ans = dis[state];
		}
		if(dis[state] != -1 && (ans == -1 || dis[state] < ans))
			ans = dis[state];
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3704
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const long long mod = 1e9 + 7;

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

int main() {
	int h,a;
	cin >> h >> a;

	

	ll ans = (h+(a-1))/a;

	

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<vector<string>> lun(12,vector<string>());
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int cur=9;
    lun[1]={"1","2","3","4","5","6","7","8","9"};
    for(int i=2;i<12;i++){
        for(int j=0;j<lun[i-1].size();j++){
            vector<int> pos;
            if((int)(lun[i-1][j][i-2]-'0')==0){
                pos = {0,1};
            }else if((int)(lun[i-1][j][i-2]-'0')==9){
                pos = {8,9};
            }else{
                pos = {(int)(lun[i-1][j][i-2]-'0')-1,(int)(lun[i-1][j][i-2]-'0'),(int)(lun[i-1][j][i-2]-'0')+1};
            }
            for(int k:pos)
            lun[i].push_back(lun[i-1][j]+(char)(k+'0'));
            cur++;
            if(cur==100000)break;
        }
    }
    vector<string> fin;
    for(int i=1;i<12;i++){
        for(string s:lun[i]){
            fin.push_back(s);
        }
    }
    int k;
    cin>>k;
    cout<<fin[k-1]<<"\n";
    return 0;
}

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

using namespace std;

int main() {
    int n; double d, x;
    cin >> n >> d >> x;
    vector<double> p(n+1, 0), psm(n+2, 0);
    for (int i = 1; i <= n; i++) {
        p[i] = 0.5 + psm[i]/i;
        psm[i+1] = psm[i] + p[i];
    }

    double ans = 0;
    for (int i = 0; i < n; i++) {
        ans += (p[i+1]+p[n-i])/2 * (d + d+x);
        d += 2*x;
    }
    printf("%.20lf\n", ans);
    
    return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
  ll A; cin >> A;
cout << A/2+A%2;
}


Measured memory_bytes: 256
# Merge sort マージソート
# 与えられたリストAをマージソートして返す。
def mergesort(A, left, right):
    mid = int((left + right) / 2)
    if left + 1 >= right:
        return 0
    else:
        cnt = 0
        cnt += mergesort(A, left, mid)
        cnt += mergesort(A, mid, right)
        cnt += merge(A, left, mid, right)
        return cnt


def merge(A, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    l1, l2 = len(L), len(R)
    i1, i2 = 0, 0
    L += [2000000000]
    R += [2000000000]
    cnt = 0
    for k in range(l1 + l2):
        cnt += 1
        if L[i1] <= R[i2]:
            A[left + k] = L[i1]
            i1 += 1
        else:
            A[left + k] = R[i2]
            i2 += 1
    return cnt


n = int(input())
S = [int(i) for i in input().split()]
mergecnt = mergesort(S, 0, n)
for i in range(0, n - 1):
    print(S[i], end=" ")
print(S[n - 1])
print(mergecnt)



Measured memory_bytes: 61656
#include <bits/stdc++.h>
  using namespace std;
  typedef long long int ll;
  #define mod 1000000007
  #define all(v)  v.begin(),v.end()
  #define pb push_back
  #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
  ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
  ll inv(ll a){return power_mod(a,mod-2);}
  ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}
  int add(int a ,int b){ a+=b; if(a>mod) a-=mod; return a;}  

  int main()
  {
     
           int n,m;
           cin>>n>>m;
           int a[m+1];
           for(int i=1;i<=m;i++) cin>>a[i];
           int dp[n+1];
           memset(dp,0,sizeof(dp));
           dp[0]=1;
           int s[n+1];
           for(int i=1;i<=n;i++) s[i]=1;
           for(int i=1;i<=m;i++) s[a[i]]=0;
           for(int i=1;i<=n;i++)
           {
               if(s[i]==0) continue;

               dp[i]=add(dp[i-1],dp[i-2]);
           }

           cout<<dp[n]<<endl;
           
          
  }
  
  




Measured memory_bytes: 1408
N_ = int(input())

A_ = input().split()
#print(A_)

#U_ = set(A_)
#print(U_)


#def xC(num):
#    return (num * (num - 1)) //2
import collections
cnt = collections.Counter(A_)

num = 0
dict = {}
#judge = {}
#for u in U_:
#    judge[u] = False
#    num += xC(A_.count(u))
for v in cnt.values():
    num += v*(v - 1)//2
Re = []
for value in A_:
    Re.append(str(num - (cnt[value] - 1)))
print('\n'.join(Re))


Measured memory_bytes: 39636
import java.util.Scanner;

/**
 * @author shengboxu
 */

public class Main {
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        final int A = sc.nextInt();
        final int B = sc.nextInt();
        
        if (B % A  == 0) {
            System.out.println(A+B);
        } else {
            System.out.println(B-A);
        }
    }
}


Measured memory_bytes: 23764
while True:
    n = int(input())
    if n==0: break
    y = float(input())
    ans= 0 
    for i in range(n):
        b,r,t = map(int,input().split())
        if t==1:
            m = 1+y*(r/100)
        else:
            m = (1+(r/100))**y
        
        if ans < m:
            ans = m
            a = b
    
    print(a)


Measured memory_bytes: 5696
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb           push_back
#define pii          pair<int,int>
#define vi           vector<int>
#define vii         vector<pair<int,int>>
#define mp           make_pair
#define FOR(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD0(i, n) for (int i = (int)n; i >= 0; i--)
#define FORD1(i, n) for (int i = (int)n; i >= 1; i--)
#define debug(X) { cout << #X << " = " << (X) << endl; }
#define endl '\n'
#define int long long int
#define TIME (chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
bool is(string a){
    int i = 0;
    int j = a.length() -1;
    while(i < j){
        if(a[i] != a[j])return false;
        i++;
        j--;
    }
    return true;
}

void solve(){

    int l;cin >> l;
    double a = (l)*1.0/3;
    double ans = a*a*a;
    printf("%.20f", ans);

}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    
    int t = 1;
   // cin >> t;
    while(t--)solve();
}




Measured memory_bytes: 256
#include<iostream>
 
using namespace std;
 
const int MAX= 10000100;
bool prime[MAX];
void make_prime(){
  for(int i = 0 ; i < MAX ; i ++) prime[i]=true;
  prime[0]=prime[1]=false;
  for(int i = 0; i < MAX; i ++)
    if(prime[i]){
      for(int j = i * 2 ; j < MAX ; j += i)
	prime[j]=false;
    }
}
 
int main(void){
  make_prime();
  long long int n;
  while(cin>>n,n){
    if(prime[n]){
      cout<<0<<endl;
      continue;
    }
    long long int k,j;
    
    for(k = n; !prime[k]; k--);
    for(j = n; !prime[j]; j++);
    cout<<j-k<<endl;
    
  }
}

Measured memory_bytes: 10924
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    REP(i, n)
    cin >> s[i];

    sort(s.begin(), s.end());
    s.erase(std::unique(s.begin(), s.end()), s.end());

    cout << s.size() << endl;
}

int main()
{
    std::cout << std::fixed << std::setprecision(15);
    Main();
}

Measured memory_bytes: 9600
#include<stdio.h>

int main(void){
    int N,M,X,Y;
    scanf("%d %d %d %d",&N,&M,&X,&Y);
    int xmax = X;
    int x;
    for(int i=0;i<N;i++){
        scanf("%d",&x);
        if(x>xmax){
            xmax = x;
        }
    }
    int y;
    int ymin=Y;
    for(int i=0;i<M;i++){
        scanf("%d",&y);
        if(y<ymin){
            ymin = y;
        }
    }
    if(xmax>=ymin){
        printf("War");
        return 0;
    }
    printf("No War");
    return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define ll long long
void view(vector<int> &arr){
    for (auto x:arr) cout<<x<<" ";
    cout<<endl;
}

int op(int a,int b){
    return max(a,b);
}
int e(){
    return -1000000000;
}

int M;
bool f(int x){
    return x<M;
}

int main(){
    int N,Q;
    cin>>N>>Q;
    vector<int> A(N);
    REP(i,N) cin>>A[i];
    segtree<int,op,e> SEG(A);

    REP(q,Q){
        int T;
        cin>>T;
        if (T==1){
            int X,V;
            cin>>X>>V;
            X--;
            SEG.set(X,V);
        }else if (T==2){
            int L,R;
            cin>>L>>R;
            L--;
            cout<<SEG.prod(L,R)<<endl;
        }else if (T==3){
            int X;
            cin>>X>>M;
            int res=SEG.max_right<f>(X-1)+1;
            cout<<res<<endl;
        }
    }

}

Measured memory_bytes: 6260
def yakusu(num):
    x=num
    count=0
    i=0
    while (i<num):
        i+=1
        if (num%i==0):
            num=num/i
            count+=2
            if (num**2==x):
                count-=1
    return count

n=int(input())
ans=0
for j in range(1,n+1,2):
    if (yakusu(j)==8):
        ans+=1
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2")
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<unordered_map>
#include<assert.h>
#include<time.h>
#include<stdlib.h>
#include<random>
#include<deque>
using namespace std;
using lld = long long int;
using pll = pair<lld, lld>;
using lf = double;
using pff = pair<lf, lf>;
using pii = pair<int, int>;
using pli = pair<lld, int>;
using pil = pair<int, lld>;
#define M 1000000007
int n, m, p;
vector<int> a[300009];
vector<int> b[300009];
#define I 524288
int ma[2 * I];
set<pii> ss;
void updatema(int i, int k) {
	i += I;
	ma[i] += k;
	i >>= 1;
	while (i > 0) {
		ma[i] = max(ma[i * 2], ma[i * 2 + 1]);
		i >>= 1;
	}
}
int main() {
	int i, j, k, l;
	int t = 1, tv = 0;
	//scanf("%d", &t);
	while (t--) {
		scanf("%d %d %d", &n, &m, &p);
		while (p--) {
			scanf("%d %d", &i, &j);
			i--; j--;
			a[i].push_back(j);
			b[j].push_back(i);
			ss.insert(pii(i, j));
		}
		int res = 0;
		int zz[3] = { -1, -1, -1 };
		for (j = 0; j < m; j++) {
			ma[j + I] = b[j].size();
		}
		for (; j < I; j++) {
			ma[j + I] = 0;
		}
		for (j = I - 1; j > 0; j--) {
			ma[j] = max(ma[j * 2], ma[j * 2 + 1]);
		}
		for (i = 0; i < n; i++) {
			int al = a[i].size();
			for (auto it : a[i]) {
				updatema(it, -1);
			}
			int cur = al + ma[1];
			res = max(res, cur);
			for (auto it : a[i]) {
				updatema(it, 1);
			}
		}
		for (i = 0; i < n; i++) {
			ma[i + I] = a[i].size();
		}
		for (; i < I; i++) {
			ma[i + I] = 0;
		}
		for (j = I - 1; j > 0; j--) {
			ma[j] = max(ma[j * 2], ma[j * 2 + 1]);
		}
		for (j = 0; j < m; j++) {
			int al = b[j].size();
			for (auto it : b[j]) {
				updatema(it, -1);
			}
			int cur = al + ma[1];
			res = max(res, cur);
			for (auto it : b[j]) {
				updatema(it, 1);
			}
		}
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 54276
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define gt first
#define gc second.first
#define gr second.second
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int a,b,mp[123][123],i,j,x,y,p,q;
	bool flag = false;
	for(i=0; i<=100; ++i){
		for(j=0; j<=100; ++j){
			mp[i][j] = ((i%4 && j%4)?0:1);
		}
	}
	cin >> a >> b;
	if(a<b){
		swap(a,b);
		flag = true;
	}
	for(i=a; i<625; ++i){
		x = (i/25)+1;
		x *= 4;
		y = (i%25)+1;
		y *= 4;
		for(p=1; p<4; ++p){
			for(q=1; q<4; ++q){
				mp[x-p][y-q] = 1;
			}
		}
	}
	--b;
	for(i=0; i<b; ++i){
		x = (i/25)+1;
		x *= 4;
		y = (i%25)+1;
		y *= 4;
		mp[x-2][y-2] = 1;
	}
	cout << "100 100" << endl;
	for(i=1; i<=100; ++i){
		for(j=1; j<=100; ++j){
			cout << ((flag^mp[i][j])?"#":".");
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }
    }
}
int main()
{
  int X,n;
  cin>>X>>n;
  if(n==0)
  {
      cout<<X;
  }
  else
  {
      int a[n],i;
      int b[1005]={0};
      for(i=0;i<n;i++)
      {
          cin>>a[i];
          b[a[i]]=1;
      }
      int ans=1e4,res;
      for(i=0;i<=1000;i++)
      {
         int d=abs(X-i);
         if(b[i]==0)
         {
             if(ans>d)
             {
                 ans=d;
                 res=i;
             }
         }
      }
      cout<<res;
  }
}


Measured memory_bytes: 3624
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

string T;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> T;
    solve();
}

// 1 <= |T| <= 2 × 10^5
// T は P, D, ? からなる。

// string T
// T に含まれる ? をそれぞれ P または D で置き換えてできる文字列の中で、博士・PD 指数が最大のものを 1 つ出力せよ。そのような文字列が複数ある場合、どれを出力しても構わない。
void solve(){
    ll n=T.size();
    rep(i,n){
        if(T[i]=='?')T[i]='D';
    }
    cout<<T<<endl;
}


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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  
  int num = r*100 + g*10 + b;
  
  if(num % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}

Measured memory_bytes: 256