akhauriyash/Code-Regression huggingface dataset:
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);i++)
#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 fs first
#define sc second
#define eb emplace_back
#define pb eb
#define all(x) x.begin(),x.end()
template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

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

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

struct UnionFind {
    V<int> p, r;
    int gn;
    UnionFind(int n = 0) : p(n, -1), r(n, 1), gn(n) {}
    void merge(int a, int b) {
        int x = group(a), y = group(b);
        if (x == y) return;  // same
        gn--;
        if (r[x] < r[y]) {
            p[x] = y;
        } else {
            p[y] = x;
            if (r[x] == r[y]) r[x]++;
        }
    }
    int group(int a) {
        if (p[a] == -1) return a;
        return p[a] = group(p[a]);
    }
    bool same(int a, int b) { return group(a) == group(b); }
};

void good() {
    cout << "Yes" << endl;
    exit(0);
}

void fack() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, m;
    cin >> n >> m;


    V<int> a(m), b(m);
    V<int> deg(n);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i]; a[i]--; b[i]--;
        deg[a[i]]++; deg[b[i]]++;
    }

    for (int i = 0; i < n; i++) {
        if (deg[i] % 2) fack();
    }

    if (m > n + 2) good();
    if (n + 2 > m) fack();

    int s = -1;
    for (int i = 0; i < n; i++) {
        if (deg[i] == 6) good();
        if (deg[i] == 4) s = i;
    }

    auto uf = UnionFind(n);
    for (int i = 0; i < m; i++) {
        if (a[i] == s || b[i] == s) continue;
        uf.merge(a[i], b[i]);
    }

    if (uf.gn == 2) fack();
    else good();

    return 0;
}


Measured memory_bytes: 2176
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;

int main() {
	speed;
	int a, b, c;
	cin >> a >> b >> c;
	a -= b;
	c -= a;
	if (c < 0)c = 0;
	c(c);

	return 0;
}


Measured memory_bytes: 256
<?php

$line = trim(fgets(STDIN));
$line = explode(' ', $line);

$a = $line[0];
$b = $line[1];
$hr = $line[2];
$mn = $line[3];

// 長針・短針の設定
$short = $hr;
$long  = $mn;

// 24時間表示　→　12時間表示
$hour   = $short <= 12 ? $short : $short - 12;
$minute = $long;

// 短針の角度取得
$rShort = ($hour * (360 / 12)) + $minute * 1 / 2;

// 長針の角度取得
$rLong = $minute * (360 / 60);

// 角度取得
$ang = abs($rLong - $rShort);

if ($ang == 360) {
    echo 0;
    exit();
}

if ($ang > 180) {
    $ang = 360 - $ang;
}

echo sqrt(($a * $a) + ($b * $b) - 2 * $a * $b * cos(deg2rad($ang)));


Measured memory_bytes: 16512
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(int k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(int n, int k) {
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){ int t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


mint solve(int a, int n) {
	mint x=1,y=1,z=1,w=1;
	mint sum = 0;
	for(int i=1;i<=n;i++) {
		y*=i+1;
	} w=y;
	for(int i=1;i<=a;i++) {
		x*=i+1;y*=i+n+1;z*=i;
		sum+=(mint(n+1)*y-x*w)/(mint(i+1)*z*w);
	}
	return sum;
}

signed main() {
	int a,b,c,d;
	std::cin >> a >> c >> b >> d;
	print(solve(b,d)-solve(c-1,b)-solve(a-1,d)+solve(a-1,c-1));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  long int r,d,i,x[11];
  cin >> r >> d >> x[0];
  for (i=1;i<=10;i++){
    x[i]=x[i-1]*r-d;
    cout << x[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

int N;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  int d[10] = {0,111,222,333,444,555,666,777,888,999};
  for(int i = 0 ; i < 10 ; i++){
    if(d[i] < N && N <= d[i+1]){
      cout << d[i+1] << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N, D;
  std::cin >> N >> D;
  if(N%(2*D+1)==0){
    std::cout << N/(2*D+1) << '\n';
  }else{
    std::cout << N/(2*D+1)+1 << '\n';
  }
  return 0;
}


Measured memory_bytes: 888
import java.util.*;
import java.io.*;
import java.lang.*;
//import java.util.Scanner;
//import java.io.InputStream;
//import java.io.IOException;
//import java.util.NoSuchElementException;
//import java.io.PrintWriter;
//import java.lang.Math;
//import java.io.BufferedReader;
//import java.io.InputStreamReader;
//import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args)
	{
		StringBuilder sb = new StringBuilder();
		
//		Scanner sc = new Scanner(System.in);
		FastScanner sc = new FastScanner();
		Util39 util = new Util39();
//		int n = sc.nextInt();
//		String s = sc.next();
//		int a[] = new int[3];
//		for (int ii = 0; ii < 3; ii++) a[ii] = sc.nextInt();
		
		
		
		String s = sc.next();
		sb.append(s.replace("2017", "2018"));
		
		
		
//		System.out.println(sb.toString());
		PrintWriter out = new PrintWriter(System.out);
		out.println(sb.toString());
		out.flush();
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

class Util39 {
	public int pow(int a, int b)
	{
		int r = 1;
		for (int i = 0; i < b; i++) r *= a;
		return r;
	}
}


Measured memory_bytes: 21332
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        if((500 * k) >= x){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 22868
// ------ Includes ------ //

#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;


// ------ Variable Definition ------ //

#define INF (1 << 26)

#define MAX_N 200
#define MAX_R 1000

int N, M, R, X, Y, T; char SL;

int S[MAX_N][MAX_N], L[MAX_N][MAX_N]; // Graph

int Short_S[MAX_N][MAX_N], Short_L[MAX_N][MAX_N]; // Shortest_Path

int Z[MAX_R + 1], dp[MAX_R + 1][MAX_N]; // dp[i][j] --> i = town, j = ship


// ------ Shortest Path Function ------ //

void Shortest(int start, string mode)
{
	int D[MAX_N]; for (int i = 0; i < MAX_N; i++) { D[i] = INF; }

	bool P[MAX_N]; for (int i = 0; i < MAX_N; i++) { P[i] = false; }

	D[start] = 0;

	while (true)
	{
		int v = -1;

		for (int i = 0; i < N; i++)
		{
			if (P[i] == false)
			{
				if (v == -1)
				{
					v = i;
				}
				else if (D[i] < D[v])
				{
					v = i;
				}
			}
		}

		if (v == -1) { break; }

		P[v] = true;

		for (int i = 0; i < N; i++)
		{
			if (mode == "Land")
			{
				D[i] = min(D[i], D[v] + L[v][i]);
			}
			else
			{
				D[i] = min(D[i], D[v] + S[v][i]);
			}
		}
	}

	for (int i = 0; i < N; i++)
	{
		if (mode == "Sea")
		{
			Short_S[start][i] = D[i];
		}
		else
		{
			Short_L[start][i] = D[i];
		}
	}
}


int main()
{
	// ------ Input, Graph Construction ------ //

	while(true)
	{
		cin >> N >> M;

		if (N == 0 && M == 0) { break; }

		for (int i = 0; i < MAX_N; i++)
		{
			for (int j = 0; j < MAX_N; j++)
			{
				S[i][j] = INF;
				L[i][j] = INF;
			}
		}

		for (int i = 0; i < N; i++)
		{
			for (int j = 0; j < N; j++)
			{
				Short_L[i][j] = 0;
				Short_S[i][j] = 0;
			}
		}

		for (int i = 0; i < M; i++)
		{
			cin >> X >> Y >> T >> SL;

			switch (SL)
			{
			case 'S': S[X - 1][Y - 1] = T; S[Y - 1][X - 1] = T; break;
			case 'L': L[X - 1][Y - 1] = T; L[Y - 1][X - 1] = T; break;
			}
		}

		cin >> R;

		for (int i = 1; i <= R; i++)
		{
			cin >> Z[i]; Z[i] -= 1; // 0 - indexed
		}
		
		Z[0] = Z[1];

		// ------ Shortest Path ------ //

		for (int i = 0; i < N; i++)
		{
			Shortest(i, "Land");
			Shortest(i, "Sea");
		}

		for (int i = 0; i <= R; i++)
		{
			for (int j = 0; j < N; j++)
			{
				dp[i][j] = INF;
			}
		}

		dp[0][Z[0]] = 0;

		for (int i = 1; i <= R; i++)
		{
			int Land_Only = Short_L[Z[i - 1]][Z[i]];

			for (int k = 0; k < N; k++)
			{
				dp[i][k] = min(dp[i - 1][k] + Land_Only, dp[i][k]);
			}

			for (int j = 0; j < N; j++)
			{
				if (dp[i - 1][j] != INF)
				{
					int Land_1 = Short_L[Z[i - 1]][j];

					for (int k = 0; k < N; k++)
					{
						int Sea = Short_S[j][k];

						int Land_2 = Short_L[k][Z[i]];

						dp[i][k] = min(dp[i][k], dp[i - 1][j] + Land_1 + Sea + Land_2);
					}
				}
			}
		}

		int Answer = INF;

		for (int i = 0; i < N; i++)
		{
			Answer = min(Answer, dp[R][i]);
		}

		cout << Answer << endl;
	}

	return 0;
}

// Time : O ( R * N ^ 2 + N ^ 3 )

Measured memory_bytes: 4424
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	string s;
	cin >> s;
	int a = stoi(s.substr(5, 2));
	if( a <= 4 ){
		cout << "Heisei" << endl;
	} else {
		cout << "TBD" << endl;
	}
	return 0;
}

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

const int maxn = 200010;
int n, m, cnt[maxn][2];
vector<int> G[maxn];
char s[maxn];

int main() {
    scanf("%d %d %s", &n, &m, s + 1);
    for (int i = 1, u, v; i <= m; i++) {
        scanf("%d %d", &u, &v);
        cnt[u][s[v] - 'A']++, cnt[v][s[u] - 'A']++;
        G[u].push_back(v), G[v].push_back(u);
    }
    queue<int> q;
    for (int i = 1; i <= n; i++) {
        if (!cnt[i][0] || !cnt[i][1]) q.push(i);
    }
    int num = 0;
    while (!q.empty()) {
        int v = q.front(); q.pop(), num++;
        for (int u : G[v]) {
            if (!cnt[u][0] || !cnt[u][1]) continue;
            cnt[u][s[v] - 'A']--;
            if (!cnt[u][0] || !cnt[u][1]) q.push(u);
        }
    }
    printf("%s\n", num == n ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 12416
n = gets.to_i
ts = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
tss, ass = [], []
ts.each_with_index do |e, i|
  tss[i] = (i == 0 || ts[i - 1] < e) ? e : nil
end
as.each_with_index do |e, i|
  ass[i] = (i == as.size - 1 || as[i + 1] < e) ? e : nil
end
ts.zip(ass).each do |t, a|
  if a && t < a
    puts 0
    exit
  end
end
as.zip(tss).each do |a, t|
  if t && a < t
    puts 0
    exit
  end
end
ans = 1
mod = 10 ** 9 + 7
ts.zip(as).each_with_index do |ta, i|
  next if tss[i] || ass[i]
  ans *= ta.min
  ans %= mod
end
puts ans


Measured memory_bytes: 29120
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

//つねに10億7などの剰余をとる構造体
//参考: https://www.youtube.com/watch?v=L8grWxBlIZ4&t=9858
//参考: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a#4-%E7%B4%AF%E4%B9%97-an
int mod  = MODA;
struct modint {
	ll x;
	modint (ll x):x(x%mod){}
	modint& operator+=(const modint a){
		(x += a.x ) %= mod;
		return *this;
	}
	modint& operator-=(const modint a){
		(x -= a.x ) %= mod;
		if (x < 0) x += mod;
		return *this;
	}
	modint& operator*=(const modint a){
		(x *= a.x ) %= mod;
		return *this;
	}
	modint& operator/=(modint a){
		ll exp = mod - 2;
		while(exp > 0){
			if(exp & 1) *this *= a.x;
			a *= a.x;
			exp >>= 1;
		}
		return *this;
	}
	modint operator+(const modint a) const{
		modint res(*this);
		return res+=a;
	}
	modint operator-(const modint a) const{
		modint res(*this);
		return res-=a;
	}
	modint operator*(const modint a) const{
		modint res(*this);
		return res*=a;
	}
	modint operator/(const modint a) const{
		modint res(*this);
		return res/=a;
	}
};
modint modpow(modint x, ll n){
	modint res=1;
	while(n > 0){
		if(n & 1) res = res * x.x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

int main() {
	modint ans = 0;
	int tmp;
	string L;
	cin >> L;
	int n = L.size();
	vector<modint> ful, ue;
	ful.push_back(1);
	REP1(i, n) ful.push_back(ful[i-1] * 3);
	ue.push_back(1);
	REP1(i, n){
		if(L[i-1] == '1') ue.push_back(ue[i-1] * 2);
		else ue.push_back(ue[i-1]);
	}
	ans += ue[n];
	//cout << ans.x << endl;
	for(int i = n-1; i >= 0; i--){
		if(L[i] == '1'){
			ans += ue[i] * ful[n-i-1];
		}
		//cout << ans.x << endl;
	}
	cout << ans.x << endl;
}

Measured memory_bytes: 2676
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a,b,c,a0,b0,c0;
vector<string> v;
string k;
int rr(string x){
    if(x=="AB") return 1;
    if(x=="AC") return 2;
    if(x=="BC") return 3;
}
int main()
{
    cin>>n>>a>>b>>c;
    a0=a;b0=b;c0=c;
    for(int i=0;i<n;i++){
        cin>>k;
        v.push_back(k);
    }
if ((((b*c>=2)||(a*b>=2))||(a*c>=2))||(a*b*c==1)){
    cout<<"Yes"<<endl;
    for (int i=0;i<n;i++){
        switch(rr(v[i])){
            case 1:
            if (a>=b){cout<<"B"<<endl;a--;b++;}
            else {cout<<"A"<<endl;b--;a++;}
            break;
            case 2:if (a>=c){
                cout<<"C"<<endl;a--;c++;
            }
            else {cout<<"A"<<endl;c--;a++;}break;
            case 3:if (c>=b){
                cout<<"B"<<endl;c--;b++;
            }
            else {cout<<"C"<<endl;b--;c++;}break;
        }
    }
}
else{
    for (int i=0;i<n;i++){
        switch(rr(v[i])){
            case 1:if (a==0&&b==0){cout<<"No";return 0;}
                if (a>b){a--;b++;}
            else if(a<b) {b--;a++;}
            else if (i==n-1) ;
            else if ((v[i+1]=="AC")) {b--;a++;}
            else {a--;b++;}
            break;
            case 2:if (a==0&&c==0){cout<<"No";return 0;}
                if (a>c){a--;c++;}
            else if(a<c) {c--;a++;}
            else if (i==n-1) ;
            else if ((v[i+1]=="AB")) {c--;a++;}
            else {a--;c++;}
            break;
            case 3:if (c==0&&b==0){cout<<"No";return 0;}
                if (b>c){b--;c++;}
            else if(b<c) {c--;b++;}
            else if (i==n-1) ;
            else if ((v[i+1]=="AB")) {c--;b++;}
            else {b--;c++;}
            break;
        }
    }

        a=a0;b=b0;c=c0;
        cout<<"Yes"<<endl;
        for (int i=0;i<n;i++){
        switch(rr(v[i])){
            case 1:
                if (a>b){a--;b++;cout<<"B"<<endl;}
            else if(a<b) {b--;a++;cout<<"A"<<endl;}
            else if (i==n-1) {b--;a++;cout<<"A"<<endl;}
            else if ((v[i+1]=="AC")) {b--;a++;cout<<"A"<<endl;}
            else {a--;b++;cout<<"B"<<endl;}break;
            case 2:
                if (a>c){a--;c++;cout<<"C"<<endl;}
            else if(a<c) {c--;a++;cout<<"A"<<endl;}
            else if (i==n-1) {c--;a++;cout<<"A"<<endl;}
            else if ((v[i+1]=="AB")) {c--;a++;cout<<"A"<<endl;}
            else {a--;c++;cout<<"C"<<endl;}break;
            case 3:
                if (b>c){b--;c++;cout<<"C"<<endl;}
            else if(b<c) {c--;b++;cout<<"B"<<endl;}
            else if (i==n-1) {c--;b++;cout<<"B"<<endl;}
            else if ((v[i+1]=="AB")) {c--;b++;cout<<"B"<<endl;}
            else {b--;c++;cout<<"C"<<endl;}break;



}
        }
}
}


Measured memory_bytes: 7444
package main

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

var (
	N, R, discount, I int
)

func readVariables() {
	N, R = nextInt(), nextInt()
}

func main() {
	readVariables()
	discount = 100 * MaxInt(0, 10-N)
	I = R + discount
	fmt.Println(I)
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt は、2つの整数を受け取り、最小値を返します。
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt は、2つの整数を受け取り、最大値を返します。
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt は、整数の絶対値を返します。
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow は整数の累乗関数で、剰余もサポートします。
//base^exponentの値をmoduleで割った余りを返します。
//moduloが1以下の場合には、剰余演算をしません。
//baseが負の値である場合には、返す値が負になることがあります。
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd は、引数の整数全ての最大公約数を返します。
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm は、与えられた整数の最小公倍数を返します。
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
int N;

void dijk(int s, vector<vector<pair<int, int>>> &E, vector<long long> &D) {
    int vis[101010];
    for(int i = 0; i < N; i++) {
        D[i] = INF;
        vis[i] = 0;
    }

    min_priority_queue<pair<long long, int>> que;

    D[s] = 0;
    que.push({0, s});

    while(!que.empty()) {
        auto q = que.top();
        que.pop();

        auto cst = q.first;
        auto cu = q.second;

        if(vis[cu]) {
            continue;
        } else {
            vis[cu] = 1;
        }
        for(auto p : E[cu]) {
            long long cst2 = cst + p.second;
            int to = p.first;

            if(D[to] > cst2) {
                D[to] = cst2;
                que.push({D[to], to});
            }
        }
    }
}

int M, S, T;
int main() {
    cin >> N >> M >> S >> T;
    // n個,m本,sからtへ向かう
    S--;
    T--;
    vector<vector<pair<int, int>>> EA(N); // edge list yen
    vector<vector<pair<int, int>>> EB(N); // edge list sunke
    vector<long long> DA(N), DB(N);
    REP(i, M) {
        // uからvへa円orbスヌーク
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--;
        v--;
        EA[u].push_back({v, a});
        EA[v].push_back({u, a});
        EB[u].push_back({v, b});
        EB[v].push_back({u, b});
    }
    dijk(S, EA, DA);
    dijk(T, EB, DB);
    long long dp[N];
    //両替する都市によって変わる
    REP(i, N) { dp[i] = DA[i] + DB[i]; }
    // dp[i]:i~N-1で両替したときの最短経路
    //つまりi年後
    for(int i = N - 2; i >= 0; i--) {
        dp[i] = min(dp[i], dp[i + 1]);
    }
    long long ma = 1e15;
    REP(i, N) {
        dp[i] = ma - dp[i];
        cout << dp[i] << endl;
    }
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int x,a,b; cin >> x >> a >> b;
    cout << (abs(x-a)>abs(x-b)?"B":"A") << endl;
    return 0;
}

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

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


int main(){

    int A,B; cin >> A >> B;

    if(A>=13) cout << B << endl;
    else if(A<=5) cout << 0 << endl;
    else cout << B/2 << endl;


}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,m = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	x = 0
	tmp = a[1]
	while tmp%2==0
		x+=1
		tmp>>=1
	end
	f = 0
	for i in 2:n
		y = 0
		tmp = a[i]
		while tmp%2==0
			y+=1
			tmp>>=1
		end
		if y!=x
			f = 1
			break
		end
	end
	b = Int[a[i]>>1 for i in 1:n]
	k = lcm(b)
	println(f==1?0:max(div(m+k,2*k),0))
end

main()

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

struct Unionfind {
  // tree number
  vector<int> par;
  // constructor
  Unionfind(int n = 1) : par(n, -1) {}
  // search root
  int root(int x) {
    if (par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return 0;
    if (par[x] > par[y]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
  int size(int x) { return -par[root(x)]; }
};

int n, m;
Unionfind uf;

int main() {
  cin >> n >> m;
  uf = Unionfind(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    uf.uni(--a, --b);
  }
  int res = 0;
  for (int i = 0; i < n; ++i)
    if (uf.root(i) == i) ++res;
  cout << res - 1 << endl;
  return 0;
}

Measured memory_bytes: 3688
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  int cx, cy, ct;
  auto f = false;
  foreach (_; 0..n) {
    auto x = readln.chomp.split.to!(int[]);
    x[0] -= ct;
    auto d = x[1] - cx + x[2] - cy;

    if (x[0] - d >= 0 && (x[0] - d) % 2 == 0) {
      cx = x[1];
      cy = x[2];
      ct += x[0];
    } else {
      f = true;
      break;
    }
  }
  
  if (f) {
    writeln("No");
  } else {
    writeln("Yes");
  }
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=998244353;
const int MAX = 510000;
const int INF = 1e9;
const double pi=acos(-1);


int main(){
  int n;
  cin >> n;
  int ans=0;
  vector<int>p(n);
  rep(i,n)cin>>p[i];
  rep(i,n){
    if(p[i]==i+1){
      ans++;
      i++;
    }
  }
    
  cout << ans << endl;
  return 0;
  
  
}

Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int i, price=700;
    char S[3];
    
    scanf("%s", &S);
    for(i=0; i < 3; i++){
        if(S[i] == 'o') price += 100;
    }
    printf("%d\n", price);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int N;
vector<pair<int, int>>* v;

int func(int k) {
	int r = 0;
	vector<int> check;
	for (int i = 0; i < N; i++) {
		check.push_back(1 << i);
		if ((k & (1 << i)) != 0) { r++; }
	}
	for (int i = 0; i < N; i++) {
		if (check[i] & k) {
			for (auto itr = v[i].begin(); itr != v[i].end(); itr++) {
				if ((check[itr->first] & k) != 0 && itr->second == 0) {
					return 0;
				}
				if ((check[itr->first] & k) == 0 && itr->second != 0) {
					return 0;
				}
			}
		}
	}
	return r;
}

int main() {
	cin >> N;
	v = new vector<pair<int, int>>[N];

	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		for (int j = 0; j < a; j++) {
			int x, y; cin >> x >> y;
			v[i].push_back({ x - 1, y });
		}
	}

	int r = 0;
	for (int i = 0; i < 32768; i++) {
		r = max(r, func(i));
	}

	cout << r << endl;
	return 0;
}

Measured memory_bytes: 256
A_1 = list(map(int,input().split()))
A_2 = list(map(int,input().split()))
A_3 = list(map(int,input().split()))
N = int(input())
b = []
save = []
count = 0
hantei1 = [[1,1],[2,2],[3,3]]
hantei2 = [[1,1],[1,2],[1,3]]
hantei3 = [[2,1],[2,2],[2,3]]
hantei4 = [[3,1],[3,2],[3,3]]
hantei5 = [[1,3],[2,2],[3,1]]
hantei6 = [[1,1],[2,1],[3,1]]
hantei7 = [[1,2],[2,2],[3,2]]
hantei8 = [[1,3],[2,3],[3,3]]
for i in range(N):
    b.append(int(input()))

for i in range(N):
    if b[i] in A_1:
        save.append([1,A_1.index(b[i])+1])
    if b[i] in A_2:
        save.append([2,A_2.index(b[i])+1])
    if b[i] in A_3:
        save.append([3,A_3.index(b[i])+1])


if hantei1[0] in save and hantei1[1] in save and hantei1[2] in save:
    count +=1
if hantei2[0] in save and hantei2[1] in save and hantei2[2] in save:
    count +=1
if hantei3[0] in save and hantei3[1] in save and hantei3[2] in save:
    count +=1
if hantei4[0] in save and hantei4[1] in save and hantei4[2] in save:
    count +=1
if hantei5[0] in save and hantei5[1] in save and hantei5[2] in save:
    count +=1
if hantei6[0] in save and hantei6[1] in save and hantei6[2] in save:
    count +=1
if hantei7[0] in save and hantei7[1] in save and hantei7[2] in save:
    count +=1
if hantei8[0] in save and hantei8[1] in save and hantei8[2] in save:
    count +=1

if count >= 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3192
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
long long mod = 1000000007;
long long dp[401][401];
long long cs[401][401];
int A[400], B[400];

int main(){
    int N,C;
    cin>>N>>C;
    for(int i= 0;i<N;i++) scanf("%d", &A[i]);
    for(int i= 0;i<N;i++) scanf("%d", &B[i]);
    for(int i=0;i<N;i++) {
        for(int j=A[i];j<B[i]+1;j++){
            long long p = 1;
            for(int k=0;k<C+1;k++) {
                cs[i][k]=(cs[i][k] + p) % mod;
                p=(p * j) % mod;
            }
        }
    }

    dp[0][0] = 1;
    for(int i=0;i<N;i++){
        for(int j=0;j<=C;j++){
            for(int k=0;k<=j;k++) dp[i+1][j] = (dp[i+1][j] + dp[i][j-k] * cs[i][k]) % mod;
        }
    }
    cout<<dp[N][C]<<endl;
    return 0;
};


Measured memory_bytes: 2816
unittest
{
	assert( [ "3", "7 12 8" ].parse.expand.solve == 4 );
	assert( [ "2", "11 11" ].parse.expand.solve == 2 );
	assert( [ "1", "0" ].parse.expand.solve == 0 );
	
	assert( [ "2", "1 11" ].parse.expand.solve == 1 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto ds = input.front.split.to!( long[] );
	return tuple( ds );
}

auto solve( long[] ds )
{
	// 現地時間を復元
	ds.sort();
	for( auto i = 0L; i < ds.length; i += 2 )
	{
		if( 0 < ds[ i ] ) ds[ i ] = 24 - ds[ i ];
	}
	
	// 高橋君の都市を含めて並び替え
	ds ~= 0;
	ds ~= 24;
	ds.sort();
	
	// 時差の最小値を計算
	auto ans = long.max;
	for( auto i = 1L; i < ds.length; i++ )
	{
		ans = min( ans, ds[ i ] - ds[ i - 1 ] );
	}
	return ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//解説写し
int main(){
  int h,w;
  cin>>h>>w;
  map<int,int>s;
  multiset<int>vals;
  rep(i,w)s[i]=i;
  rep(i,w)vals.insert(0);
  rep(i,h){
    int l,r;
    cin>>l>>r;
    --l;
    auto it=s.lower_bound(l);
    int mr=-1;
    while(it!=s.end() && it ->first <=r){
      chmax(mr,it->second);
      int x=it->first - it->second;
      vals.erase(vals.find(x));
      s.erase(it++);
    }
    if(mr!=-1 && r<w){
      vals.insert(r-mr);
      s[r]=mr;
    }
    int ans=-1;
    if(vals.size()>0)ans=*vals.begin()+i+1;
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 22420
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
    (0..b).each do |j|
        (0..c).each do |k|
     cnt += 1  if i * 500 + j * 100 + k * 50 == x
        
        end
    end
end
 
puts cnt

Measured memory_bytes: 1788
#include <cstdio>

int main()
{
	char s[5];

	scanf("%s", s);
	
	int i;

	int counta = 0;
	int countb = 0;
	int	countc = 0;

	for (i = 0; i < 3; i++)
	{
		if (s[i] == 'a')
			counta++;
		if (s[i] == 'b')
			countb++;
		if (s[i] == 'c')
			countc++;
	}

	if (counta > 1 || countb > 1 || countc > 1)
	{
		printf("No");
	}
	else
	{
		printf("Yes");
	}
}

Measured memory_bytes: 128
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
t,a = li()
h = list(li())

ans = -1
res = 10**18
for i,hi in enumerate(h):
    if abs(a-(t-0.006*hi)) < res:
        res = abs(a-(t-0.006*hi))
        ans = i+1
        
print(ans)

Measured memory_bytes: 3064
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

double t,x;

signed main(){

    in(t,x);
    out(t/x);

    return 0;
}


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

using namespace std;

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

const ll mod = 998244353;

struct mod_affine_lazy_segtree {
  int n;
  vector<ll> data;
  vector<ll> lazy_b;
  vector<ll> lazy_c;
  vector<bool> lazyFlag;

  mod_affine_lazy_segtree() {
    init(1);
  }

  mod_affine_lazy_segtree(const int s) {
    init(s);
  }

  mod_affine_lazy_segtree(const vector<ll> &v) {
    int s = v.size();
    init(s);
    for (int i = 0; i < s; i++) {
      data[i+n-1] = v[i];
    }
    for (int i = n-2; i >= 0; i--) {
      data[i] = (data[i*2+1] + data[i*2+2]) % mod;
    }
  }

  void init(const int s) {
    n = 1;
    while (n < s) n <<= 1;
    data = vector<ll>(2*n-1, 0);
    lazy_b = vector<ll>(2*n-1, 1);
    lazy_c = vector<ll>(2*n-1, 0);
    lazyFlag = vector<bool>(2*n-1);
  }

  void evaluate(int p, int a, int b) {
    if (lazyFlag[p]) {
      // (b * a[i] + c) % mod
      data[p] = (lazy_b[p] * data[p] + lazy_c[p] * (b - a)) % mod;
      if (b - a > 1) {
        lazy_b[p*2+1] = (lazy_b[p*2+1] * lazy_b[p]) % mod;
        lazy_c[p*2+1] = (lazy_c[p*2+1] * lazy_b[p] + lazy_c[p]) % mod;
        lazy_b[p*2+2] = (lazy_b[p*2+2] * lazy_b[p]) % mod;
        lazy_c[p*2+2] = (lazy_c[p*2+2] * lazy_b[p] + lazy_c[p]) % mod;
        lazyFlag[p*2+1] = true;
        lazyFlag[p*2+2] = true;
      }
      lazy_b[p] = 1;
      lazy_c[p] = 0;
      lazyFlag[p] = false;
    }
  }

  void update(int l, int r, ll b, ll c, int p = 0, int x = 0, int y = -1) {
    if (y < 0) y = n; // init

    // evaluate lazy value
    evaluate(p, x, y);

    if (r <= x || y <= l) return; // out of range
    if (l <= x && y <= r) { // fully covered
      lazy_b[p] = (lazy_b[p] * b) % mod;
      lazy_c[p] = (lazy_c[p] * b + c) % mod;
      lazyFlag[p] = true;
      evaluate(p, x, y);
    }
    else {
      update(l, r, b, c, p*2+1, x, (x + y) / 2); // left
      update(l, r, b, c, p*2+2, (x + y) / 2, y); // right
      data[p] = (data[p*2+1] + data[p*2+2]) % mod; // update
    }
    return;
  }

  int query(int l, int r, int p = 0, int a = 0, int b = -1) {
    if (b < 0) b = n; // init
    if (r <= a || b <= l) return 0; // out of range

    // evaluate lazy value
    evaluate(p, a, b);

    if (l <= a && b <= r) return data[p];// fully covered

    int vl = query(l, r, p*2+1, a, (a + b) / 2); // left
    int vr = query(l, r, p*2+2, (a + b) / 2, b); // right
    return (vl + vr) % mod;
  }
};

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

  int n, q;
  cin >> n >> q;
  vector<ll> a(n);
  for (auto &x: a) cin >> x;
  vector<vector<ll> > query(q, vector<ll>(5));
  for (auto &x: query) {
    cin >> x[0] >> x[1] >> x[2];
    if (x[0] == 0) cin >> x[3] >> x[4];
  }

  mod_affine_lazy_segtree malst(a);

  vector<ll> ans;
  for (auto &x: query) {
    if (x[0] == 0) malst.update(x[1], x[2], x[3], x[4]);
    else ans.push_back(malst.query(x[1], x[2]));
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}


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

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

    sort(l.begin(), l.end());

    int ans = 0;
    for(int i = 0; i < n-2; i++) {
        for(int j = i + 1; j < n - 1; j++) {
            int k = lower_bound(l.begin(), l.end(), l[i] + l[j]) - l.begin();
            ans += max(0, k - (j + 1));
        }
    }

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



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll h1,h2,a1,a2;
   cin>>h1>>a1>>h2>>a2;
   bool tur = 0;
   while(1)
   {
       if(tur == 0)
       {
           if(h2-a1<=0)
           {
               cout<<"Yes";
               break;
           }
           
           else h2-=a1;
       }
       
       else
       {
           if(h1-a2<=0)
           {
               cout<<"No";
               break;
           }
           else h1-=a2;
       }
       tur^=(1ll);
   }
   
   return 0;        
}  
  
   

Measured memory_bytes: 3652
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
N = INT()
A = LIST()
C = [[INF] * W for i in range(H)]

even = 0
num = 0
for i in range(H):
    if even == 0:
        for j in range(W):
            if A[num] > 0:
                C[i][j] = num + 1
                A[num] -= 1
            else:
                num += 1
                C[i][j] = num + 1
                A[num] -= 1

            # for k in range():
        even ^= 1
    else:
        for j in range(W-1, -1, -1):
            if A[num] > 0:
                C[i][j] = num + 1
                A[num] -= 1
            else:
                num += 1
                C[i][j] = num + 1
                A[num] -= 1

        even ^= 1

for c in C:
    print(*c, end="\n")
        # C[i][j]


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

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)

int main() {
    ll k;
    cin >> k;

    rep(i, k) {
        cout << "ACL";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int n;
int x[8], y[8];
double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

void solve() {
    cin >> n;
    for(int i=0;i<n;++i) cin >> x[i] >> y[i];
    double sum=0.0;
    vector <int> v(n);
    for(int i=0;i<n;++i) v[i]+=i;
    do {
        for(int i=0;i<n-1;++i) sum+=dist(v[i],v[i+1]);
            }
    while(next_permutation(v.begin(),v.end()));
    int count=1;
    for(int i=1;i<=n;++i) count*=i;
    cout << fixed << setprecision(10) <<sum/count << endl;
    return;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = []
first = 0
second = 0
for _ in range(N):
    t = int(input())
    if t > first:
        second = first
        first = t
    elif t > second:
        second = t
    A.append(t)

for a in A:
    if a == first:
        print(second)
    else:
        print(first)


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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var k = int.Parse(_[1]);
            var s = Console.ReadLine().ToCharArray();

            s[k-1] = char.ToLower(s[k-1]);
            Console.WriteLine(string.Join("",s));
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=100009;
 
// Happy Coding!

int grid[3][3];

void mark(int n){
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(grid[i][j]==n){
                grid[i][j]=0;
            }
        }
    }
}
bool rowB(int row){
    for(int col=0;col<3;col++){
        if(grid[row][col]!=0){
            return false;
        }
    }
    return true;
}
bool colB(int col){
    for(int row=0;row<3;row++){
        if(grid[row][col]!=0){
            return 0;
        }
    }
    return 1;
}
bool check(){
    for(int row=0;row<3;row++){
        if(rowB(row)){
            return 1;
        }
    }
    for(int col=0;col<3;col++){
        if(colB(col)){
            return 1;
        }
    }
    bool flag=1;
    // left diagonal
    for(int i=0;i<3;i++){
        if(grid[i][i]!=0){
            flag=0;break;
        }
    }
    if(flag){
        return 1;
    }
    
    // right diagonal
    flag=1;
    for(int i=0;i<3;i++){
        if(grid[i][3-1-i]!=0){
            flag=0;
            break;
        }
    }
    return flag;
}

void solve(){
    
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>grid[i][j];
        }
    }
    
    int n;
    cin>>n;
    
    while(n-->0){
       int x;
       cin>>x;
       mark(x);
    }
    if(check()){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}

 
int main() {
    faster;
    int t=1;
    // cin>>t;
    
    while(t-->0){
        solve();
    }
	return 0;
}

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

int main()
{
  int A,B;
  cin >> A >> B;
  int x = A + B;
  int y = A - B;
  int z = A * B;

  int max1 = max({x,y,z});

  cout << max1 << endl;

  return 0;
}


Measured memory_bytes: 256