akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

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

int main(){
    int N; cin >> N;
    if(N==1){
        cout << "Hello World" << endl;
    }else{
        int A,B; cin >> A >> B;
        cout << A+B << endl;
    }
}


Measured memory_bytes: 3560
def dual_gt(x, max)
  n=0
  while(x < max) do
  	n += 1
  	x *= 2
  end
  return n
end
 
n,k = gets.split.map(&:to_f)
result = 0.0
xs = (1..n).each do |i|
	result += (1.to_f/n.to_f) * ((1.to_f/2.to_f) ** dual_gt(i.to_f, k.to_f).to_f)
end
puts result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr ll P = 1e9 + 7;
	//constexpr ll P = 998244353;

	ll n;
	cin >> n;
	ll ans = 1;
	for (ll i = 0; i < n; i++) {
		ans *= i + 1;
		ans %= P;
	}
	cout << ans << endl;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=0;
    vector<int> count(100000,0);
    for(int i=0;i<n;i++){
        count[a[i]]++;
    }
    for(int i=0;i<100000;i++){
        int num=0;
        if(i==0){
            num=count[i]+count[i+1];
        }else if(i==n-1){
            num=count[i-1]+count[i];
        }else{
            num=count[i-1]+count[i]+count[i+1];
        }
        if(num>ans){
            ans=num;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[]){

  int N;
  cin >> N;
  unsigned long long L[87];
  L[0] = 2;
  L[1] = 1;

  for(int i = 2; i <= N; i++){
    L[i] = L[i-1] + L[i-2];
  }
  printf("%llu\n", L[N]);


  return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4,sse4.1,sse4.2,avx,avx2,tune=native")
#include <bits/stdc++.h>

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

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){ if(a>b) a=b;}


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n >>k;
	
	double ans=0;
	
	rep2(i, 1, n+1){
		int su =0;
		ll z = i;
		while(z < k){ z*=2; su++;}
		ans += 1.0 / (1LL<<su) / n;
	}
	printf("%.13f\n", ans);
	return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 924844033;

struct Combination {
    int mod;
    vector<int64_t> mfact, rfact;

    Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod) {
        mfact[0] = 1;
        for (int i = 1; i < mfact.size(); i++) {
            mfact[i] = mfact[i - 1] * i % mod;
        }
        rfact[sz] = inv(mfact[sz]);
        for (int i = sz - 1; i >= 0; i--) {
            rfact[i] = rfact[i + 1] * (i + 1) % mod;
        }
    }

    int64_t fact(int k) const {
        return (mfact[k]);
    }

    int64_t pow(int64_t x, int64_t n) const {
        int64_t ret = 1;
        while (n > 0) {
            if (n & 1) (ret *= x) %= mod;
            (x *= x) %= mod;
            n >>= 1;
        }
        return (ret);
    }

    int64_t inv(int64_t x) const {
        return (pow(x, mod - 2));
    }

    int64_t P(int n, int r) const {
        if (r < 0 || n < r) return (0);
        return (mfact[n] * rfact[n - r] % mod);
    }

    int64_t C(int p, int q) const {
        if (q < 0 || p < q) return (0);
        return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
    }

    int64_t H(int n, int r) const {
        if (n < 0 || r < 0) return (0);
        return (r == 0 ? 1 : C(n + r - 1, r));
    }
};

int main() {
    Combination comb(2001, mod);

    int N, K;
    cin >> N >> K;
    vector<int> line[2001];
    for (int i = 0; i < N; i++) line[i % K].push_back(i);

    int ret = 0;
    int sz = 1;
    vector<int> dp(sz);
    dp[0] = 1;
    for (int i = 0; i < 2 * K; i++) {
        vector<int> dp2(sz + line[i % K].size());
        for (int j = 0; (int) line[i % K].size() - j >= 0; j++) {
            auto add = comb.C((int) line[i % K].size() - j, j);
            for (int k = 0; k < sz; k++) {
                (dp2[j + k] += 1LL * dp[k] * add % mod) %= mod;
            }
        }
        dp.swap(dp2);
        sz += line[i % K].size();
    }

    for (int i = 0; i <= N; i++) {
        auto sub = dp[i] * comb.fact(N - i) % mod;
        if (i % 2 == 0) (ret += sub) %= mod;
        else (ret += mod - sub) %= mod;
    }
    cout << ret << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}


Measured memory_bytes: 26344
#!/usr/bin/perl

while (<>) {
    ($n, $k) = split /\s/, $_;
}

$total = 1;
foreach (1 .. $n) {
    if ($_ == 1) {
        $total *= $k;
    } else {
        $total *= ($k - 1);
    }
}

print "$total\n";


Measured memory_bytes: 512
n = int(input())
s = input()

if n % 2 != 0:
  print("No")
else:
  half = n // 2
  found = False
  for i in range(0, half):
    if s[i] != s[half + i]:
      found = True
      break
  print("No" if found else "Yes")
  


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    int n,c;
    cin>>n>>c;
    int a[n],b[n];
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    ll powsum[401][c+1];
    fill(powsum[0],powsum[401],0);
    for(int i=1;i<=400;++i){
        for(int j=0;j<=c;++j){
            if(j==0)powsum[i][j]=1;
            else powsum[i][j]=(powsum[i][j-1]*i)%mod;
        }
    }
    for(int i=1;i<=400;++i){
        for(int j=0;j<=c;++j){
            powsum[i][j]=(powsum[i][j]+powsum[i-1][j])%mod;
        }
    }
    ll dp[n+1][c+1]={};
    dp[0][0]=1;
    rep(i,n){
        rep(j,c+1){
            for(int k=0;j+k<=c;++k){
                dp[i+1][j+k]=(dp[i+1][j+k]+dp[i][j]*(powsum[b[i]][k]-powsum[a[i]-1][k]))%mod;
            }
        }
    }
    (dp[n][c]+=mod)%=mod;
    cout<<dp[n][c]<<endl;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;



int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    if(k == 1) print(0);
    else print(n - k);

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int l,n,s=0,i;
    int tmp,  mini = 300, tmini; 
    cin >> n >> l;
    for(i=0;i<n;i++) s += l+i;
    for(i=0;i<n;i++){
        if(mini>(tmp = abs(l+i)) ){
            tmini = l+i;
            mini = tmp;
        }
    }
    s -= tmini;
    cout << s << endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x,s1=0,s2=0,i,a;
	scanf("%d %d %d",&n,&m,&x);
	for(i=0;i<m;i++)
	{
		scanf("%d",&a);
		if(a<x)
		{
			s1++;
		}
		else
		{
			s2++;
		}
	}
	printf("%d",min(s1,s2));
	return 0;
}

Measured memory_bytes: 764
/*{{{*/
#include<bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPR(I, N) for (int I = (N)-1; I >= 0; --I)
#define REPPR(I, A, B) for (int I = (A); I >= (B); --I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
void ADD(LL& x, LL v) {x = (x + v) % MOD; if (x < 0)x += MOD;}
/*}}}*/
void solve() {
	int a, b;
	R(a, b);
	REP(i, 1000000) {
		if (i * 8 / 100 == a && i / 10 == b) {
			W(i);
			return;
		}
	}
	W(-1);
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 3792
#include <iostream>
using namespace std;
int main(void){
	int  N,A,B;
  
  	cin >> N;
  
  	if(N<=1){
    	cout << "Hello World"<<endl;
    }else if(N==2){
    	cin >> A >> B;
        cout << A+B<<endl;
    }else{
    	return 1;
    }
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>

using namespace std;


int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include <array>
#include <vector>
#include <algorithm>
#include "math.h"
using namespace std;
/*
int main() {
  int N, X;
  vector<int> m;
  cin >> N >> X;
  for (int i=0; i<N; i++) {
    int mm;
    cin >> mm;
    m.push_back(mm);
    X -= mm;
  }
  int cnt = N;
  int min_price = *std::min_element(m.begin(), m.end());
  cnt = cnt + X / min_price;
  std::cout << cnt;
  return 0;
}
*/

int main() {
  std::string S;
  cin >> S;
  int price = 700;
  for (int i=0; i<3; i++) {
    if (S[i] == 'o') {
      price += 100;
    }
  }
  cout << price << std::endl;
  return 0;
}


Measured memory_bytes: 256
<?php
list($n,$m,$k)=explode(" ",trim(fgets(STDIN)));
$a=explode(" ",trim(fgets(STDIN)));
$b=explode(" ",trim(fgets(STDIN)));
$a_sum[]=(int)0;
$i=0;
while($i<$n){
  $a_sum[$i+1]=$a_sum[$i]+$a[$i];
  if($a_sum[$i+1]>$k){
    $n=$i;
    break;
  }
  ++$i;
}
$ans=$n;
$b_sum=(int)0;
$i=0;
$j=0;
while($i<=$n){
  $sum=$a_sum[$n-$i]+$b_sum;
  while($j<$m){
    if($sum+$b[$j]>$k){
      $ans=max($ans,$j+$n-$i);
      break;
    }else{
      $b_sum+=$b[$j];
      $sum+=$b[$j];
    }
    ++$j;
  }
  if($j==$m){
    echo max($ans,$j+$n-$i);
    exit;
  }
  ++$i;
}
echo $ans;

Measured memory_bytes: 50504
from collections import deque
import sys
input = sys.stdin.readline

n = int(input())
adj = [[] for _ in range(n)]
edge = {}

for i in range(n-1):
    a, b = map(int, input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)
    edge[(a-1, b-1)] = i
    edge[(b-1, a-1)] = i

que = deque()
que.append(0)
usd = [0]+[-1]*(n-1)
ans = [0]*(n-1)

while que:
    v = que.pop()
    j = 1
    for u in adj[v]:
        if usd[u] < 0:
            if j == usd[v]:
                j += 1
            usd[u] = j
            ans[edge[(u, v)]] = j
            que.appendleft(u)
            j += 1
print(max(ans))
for a in ans:
    print(a)

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

class Solver
{
    string s;

    public void Scan() => s = Console.ReadLine();

    public void Solve()
    {
        var days = new List<string>() { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
        var n = days.IndexOf(s);
        const int daysInWeek = 7;
        var answer = daysInWeek - n;
        System.Console.WriteLine(answer);
    }
}

class Program
{
    static void Main(string[] args)
    {
        var solver = new Solver();
        solver.Scan();
        solver.Solve();
    }
}

Measured memory_bytes: 13152
import java.util.*;
import java.math.*;
import java.io.*;

public class Main{
  public static void main(String agrgs[]){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int W=sc.nextInt();
    long w[]=new long[n];
    long v[]=new long[n];
    for(int i=0;i<n;i++){
        w[i]=sc.nextInt();
        v[i]=sc.nextInt();
    }
    long dp[][]=new long[n+1][W+1];
    for(int i=0;i<=n;i++){
        for(int wt=0;wt<=W;wt++){
            if(i==0||wt==0){
                dp[i][wt]=0;
            }
            else if(w[i-1]<=wt){
                dp[i][wt]=Math.max(v[i-1]+dp[i-1][wt-(int)w[i-1]],dp[i-1][wt]);
            }
            else{
                dp[i][wt]=dp[i-1][wt];
            }
        }
    }
    // for(int i=0;i<=n;i++){
    //     for(int wt=0;wt<=W;wt++){
    //         System.out.print(dp[i][wt]+" ");
    //     }
    //     System.out.println();
    // }
    System.out.println(dp[n][W]);
  }
}


Measured memory_bytes: 125908
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			String str = scan.nextLine();
			if(str.equals("0")){
				break;
			}
			String[] ns = str.split(" ");
			int sum = 0;
			int count = 0;
			for(int i = 0;i < ns.length;i++){
				int t = Integer.parseInt(ns[i]);
				sum += (t > 9)?10:t;
				if(t == 1){
					count++;
				}
			}
			boolean fl = true;
			if(sum > 21){
				System.out.println("0");
				fl = false;
			}else if(count > 0){
				for(int i = 0;i < count;i++){
					sum += 10;
					if(sum > 21){
						System.out.println(sum-10);
						fl = false;
						break;
					}
				}
			}
			if(fl){
				System.out.println(sum);
			}
		}
	}
}

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

int main(void){
    string S;
    cin>>S;
    int cnt=0,Scnt=0;
    if(S[0]=='A')
        cnt++;

    for(int i=2;i<=S.size()-2;i++){
        if(S[i]=='C'){
            Scnt++;
        }
    }
    if(Scnt==1)
        cnt++;

    int s=0;
    for(int i=0;i<S.size();i++){
        if(S[i]>='a'&&S[i]<='z')
           s++;
    }

    if(s==S.size()-2)
        cnt++;
    if(cnt==3)
        cout<<"AC"<<endl;
    else
        cout<<"WA"<<endl;
    return 0;
}


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

using namespace std;


#define MOD 1e9+7
#define ll long long int
#define ff first
#define ss second
#define N 100001


template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.ff<<", "<<a.ss<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

int dp[N][3];
int n;
int a[N][3];

int dfs(int i,int j)
{
	if(dp[i][j])
		return dp[i][j];
	if(i==n-1)
		return a[i][j];
	int x1=0,x2=0;
	if(j==0)
	{
		x1=dfs(i+1,1);
		x2=dfs(i+1,2);
	}
	if(j==1)
	{
		x1=dfs(i+1,0);
		x2=dfs(i+1,2);
	}
	if(j==2)
	{
		x1=dfs(i+1,0);
		x2=dfs(i+1,1);
	}
	dp[i][j]=a[i][j]+max(x1,x2);
	return dp[i][j];
}

void solve()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	if(n!=1)
	{
		dfs(0,0);
		dfs(0,1);
		dfs(0,2);
		cout<<max({dp[0][0],dp[0][1],dp[0][2]})<<"\n";
	}
	else
		cout<<max({a[0][0],a[0][1],a[0][2]})<<"\n";
}


int32_t main()
{
	//your code goes here...	
	int t=1;
	//cin>>t;
	while(t--)
	{
	    solve();
	}	
}

Measured memory_bytes: 7296
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  int n;
  cin >> n;
  map<string, int> vote;
  rep(i, n) {
    string s;
    cin >> s;
    vote[s]++;
  }
  int mx = 0;
  for (auto x : vote) {
    mx = max(mx, x.second);
  }
  for (auto x : vote) {
    if (x.second == mx) cout << x.first << endl;
  }
  return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#define rep(i, a, n) for(int i = int(a);i < int(n);++i)
#define repe(i, a, n) for(int i = int(a);i <= int(n);++i)
#define repr(i, a, n) for(int i = int(a);i > int(n);--i)
#define reper(i, a, n) for(int i = int(a);i >= int(n);--i)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &x[0], &x[n]
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


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

	int S = 0;
	int n = N;
	do {
		S += (n%10);
	} while(n/=10);

	if(N%S == 0) Yes;
	else No;

	return 0;
}

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

struct Problem {

	void Solve() {
		UL K; cin >> K;
		vector<UL> V(max(10u, K), -1);
		priority_queue<pair<UL, UL>, vector<pair<UL, UL>>, greater<pair<UL, UL>>> Q;
		Q.push({ 0, 0 });
		while (Q.size()) {
			UL z = Q.top().first, p = Q.top().second; Q.pop();
			if (z > 15) continue;
			if (V[p] != -1) continue;
			V[p] = z;
			rep(i, 10) {
				UL e = p + K * i;
				UL ez = z + e % 10;
				e /= 10;
				Q.push({ ez, e });
			}
		}
		UL ans = 0;
		UL buf = K; while (buf > 0) { ans += buf % 10; buf /= 10; }
		for (UL i = 1; i < 10; i++) {
			if (V[i] == -1) continue;
			ans = min(ans, V[i] + i);
		}
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 10860
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
VI tele(200005);

int f(int x) {
    return tele[x];
}

int main(){
    int n;
    ll k;
    cin >> n >> k;
    for (int i = 0; i < n; i+=1){
        int a;
        cin >> a;
        tele[i] = a-1;
    }
    int tortoise = f(0), hare = f(f(0));    // f(x0) is the node next to x0
    while (tortoise != hare) { tortoise = f(tortoise); hare = f(f(hare)); }
    // 2nd part: finding mu, hare and tortoise move at the same speed
    ll mu = 0; hare = 0;
    while (tortoise != hare) { tortoise = f(tortoise); hare = f(hare); mu++; }
    // 3rd part: finding lambda, hare moves, tortoise stays
    ll lambda = 1; hare = f(tortoise);
    while (tortoise != hare) { hare = f(hare); lambda++; }
    if(k < mu){
        int ans = 0;
        for (int i = 0; i < (int)k; i+=1){
            ans = tele[ans];
        }
        printf("%d", ans + 1);
    }else{
        int ans = 0;
        for (int i = 0; i < (int)mu; i+=1){
            ans = tele[ans];
        }
        k-=mu;
        k%=lambda;
        for (int i = 0; i < k; i+=1){
            ans = tele[ans];
        }
        printf("%d", ans + 1);
    }
    return 0;
}



Measured memory_bytes: 3912
#include <cstdio>
using namespace std;

#define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i)

const int is = 1 << 17;
char ib[is], *ip = ib + is, it;
inline char getc() {
	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }
	return *ip++;
}
inline int read() {
	int r = 0;
	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
	else while ((it = *ip++) & 16) r = r * 10 + it - '0';
	return r;
}

const int os = 1 << 17;
char ob[os], *op = ob, ot;
inline void putc(const char c) {
	*op++ = c;
	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }
}
// x shoud be greater than or equal to zero
inline void write(int x) {
	char d[6];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putc(d[i]);
	}
}

int A[200000];
signed main() {
	int n = read();
	int m0 = 0;
	int m1 = 0;
	REP(i, n) {
		int a = read();
		if (a > m0) {
			m1 = m0;
			m0 = a;
		} else if (a > m1) {
			m1 = a;
		}
		A[i] = a;
	}
	REP(i, n) {
		int a = A[i];
		if (a == m0) {
			write(m1);
		} else {
			write(m0);
		}
		putc('\n');
	}
	fwrite_unlocked(ob, 1, op - ob, stdout);
}


Measured memory_bytes: 2560
import heapq
n,m = map(int,input().split())
an = [-int(i) for i in input().split()]
heapq.heapify(an)
hpop = heapq.heappop
hpush = heapq.heappush

for i in range(m):
  v = hpop(an) 
  hpush(an,-(-v//2))
print(-sum(an))

Measured memory_bytes: 14184
def fact(n):
    f = 1
    for i in range(1, n + 1):
        f = f * i
    return f

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

a = 0
b = 0

for i in range(N - 1):
    a = a + fact(N - 1 - i) * ((P[i]) - 1)
    b = b + fact(N - 1 - i) * ((Q[i]) - 1)
    for j in range(i + 1, N):
        if P[j] > P[i]:
            P[j] = P[j] - 1
        if Q[j] > Q[i]:
            Q[j] = Q[j] - 1

a = a + P[N - 1]
b = b + Q[N - 1]

ans = abs(a - b)

print(ans)

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

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll a,b;
    while(cin >> a >> b)
    {
        if(a == 1 && b == 1)
            cout << 1 << '\n';
        else if(a == 1)
            cout << max(0LL, b-2) << '\n';
        else if(b == 1)
            cout << max(0LL, a-2) << '\n';
        else
            cout << max(0LL, a-2) * max(0LL, b-2) << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
s=input()
t=input()
if len(set(t)-set(s))>0:
  print(-1)
  exit(0)

ss=s*2
ind=-1
turn=0
for c in t:
  nex=ss[ind+1:].find(c)
  ind=(ind+1)+nex
  if ind>=len(s):
    ind-=len(s)
    turn+=1

print(turn*len(s)+ind+1)

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

class Program
{
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var n = input[0];
		var k = input[1];

		var ans = 0;

		while (n > 0)
		{
			var num = n % k;
			n /= k;
			ans++;
		}

		System.Console.WriteLine(ans);

	}
}

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

#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
using Graf_l=vector<list<int>>;

Graf g(200010);
vector<ll> x(200010,0);
vector<bool> vis(200010,false);

void dfs(int p,ll y){
    if(vis[p]==true){
        return;
    }
    vis[p]=true;
    x[p]+=y;
    if(g[p].empty()){
        return;
    }
    rep(i,g[p].size()){
        dfs(g[p][i],x[p]);
    }
    return;
}

int main()
{
    int n,q;
    cin >> n >> q;
    
    int a,b;
    ll p,val;
    rep(i,n-1){
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    rep(i,q){
        cin >> p >> val;
        x[p-1]+=val;
    }
    dfs(0,0);
    rep(i,n){
        cout << x[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 25176
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#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 ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;

int main(){
    ll x=1,g=0,n,h,w,k,m,ans=0,ptr=0;
    string s,s1,s2;
    cin >> h >> w;
    VCC o(h+2, vector<char>(w+2));
    for(int i=1;i<=h;i++){
        for(int j=1; j<=w;j++){
            cin >> o[i][j];
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1; j<=w;j++){
            if(o[i][j] == '#' && o[i][j - 1] !='#' && o[i - 1][j] != '#' && o[i][j + 1] !='#' && o[i + 1][j] != '#')
                ans++;
        }
    }
    
    if(ans==0)
        cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}






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

int H,W,h[110],w[110],k;
char m[110][110];

int main(){
    while(cin>>H>>W){
        memset(h,0,sizeof(h));
        memset(w,0,sizeof(w));
        for(int i=0; i<H; i++){
            k = 0;
            for(int j=0; j<W; j++){
                cin>>m[i][j];
                if(m[i][j]=='.')
                    k++;
            }
            if(k==W){
                w[i] = 1;//哪一排
            }
        }

        for(int i=0; i<W; i++){
            k = 0;
            for(int j=0; j<H; j++){
                if(m[j][i]=='.')
                    k++;
            }
            if(k==H){
                h[i] = 1;//哪一列
            }
        }

        for(int i=0; i<H; i++){
            if(w[i]==1)
                continue;
            for(int j=0; j<W; j++){
                if(h[j]==1)
                    continue;
                cout<<m[i][j];
            }
            cout<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
n=int(input())
list=[]
word=input()
list.append(word)
key=word[-1]
flag=True
for i in range(1,n):
    word=input()
    if key==word[0] and (word not in list):
        list.append(word)
        key=word[-1]
    else:
        print("No")
        flag=False
        break
if flag:
    print("Yes")

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

void group(int p, vector<unordered_set<int>> &v, vector<bool> &check){
  if (check.at(p)) return;
  check.at(p)=true;
  for (auto i: v.at(p)) group(i,v,check);
} //多分間に合わない

int main(){
  int n,m,x,y,z;
  cin>> n >> m;
  vector<unordered_set<int>> v(n);
  for (int i=0; i<m; i++){
    cin>> x >> y >> z;
    v.at(x-1).insert(y-1); v.at(y-1).insert(x-1);
  }
  vector<bool> check(n);
  int ans=0;
  for (int i=0; i<n; i++){
    if (check.at(i)) continue;
    if (v.at(i).size()==0) check.at(i)=true;
    else group(i,v,check);
    ans++;
  }
  cout<< ans <<endl;
}

Measured memory_bytes: 19840
n = int(input())
a = [int(input()) for _ in range(n)]
total = a[0] // 2
a[0] -= a[0] // 2 * 2
for i in range(1, n):
    r = min(a[i-1], a[i])
    total += r
    a[i-1] -= r
    a[i] -= r
    total += a[i] // 2
    a[i] -= a[i] // 2 * 2
print(total)

Measured memory_bytes: 7072
n = int(input())
now = [1,1]
data = []

for i in range(n):
    data.append(list(map(int, input().split())))
for i in range(n):
    t,a = data[i]
    mul = max((now[0] + t - 1)//t, (now[1] + a - 1) //a)
    now = list(map(lambda x:x*mul, data[i]))
print(sum(now))

Measured memory_bytes: 39792
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ",debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os,pair<T,S>a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}

//char inv(char c){
//    return c^32;
//}
//string inv(string &a){
//    auto res = a;
//    for(auto &x:res) x^=32;
//    reverse(res.begin(),res.end());
//    return res;
//}
//string product(const string &a,const string &b){
//    auto res = a;
//    for(auto x:b){
//        if(res.size() and inv(x) == res.back())res.erase(res.begin()+res.size()-1);
//        else res.push_back(x);
//    }
//    return res;
//    
//}

vector<int> id(const int n){
    vector<int> res(n);
    rep(i,n)res[i] = i;
    return res;
}
vector<int> inv(const vector<int> &a){
    vector<int> res(a.size());
    rep(i,a.size()){
        res[a[i]] = i;
    }
    return res;
}
vector<int> product(const vector<int> &a, const vector<int> &b){
    vector<int> res(a.size());
    rep(i,a.size()){
        res[i] = a[b[i]];
    }
    return res;
}
vector<int> power(const vector<int> &a, ll p){
    if(p == 0)return id((int)a.size());
    auto res = a;
    auto temp = a;
    p--;
    for(int i = 0; i < 30; i++){
        if(p >> i & 1){
            res = product(res, temp);
        }
        temp = product(temp, temp);
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int k;
    cin >> k;
    vector<int>p(n),q(n);
    rep(i,n)cin >> p[i],p[i]--;
    rep(i,n)cin >> q[i],q[i]--;
    auto g = product(q,product(inv(p),product(inv(q),p)));
    g = power(g,(k-1)/6);
    auto a = product(g,product(p,inv(g)));
    auto b = product(g,product(q,inv(g)));
    int now = 1 + (k-1)/6*6;
    while(now != k){
        auto c = product(b, inv(a));
        a = b;
        b = c;
        now++;
    }
    rep(i,n)cout << a[i] + 1 << " \n"[i==n-1];
}

Measured memory_bytes: 3544
#include <cstdio>
int n;
long long a[100005], x[100005];

int main()
{
	scanf("%d", &n);
	
	int sum = 0, sum_odd = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", a + i);
		sum += a[i];
		if (i < n && i % 2)
			sum_odd += a[i];
	}
	x[n] = sum - 2 * sum_odd;
	for (int i = n - 1; i >= 1; i--) {
		x[i] = 2 * a[i] - x[i + 1];
	}
	for (int i = 1; i <= n; i++) {
		printf("%lld ", x[i]);
	}
	return 0;
}

Measured memory_bytes: 2816
s = int(input())
l = [s]
chk = 0
for i in range(10**6):
	if(s % 2 == 0):
		s = s/2
	else:
		s = 3*s+1
	s = int(s)
	for j in range(0,len(l)):
		if(l[j] == s):
			chk = 1
			break
	if(chk == 1):
		break
	l.append(s)
print(i+2)

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

int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(x-r<0 || y-r<0 || x+r>w || y+r>h){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3084
//
//  main.cpp
//  ggggggggggggggggggggggggggggggggggggg
//
//  Created by h3037175 on 2017/08/01.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
using namespace std;
int main() {
    int n,a,v,max=-100000,num;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>v;
        if(max<v || max==v&&num>a){
            max=v;
            num=a;
        }
    }
    cout<<num<<" "<<max<<endl;
    return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int N; map<string, int> votes;
int maxvotes =0;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        votes[s]++; maxvotes=  max(maxvotes, votes[s]);
    }
    for (pair<string, int> e: votes){
        if(e.second==maxvotes) cout << e.first << '\n'; 
    }

    return 0;
}

Measured memory_bytes: 23808
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
int main()
{
	mp::cpp_int x = 1;
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0;i<n;i++)cin >> a[i];

	sort(a.begin(),a.end());
	for(int i = 0;i<n;i++)
	{
		x*=a[i];
		if(x>1000000000000000000)
		{
			cout<<-1<<endl;
          	return 0;
		}
	}
	cout<<x<<endl;
}

Measured memory_bytes: 4052
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;

int main(int argc, char**argv){
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    for(int i = 0; i < n; i++) cin >> m[i];

    int remain = x - accumulate(m.begin(), m.end(), 0);

    cout << n + remain / *min_element(m.begin(), m.end()) << endl;


    return 0;
}





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

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

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	double w, h, x,y;
	cin >>w >>h >>x >>y;
	int as2 = (x*2 ==w && y*2==h)? 1: 0;
	cout << w * h /2.0 <<" "<<as2 <<"\n";
	return 0;
}


Measured memory_bytes: 256
n=int(input())
dist=[-1]*n
G=[[] for i in range(n)]

for i in range(n-1):
    a,b=map(int,input().split())
    a-=1;b-=1
    G[a].append(b)
    G[b].append(a)

from collections import deque
queue=deque([[0,i] for i in G[0]])
dist[0]=0
while queue:
    now,to=queue.pop()
    # print(now,to)
    if dist[to]!=-1:continue
    dist[to]=1-dist[now]
    for i in G[to]:
        queue.appendleft([to,i])

# print(dist)
q=sum(dist)
LAST=[0]*n
if n/3 <= q and n/3 <= n-q:
    
    A=[i for i in range(1,n+1,3)] + [0]*n
    

    B=[i for i in range(2,n+1,3)] + [0]*n


    now1=0
    now2=0
    for i in range(n):
        if dist[i]:
            LAST[i]=B[now2]
            now2+=1
        else:
            LAST[i]=A[now1]
            now1+=1
    w=3
    for i in range(n):
      if LAST[i]==0:
        LAST[i]=w
        w+=3
    print(*LAST)
            
elif n/3 >q:
    w=3
    for i in range(n):
        if dist[i]:
            LAST[i]=w
            w+=3
    A=[i for i in range(w,n+1,3)]+[i for i in range(1,n+1) if i%3!=0]
    now=0
    for i in range(n):
        if LAST[i]==0:
            LAST[i]=A[now]
            now+=1
    print(*LAST)
else:
    w=3
    for i in range(n):
        if dist[i]==0:
            LAST[i]=w
            w+=3
    A=[i for i in range(w,n+1,3)]+[i for i in range(1,n+1) if i%3!=0]
    now=0
    for i in range(n):
        if LAST[i]==0:
            LAST[i]=A[now]
            now+=1
    print(*LAST)
    
            


Measured memory_bytes: 62152
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int n,maxans = 0,count = 0;
  string str;
  bool alph[26] = {};
  
  cin >> n >> str;
  for(int right = 0; right < n-1 ;right++){
    for(int i = 0; i <= right ; i++){
      alph[str[i] - 'a'] = true;
    }
    for(int j = right + 1; j < n ; j++){
      if(alph[str[j] - 'a']){
	count ++;
	alph[str[j] - 'a'] = false;
      }
      
    }
    maxans = max(maxans,count);
    count = 0;
  }
 
  cout << maxans << endl;

  return 0;
}


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

int n;
vector<int> a, b;

int main() {
    cin >> n;
    a.resize(n), b.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    int sa = a[0], sb = a[0] + b[0];
    for (int i = 1; i < n; i++) {
        sa += a[i];
        sb = max(sb + b[i], sa + b[i]);
    }
    cout << sb << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = 0, w = 0, s = 0, e = 0;

        String str = sc.nextLine();

        for (int i = 0, len = str.length(); i < len; i++) {
            char ch = str.charAt(i);

            n += ch == 'N' ? 1 : 0;
            w += ch == 'W' ? 1 : 0;
            s += ch == 'S' ? 1 : 0;
            e += ch == 'E' ? 1 : 0;
        }

        boolean isNsOk = (n == 0 && s == 0) || (n > 0 && s > 0);
        boolean isWeOk = (w == 0 && e == 0) || (w > 0 && e > 0);

        if (isNsOk && isWeOk) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int main(void){
    int a = 0, b = 0;
    char s[12];
    int yes = 1;

    scanf("%d%d%s", &a, &b, s);

    for(int i = 0; i < a; i++){
        if(s[i] >= '0' && s[i] <= '9'){
        }else{
            yes = 0;
        }
    }

    if(s[a] != '-'){
        yes = 0;
    }

    for(int i = a + 1; i < a + b; i++){
        if(s[i] >= '0' && s[i] <= '9'){
        }else{
            yes = 0;
        }
    }

    if(yes == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;

} 


Measured memory_bytes: 256
#include<vector>
#include<set>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int N=1e5+5;
int n;
std::vector<int>s[N];
void solve(int k)
{
	int now=1;puts("Yes");
	for(int i=1;i<=k;++i)
		for(int j=i+1;j<=k;++j)
			s[i].push_back(now),s[j].push_back(now++);
	printf("%d\n",k);
	for(int i=1;i<=k;++i)
	{
		printf("%d ",k-1);
		for(int j=0;j<k-1;++j)printf("%d ",s[i][j]);
		puts("");
	}
}
int main()
{
	n=in();if(n==1)return puts("Yes\n2\n1 1\n1 1"),0;
	for(int i=1;i*(i-1)/2<=n;++i)
		if(i*(i-1)/2==n)
		{
			solve(i);return 0;
		}
	puts("No");
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=2e5+10;
ll a[maxn],b[maxn];
int n;

int main(){
	io;
	cin>>n;
	for(int i=1;i<=n;i++){
		ll x,y;cin>>x>>y;
		a[i]=x+y;b[i]=x-y;
	}
	ll ans=0,aa=-inf,bb=inf;
	for(int i=1;i<=n;i++){ aa=max(aa,a[i]);bb=min(bb,a[i]); }
	ans=max(ans,aa-bb);
	aa=-inf;bb=inf;
	for(int i=1;i<=n;i++){ aa=max(aa,b[i]);bb=min(bb,b[i]); }
	ans=max(ans,aa-bb);
	cout<<ans<<endl;
}

Measured memory_bytes: 6724
#include<stdio.h>
short N, W, H, N, x, y, a;
short l, r, b, t;
short i;
int main(){
  scanf("%hd%hd%hd", &W, &H, &N);
  l=0; r=W, b=0; t=H;
  for(i=0; i<N; i++){
    scanf("%d%d%d", &x, &y, &a);
    if(a==1){
      if(x>l){l=x;}
    }else if(a==2){
      if(x<r){r=x;}
    }else if(a==3){
      if(y>b){b=y;}
    }else if(a==4){
      if(y<t){t=y;}
    }
  }
  if(l<r && b<t){
    printf("%d\n", (r-l)*(t-b));
  }else{
    printf("0\n");
  }
}


Measured memory_bytes: 128
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
dc = Counter(D)
flag = True
count = 0
cand = [0]
one = []
if 0 in dc:
    flag = False
if 12 in dc:
    if dc[12] >= 2:
        flag = False
    else:
        cand.append(12)
for i in range(1,12):
    if i not in dc:
        continue
    if dc[i] == 1:
        count += 1
        one.append(i)
    elif dc[i] >= 3:
        flag = False
        break
    else:
        cand += [24-i,i]
if flag:
    if count:
        ans = 0
        for i in range(2**count):
            candone = []
            for j in range(count):
                if (i >> j) & 1 == 1:
                    candone.append(one[j])
                else:
                    candone.append(24-one[j])
            cand2 = cand+candone
            cand2.sort()
            ans1 = min(cand2[-1]-cand2[0],24-cand2[-1]+cand2[0])
            for i in range(1,len(cand2)):
                ans1 = min(ans1,cand2[i]-cand2[i-1])
            ans = max(ans,ans1)
        print(ans)
    else:
        cand.sort()
        if len(cand) == 1:
            print(0)
        else:
            ans = 24
            for i in range(1,len(cand)):
                ans = min(ans,cand[i]-cand[i-1])
            print(ans)
else:
    print(0)

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

int main() {
    int N,K,result=0;
    string S;
    int* count;
    char now;
    cin >> N >> K >> S;
    count = new int[N+1];
    now = S[0];
    count[0]=0;
    for(int i=0;i<N+1;i++){
        count[i]=-1;
    }
    int j=0;
    count[0]=1;
    for(int i=1;i<N;i++){
        if(S[i]==now){
            count[j]++;
        }
        else{
            now=S[i];
            j++;
            count[j]=1;
        }
    }
    // for(int i=0;i<N;i++){
    //     cout << S[i] << " " << count[i] << endl;
    // }
    for(int i=0;i<N;i++){
        if(count[i]!=-1){
            if(i<K*2){
                result+=count[i];
                if(count[i+1]==-1){
                    result--;
                }
            }
            else{
                result+=count[i]-1;
            }
        }
        else{
            break;
        }
    }
    cout << result << endl;
    return 0;

}

Measured memory_bytes: 896
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int a, b; cin >> a >> b;
    int res = -1;
    rept(i, 1, 10000){
        int x = i * 0.08;
        int y = i * 0.1;
        if(a==x && b==y){
            res = i;
            break;
        }
    }
    cout << res << ln;
}

Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main (){
    int A, B;

    cin >> A >> B;

    if ((B - 1) % (A - 1) == 0)
        cout << (B - 1) / (A - 1);
    else
        cout << (B - 1) / (A - 1) + 1;

    return 0;
}

Measured memory_bytes: 256