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

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;

// code
// ------------------------------------------------
int main() {

  ll k;
  string s;
  cin >> s >> k;

  ll ans = 0;
  rep(i,sz(s))
  {
    if(i+1 > k)
    {
      // ありえない
      break;
    }
    ans = s[i] - '0';

    if(s[i] != '1')
    {
      break;
    }
  }

  cout << ans << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int N;
  cin>>N;
  string s[N];
  int64 a=0,b=0,c=0,d=0,e=0;
  rep(i,N){
    cin>>s[i];
    switch(s[i][0]){
      case 'M':
        a++;
        break;
      case 'A':
        b++;
        break;
      case 'R':
        c++;
        break;
      case 'C':
        d++;
        break;
      case 'H':
        e++;
        break;
      default:
        break;
    }
  }
  cout<<a*b*(c+d+e)+a*c*(d+e)+(a+b+c)*d*e+b*c*(d+e)<<"\n";
}

Measured memory_bytes: 6144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        string S = Console.ReadLine();

        int len = S.Length;

        List<int> nums = new List<int>();

        for(int i = 0; i < len; i++)
        {
            var left = i;
            var right = i + 2;
            if (right >= len) break;

            nums.Add(int.Parse(S.Substring(left, 3)));
        }

        var ans = nums.Select(n => Math.Abs(n - 753)).OrderBy(n => n).First();

        Console.WriteLine(ans);


    }
}


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

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

    cin >> N;
    cin >> S;

    int co = 0;
    for (int i = 0; i < N - 2; ++i){ 
        if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C'){
            co++;
        }
    }

    cout << co << "\n";

    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[200000], a[200000], b[200000];
string str, ss;
bool f;
char c[800][800];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<Edge>vec[20000];
vector<edge>ed;
vector<LL>v[23];
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n+1)dp[i] = INF/2;
	dp[0] = 0;
	rep(i, n) {
		rep(j, m) {
			if (i + j >= n)continue;
			dp[i + j + 1] = min(dp[i + j + 1], dp[i] + abs(a[i] - a[i + j+1]));
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 3584
import sys, bisect
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()
    A = LI()

    AA = list(sorted([i+1+A[i] for i in range(N)]))

    ans = 0
    for i in range(N):
        idx_l = bisect.bisect_left(AA, i+1-A[i])
        idx_r = bisect.bisect_right(AA, i+1-A[i])
        # print(idx_l, idx_r, i+1-A[i], i+1)
        # num = min(idx_r, N-1)-max(idx_l, 0)
        num = 0
        if 0<=idx_l<N and 0<=idx_r<N:
            num = idx_r - idx_l
        # if AA[idx] == i+1-A[i]:
        #     ans += 1
        # print(num)
        ans += num

    print(ans)

if __name__ == '__main__':
    resolve()


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


int main() {
  int n;
  cin >> n;
  int a[n];
  int all = 0;
  int num = 0;
  for(int i = 0; i < n;i++){
  cin >> a[i];
  all += a[i];
  }
  int b;
  b = a[0]*n-all;

  if(b < 0){
    b *= -1;
  }




  
  int c;
  for(int i = 1;i < n;i++){
    c = a[i]*n-all;
    if(c < 0){
      c *= -1;
    }
    if(c < b){
      num = i;
      b = c;
    }
  }
   cout << num << endl;
  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a, b; scanf("%d %d", &a, &b);
    
    if ( a < b)
        printf("a < b\n");
    else if ( a > b)
        printf("a > b\n");
    else
        printf("a == b\n");

    return 0;
}


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

int main() {
  string S;
  cin >> S;
  if(S == "Sunny"){
    cout << "Cloudy" <<endl;
  }
  if(S == "Cloudy"){
    cout << "Rainy" <<endl;
  }
  if(S == "Rainy"){
    cout << "Sunny" <<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){

		//次に入力する数値の個数を決めるスキャナー
		Scanner scan = new Scanner(System.in);

		//int型の宣言と一つ目の入力
		int intNum = scan.nextInt();
		//配列の宣言と要素数に入力した内容を代入
		int[] array = new int[intNum];

		//scan2で順番に要素を格納していく
		for(int i = 0 ;i < intNum;i++){
			array[i] = scan.nextInt();
		}

		long longSum = 0;
		for(int i = 0 ;i < intNum;i++){
			longSum+=array[i];
		}

		for(int i = 0 ;i < intNum;i++){
			for(int j = 0 ;j < intNum-1;j++ ){
				if(array[j] > array[j+1]){
					int intCh = array[j];
					array[j] = array[j+1];
					array[j+1] = intCh;
				}
			}
		}
		System.out.println(array[0] + " " + array[array.length-1] + " " + longSum);
		scan.close();
	}
}



Measured memory_bytes: 41660
fn main() {
    read::<u32>();
    let arr = read_vec::<u32>();
    let mut min: i32 = 99999;
    for mut a in arr {
        let mut div = 0;
        loop {
            if a % 2 == 0 {
                a = a / 2;
                div += 1;
            } else {
                if div < min {
                    min = div;
                }
                break;
            }
        }
    }
    println!("{}", min);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

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

class Program
{
    static void Main(string[] args)
    {
        // 入力
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long l = a[0];
        long r = a[1];

        long ans = 2019;
        long mod = 2019;
        if (r-l >2019)
        {
            ans = 0;
        }
        else
        {
            //組み合わせ
            for (long i = l; i <= r; i++)
            {
                for (long j = i + 1; j <= r; j++)
                {
                    ans = Math.Min(ans, i * j % mod);
                    if (ans == 1)
                    {
                        break;
                    }
                }

            }

        }


        Console.WriteLine(ans);

    }


}


Measured memory_bytes: 13268
H, W = map(int, input().split())
a = [input() for _ in range(H)]

ans = [ch for ch in a if "#" in ch]
ans = [ch for ch in zip(*ans) if "#" in ch]
ans = [ch for ch in zip(*ans)]

for i in range(len(ans)):
    print(''.join(ans[i]))

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

typedef double D;
typedef complex<D> P;

#define X real()
#define Y imag()

const D eps=1e-8;
const D inf=1e12;
const D PI=acos(-1);
typedef vector<P> L;
D cross(P a,P b){ return (conj(a)*b).Y; }
P crosspoint(L l,L m) {
  D A=cross(l[1]-l[0],m[1]-m[0]);
  D B=cross(l[1]-l[0],l[1]-m[0]);
  if (abs(A)<eps&&abs(B)<eps) return m[0]; // same line
  if (abs(A)<eps) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0]+B/A*(m[1]-m[0]);
}
P projection(L l,P p){
  P b=l[1]-l[0],c=p-l[0];
  return l[0]+b*(c/b).X;
}
P reflection(L l,P p) {
  return p+2.0*(projection(l,p)-p);
}

struct data{
  bool is_point;
  P p;
  L l;
};

string s;

data calc(data a,data b){
  data res;
  if(!a.is_point&&!b.is_point){
    res.is_point=true;
    res.p=crosspoint(a.l,b.l);
  }
  if(!a.is_point&&b.is_point){
    res.is_point=true;
    res.p=reflection(a.l,b.p);
  }
  if(a.is_point&&!b.is_point){
    res.is_point=true;
    res.p=reflection(b.l,a.p);
  }
  if(a.is_point&&b.is_point){
    res.is_point=false;
    res.l.clear();
    res.l.push_back(a.p); res.l.push_back(b.p);
  }
  return res;
}

int idx=0,n;

data dfs(){
  if(isdigit(s[idx])||s[idx]=='-'){
    double vl=0,vr=0;
    int& i=idx;
    double nl=(s[i]=='-'?-1:+1);
    if(s[i]=='-')i++;
    while(s[i]!=','){
      vl*=10; vl+=s[i]-'0'; i++;
    }
    i++;
    double nr=(s[i]=='-'?-1:+1);
    if(s[i]=='-')i++;
    while(s[i]!=')'){
      vr*=10; vr+=s[i]-'0'; i++;
    }
    i++;
    data res;
    res.is_point=true;
    res.p=P(vl*nl,vr*nr);
    return res;
  }
  idx++;
  data res=dfs();
  while(idx<n&&s[idx]=='@'){
    idx+=2;
    data tmp=dfs();
    res=calc(res,tmp);
  }
  idx++;
  return res;
}

int main(){
  while(1){
    cin>>s;
    if(s=="#")break;
    n=s.size();
    idx=0;
    data res=dfs();
    printf("%.10f %.10f\n", res.p.X,res.p.Y);
  }
  return 0;
}



Measured memory_bytes: 3200
import numpy as np
#np_ary=np.array([1,2,3,4,5])
l = list(map(int, input().split()))
l[0]*=60
l[2]*=60
o=[0 ,0]
o[0]=l[0]+l[1]
o[1]=l[2]+l[3]
p=o[1]-o[0]-l[4]
print(p)


Measured memory_bytes: 27132
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = LI()
ans = float('INF')
sum_A = sum(A)
accumulate_A = list(itertools.accumulate(A))
for i in range(N-1):
    ans = min(ans,abs(sum_A-accumulate_A[i]*2))
print(ans)


Measured memory_bytes: 25772
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>

#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <random>
#include <complex>
#include <utility>
#include <tuple>
#include <memory>

#include <array>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <csignal>
#include <cstdint>
#include <cstddef>

#ifdef ONLINE_JUDGE
#define NDEBUG
#endif
#include <cassert>
#include <stdexcept>
#include <exception>

// << pair
template <typename T1, typename T2>
std::ostream&operator<<(std::ostream&os,const std::pair<T1,T2>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
// << container
template <typename C>
std::ostream&_debug_go(std::ostream&os,const C&v) {bool first=true;os<<"[";for(auto i:v){if(!first)os<<", ";os<<i;first=false;}return os<<"]";}
// << {vector, set, map} delegating to _debug_go
template<typename T> std::ostream&operator<<(std::ostream&os,const std::vector<T>&v){return _debug_go(os, v);}
template<typename T> std::ostream&operator<<(std::ostream&os,const std::set<T>&v){return _debug_go(os, v);}
template<typename T1, typename T2> std::ostream&operator<<(std::ostream&os,const std::map<T1,T2>&v){return _debug_go(os, v);}
struct Debugger{template<typename T>Debugger&operator,(const T&v){std::cerr<<v<<" "; return *this;}} dbg;
#ifndef NDEBUG
#define debug(args...) do {dbg,args; cerr << "\n";} while(0)
#else
#define debug(args...)
#endif

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ITER(i, s, e) for (auto i((s)); i != (e); ++i)
#define IT(i, c) ITER(i, (c).begin(), (c).end())

using namespace std;

using ui = uint32_t;
using ll = int64_t;
using ull = uint64_t;
template <typename T = int> using Pt = complex<T>;

template <typename T>
T cross(const Pt<T>& a, const Pt<T>& b) { return a.real() * b.imag() - a.imag() * b.real(); }

template <typename T>
bool cmpPt(const Pt<T>& a, const Pt<T>& b) {
    return a.real() < b.real() || (a.real() == b.real() && a.imag() < b.imag());
}
// END TEMPLATE

vector<int> solve(const string& S) {
    int N = S.size();
    vector<int> ans(N);
    for (int i = 0, j, k; i < N; i = k) {
        j = i;
        while (S[j] == 'R') ++j;
        k = j;
        while (k < N && S[k] == 'L') ++k;
        //debug(i, j, k);
        int x = (j - i + 1) / 2;
        int y = (k - j + 1) / 2;
        ans[j-1] = x + (k - j - y);
        ans[j] = (j - i - x) + y;
    }
    return ans;
}

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

    string S; cin >> S;
    auto ans = solve(S);
    for (int n : ans) cout << n << " ";
    cout << "\n";

    return 0;
}


Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> par;
  vector<int> rank;
  vector<int> num;
  
  UnionFind(int N) : par(N),rank(N),num(N) {
        for(int i = 0; i < N; i++){ 
          par[i] = i;
          rank[i] = 0;
          num[i] = 1;
        }
   }
  
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  
  int ranker(int x){
    x = root(x);
    return rank[x];
  }
  
  int number(int x){
    x = root(x);
    return num[x];
   }
  
  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if ( rx == ry ) return;
    if ( rank[rx] < rank[ry] ){
      par[rx] = ry;
      num[ry] += num[rx];
      num[rx] = 0;
    } else {
      par[ry] = rx;
      num[rx] += num[ry];
      num[ry] = 0;
      if ( rank[rx] == rank[ry] ) rank[rx]++;
    }
   }
  
  bool same(int x, int y){
    return root(x) == root(y);
  }
};

struct edge{ int u, v, cost; };

bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}

int main(){
    int N;
    typedef pair<int,int> P;
    vector<P> X,Y;
    cin >> N;
    for(int i = 0; i < N; ++i){
        int x,y;
        cin >> x >> y;
        X.push_back(make_pair(x,i));
        Y.push_back(make_pair(y,i));
    }
    
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    
    vector<edge> es;
    
    for(auto itr = X.begin(); itr != X.end()-1; ++itr){
        es.push_back({itr->second , (itr+1)->second, (itr+1)->first - itr->first});
    }
    
    for(auto itr = Y.begin(); itr != Y.end()-1; ++itr){
        es.push_back({itr->second , (itr+1)->second, (itr+1)->first - itr->first});
    }

    sort(es.begin(),es.end(),comp);
    
    UnionFind city(N);
    int ans = 0;
    for(auto itr = es.begin(); itr != es.end(); itr++){
        int c1 = itr->u;
        int c2 = itr->v;
        int ct = itr->cost;
        if(!city.same(c1,c2)){
            city.unite(c1,c2);
            ans += ct;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 7144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  rep(i, b) {
    if (a * i % b == c) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;


  
  return 0;
}

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

long int KnapSack(int wt[],long int val[],int N,int W)
{
    long int dp[N+1][W+1];
    
    for (int  i=0;i<=N;i++)
    {
        for (int w = 0;w<=W;w++)
        {
            if ( w == 0 || i==0)
            dp[i][w] = 0;
            else if ( wt[i-1] <= w)
            {
                dp[i][w] = max(val[i-1]+dp[i-1][w-wt[i-1]],dp[i-1][w]);
                
            }
            else
            dp[i][w] = dp[i-1][w];
        }
    }    
            
    return dp[N][W];
}
   

int main()
{
   int N,W;
   cin >> N >> W;
   int wt[N];
   long int val[N];
   for (int i=0;i<N;i++)
   cin >> wt[i] >> val[i];
   cout << KnapSack(wt,val,N,W) << endl;
    return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

const int INF = 1e9+10;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  priority_queue<int> l;
  priority_queue<int, vector<int>, greater<int>> r;
  l.push(-INF);
  r.push(INF);
  ll lsum = -INF, rsum = INF, b = 0;
  rep(i, q) {
    int c;
    cin >> c;
    if (c == 1) {
      vector<int> a(1);
      int tmp;
      cin >> a[0] >> tmp;
      b += tmp;
      if (l.size() == r.size()) {
        a.push_back(l.top());
        lsum -= l.top();
        l.pop();
        a.push_back(r.top());
        rsum -= r.top();
        r.pop();
        sort(a.begin(), a.end());
        l.push(a[0]);
        l.push(a[1]);
        r.push(a[2]);
        lsum += a[0]+a[1];
        rsum += a[2];
      }
      else {
        a.push_back(l.top());
        lsum -= l.top();
        l.pop();
        sort(a.begin(), a.end());
        l.push(a[0]);
        r.push(a[1]);
        lsum += a[0];
        rsum += a[1];
      }
    } else {
      ll mid = l.top();
      ll res = mid*l.size()-(lsum+INF)+(rsum-INF)-mid*r.size()+b;
      cout << mid << ' ' << res << endl;
    }
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N-1);
  for(int i=0;i<N;i++) cin>>a[i];
  for(int i=0;i<N;i++) cin>>b[i];
  for(int i=0;i<N-1;i++) cin>>c[i];
  int ans=0;
  int tmp=999;
  for(int i=0;i<N;i++){
    ans += b[a[i]-1];
    if(tmp==(a[i]-2)) ans+=c[a[i]-2];
    tmp = a[i]-1;
   // cout<<ans<<endl;
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
static const int MAXN = 100000;
static const int MAX = 1000000000;

int gcd(int a, int b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

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

    ll ans = 0;
    for(int i = 1; i <= K; i++){
        for(int j = 1; j <= K; j++){
            int a = gcd(i,j);
            for(int k = 1; k <= K; k++){
                ans += gcd(k,a);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3220
using System;
using System.Linq;
using System.Collections.Generic;
    
    
class Program
{
    static void Main(string[] args)
    {
        string[] NK = Console.ReadLine().Split(' ');
        int N = int.Parse(NK[0]);
        int K = int.Parse(NK[1]);

        int d;

        int[] snuke = new int[N];
        for(int i=0; i<N; i++) {
            snuke[i] += 1;
        }

        for(int i=0; i<K; i++) {
            d = int.Parse(Console.ReadLine());
            string[] A = Console.ReadLine().Split(' ');

            for(int j=0; j<d; j++) {
                snuke[int.Parse(A[j]) - 1] = 0;
            }
        }

        int answer = 0;

        for(int i=0; i<N; i++) {
            answer += snuke[i];
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 27592
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r=0,b=0;
    REP(i,n){
        if(s[i]=='R'){
            r++;
        }else{
            b++;
        }
    }
    cout << (r>b?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

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

    cout << 0 << endl << flush;
    string s0;
    cin >> s0;
    if (s0[0] == 'V') return 0;

    int l = 0, r = n;
    while (r - l > 1) {
        int m = (l + r) / 2;
        cout << m << endl << flush;
        
        string s;
        cin >> s;
        if (s[0] == 'V') return 0;
        else if (s0 == s) {
            if (m % 2 == l % 2) {
                l = m;
                s0 = s;
            }
            else r = m;
        }
        else {
            if (m % 2 != l % 2) {
                l = m;
                s0 = s;
            }
            else r = m;
        }

    }
  	return 0;

}


Measured memory_bytes: 852
N = eval(input())
A = [int(v) for v in input().strip().split(" ")]

result = 1
if 0 in A:
    print(0)
else:
    for i in range(N):
        result *= A[i]
        if result > 1e18:
            print(-1)
            exit(0)

    print(result)

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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

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

    int l = 0;
    int r = N - 1;

    int ans = 0;
    while (true) {
        while (l < N && c[l] != 'W') l++;
        while (r >= 0 && c[r] != 'R') r--;

        if (l >= r) break;

        swap(c[l], c[r]);
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3736
N, K, Q = map(int, input().split(" "))
answer_counts = [0] * N
for _ in range(Q):
    idx = int(input()) - 1
    answer_counts[idx] += 1
for answer_count in answer_counts:
    if Q - answer_count < K:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 4680
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  cout<<a*b<<'\n';
  return(0);
}


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

int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;

  for (int i=0; i <= A; i++) { 
    for (int j=0; j <= B; j++) { 
      for (int k=0; k <= C; k++) { 
        if (i*500 + j * 100 + k * 50 == X){
          ans++;
        }
      }
    }
  }
  
  cout << ans << endl;
}

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

signed main() {
	int N;
	cin >> N;
	vector<unsigned long long int> vec(N);
	for(int i = 0;i < N;i++) {
		cin >> vec.at(i);
	}
	unsigned long long int answer = vec.at(0);
	for(int i = 1;i < N;i++) {
		unsigned long long int d = __gcd(answer,vec.at(i));
		answer = answer / d * vec.at(i);
	}
	cout << answer << endl;
}

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

int main() {
	int n, m;
	
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0)
			break;
			
		int p[1000];
		//fill_n(p, 1000, 0);
		for(int i = 0; i < n; ++i)
			cin >> p[i];
		sort(p, p + n, greater<int>());
		int ans = 0;
		for(int i = 0; i < n; i += m){
			for(int j = i; j < n && j < i + m; ++j)
				ans += p[j];
			if(i + m <= n)
				ans -= p[i + m - 1];
		}
		
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1176
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    int n = scanner.nextInt();
    scanner.nextLine();
    for (int ii = 0; ii < n; ii++) {
      boolean[] ruis = new boolean[3];
      int outc = 0;
      int score = 0;
while (outc < 3) {
      String line = scanner.nextLine();
      if (line.equals("OUT")) {
        outc++;
        if (outc == 3) {
          out += score + "\n";
          break;
        }
      } else if (line.equals("HOMERUN")) {
        score++;
        for (int jj = 0; jj < ruis.length; jj++) {
          if (!ruis[jj]) {
            continue;
          }
          score++;
          ruis[jj] = false;
        }
      } else if (line.equals("HIT")) {
        if (ruis[2]) {
          score++;
          ruis[2] = false;
        }
        if (ruis[1]) {
          ruis[2] = true;
          ruis[1] = false;
        }
        if (ruis[0]) {
          ruis[1] = true;
        }
        ruis[0] = true;
      }
}
    }
    System.out.print(out);
  }
}

Measured memory_bytes: 17516
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
struct node{
	double x,y;
}p[10];
int main()
{
	double sum=0;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> p[i].x;
		cin >> p[i].y;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			sum+=sqrt((p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y));
		}
	}
	printf("%.6lf\n",sum/n);
	return 0;
}

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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int x=sc.nextInt();
		int count=0;
		for(int i=0;i<=a;++i) {
			for(int j=0;j<=b;++j) {
				if((x-500*i-100*j)/50>=0 && (x-500*i-100*j)/50<=c ) {
					++count;
				}
			}
		}
		
		System.out.println(count);
}}


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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    int ok = 1e9, ng = 0;
    while(ok-ng>1){
        int mid = (ok+ng)/2;
        int64_t cnt = 0;
        for(auto a : A) cnt += (a-1)/mid;
        (cnt <= K ? ok : ng) = mid;
    }
    cout << ok << endl;
    return 0;
}


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

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

	for (int i = 0; i < a.size(); i++) {
		a[i] = 'x';
	}

	cout << a << endl;

	cin.get();
    cin.get();
    return 0;
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

ll gcd(ll a, int b)
{
    if (a < b)
        gcd(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int d, n;
    cin >> d >> n;

    int ret = pow(100, d);
    int tmp = ret;
    if (n == 100)
    {
        ret = tmp * 101;
    }
    else
    {
        ret = tmp * n;
    }

    cout << ret << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; double w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 100;

void dijkstra(int n, vector< vector<edge> >& G, int s, vector<double>& d) {
    fill(d.begin(), d.end(), DBL_MAX); d[s] = 0;
    priority_queue<d_i, vector<d_i>, greater<d_i> > q;
    q.push(d_i(0, s));
    while (!q.empty()) {
        d_i p = q.top(); q.pop();
        int u = p.second;
        if (p.first > d[u]) continue;
        for (int i = 0; i < G[u].size(); i++) {
            edge e = G[u][i];
            if (d[e.v] > d[u] + e.w) {
                d[e.v] = d[u] + e.w;
                q.push(d_i(d[e.v], e.v));
            }
        }
    }
}

void add_edge(vector< vector<edge> >& G, int u, int v, double w) {
	edge e = {u, v, w};
	G[u].push_back(e);
}

int f(int n, int x, int y, int v) {
	return (n * x + y) * 32 + v;
}

int main() {
	for (;;) {
		int n, m; cin >> n >> m;
		if (n == 0) break;
		n++;
		int s, g; cin >> s >> g;
		vector< vector<edge> > G(n * n * 32);
		while (m--) {
			int x, y, c; double d;
			cin >> x >> y >> d >> c;
			for (int z = 0; z < n; z++) {
				if (z == x || z == y) continue;
				for (int v = 1; v <= c; v++) {
					add_edge(G, f(n, z, x, v), f(n, x, y, v - 1), d / v);
					add_edge(G, f(n, z, x, v), f(n, x, y, v), d / v);
					add_edge(G, f(n, z, x, v), f(n, x, y, v + 1), d / v);
					add_edge(G, f(n, z, y, v), f(n, y, x, v - 1), d / v);
					add_edge(G, f(n, z, y, v), f(n, y, x, v), d / v);
					add_edge(G, f(n, z, y, v), f(n, y, x, v + 1), d / v);
				}
			}
		}
		vector<double> d(n * n * 32);
		dijkstra(n * n * 32, G, f(n, 0, s, 1), d);
		double mini = DBL_MAX;
		for (int i = 0; i < n; i++)
			mini = min(mini, d[f(n, i, g, 0)]);
		if (mini < DBL_MAX) printf("%.10f\n", mini);
		else cout << "unreachable" << endl;
	}
}

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

using namespace std;
using ll=long long;

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

int main()
{
   int n;cin >> n;
   vector <ll >a(n);
   vector<ll> r(n,0),l(n,0);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }

   for(int i=0;i<(n-1);i++){
    l[i+1]=gcd(l[i],a[i]);
   }
   for(int i=n-1;i>0;i--){
     r[i-1]=gcd(r[i],a[i]);
   }
 ll ans=1;
 for(int i=0;i<n;i++){
    ans=max(ans,gcd(l[i],r[i]));
 }
 cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <time.h>
using namespace std;

vector<int>cnts;
vector<vector<int>>E;
int N, M;

bool solve()
{
	int a;
	for (int i = 1; i <= N; i++)if (cnts[i] == 4)a = i;

	for (int i = 0; i < E[a].size(); i++)
	{
		int pre = a;
		int pos = E[a][i];
		while (cnts[pos] != 4)
		{
			int tmp = pos;
			if (E[pos][0] != pre)pos = E[pos][0];
			else pos = E[pos][1];
			pre = tmp;
		}

		if(pos == a)return true;
	}

	return false;
}

int main()
{
	cin >> N >> M;
	E.resize(N + 1);
	cnts.resize(N + 1);

	for (int i = 0; i < M; i++)
	{
		int a, b; cin >> a >> b;
		cnts[a]++;
		cnts[b]++;
		E[a].push_back(b);
		E[b].push_back(a);
	}

	bool flag = true;
	bool flag2 = false;
	int cnt4 = 0;

	for (int i = 1; i <= N; i++)
	{
		if (cnts[i] % 2)flag = false;
		if (cnts[i] == 4)cnt4++;
		if (cnts[i] > 4)flag2 = true;
	}
	if (cnt4 > 2)flag2 = true;
	else if (flag && flag2 == false && cnt4 == 2 && solve())flag2 = true;

	cout << (flag & flag2 ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 6144
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}




fn main() {
    let n:u32 = read();
    let var: Vec<u32> = (0..n).map(|_| read()).filter(|n| n % 2 == 0).collect();
    let is_ok = var.iter().all(|n| n % 3 ==0 || n % 5 ==0);
    println!("{}", if is_ok  {"APPROVED"} else {"DENIED"});
}


Measured memory_bytes: 4352
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(m)]

for x in range(1000):
    keta = 1
    nx = x // 10
    d = []
    d.append(x%10)
    while nx:
        keta += 1
        d = [nx%10] + d
        nx //= 10
    if keta != n: continue
    ok = True
    for i in range(m):
        if d[p[i][0] - 1] != p[i][1]: ok = False
    if ok: 
        print(x)
        exit() 
print(-1)

Measured memory_bytes: 3064
def solve():
    MOD = 10**9 + 7

    N = int(input())
    xs = list(map(int, input().split()))

    ds = []
    for i in range(N-1):
        d = xs[i+1] - xs[i]
        ds.append(d)

    nums = [1, 1]
    num = 1
    for i in range(2, N-1):
        num *= i
        num %= MOD
        nums.append(num)

    ms = [N-1]
    m = N-1
    for i in reversed(range(2, N-1)):
        m *= i
        m %= MOD
        ms.append(m)
    ms.reverse()
    ms.append(1)

    ks = []
    k = 0
    for num, m in zip(nums, ms):
        k += num*m % MOD
        k %= MOD
        ks.append(k)

    ans = 0
    for d, k in zip(ds, ks):
        ans += d*k % MOD
        ans %= MOD

    print(ans)

solve()


Measured memory_bytes: 68632
time = [int(input()) for i in range(5)]
fixedtime = []
bit = 10
arg = None

for i in range(len(time)):
    if time[i]%10 < bit and time[i]%10 != 0:
        bit = time[i]%10
        arg = i

for i in range(len(time)):
    if i == arg or time[i]%10 == 0:
        fixedtime.append(time[i])
    else:
        fixedtime.append(time[i]+10-time[i]%10)

print(sum(fixedtime))

Measured memory_bytes: 3064
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto s = sread();
    foreach (i, e; s)
    {
        if(i == 4)
            write(" ");

        e.write();
    }
    writeln();
}


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

int main() {
  // 整数の入力
  int a,b,c;
  cin >> a >> b >> c;
  // 出力
  int d,e;
  d=b/a;
  if(d < c){
    e=d;
  }else{
    e=c;
  }
  cout << e << endl;
  return 0;
}

Measured memory_bytes: 384
'use strict';

function main(stdin) {
  const input = stdin.split('\n');
  const S = input[0];
  const T = input[1];

  let ans = 0;
  
  for (let i = 0; i < 3; ++i) {
    if (S[i] === T[i]) ++ans;
  }
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());

Measured memory_bytes: 21064
N=int(input())
H=list(map(int,input().split()))
count=0
ans=[]
for i in range(1,N):
    if H[i-1]>=H[i]:
        count+=1
        if i==N-1:
            ans.append(count)
    else:
        ans.append(count)
        count=0

if N==1:
    print(0)
else:
    print(max(ans))

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


using namespace std;


int N;

vector<int> A, B, C;


int main()
{

	int ans = 0;
	cin >> N;
	

	A = vector<int>(N+1);
	B = vector<int>(N+1);
	C = vector<int>(N);


	for (int i = 1; i <= N; i++) {
		cin >> A.at(i);
	}
	for (int i = 1; i <= N; i++) {
		cin >> B.at(i);
	}
	for (int i = 1; i <= N-1; i++) {
		cin >> C.at(i);
	}

	int lest = -1;
	for (int i = 1; i <= N; i++) {
		ans += B.at(i);

		if (A.at(i) == lest + 1) {
			ans += C.at(A.at(i-1));
		}

		lest = A.at(i);
	}


	cout << ans << endl;


	return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<long long> vll, vLL;

bool check(const string& s,const string& t){
	int n = s.size();
	int m = t.size();
	for(int i=0;i<=n-m;i++){
		bool ok = true;
		REP(j,m){
			if(s[i+j]!='?' && s[i+j]!=t[j])ok=false;
		}
		if(ok)return true;
	}
	return false;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n,x,a[100000];
	ll sosa = 0;

	scanf("%d %d",&n,&x);
	REP(i,n)scanf("%d",&a[i]);
	REP(i,n-1){
		if(a[i]+a[i+1] > x){
			sosa+=(a[i]+a[i+1] - x);
			if(a[i] < x){
				a[i+1] = x-a[i];
			}else{
				a[i]=x;
				a[i+1]=0;
			}
		}
	}
	
	cout << sosa << endl;

	return 0;
}


Measured memory_bytes: 640
i = int(input())
s = 'Eve '
if i == 22:
    print('Christmas {}'.format(s*(25-22)))
elif i == 23:
    print('Christmas {}'.format(s*(25-23)))
elif i == 24:
    print('Christmas {}'.format(s*(25-24)))
elif i == 25:
    print('Christmas')


Measured memory_bytes: 3060
N=parse(Int,readline())
INF=10^9
mx=[INF,INF,INF,INF]
my=mx[:]
Mx=-mx
My=Mx[:]
for i=1:N
	x,y,d=split(readline())
	x=parse(Int,x)
	y=parse(Int,y)
	if d=="L"
		d=1
	elseif d=="R"
		d=2
	elseif d=="U"
		d=3
	elseif d=="D"
		d=4
	end
	mx[d]=min(mx[d],x)
	my[d]=min(my[d],y)
	Mx[d]=max(Mx[d],x)
	My[d]=max(My[d],y)
end
T=[0.0]
push!(T,(mx[1]-mx[2])/2)
push!(T,mx[1]-min(mx[3],mx[4]))
push!(T,min(mx[3],mx[4])-mx[2])
push!(T,(Mx[1]-Mx[2])/2)
push!(T,Mx[1]-max(Mx[3],Mx[4]))
push!(T,max(Mx[3],Mx[4])-Mx[2])
push!(T,(my[4]-my[3])/2)
push!(T,my[4]-min(my[1],my[2]))
push!(T,min(my[1],my[2])-my[3])
push!(T,(My[4]-My[3])/2)
push!(T,My[4]-max(My[1],My[2]))
push!(T,max(My[1],My[2])-My[3])
ans=10^18
for t=T
	if t<0;continue;end
	X=max(Mx[1]-t,Mx[2]+t,Mx[3],Mx[4])-min(mx[1]-t,mx[2]+t,mx[3],mx[4])
	Y=max(My[1],My[2],My[3]+t,My[4]-t)-min(my[1],my[2],my[3]+t,my[4]-t)
	ans=min(ans,X*Y)
end
println(ans)

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

long N;
set<string> S;

int main(void) {

    cin >> N;

    for (long i = 0; i < N; i++) {
        string s; cin >> s;
        S.emplace(s);
    }

    cout << S.size() << endl;

    return 0;

}

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

using namespace std;

int main() {
	int N, D, X;
	cin >> N >> D >> X;
	vector<int> A(N);
	int i, n = 1, choco = 0;
	for(i = 0; i < N; i++)
		cin >> A.at(i);
	
	for(i = 0; i < N; i++) {
		while(n <= D) {
			choco++;
			n += A.at(i);
		}
		n = 1;
	}

	cout << choco+X << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
int main(){
  int n,flag;
  char s[210];
  scanf("%s",s);
  n=strlen(s);
  for(int i=n-1;i>0;i--){
    flag=1;
    if(i%2==0){
      for(int j=0;j<i/2;j++)
        if(s[j]!=s[j+i/2])
          flag=0;
      if(flag){
        printf("%d\n",i);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
void solve()
{
	ll a;
	cin>>a;
	cout<<a+(a*a)+(a*a*a);
}
int main()
{
	FAST
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++) solve();
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
int dfs(vector< vector< int > > &G, int x, int p) {
	int c = K - 1;
	if (p != -1)
		c--;
	int ret = 1;
	for (auto j : G[x]) {
		if (j == p)
			continue;
		(ret *= dfs(G, j, x)) %= MOD;
		if (c == 0)
			return 0;
		(ret *= (c--)) %= MOD;
	}
	return ret;
}
signed main() {
	cin >> N >> K;
	vector< vector< int > > G(N);
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	cout << dfs(G, 0, -1) * K % MOD << endl;
	return 0;
}

Measured memory_bytes: 11520