akhauriyash/Code-Regression huggingface dataset:
use std::io::{self, Read};
use std::ops::{BitAnd, BitOr};

fn main() {
    let mut input = "".to_owned();
    io::stdin().read_to_string(&mut input).unwrap();
    let mut input = input.split_whitespace();
    macro_rules! read {
        (_1based) => {
            read!(usize) - 1
        };
        ([$tt:tt]) => (read!([$tt; read!(usize)]));
        ([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
        (($($tt:tt),+)) => (($(read!($tt)),*));
        ($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
    }

    let (n, _) = read!((usize, usize));
    let a = read!([[_1based]; n]);

    let ans = a
        .into_iter()
        .map(|row| row.into_iter().map(|k| 1 << k).fold(0, BitOr::bitor))
        .fold(usize::max_value(), BitAnd::bitand)
        .count_ones();
    println!("{}", ans);
}


Measured memory_bytes: 4476
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static int PopCount(int bits)
    {
        bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
        bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
        bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
        bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
        return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
    }

    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var B = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        /* need c# 7.0
        int getCard(int i, int j)
        {
            if ((i - j) % 2 == 0)
            {
                return A[i];
            }
            return B[i];
        }
        */

        var maxMask = 1 << N;
        var step = new int[maxMask, N]; // [used, last]
        for (var mask = 1; mask < maxMask; mask++)
        {
            for (int i = 0; i < N; i++)
            {
                step[mask, i] = int.MaxValue;
            }
        }
        for (int i = 0; i < N; i++)
        {
            step[1 << i, i] = i;
        }

        for (var mask = 1; mask < maxMask; mask++)
        {
            var used = new List<int>();
            var nexts = new List<int>();
            for (int i = 0; i < N; i++)
            {
                if ((mask & (1 << i)) == 0)
                {
                    nexts.Add(i);
                }
                else
                {
                    used.Add(i);
                }
            }

            foreach (var last in used)
            {
                if (step[mask, last] == int.MaxValue)
                {
                    continue;
                }

                var curStep = step[mask, last];
                //var lastCard = getCard(last, used.Count - 1);
                var lastCard = (last + used.Count - 1) % 2 == 0 ? A[last] : B[last];
                for (int move = 0; move < nexts.Count; move++)
                {
                    var next = nexts[move];
                    //var nextCard = getCard(next, used.Count);
                    var nextCard = (next + used.Count) % 2 == 0 ? A[next] : B[next];
                    if (lastCard <= nextCard)
                    {
                        var nextMask = mask | (1 << next);
                        step[nextMask, next] = Math.Min(step[nextMask, next], curStep + move);
                    }
                }
            }
        }

        var best = int.MaxValue;
        for (int i = 0; i < N; i++)
        {
            best = Math.Min(best, step[maxMask - 1, i]);
        }
        if (best == int.MaxValue)
        {
            best = -1;
        }

        Console.WriteLine(best);
    }
}

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

int n,i,ans=1ll;
int a[100010];

signed main()
{
	cin>>n;
	for (i=0;i<n;i++)
	{
		cin>>a[i];
		if (a[i]==0)
		{
			cout<<0;
			return 0;
		}
	}
	for (i=0;i<n;i++)
	{
		if (1000000000000000000ll/ans<a[i])  return cout<<-1<<endl,0;
		ans*=a[i];
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 4404
module ABC131

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_B

  ! variables for this <module>
  integer(INT32), private :: num_apples
  integer(INT32), private :: val_taste_baseline

  ! arrays for this <module>
  integer(INT32), allocatable, dimension(:), private :: data_taste

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_B

    ! support variables for this <subroutine>
    integer(INT32) :: val_taste_sum

    ! support variables for this <subroutine>
    integer(INT32) :: index
    integer(INT32) :: itr

    ! STEP.01
    ! read out the given data
    read(unit=INPUT_UNIT, fmt=*) num_apples, val_taste_baseline

    ! STEP.02
    ! allocate the array to store the data of taste
    allocate( data_taste(1:num_apples) )

    ! STEP.03
    ! calculate the taste
    data_taste(:) = val_taste_baseline - 1_INT32

    do itr = 1_INT32, num_apples, 1_INT32
      data_taste(itr) = data_taste(itr) + itr 
    end do

    ! STEP.04
    ! find the index of apple which you can eat
    index = minloc( abs(data_taste(:)), dim=1 )

    ! STEP.05
    ! calculate the summation
    val_taste_sum = 0_INT32
    
    do itr = 1_INT32, num_apples, 1_INT32
      if (itr .ne. index) val_taste_sum = val_taste_sum + data_taste(itr) 
    end do

    ! STEP.06
    ! output the result
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') val_taste_sum

    ! STEP.07
    ! deallocate the array to store the data of taste
    deallocate( data_taste )

    ! STEP.END
    return

  end subroutine task_B

end module ABC131


program main

  ! <module>s to import
  use, non_intrinsic :: ABC131

  ! require all variables to be explicitly declared
  implicit none

  call task_B

end program main

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();
        final int c = scanner.nextInt();

        if (c > Math.min(a, b) && c < Math.max(a, b)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 20948
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

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

  int a10=-1,a5=-1,a1=-1;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N;j++){
      int k=N-i-j;
      if(k>=0 && i*10000+j*5000+k*1000==Y){
        a10=i;
        a5=j;
        a1=k;
        break;
      }
    }
  }
  cout << a10 << " " << a5 << " " << a1 << endl;

  return 0;
}


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

int main() {
  
  string str;
  cin >> str;
  
  int count = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == '1') {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
/*
 *******************************************************************************
 *
 * ?????????????????°???????????????????????????????????°??????
 *
 * Input		: ??\????????\????????¢?????§??????????????????
 *				  n
 *				  a1 a2 . . . an
 *				  n ?????°????????????????????????ai ??? i ???????????°?????¨??????
 * Output		: ???????????°??????????????????????????????
 *				  ??°??????????´??????????????????????????????\????????????????????°????????????????????\???????????????
 *
 * Constraints	: n <= 100
 *				  0 <= ai < 1000
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_A&lang=jp
 *
 *******************************************************************************
 */

#include<stdio.h>

#define n_MAX (int) 100		/* ??°????????????????????§??? */
#define ai_MAX (int) 999	/* ??°??????????´?????????§???(??\????????\?????§??±???????????????) */
#define ai_MIN (int) 0		/* ??°??????????´????????°???? */

void Call(int n);

/*
 *************************************************************************
 *
 * ??¢??°??????		: main??????
 *
 * param[in]	: ??????
 *
 * return		: 0 ??£?????????
 *				  1 ??°?????????
 *
 * note			: ??´??°??????????????????Call??¢??°?????£??\?????????
 *					??\???????§????
 *						??´??°???1?????§??????????????????
 *						?¬?????????§??´??°????????????????????§??????????????????
 *					??????????§????
 *						??\?????¨???????????°??????1?????§???????????????
 *
 *					??°???????????????
 *						??\????????´??????????????°?????????????????§??¨?????????????????????
 *							?????£????????´??°???????????????????????¨?????§???????????£?????´???
 *							?????????????????´??°????????¶?´??????????????????£?????´???
 *
 *************************************************************************
 */

int main(void)
{
	int n, a[ n_MAX ];
	
	if( scanf( "%d", &n ) == 1 )
	{
		if( n <= n_MAX )
		{
			for( int i = 0; i < n; i++ )
			{
				if( scanf( "%d", &a[ i ] ) == 1 )
				{
					if( ( a[ i ] < ai_MIN ) && ( a[ i ] > ai_MAX ) )
					{
						/* ??????????????´??°?????¶?´?????????????????????????ERROR???????????? */
						return -1;
					}
				}
				else
				{
					/* ??£????????´??°??????????????§???????????£????????????ERROR???????????? */
					return -1;
				}
			}
		}
		else
		{
			/* ??????????????´??°?????¶?´?????????????????????????ERROR???????????? */
			return -1;
		}
	}
	else
	{
		/* ??£????????´??°??????????????§???????????£????????????ERROR???????????? */
		return -1;
	}
	
	for( int j = n-1; j > 0; j-- )
	{
		printf( "%d ", a[j] );
	}
	printf( "%d\n", a[0] );
	
	return 0;
}

Measured memory_bytes: 1756
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;

vector<vector<int>> a;
vector<int>c;
int ans = 2000000000;
int n, m, x;

bool check(vector<int>all) {
  vector<int> score(m);
  for(int x : all) {
    rep(i, m) {
      score[i] += a[x-1][i];
    }
  }
  for(int y : score) {
    if(y < x) return false;
  }
  return true;
}

void dfs(vector<int>all) {

  if(check(all)) {
    int now = 0;
    for(int x :all) {
      now += c[x-1];
    }
    ans = min(ans, now);
    return;
  }
  for(int i= all.back()+1; i<=n; i++) {
    all.push_back(i);
    dfs(all);
    all.pop_back();
  }
}

int main() {
  cin >> n >> m >> x;
  a = vector<vector<int>>(n);
  c = vector<int>(n);
  rep(i,n) {
    cin >> c[i];
    vector<int> tmp(m);
    rep(j,m) cin >> tmp[j];
    a[i] = tmp;
  }
  for(int i=1; i<=n; i++) {
    dfs(vector<int>(1,i));
  }
  if(ans == 2000000000) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}

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

int main() {
    string s;
    cin>>s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
    }
    for(int i=0;i<s.size()-2;i++){
        if(s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    cout<<-1<<" "<<-1<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A,B,C,D; cin >> A >> B >> C >> D;
  if(C>B || A>D) cout << 0 << endl;
  else if(A<=C && B>D) cout << D- C << endl;
  else if(A>C && B<=D) cout << B-A << endl;
  else if(A>C && B>D) cout << D-A << endl;
  else if(A<=C && B <=D) cout << B-C << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>

using namespace std;

int main() {
    string S;
    cin >> S;
    int win = 0;
    for (int i = 0; i < S.length(); ++i) if (S[i] == 'o') ++win;
    cout << ((win + (15 - S.length()) >= 8) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
import math
a,b,c = map(float, input().split())

r = c * (math.pi/180)
h = b * math.sin(r)
S = 0.5*a*h
L = a+b+math.sqrt(a**2+b**2-2*a*b*math.cos(r))
print(S)
print(L)
print(h)



Measured memory_bytes: 5684
import heapq

n,m=map(int,input().split())
ls=list(map(lambda x:-int(x),input().split()))
heapq.heapify(ls)
for i in range(m):
    a=heapq.heappop(ls)
    a=-((-a)//2)
    heapq.heappush(ls,a)

print(-sum(ls))

Measured memory_bytes: 72216
#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 6333
	typedef long long ll;
	typedef double db;
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
//	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n;ll mod;
ll dp[sz][sz+2020];

int main()
{
	file();
	read(n),read(mod);
	dp[0][0+n+1]=1;
	rep(i,1,n*3) rep(j,-min(n,i/2),i) (dp[i][j+n+1]+=dp[i-1][j-1+n+1]+(i>=2?dp[i-2][j+1+n+1]*(i-1)%mod:0)+(i>=3?dp[i-3][j+n+1]*(i-1)%mod*(i-2)%mod:0))%=mod;
	ll ans=0;
	rep(i,0,n*3) (ans+=dp[n*3][i+n+1])%=mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 230552
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        String[] a=new String[n+1];
        a[0]="";
        for (int i = 1; i <= n; i++) {
            a[i]=sc.next();
        }
        if(n%2==1){
            for (int i = 0; i <= (n-1)/2; i++) {
                out.print(a[n-2*i]+" ");
            }
            for (int i = 1; i <= (n-1)/2; i++) {
                out.print(a[2*i]);
                if(i!=(n-1)/2)out.print(" ");
            }
            out.println();
        }else{
            for (int i = 0; i <= (n-2)/2; i++) {
                out.print(a[n-i*2]+" ");
            }
            for (int i = 0; i <= (n-2)/2; i++) {
                out.print(a[1+i*2]);
                if(i!=(n-2)/2)out.print(" ");
            }
            out.println();
        }
    }
}

Measured memory_bytes: 80628
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define REP(i, n) FOR(i, 1, ll(n) + 1)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    string s;
    cin >> s;

    int n = s.size();
    vector<int> dp(n + 2, 1 << 30), a(n + 1), ret(n + 1), last(26, n + 1);
    vector<vector<int>> nxt(n + 1, vector<int>(26));

    REP(i, n) a[i] = s[i - 1] - 'a';
    dp[n + 1] = 0;

    for(int i = n; i >= 0; i--) {
        rep(j, 26) {
            nxt[i][j] = last[j];
            if(chmin(dp[i], dp[last[j]] + 1)) ret[i] = j;
        }
        last[a[i]] = i;
    }

    int id = 0;
    while(id <= n) {
        cout << char(ret[id] + 'a');
        id = nxt[id][ret[id]];
    }
}

Measured memory_bytes: 29460
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
 int main(){
     string s;cin >>s;
     Yes(count(ALL(s),'a')==1&&count(ALL(s),'b')==1&&count(ALL(s),'c')==1);
  return 0;
 }


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  int B[N];
  for(int i=0;i<N;i++){
    B[i] = i+1;
  }
  pair<int,int> AB[N];
  for(int i=0;i<N;i++){
    AB[i] = make_pair(A[i],B[i]);
  }
  sort(AB,AB+N);
  for(int i=0;i<N;i++){
    cout << AB[i].second << ' ';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2432
#ABC044b
import sys
import re
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

w = input()
eimozi = "abcdefghijklmnopqrstuvwxyz"
flag = True
for i in eimozi:
    flag = w.count(i) % 2 == 0
    if (not flag):
        break
print("Yes" if flag else "No")

Measured memory_bytes: 3316
N, X, Y = [int(i) for i in input().split()]

X = X - 1
Y = Y - 1
ans = [0]*N 

for i in range(N):
    for j in range(i,N):
        minimum_line = min(abs(i-j), abs(i-X)+abs(j-Y)+1,(abs(i-Y)+abs(j-X)+1))
        ans[minimum_line] += 1

for k in range(1, N):
    print(ans[k])

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

using namespace std;

#define pb push_back
#define fs first
#define sc second
#define sz size
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+5; 

const double PI =  3.141592653589793;

int main(){
	IO;
	ll s,w;
	cin>>s>>w;
	(w>=s)?cout<<"unsafe\n":cout<<"safe\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 3616
N, Q = map(int, input().split())
S = input()

cumm = [0]*(N+1)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        cumm[i+2] = cumm[i+1] + 1
    else:
        cumm[i+2] = cumm[i+1]

for i in range(Q):
    l, r = map(int, input().split())
    print(cumm[r] - cumm[l])


Measured memory_bytes: 51288
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define HASH 18014398241046527
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
template <typename T>
ll SIZEOF(T a){return (ll)a.size();}
ll xlcm(ll a, ll b){return (a/__gcd(a, b))*b;}

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


const int N = 100005;


void SOLVE(){
    inp(n);
    inpv(a, n);
    ll ans = 0;
    for(ll i=0; i<n; i++){
        if(i&1){

        }
        else{
            if(a[i]&1){
                ans++;
            }
        }
    }
    cout << ans << '\n';
}

int main() {
	fastIO();
	// #ifndef ONLINE_JUDGE
    //     freopen("i.txt", "r", stdin);
    //     freopen("o.txt", "w", stdout);
	// #endif

    ll TC = 1;
    // cin >> TC;
    for(ll tc1=1; tc1<=TC; tc1++){
        // cout << "Case #" << tc1 << ": ";
        SOLVE();
    }
    printclock;
}

Measured memory_bytes: 3780
import Control.Applicative
import Data.List
import Control.Monad


main = do
    n <- read <$> getLine :: IO Int
    xs <- map read.words <$> getLine :: IO [Int]
    let v = foldl max (-1) xs
    putStrLn.format $ f v (delete v xs)

format (a,b) = show a ++ " " ++ show b

f v xs = foldl g (v,0) xs where
    g (n,x) y = if a < c  then (n,x) else (n,y) where 
        a = (abs $ (n-x) - (div n 2)) `min` (abs $ x - (div n 2)) 
        c = (abs $ (n-y) - (div n 2)) `min` (abs $ y - (div n 2)) 

Measured memory_bytes: 36220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<double,double> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n;
  cin>>n;
  vector<P> a(n);
  int m=1;
  reps(i,1,n+1) m*=i;
  rep(i,n){
    double x,y;
    cin>>x>>y;
    a[i]=P(x,y);
  }
  double d=0.0;
  rep(i,m){
    bool f=false;
    P p;
    double c=0.0;
    for(auto au:a){
      if(f){
        c+=sqrt(pow((p.first-au.first),2.0)+pow((p.second-au.second),2.0));
      }
      p=au;
      f=true;
    }
    d+=c;
    next_permutation(all(a));
  }
  cout<<fixed<<setprecision(10)<<d/(double)m;
}

Measured memory_bytes: 256
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

signed main(){
    ll k;
    cin>>k;
    string s;
    cin>>s;
    string a;
    if(s.size() <= k) a = s;
    else{
        rep(i,k) a += s[i];
        a += "...";
    }
    cout<<a<<endl;
}


Measured memory_bytes: 3632
//بسم الله الرحمن الرحيم
// In the name of Allah.
//Ya ALLAH,  We're nothing and you're everything.

#include <bits/stdc++.h>
#define FF(x,z,y) for(long long x=z;x<y;x++)
#define FB(x,y,z) for(long long x=y;x>z;x--)
#define asc(x) x.begin(),x.end()
#define dsc(x) x.begin(),x.end(),greater<>()
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define mxll   LONG_LONG_MAX
#define mnll   LONG_LONG_MIN
#define mxi INT_MAX
#define mni  INT_MIN
#define NL cout<<endl;

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<long long> vll;
typedef vector<int> vin;
typedef vector<vll> vllll;
typedef vector<bool> vebu;
typedef vector<vebu> vebubu;
typedef vector<string> VS;
typedef set <long long> sl;
typedef map<long long,long long> mpl;
typedef map<ll,ll,greater <ll> > mp_des;
//typedef MII::iterator iMII;

//direc     d  u   r  l
int fx4[]={+1,-1,+0,+0};
int fy4[]={+0,+0,+1,-1};
//direc    l  r   d  u  tr br tl bl
int fx8[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy8[]={-1,+1,+0,+0,+1,+1,-1,-1};
const int mxx = 1e5+1;
void cal(){
    string s = "ACL";
    int n ;
    cin>>n;
    for(int i = 0 ; i<n ; i++ ) cout<<s;
    NL;

}
void solve(){
    ll t=1;
  //  cin>>t;
    while(t--)cal();
}
//#define ALLAHU_KHALIQ 1
int main(){
  #ifdef ALLAHU_KHALIQ
        clock_t tStart = clock();
        freopen("i.txt", "r", stdin);
        freopen("o.txt", "w", stdout);
    #endif
  solve();
    #ifdef ALLAHU_KHALIQ
        fprintf(stderr, "\nRuntime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
        return 0;
}

Measured memory_bytes: 3596
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
if s[-1]=="s":
    print(s+"es")
else:
    print(s+"s")

Measured memory_bytes: 68224
#include <stdio.h>
int main(){
	char s[9];
	int a;
	for(int i=0;i<8;i++)
	{
		scanf("%c",&s[i]);
	}
	scanf("%d",&a);
	s[3]+=1;
	for(int i=0;i<8;i++)
	{
	 printf("%c",s[i]);
	}
	if(a<10)
	printf("0%d\n",a);
	else printf("%d\n",a);
	return 0;
}

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

//#include "rubo.h"
//#define mp make_pair
//#define pb push_back
#define in int
#define ll long long
#define vc vector
#define SQ(j) (j)*(j)
//#define x first
//#define y second

//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

#define db(x) cout << #x << " = " << x << endl
#define dbCont(x) cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout << endl;

typedef long double ld;

using namespace std;


const int N = 3000 + 5;

int n;
ll a[N];

ll getMax(int l, int r);

ll getMin(int l, int r);

ll ZERO = 534756135857345ll;
ll memoMin[N][N];
ll memoMax[N][N];

ll getMax(int l, int r) {
    if(memoMax[l][r] != ZERO) return memoMax[l][r];
    if (l == r) {
        return a[l];
    }

    return memoMax[l][r] = max(
            a[l] + getMin(l + 1, r),
            a[r] + getMin(l, r - 1)
    );
}

ll getMin(int l, int r) {
    if(memoMin[l][r] != ZERO) return memoMin[l][r];
    if (l == r) {
        return -a[l];
    }

    return memoMin[l][r] = min(
            -a[l] + getMax(l + 1, r),
            -a[r] + getMax(l, r - 1)
    );
}

int main() {
    loop(i, N) loop(j, N) {
            memoMax[i][j] = ZERO;
            memoMin[i][j] = ZERO;
        }

    cin >> n;
    loop(i, n) {
        cin >> a[i];
    }

    ll res = getMax(0, n - 1);
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 141568
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
int main() {
	int H, W;
	cin >> H >> W;
	int cnt[26] = { 0 };
	rep(i, H) {
		string a;
		cin >> a;
		rep(j, W) cnt[a[j] - 'a']++;
	}
	int four, two, one;
	if (H % 2 == 0 && W % 2 == 0) {
		four = H*W / 4;
		two = one = 0;
	}
	else if (H % 2 == 0) {
		four = H*(W - 1) / 4;
		two = H / 2;
		one = 0;
	}
	else if (W % 2 == 0) {
		four = (H - 1)*W / 4;
		two = W / 2;
		one = 0;
	}
	else {
		four = (H - 1)*(W - 1) / 4;
		two = (H - 1) / 2 + (W - 1) / 2;
		one = 1;
	}
	for (int i = 0; i < 26; i++) {
		if (four) {
			int k = min(four, cnt[i] / 4);
			four -= k;
			cnt[i] -= 4 * k;
		}
		if (two) {
			int k = min(two, cnt[i] / 2);
			two -= k;
			cnt[i] -= 2 * k;
		}
		if (one) {
			int k = min(one, cnt[i]);
			one -= k;
			cnt[i] -= k;
		}
	}
	if (four == 0 && two == 0 && one == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 1300009
#define M 1000000007
#define INF 5e17
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define mp make_pair
#define mt make_tuple
#define pb push_back
bool desc(ll i, ll j) { return i > j; }
ll power(ll x,ll n)
{   if(n==0||x==0) return 1;
    else if(n%2 == 0) return power((x*x)%M,n/2);
    else return (x*power((x*x)%M,(n-1)/2))%M;
}
ll fac[MAX],not_prime[MAX],ar[MAX],dp[MAX],vis[MAX];
string s[MAX];
void fact(){
    fac[0]=1;
    for(ll i=1;i<=1000009;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<=MAX;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=MAX;i+=p) not_prime[i]=1;
        }
    }
}
vector<list<pair<ll,ll> > > g(MAX);
int main(){
    //buf; 
    //sieve(); 
    //fact();
    ll i,j,test,ans,a,b,c,d,n,z,m,p,k,flag; string sk; 
    cin>>n;
    for(i=1;i<n;i++){
        cin>>a>>b>>c;
        g[a].pb({b,c}); g[b].pb({a,c});
    }
    cin>>m>>k;
    queue<ll> qu;
    qu.push(k);
    while(!qu.empty()){
        ll cur=qu.front();
        qu.pop();
        vis[cur]=1;
        for(auto it=g[cur].begin();it!=g[cur].end();it++){
            if(!vis[it->first]){
                qu.push(it->first); dp[it->first]=dp[cur]+it->second;
            }
        }
    }
    while(m--){
        cin>>a>>b;
        cout<<dp[a]+dp[b]<<endl;
    }
    return 0;
} 

Measured memory_bytes: 48256
#include<iostream>
#include<math.h>
using namespace std;

int N, K;
int x;
int cost = 0;

int main(){
    cin >> N;
    cin >> K;
    for (int i = 0; i < N; i++)
    {
        cin >> x;
        cost += min(K - x, x);
    }
    
    cout << cost * 2 << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vector<int> v(N);
    rep(i, N) cin >> v[i];
    int p = 0;
    p = N * (N - 1) / 2;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            ans += v[i] * v[j];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
var lines = [];

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
})

rl.on('line', function (x) {
    lines.push(x);
});

rl.on("close", function () {
    var N = Number(lines[0]);

    
    if (1000 <= N) { console.log("ABD") }
    else { console.log("ABC") }

});

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535
const long long int MOD = 998244353;
#define pb push_back
#define mp make_pair
#define fill(a)  memset(a, 0, sizeof (a))
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define watch(x) cout << (#x) << " is " << (x) << endl;
const long long int MAXX = 2e6 + 5;
const long long int MINN = 2e5 + 5;
const long long int inf = 1e8;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;

ll lcm(ll a, ll b) {
   return a / __gcd(a, b) * b;
}
int XOR(int x, int y){
  return (x | y) & (~x | ~y);
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
    return (a.second < b.second);
}
// bool isl = binary_search(x.begin(), x.end(), 5);
// __builtin_popcount(x)  - Returns the number of set bits in x
const long long int N = 1000+5;
const int MAXN = 105;
int binsearch(int lo, int hi){
	while(lo<hi){
		int mid=(lo+hi)/2;
		if((mid))   // check(mid)
			hi=mid;
		else
			lo=mid+1;
	}
	return lo;
}
ll power(ll x,ll y){
    ll res=1;
    while(y>0){
      if(y&1) res=(res*x);

      y/=2;
      x=(x*x);
    }
    return res;
}

int main(){
    FAST
    ll x;
    cin>>x;
    ll ans=0;
    ll temp= x;
    ans = 1000*(x/500) + 5*((x%500)/5);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int input[4], i;
	int time[100] = {};
	int count = 0;

	for (i = 0; i < 4; i++) {
		scanf("%d", &input[i]);
	}

	for (i = input[0]; i < input[1]; i++) {
		time[i]++;
	}

	for (i = input[2]; i < input[3]; i++) {
		time[i]++;
	}

	for (i = 0; i < 100; i++) {
		if (time[i] == 2) {
			count++;
		}
	}

	printf("%d", count);
	return(0);
}


Measured memory_bytes: 128
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	buff := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &buff[i])
	}
	for i := 0; i < n; i++ {
		v := buff[i]
		j := i - 1
		for j >= 0 && buff[j] > v {
			buff[j+1] = buff[j]
			j--
		}
		buff[j+1] = v
		for k := 0; k < n; k++ {
			fmt.Printf("%d", buff[k])
			if k < n-1 {
				fmt.Print(" ")
			}
		}
		fmt.Print("\n")
	}
}



Measured memory_bytes: 1216
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.algorithm;

immutable MAX_SCORE = 20;
immutable MAX_CARDS = 10;



void main() {
    string[] input;

    while ((input = readln.chomp.split(" ")).length != 0) {
        auto cards = new bool[](10); //未出現カード
        auto openedCards = input.map!(to!int); //0,1:自分の手札, 2:相手の公開札
        auto deck = MAX_CARDS - (openedCards.length); //山札の残り枚数
        auto myScore = openedCards[0] + openedCards[1]; //現在の手札の合計
        auto count = 0;

        cards.fill(true);
        foreach (i; openedCards) {
            cards[i - 1] = false;
        }
        foreach (i; 0..(MAX_SCORE - myScore)) {
            if (i >= 10) break;
            if (cards[i]) count++;
        }

        if ((count.to!double / deck) >= 0.50) {
            writeln("YES");
        } else {
            writeln("NO");
        }
    }
}

Measured memory_bytes: 1076
//
// Default setup for C++
//

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

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
template<typename T> struct is_container {
template<typename C> static char test(typename C::const_iterator*); template<typename> static int test(...);
static bool const value = sizeof(test<T>(nullptr)) == sizeof(char) && !std::is_same<std::string, T>::value;
};
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
istream& operator>>(istream& i, T& x) { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#ifndef DEBUG
#define DEBUG 0
#endif
#define dbg(X) do { if (DEBUG) { cout << #X ": " << (X) << endl << flush; } } while (0)
#define dbg2(X) do { if (DEBUG) { cout << #X ":" << endl; for (auto& __x : (X)) { cout << __x << endl << flush; } } } while (0)
#define dbgv(...) do { if (DEBUG) { cout << "(" #__VA_ARGS__ "): " << make_tuple(__VA_ARGS__) << endl << flush; } } while (0)
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
ostream& operator<<(ostream& o, const T& x) { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Main
void mainCase() {
  int n; // <= 10^6
  cin >> n;
  vector<ll> ls(n, 0);
  cin >> ls;

  // cnts[x] = #{ i | x = -Ai + i }
  map<ll, ll> cnts;
  FOR(i, 0, n) {
    ll q = - ls[i] + i;
    cnts[q]++;
  }

  ll res = 0;
  FOR(i, 0, n) {
    ll p = ls[i] + i;
    ll q = - ls[i] + i;
    cnts[q]--;
    res += cnts[p];
  }
  cout << res << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  // [ Single case ]
  mainCase();
  return 0;
  // [ Multiple cases ]
  // int t;
  // cin >> t;
  // FOR(i, 0, t) { mainCase(); }
  // return 0;
}

/*
python misc/run.py atcoder/abc166/e/main.cpp --check

%%%% begin
6
2 3 3 1 3 1
%%%%
3
%%%% end
*/


Measured memory_bytes: 27336
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define ABS(a) ((a) > (0) ? (a) : -(a))

i32 gcd (i32 a, i32 b) {
  a = ABS(a);
  b = ABS(b);
  if (a == 0) return b;
  if (b == 0) return a;
  i32 r = a % b;
  while (r > 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int cmp (const void *a, const void *b) {
  i32 d = *(i32 *)a - *(i32 *)b;
  return d == 0 ? 0 : d < 0 ? -1 : 1;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *a = (i32 *) calloc (n + 1, sizeof (i32));
  for (i32 i = n; i >= 0; --i) {
    scanf ("%" SCNi32, a + i);
  }
  uint8_t *p = (uint8_t *) calloc (n + 1, sizeof (uint8_t));
  for (i32 i = 2; i <= n; ++i) {
    p[i] = 1;
  }
  for (i32 i = 2; i * i <= n; ++i) {
    if (p[i] == 0) continue;
    for (i32 j = i * i; j <= n; j += i) {
      p[j] = 0;
    }
  }
  i64 *dp = (i64 *) calloc (n + 1, sizeof (i64));
  i32 *ans = (i32 *) calloc (n + 1 + 30, sizeof (i32));
  i32 len = 0;
  for (i32 i = 2; i <= n; ++i) {
    if (p[i] == 0) continue;
    for (i32 j = 0; j <= n; ++j) {
      dp[j] = a[j];
    }
    const i32 prime = i;
    for (i32 j = n; j >= prime; --j) {
      dp[j - prime + 1] += dp[j];
      dp[j] = 0;
    }
    i32 ok = 1;
    for (i32 j = prime - 1; j >= 0; --j) {
      if (dp[j] % prime != 0) {
	ok = 0;
	break;
      }
    }
    if (ok) {
      ans[len++] = prime;
    }
  }
  i32 g = ABS(a[0]);
  for (i32 i = 1; i <= n; ++i) {
    g = gcd (g, a[i]);
  }
  for (i32 i = 2; i * i <= g; ++i) {
    if (g % i != 0) continue;
    ans[len++] = i;
    while (g % i == 0) {
      g /= i;
    }
  }
  if (g > 1) {
    ans[len++] = g;
  }
  qsort (ans, len, sizeof (i32), cmp);
  for (i32 i = 0; i < len; ++i) {
    if (i > 0 && ans[i - 1] == ans[i]) continue;
    printf ("%" PRIi32 "\n", ans[i]);
  }
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 384
/*-------property of the half blood prince-----*/

#include <bits/stdc++.h>
#include <dirent.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define MIN(X,Y) X<Y?X:Y
#define MAX(X,Y) X>Y?X:Y
#define ISNUM(a) ('0'<=(a) && (a)<='9')
#define ISCAP(a) ('A'<=(a) && (a)<='Z')
#define ISSML(a) ('a'<=(a) && (a)<='z')
#define ISALP(a) (ISCAP(a) || ISSML(a))
#define MXX 10000000000
#define MNN -MXX
#define ISVALID(X,Y,N,M) ((X)>=1 && (X)<=(N) && (Y)>=1 && (Y)<=(M))
#define LLI long long int
#define VI vector<int>
#define VLLI vector<long long int>
#define MII map<int,int>
#define SI set<int>
#define PB push_back
#define MSI map<string,int>
#define PII pair<int,int>
#define PLLI pair<LLI,LLI>
#define PDD pair<double,double>
#define FREP(i,I,N) for(int (i)=(int)(I);(i)<=(int)(N);(i)++)
#define eps 0.0000000001
#define RFREP(i,N,I) for(int (i)=(int)(N);(i)>=(int)(I);(i)--)
#define SORTV(VEC) sort(VEC.begin(),VEC.end())
#define SORTVCMP(VEC,cmp) sort(VEC.begin(),VEC.end(),cmp)
#define REVV(VEC) reverse(VEC.begin(),VEC.end())
#define INRANGED(val,l,r) (((l)<(val) || fabs((val)-(l))<eps) && ((val)<(r) || fabs((val)-(r))<eps))
#define INRANGEI(val,l,r) ((val)>=(l) && (val)<=(r))
#define MSET(a,b) memset(a,b,sizeof(a))
using namespace std;
using namespace __gnu_pbds;

//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction


//typedef tree < int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

int main(){
    string s;
    cin>>s;
    if(s[0]==s[1] && s[1]==s[2]){
        cout<<"Yes\n";
    }
    else if(s[1]==s[2] && s[2]==s[3]){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::{self, Read};

fn main() {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).unwrap();
    let buffer = buffer.trim_right();

    let mut it = buffer.split(' ');
    let a: i32 = it.next().unwrap().parse().unwrap();
    let b: i32 = it.next().unwrap().parse().unwrap();

    let r = a - (2 * b);
    if 0 < r {
        println!("{}", r);
    } else {
        println!("0");
    }
}


Measured memory_bytes: 4352
N = int(input())
A = map(int, input().split())
flag = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            flag = False
            break
if flag:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 2940
N = int(input()) # 数字を変数に格納
K = int(input()) # 数字を変数に格納

num = len(str(N))
n = str(N)
List = [[0,0],[0,0],[0,0]]
count = 0

for i in range(num):
    if n[i] != '0':
        List[count][0] = int(n[i])
        List[count][1] = num - i
        count += 1
        if count == 3:
            break
        
result = 0

if K == 1:
    result += List[0][0] + (List[0][1] - 1) * 9
elif K == 2:
    if N <= 10:
        result = 0
    else:
        if List[1][1] != 0:
            result += List[1][0] + (List[1][1] - 1) * 9 # 最高桁数固定
        result += (List[0][0] - 1) * (List[0][1] - 1) * 9 # 最高桁数が上記以外
        result += 9 * 9 * (List[0][1] - 1) * (List[0][1] - 2) / 2 # 最高桁数が0
elif K == 3:
    if N <= 110:
        result = 0
    else:
        if List[2][1] != 0:
            result += List[2][0] + (List[2][1] - 1) * 9 # 最高1桁2桁固定
        if List[1][1] != 0:
            result += (List[1][0] - 1) * (List[1][1] - 1) * 9 # 最高1桁固定2桁が上記以外
        result += 9 * 9 * (List[1][1] - 1) * (List[1][1] - 2) / 2 # 最高1桁固定2桁が0
        result += (List[0][0] - 1) * 9 * 9 * (List[0][1] - 1) * (List[0][1] - 2) / 2 # 最高1桁が上記以外
        result += 9 * 9 * 9 * (List[0][1] - 1) * (List[0][1] - 2) * (List[0][1] - 3) / 3 / 2 # 最高1桁が0

print(int(result))

Measured memory_bytes: 3188
from scipy.sparse.csgraph import dijkstra, csgraph_from_dense
import numpy as np

H, W = map(int, input().split())
S = [input() for _ in range(H)]

v_id_dict = {}
dista = np.ones((400, 400)) * np.inf

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            v_id_dict[i, j] = len(v_id_dict)

            if (i > 0) and (S[i - 1][j] == "."):
                dista[v_id_dict[(i, j)], v_id_dict[(i - 1, j)]] = 1

            if (j > 0) and (S[i][j - 1] == "."):
                dista[v_id_dict[(i, j)], v_id_dict[(i, j - 1)]] = 1

dist_mat = dijkstra(
    csgraph_from_dense(dista[: len(v_id_dict), : len(v_id_dict)]),
    directed=False,
    unweighted=False,
)

print(int(dist_mat.max()))


Measured memory_bytes: 19424
/*
We will not return to the countless mistakes of the past
I will not relive the failures of the man I once was

Only through dedication will I destroy all preconception

No longer will I let myself be truly satisfied with the standard
We will not return to the countless mistakes of the past

Only through dedication will I destroy all preconception

Let this be
Be the day
Day of my
My declaration
Let this be the day of my declaration

Join me,
Walk with me

Shatter the bonds that tie us
To what we strive to never be

Join me,
Walk with me
*/
#include<bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const ll maxn=1000001;

int main(){

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

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
#include <cmath>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define P(r) do{for(auto i:r){cout<<i<<' ';}cout<<'\n';}while(0)
int main()
{
    int N; cin >> N;
    vector<int> a(N); for (int &x : a) cin >> x;
    int ans = numeric_limits<int>::max();
    for (int t = -100; t <= 100; t++) {
        int cost = 0;
        for (int x : a) cost += (x - t) * (x - t);
        ans = min(ans, cost);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256