akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
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;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  str s;
  cin>>n>>s;
  V black(n+1,0),white(n+1,0);
  reps(i,n){
    black[i]=black[i-1];
    white[i]=white[i-1];
    if(s[i-1]=='.')white[i]++;
    if(s[i-1]=='#')black[i]++;
  }
  int res=INF;
  rep(i,n){
    chmin(res,( (white[n]-white[i+1]) + (black[i]-black[0]) ));
  }
  out(res);
  
  
  return 0;
}



Measured memory_bytes: 3732
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int sum = 0;
        for(int i=0; i<2; i++){
          if(a>=b) {
            sum += a;
            a--;
          }
          else{
            sum += b;
            b--;
          }
       
        }
		System.out.println(sum);
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=100000;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s1,s2;
	cin >> s1 >> s2;
	if(s1[0]==s2[2] && s1[2]==s2[0] && s1[1]==s2[1]){
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<Integer> list = nextIntArray();
		int output = 0;
		for(int i = 0; i < N; i++){
			if(list.get(i) % 2 == 0){
				if((list.get(i) % 3 == 0 || list.get(i) % 5 == 0)){

				}else{
					myout("DENIED");
					return;
				}
			}
		}
		myout("APPROVED");
	}
	//Method addition frame start



	//Method addition frame end
}


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

using namespace std;

int main(){
  int A,B,C,X,Y;
  long long int F=0;
  cin >> A >> B >> C >> X >> Y;
  if(A+B<=2*C){
    F+=A*X;
    F+=B*Y;
  }else if(A+B>2*C){
    while((X>=1) && (Y>=1)){
      F+=2*C;
      X--;Y--;
    }
    while(X>0){
      if(A>2*C){F+=2*C;}
      else{F+=A;}
      X--;
    }
    while(Y>0){
      if(B>2*C){F+=2*C;}
      else{F+=B;}
      Y--;
    }
  }
  cout << F << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        String[] splitedString = n.split("", 0);
        int a = 0;
        int b = 0;
        int c = 0;
        boolean judge = true;
        for(int i = 0; i < splitedString.length; i++){
            switch(splitedString[i]){
                case  "a":
                    if(a == 1){
                        judge = false;
                    }else{
                        a++;   
                    }
                    break;
                case  "b":
                    if(b == 1){
                        judge = false;
                    }else{
                        b++;   
                    }
                    break;
                case  "c":
                    if(c == 1){
                        judge = false;
                    }else{
                        c++;   
                    }
                    break;
            }
        }
        if(!judge){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 25044
#include <string>
#include <iostream>
#include <vector>

using namespace std;
int main()
{
	std::string input;
	std::getline(std::cin, input);
	int N = std::stoi(input);
	std::string hats;
	std::getline(std::cin, hats);

	int red = 0, blue = 0;
	for(char& hat : hats)
	{
		switch(hat)
		{
			case 'R':
				red += 1;
				break;
			case 'B':
				blue += 1;
				break;
		}
	}

	if(red > blue)
	{
		std::cout<< "Yes" << std::endl;
	}
	else
	{
		std::cout<< "No" << std::endl;
	}
	return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N;
char S[111], T[111];
ll i, j, k, ans;
int main(){
    scanf("%lld%s%s", &N, S, T);
    fornum(i,0,N){
        printf("%c%c", S[i], T[i]);
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repbit(bit,n) for (int bit = 0; bit < (1<<n); bit++)
using namespace std;
typedef long long ll;

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

ll a, b, v, w, t;

int main() {
	char x;
	cin >> x;

	int tmp = static_cast<int>(x);
	char ans;
	if (tmp >= 65 and tmp <= 90) ans = 'A'; 
	else ans = 'a';
	cout << ans << endl;
	return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main()
{
    int n, q;
    string s;
    cin >> n >> q;
    cin >> s;
    bool is_stt = false;
    vector<int> cnt(n, 0);
    vector<int> out(n + 1, 0);
    rep(i, n)
    {
        if (is_stt)
        {
            if (s[i] == 'C')
            {
                is_stt = false;
                cnt[i]++;
            }
            else if (s[i] != 'A')
            {
                is_stt = false;
            }
        }
        else
        {
            if (s[i] == 'A')
                is_stt = true;
        }
    }
    rep(i, n) out[i + 1] = out[i] + cnt[i];
    int l, r;
    rep(i, q)
    {
        cin >> l >> r;
        cout << out[r] - out[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        int weeks = new Scanner(System.in).nextInt();
        double debt = 100000;
        for(int i = 0; i < weeks;i++) {
            debt *= 1.05;
            double fraction = debt % 1000;
            if (fraction != 0)debt += 1000 - fraction;
        }
        System.out.println((long)debt);
}
}

Measured memory_bytes: 17224
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int total_countries;
  int tolerated_difference;
  while(~scanf("%d %d",&total_countries,&tolerated_difference)){
    if(total_countries == 0) break;
    deque<int> country[100];
    int sum[100];
    memset(sum,0,sizeof(sum));
    for(int country_idx=0;country_idx < total_countries; country_idx++){
      int total_missiles;
      scanf("%d",&total_missiles);
      for(int missile_idx=0; missile_idx < total_missiles; missile_idx++){
	int missile_ability;
	scanf("%d",&missile_ability);
	country[country_idx].push_back(missile_ability);
	sum[country_idx] += missile_ability;
      }
    }

    for(;;){
      bool can_update = false;
      for(int country_idx = 0;country_idx < total_countries; country_idx++){
	if(country[country_idx].size() == 0) continue;

	int back_num = country[country_idx].back();
	sum[country_idx] -= back_num;
	country[country_idx].pop_back();

	int max_v = 0;
	int min_v = INF;
	for(int country_idx2 = 0;country_idx2 < total_countries; country_idx2++){
	  max_v = max(max_v,sum[country_idx2]);
	  min_v = min(min_v,sum[country_idx2]);
	}

	if(tolerated_difference < (max_v - min_v)){
	  sum[country_idx] += back_num;
	  country[country_idx].push_back(back_num);
	}
	else{
	  can_update = true;
	}
      }
      if(!can_update) break;
    }

    int final_sum = 0;
    for(int country_idx = 0;country_idx < total_countries; country_idx++){
      final_sum += sum[country_idx];
    }
    printf("%s\n",final_sum == 0 ? "Yes" : "No");
  }
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    string S;cin>>S;
    ll N=ll(S.size())+1;
    ll sum=0;
    vector<ll> hi(N,0),lo(N,0);
    for(int i=0;i<S.size();i++){
        if(S[i]=='<') hi[i+1]=max(hi[i+1],hi[i]+1);
    }
    
    for(int i=S.size()-1;i>=0;i--){
        if(S[i]=='>') lo[i]=max(lo[i],lo[i+1]+1);
    }
    
    for(int i=0;i<N;i++) sum+=max(hi[i],lo[i]);
    
    cout<<sum<<endl;
}



Measured memory_bytes: 8708
<?php
list($n) = ints();
$m = 26;
$c = ints();
for ($i = 0; $i < $n; ++$i) {
    $s = ints();
    for ($j = 0; $j < $m; ++$j) $s[$j] += $c[$j] * 365;
    $max = PHP_INT_MIN;
    for ($j = 0; $j < $m; ++$j) {
        if ($max < $s[$j]) {
            $max = $s[$j];
            $maxi = $j;
        }
    }
    $ans[] = $maxi + 1;
}
echo implode(PHP_EOL, $ans);
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 16292
s = gets.chomp
q = gets.to_i
q.times do
  c,a,b,p = gets.chomp.split
  a = a.to_i
  b = b.to_i
  case c
  when "print"
    puts s[a..b]
  when "reverse"
    s[a..b] = s[a..b].reverse
  when "replace"
    s[a..b] = p
  end
end


Measured memory_bytes: 6912
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}


//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

//ABC158のE見る
int main() {
	ll Q, H, S, D, N; cin >> Q >> H >> S >> D >> N;
	ll x = min(D, min(2 * S, min(4 * H, 8 * Q)));
	ll y = min(S, min(2 * H, 4 * Q));
	if (N % 2 == 0) cout << x * N / 2 << endl;
	else cout << x * ( N/2 )+ y<< endl;
}

Measured memory_bytes: 8064
n,k= list(map(int,input().split()))
pos= list(map(int,input().split()))
ans = 10**13
for i in range(n-k+1):
    a1 = abs(pos[i]) + abs(pos[i] - pos[i+k-1])
    a2 = abs(pos[i+k-1]) + abs(pos[i] - pos[i+k-1])
    ans = min(ans, a1,a2)
print(ans)

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

using namespace std;

typedef long long ll;

ll min(ll n, ll m){
  if (n < m) {
    return n;
  }
  return m;
}

int main(int argc, char const *argv[]) {
  ll i,n,m,sumn,summ,ans,nobori,s;
  string S;

  cin >> S;
  ans = 0;
  s = 0;
  if (S[0] == '>') {
    i = 1;
    ans += 1;
    while (S[i] == '>' && i < S.length()) {
      i++;
      ans += i;
    }
    if(i == S.length()){
      cout << ans;
      return 0;
    }else{
      s = i;
    }
  }
  n = 0;
  sumn = 0;
  nobori = 1;
  for (i = s; i < S.length(); i++) {
    if(nobori == 1){
      if (S[i] == '<') {
        n++;
        sumn += n;
      }else{
        m = 1;
        summ = m;
        nobori = 0;
      }
    }else{
      if (S[i] == '>') {
        m++;
        summ += m;
      }else{
        ans += sumn + summ - min(n, m);
        n = 1;
        sumn = 1;
        nobori = 1;
      }
    }
  }
  if (nobori == 1) {
    ans += sumn;
  }else{
    ans += sumn + summ - min(n, m);
  }
  cout << ans;
  return 0;
}


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

long long x, y;
int main() {
    cin >> x >> y;
    long long res = 1LL << 60;
    if (x <= y) res = min(res, y - x);
    if (-x <= y) res = min(res, y + x + 1);
    if (x <= -y) res = min(res, -y - x + 1);
    if (-x <= -y) res = min(res, -y + x + 2);
    cout << res << endl;
}

Measured memory_bytes: 256
using System;

namespace atcoder1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int x = int.Parse(input[0]);
            int y = int.Parse(input[1]);
            int clane = 0,flag=0;

            for (; x >= 0; x--)
            {
                if (x * 4 + clane * 2 == y)
                {
                    Console.WriteLine("Yes");
                    break;
                }
                clane++;
                if (x == 0)
                {
                    flag++;
                    break;
                }
            }
            if (flag==1)Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 17832
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;




long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll pow_kai(ll a, ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a;
      //x %= mod;
      cout << x << endl;
    }
    a = a*a;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll gyaku[200100];

ll combination(ll n, ll r) {
  if(r==1)return n;
  else return n * combination(n-1, r-1) % (MM+7) * gyaku[r] % (MM+7);
}

int main() {
    ll n, a, b; cin >> n >> a >> b;
    ll ans = myPow(2, n, MM+7);
    //cout << ans << endl;

    rep(i, 200100) {
        gyaku[i] = modinv(i, MM+7);
    }

    ans -= 1;
    ans %= MM+7;
    ans -= combination(n, a);
    ans %= MM+7;
    ans -= combination(n, b);
    ans %= MM+7;
    if(ans < 0) ans += MM+7;
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

int D;
vector<int> c(26);
vector<vector<int>> s;
vector<int> spa(26,0);//経過日数
vector<int> t;
vector<set<int>> schedule(26);//各コンテストが何日目に開催されるか
ll contest(int day,int x){//day日にコンテストxを開催した時の満足度の増加量 1-indexed
    ll now=s.at(day-1).at(x-1);
    rep(i,26){
        if(i==x-1){
            spa.at(i)=0;
            continue;
        }
        spa.at(i)++;
        now-=spa.at(i)*c.at(i);
    }
    return now;
}

int main() {
    std::chrono::system_clock::time_point  start, end; // 型は auto で可
 start = std::chrono::system_clock::now();

    cin>>D;
    rep(i,26)cin>>c.at(i);
    s.resize(D,vector<int>(26));
    rep(i,D)rep(j,26){cin>>s.at(i).at(j);}
    t.resize(D);

    //rep(i,D)cin>>t.at(i);
    /*rep(i,D){
        t.at(i)=rand()%26+1;
    }*/
    rep(i,D){
        rep(j,26){
            if(s.at(i).at(j)>s.at(i).at(t.at(i))){
                t.at(i)=j;
            }
        }
        t.at(i)++;
    }

    rep(i,26){
        schedule.at(i).insert(0);
    }
    rep(i,D){
        schedule.at(t.at(i)-1).insert(i+1);
    }
    rep(i,26){
        schedule.at(i).insert(D+1);
    }
    ll ans=0;
    rep(i,D){
        ans+=contest(i+1,t.at(i));
        //cout<<ans<<endl;問題A用
    }
    //改善前のansがもとまっている

    double elapsed;
    
    while(elapsed<1800){//時間が許す限り
        int d,q;
        //cin>>d>>q;
        d=rand()%D+1;
        q=rand()%26+1;
        ll oldans=ans;

        int x=t.at(d-1);
        t.at(d-1)=q;
        int bx,nx;
        auto p=lower_bound(schedule.at(x-1).begin(),schedule.at(x-1).end(),d);
        p--;
        bx=*p;
        p++;p++;
        nx=*p;
        schedule.at(x-1).erase(d);
        int bq,nq;
        auto itr=lower_bound(schedule.at(q-1).begin(),schedule.at(q-1).end(),d);
        nq=*itr;
        itr--;
        bq=*itr;
        schedule.at(q-1).insert(d);
        ans+=s.at(d-1).at(q-1)-s.at(d-1).at(x-1);
        ans+=(d-bq)*(nq-d)*c.at(q-1);
        ans-=(d-bx)*(nx-d)*c.at(x-1);
        //cout<<ans<<endl;
        if(ans<oldans){
            schedule.at(x-1).insert(d);
            schedule.at(q-1).erase(d);
            ans=oldans;
        }
        end = std::chrono::system_clock::now();  // 計測終了時間
        elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
    }
    rep(i,D){
        cout<<t.at(i)<<endl;
    }
}

Measured memory_bytes: 3904
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>

using namespace std;

int main() {
    int n;
    cin >> n;
    
    vector<int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    bool ans = true;
    int m = v[0];
    for(int i = 1; i < n; i++) {
        if(v[i] + 1 < m) {
            ans = false;
            break;
        }
        else {
            m = max(m, v[i]);
        }
    }
    
    if(ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <cmath>

int main()
{
    double x1,x2,y1,y2;

    std::cin >> x1 >> y1 >> x2 >> y2;

    std::cout << std::fixed << std::setprecision(5) << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) << std::endl;
}


Measured memory_bytes: 3276
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<int>> ds(n);
  rep(i,n) {
    int t, d;
    cin >> t >> d;
    --t;
    ds[t].push_back(d);
  }
  vector<int> y0, y1;
  rep(i,n) {
    if (ds[i].size() == 0) continue;
    sort(ds[i].begin(), ds[i].end());
    y1.push_back(ds[i].back());
    ds[i].pop_back();
    y0.insert(y0.end(), ds[i].begin(), ds[i].end());
  }
  sort(y0.rbegin(), y0.rend());
  sort(y1.rbegin(), y1.rend());
  long long ans = 0;
  int Y = max(0, k-int(y0.size()));
  long long X = 0;
  rep(i,Y) X += y1[i];
  rep(i,k-Y) X += y0[i];
  while (1) {
    ans = max(ans, X + (long long)Y*Y);
    if (Y >= k || Y >= y1.size()) break;
    X += y1[Y];
    X -= y0[k-Y-1];
    ++Y;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6396
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1000;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int a[maxn];
int main(){
	n=read();
	for(register int i=1;i<n;i++)a[i]=read();
	int ans=a[1]+a[n-1];
	for(register int i=2;i<n;i++){
		ans+=min(a[i],a[i-1]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import sys

def c1(c):
    alph ="abcdefghijklmnopqrstuvwxyz"
    if c in alph:
        return alph[(alph.find(c)+1)%26]
    else:
        return c

for string in sys.stdin:
    while True:
        af_string=""
        for c in string:
            af_string+=c1(c)
        if af_string.find("the")!=-1\
           or af_string.find("this")!=-1\
           or af_string.find("that")!=-1:
            break
        string = af_string
    print af_string[:-1]

Measured memory_bytes: 4212
#include <iostream>

using namespace std;

int main()
{
	int N;
	bool flag = false;
	cin >> N;
	if (N / 100 == 7)
	{
		flag = true;
	}
	else
	{
		N -= (N / 100) * 100;
		if (N / 10 == 7)
		{
			flag = true;
		}
		else
		{
			N -= (N / 10) * 10;
			if (N == 7)
			{
				flag = true;
			}
		}
	}
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3628
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

      # divisors.sort()
  return divisors
    
N = int(input())
ans = 0
count = make_divisors(N)

for i in count:
  if i != 1:
    q, mod = divmod(N, i-1)
    if q == mod:
      ans += i - 1
print(ans)

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    vector<ll> l(3);
    REP(i, 3) cin >> l[i];
    sort(l.begin(), l.end());

    vector<int> rem(3);
    REP(i, 3) rem[i] = l[i] % 2;
    int sumRem = accumulate(rem.begin(), rem.end(), 0);

    if (sumRem == 3) cout << l[0] * l[1] << '\n';
    else cout << 0 << '\n';
    return 0;
}


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

using namespace std;

int main(void) {
  int N, K, i;
  string S, c, tmp;

  cin >> N;
  cin >> S;
  cin >> K;

  c = S.substr(K-1, 1);

  for(i = 0; i < N; i++) {
    tmp = {S[i]};
    if(tmp != c) {
      S[i] = '*';
    }
  }

  cout << S << endl;
}




Measured memory_bytes: 256
let () = Scanf.scanf "%d %d\n" @@ fun n m -> print_int @@
  let sum = ref 0 in
  for i=1 to m do
    if i<m 
    then Scanf.scanf " %d" @@ fun a -> sum := !sum + a
    else Scanf.scanf " %d\n" @@ fun a -> sum := !sum + a
  done;
  if !sum <= n
  then n - !sum
  else -1
    

Measured memory_bytes: 5832
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

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

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	auto g1 = a;
	auto g2 = a;

	for (int i = 1; i < n; i++) {
		g1[i] = gcd(g1[i - 1], a[i]);
		int j = n - 1 - i;
		g2[j] = gcd(g2[j + 1], a[j]);
	}

	// for (int i = 0; i < n; i++) {
	// 	printf("%2d %2d: %2d %2d\n", i, a[i], g1[i], g2[i]);
	// }

	int ans = max(g1[n - 2], g2[1]);
	for (int i = 1; i < n - 1; i++) {
		ans = max(ans, gcd(g1[i-1], g2[i+1]));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int N,T,cnt=0;
    cin >> N;
	int d[N];
    for (int i=0; i<N; i++) cin >> d[i];
  	sort(d,d+N);
    cnt = d[N/2] - d[N/2-1];
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000

typedef long long ll;

ll rec(ll a,ll b,ll c){
    if(a > b) swap(a,b);
    if(b > c) swap(b,c);
    
    if (c%2 == 0 || a%2 == 0 || b%2 == 0) {
        return 0;
    }else{
        return a*b;
    }
}

int main(){
    INT(A);INT(B);INT(C);
    cout << rec(A,B,C) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int main() {
	int n, ans = 0;
	vector<int> s;
	cin >> n;
	s.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		ans += s[i];
	}
	sort(s.begin(), s.end());
	if (ans % 10 == 0) {
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 == 0) {
				continue;
			}
			else {
				ans -= s[i];
				break;
			}
		}
	}
	if (ans % 10 == 0) {
		cout << 0 << endl;
	}
	else {
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(5, 1LL << 60));
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    long long cur = 1LL << 60;
    for (int j = 0; j < 5; j++) {
      cur = min(cur, dp[i][j]);
      long long cost;
      if (j == 0 || j == 4) cost = a[i];
      if (j == 1 || j == 3) cost = (a[i] > 0 ? a[i] % 2 : 2);
      if (j == 2) cost = (a[i] % 2 == 0);
      dp[i + 1][j] = min(dp[i + 1][j], cur + cost);
    }
  }
  long long ans = 1LL << 60;
  for (int i = 0; i < 5; i++) ans = min(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15232
import itertools
n=int(input())
l=list(map(int,input().split()))

ans=0
for pair in itertools.combinations(l,3):
    pair=list(pair)
    pair.sort()
    #print(pair)
    if pair[0]+pair[1]>pair[2]>abs(pair[0]-pair[1]) and pair[0]!=pair[1]!=pair[2]:
        ans+=1
print(ans)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MS(a) memset(a,0,sizeof(a))
#define MP make_pair
#define PB push_back
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//////////////////////////////////////////////////////////////////////////
const int maxn = 1e5+10;

ll x[maxn],k[maxn];
ll n,a,b;

bool check(ll t){
    memcpy(k,x,sizeof(x));
    for(ll i=1; i<=n; i++){
        k[i] -= t*b;
    }
    ll more = (a-b),cnt=0;
    for(ll i=1; i<=n; i++){
        if(k[i]>0) cnt += (k[i]%more==0) ? (k[i]/more) : (k[i]/more+1);
    }
    return cnt <= t;
}

int main(){
    cin >> n >> a >> b;
    for(int i=1; i<=n; i++){
        x[i] = read();
    }

    ll ans,L=1,R=1e9;
    while(L<=R){
        ll mid = (L+R)/2;
        if(check(mid)) ans=mid,R=mid-1;
        else L=mid+1;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1792
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();

		boolean ansflg=false;
		if(A>B) {
			if(A>=C && B<=C) ansflg=true;
		}else {
			if(B>=C && A<=C) ansflg=true;
		}

		if(ansflg) System.out.println("Yes");
		else System.out.println("No");

		sc.close();
	}

}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
const int MOD = 1000 * 1000 * 1000 + 7;
const int N = 100;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int main()
{
    Fast_IO();
    string s ;
    cin >> s ;
    for ( int i = 1; i < s.length() ; ++i )
    {
        if ( s[i-1] == s[i]){
            cout << "Bad";
            return 0 ;
        }
    }

    cout << "Good";

    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();
		if(a == 25){
			System.out.println("Christmas");
		}else if(a == 24){
			System.out.println("Christmas Eve");
		}else if(a == 23){
			System.out.println("Christmas Eve Eve");
		}else if(a == 22){
			System.out.println("Christmas Eve Eve Eve");
		}
		
		
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int N = rei();
	multiset<long> st;
	for(int i=0;i<N;i++){
		long val = -rei();
		auto x = st.upper_bound(val);
		if(x != st.end()){
			st.erase(x);
		}
		st.insert(val);
	}
	cout << st.size() << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

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

int main(){
double x1, y1, x2, y2;
double distance;
  cin >> x1 >> y1 >> x2 >> y2;
  distance = pow(x2 - x1, 2) + pow(y2 - y1, 2);

  cout << fixed << setprecision(8) << sqrt(distance) << endl;
}



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

P x[500];
int a[250000];
int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		scanf("%d", &x[i].first);
		a[--x[i].first] = i + 1;
		x[i].second = i + 1;
	}
	sort(x, x + n);
	int s = 0;
	rep(i, n) {
		rep(j, x[i].second - 1) {
			while (s < x[i].first&&a[s] != 0)s++;
			if (s == x[i].first) {
				puts("No"); return 0;
			}
			a[s] = x[i].second;
		}
	}
	s = 0;
	rep(i, n) {
		s = max(s, x[i].first + 1);
		rep(j, n - x[i].second) {
			while (s < n*n&&a[s] != 0)s++;
			if (s == n*n) {
				puts("No"); return 0;
			}
			a[s] = x[i].second;
		}
	}
	puts("Yes");
	rep(i, n*n) {
		if (i)printf(" ");
		printf("%d", a[i]);
	}
	puts("");
}

Measured memory_bytes: 2176
// code author: Dhruva Mahajan
 
// Ideas are cheap, execution is everything.
 
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long  
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define tr(container, it) for(auto it = container.begin(); it != container.end(); it++)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define testcase(t) int t;cin>>t;while(t--)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

int main(){
 
	fastio;

	ll h,w,n;
	cin>>h>>w>>n;
	ll temp1=ceil((float)n/w), temp2=ceil((float)n/h);
	cout<<min(temp2, temp1)<<endl; 
 
 
 
	
	
	return 0;
}

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

int main() {
    int N, temp;
    std::cin >> N;
    
    std::vector<int> A;
    A.push_back(-1);
    for (int i=0; i<N; ++i) {
        std::cin >> temp;
        A.push_back(temp);
    }
    
    int cnt = 0;
    int current = 1;
    bool ans = true;
    while (1) {
        if (cnt > N) {
            ans = false; 
            break;
        }
        if (current==2) {
            break;
        } else {
            current = A[current];
            cnt++;
        }
    }
    std::cout << (ans ? cnt : -1) << std::endl;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define pii   pair<int,int>
#define hell  1000000007
#define rep(i,a,b)  for (__typeof(b) i=(a)-((a)>(b));i!=(b)-((a)>(b));i+=1-2*((a)>(b)))
#define boost ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define pb  push_back
#define all(a)      (a).begin(),(a).end()

typedef long long  ll;
using namespace std;

const ll INF=(1LL<<60)-1;
const int N=1e5+20;

int main(){
   
    boost;
    
    int n,m; cin >> n >> m;
    
    ll x[n], y[n], z[n];
    
    for(int i=0;i<n;i++){
    	cin >> x[i] >> y[i] >> z[i];	
	}
	
	ll res = 0;
	for(int i = 0; i < 8; i++){
		bitset<3> bs(i);
		vector<ll> v(n);
		ll s = 0;
		for(int j = 0; j < n; j++){
			if(bs[0]) v[j] += x[j]; else v[j] -= x[j];
			if(bs[1]) v[j] += y[j]; else v[j] -= y[j];
			if(bs[2]) v[j] += z[j]; else v[j] -= z[j];
		}
		sort(v.rbegin(), v.rend());
		ll ans = accumulate(v.begin(),v.begin()+m, 0LL);
		res = max(res, ans);
	}	
	
	cout << res;
   	return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = []
f = []
z = 0
for ai in a:
  if ai > 0:
    s.append(ai)
  elif ai < 0:
    f.append(-ai)
  else:
    z += 1
p = len(s)
q = len(f)
l = max(0,k-p)
h = min(k,q)
mod = 10**9+7
if l > h:
  print(0)
  exit()
if l%2 == 0 or h-l >= 1:
  if l%2 == 0:
    c = l
  else:
    c = l+1
  s.sort(reverse=True)
  f.sort(reverse=True)
  while c+2 <= h:
    if f[c]*f[c+1] > s[k-c-1]*s[k-c-2]:
      c += 2
    else:
      break
  ans = 1
  for i in range(c):
    ans =(ans*f[i])%mod
  for i in range(k-c):
    ans = (ans*s[i])%mod
  print(ans)
  exit()
if z > 0:
  print(0)
  exit()
m = s + f
m.sort()
ans = 1
for i in range(k):
  ans = (ans*(m[i]))%mod
ans = (-ans)%mod
print(ans)



Measured memory_bytes: 104624
# ABC154a


def main():
    import sys
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if s == u:
        a -= 1
    if t == u:
        b -= 1
    print(a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
typedef long long ll;    
typedef long double ld;  
#define pb push_back     
using namespace std;



int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
	
    int ct = 1;
    ll x, y; cin >> x >> y;

    while(x * 2 <= y){
        x*=2;
        ct++;
    }    
    cout << ct << endl;

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main(){
	int a,b,c;
	c=0;
	b=1;
	std::vector<int> e(1);
	while(true){
		std::cin>>a;
		if(a==0){
			break;
		}
		a=a/4;
		std::vector<int> v(a);
		for(int i=0;i<a;++i){
			std::cin>>v[i];
		}
		for(int i=0;i<a;++i){
			c=c+v[i];
		}
		e[b-1]=c;
		c=0;
		b=b+1;
		e.resize(b);
	}
	for(int i=0;i<b-1;++i){
		std::cout<<e[i]<<std::endl;
	}
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;

#define fbo find_by_order
#define ook order_of_key
#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// void initiate_random() { mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count()); }

// /mnt/c/Users/vince/Desktop/POST-IOI/Codeforces/Regular/670

const long MOD = 1e9+7;
long dp[1000003][4];

int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

	int n; scanf("%d", &n);
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++)
	{
		dp[i][0] += dp[i-1][0]*8;
		dp[i][1] += dp[i-1][0];
		dp[i][1] += dp[i-1][1]*9;
		dp[i][2] += dp[i-1][0];
		dp[i][2] += dp[i-1][2]*9;
		dp[i][3] += dp[i-1][1];
		dp[i][3] += dp[i-1][2];
		dp[i][3] += dp[i-1][3]*10;
		dp[i][0] %= MOD;
		dp[i][1] %= MOD;
		dp[i][2] %= MOD; 
		dp[i][3] %= MOD;
		// printf("%lld %lld %lld %lld\n", dp[i][0], dp[i][1], dp[i][2], dp[i][3]);
	}
	printf("%lld\n", dp[n][3]);
}

Measured memory_bytes: 34924
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)


N, M = LI()
LR = []

for i in range(M):
    LR.append(LI())

left, right = 0, inf
for lr in LR:
    left = max(left, lr[0])
    right = min(right, lr[1])
#  print(left, right)
if left > right:
    print(0)
else:
    print(right - left + 1)


Measured memory_bytes: 82392
#include<stdio.h>
#include<string.h>
int main()
{
    char a[4], b[4];
    gets(a);
    int check=strcmp(a, "ABC");
    if(check==0){
        printf("ARC\n");
        return 0;
    }
    printf("ABC\n");
    return 0;
}

Measured memory_bytes: 1520
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10,inf=1e9;
int n,cnt,ans=inf,size[N],dis[N],head[N],to[N<<1],nxt[N<<1];
char s[N];
inline void add(int u,int v){
	to[++cnt]=v,nxt[cnt]=head[u],head[u]=cnt;
}
void dfs1(int u,int fa){
	size[u]=s[u]-'0',dis[u]=0;
	for(int i=head[u];i;i=nxt[i]){
		int v=to[i]; if(v==fa) continue; dfs1(v,u);
		size[u]+=size[v],dis[u]+=dis[v]+size[v];
	}
}
int dfs2(int u,int fa){
	int mx=0;
	for(int i=head[u];i;i=nxt[i]){
		int v=to[i]; if(v==fa) continue;
		if(mx==0 || dis[v]>dis[mx]) mx=v;
	}
	if(mx==0) return 0;
	int tmp=size[mx]+dfs2(mx,u);
	if(dis[u]-dis[mx]-size[mx]>=tmp) return dis[u]&1;
	else return tmp-(dis[u]-dis[mx]-size[mx]);
}
int main(){
	scanf("%d%s",&n,s+1);
	for(int i=1,u,v;i<n;i++) scanf("%d%d",&u,&v),add(u,v),add(v,u);
	
	for(int i=1;i<=n;i++){
		dfs1(i,0);
		if(dfs2(i,0)==0) ans=min(ans,dis[i]/2);	
	}
	if(ans==inf) puts("-1");
	else printf("%d",ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  	
  	string s,t;
  	cin >> s >> t;
  	cout << t << s << endl;
  	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int d;
    cin>>d;
    string ans;
    if(d==25)ans="Christmas";
    else if(d==24)ans="Christmas Eve";
    else if(d==23)ans="Christmas Eve Eve";
    else ans="Christmas Eve Eve Eve";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] == 0:
    print('0')
    exit()
ans = 1
for i in range(1, n + 1):
    ans *= a[-i]
    if ans > 10 ** 18:
        print('-1')
        exit()
print(ans)

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

using namespace std;

int main() {
	int n;
	vector<int> a;
	int col[9];
	int cnt = 0;

	cin >> n;

	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < 9; i++) {
		col[i] = 0;
	}

	for (int i = 0; i < n; i++) {
		if (a[i] >= 3200) {
			if (col[8] == 0) {
				cnt++;
			}
			col[8]++;
		} else if (col[a[i] / 400] == 0) {
			cnt++;
			col[a[i] / 400]++;
		}
	}

	if (col[8] == 0) {
		cout << cnt << " " << cnt;
	}
	else {
		cout << (cnt - 1 == 0 ? 1 : cnt - 1) << " " << cnt + col[8] - 1;
	}

	return 0;
}

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

int main() {
	int a, b, c, x = 0, y = 0;
	char t;

	while (cin>>a>>t>>b>>t>>c) {
		if (a*a + b*b == c*c) {
			x++;
		}

		if (a == b) {
			y++;
		}
	}
	cout << x << endl << y << endl;

	return 0;
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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 = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string S;
    int K;
    cin >> S >> K;
    int N = S.size();
    char fi = '1';
    rep(i,N){
        if(S[i] != '1'){
            fi = S[i];
            break;
        }
    }
    if(K > 100){
        cout << fi << endl;
        return 0;
    }
    if(fi == '1'){
        cout << '1' << endl;
        return 0;
    }
    rep(i,K){
        if(S[i] != '1'){
            cout << S[i] << endl;
            return 0;
        }
        if(i == K-1){
            cout << S[i] << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256