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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n;
ll a[305][305];
ll d[305][305];
int main() {
	std::cin >> n;

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j) {
			std::cin >> a[i][j];
			d[i][j] = inf;
		}

	for (int k = 0; k < n; ++k)
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				d[i][j] = std::min(a[i][j], d[i][k] + d[k][j]);

	ll ans = 0;
	bool ok = true;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j) {
			if (d[i][j] < a[i][j])
				ok = false;
			else {
				bool f = true;
				for (int k = 0; k < n; ++k) {
					if (k == i || k == j)
						continue;

					if (d[i][k] + d[k][j] == a[i][j])
						f = false;
				}

				if (f)
					ans += a[i][j];
			}
		}

	if (ok)
		std::cout << ans / 2 << std::endl;
	else
		std::cout << -1 << std::endl;

	return 0;
}


Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(10**6)

n = int(input())
t = [[] for i in range(n + 1)]
r = [0 for i in range(n + 1)]

for i in range(n - 1):
    u, v, w = [int(j) for j in input().split(" ")]
    t[u].append((v, w))
    t[v].append((u, w))

def s(f, i):
    for k in t[i]:
        v, w = k
        if v != f:
            if w % 2 == 0:
                r[v] = r[i]
            else:
                r[v] = 1 - r[i]
            s(i, v)
s(0, 1)
print(" ".join(map(str, r[1:])))

Measured memory_bytes: 79316
N=gets.to_i
A=gets.chomp.split("")
B=gets.chomp.split("")
C=gets.chomp.split("")
ans = 0
N.times do |i|
  a = [A[i], B[i], C[i]]
  if a.uniq.size == 3
    ans += 2
  elsif a.uniq.size == 2
    ans += 1
  else
  end
end
puts ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
char s[11];
cin>>s;
int i,j;
for(i=0;s[i];++i)
{
if(s[i]=='B')
{
for(j=i-1;j>=0;--j)
{
if(s[j]=='0'||s[j]=='1')
{
s[j]='*';
break;
}
}
}
}
for(i=0;s[i];++i)
{
if(s[i]=='0'||s[i]=='1')
cout<<s[i];
}
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  ll n,l;cin>>n>>l;
  vector<ll>rope(n);
  bool flag=false;
  int num=-1;
  for(int i=0;i<n;i++){
    cin>>rope[i];
    if(rope[i]>=l){
      flag=true;
      num=i;
    }
  }
  if(flag){
    cout<<"Possible"<<endl;
    for(int i=1;i<num;i++)
      cout<<i<<endl;
    for(int i=n-1;i>num;i--)
      cout<<i<<endl;
    cout<<num<<endl;
  }else{
    bool flagg=false;
    int num2=-1;
    int num3=-1;
    for(int i=0;i<n-1;i++){
      if(rope[i]+rope[i+1]>=l){
	flagg=true;
	num2=i;num3=i+1;
      }
    }
    if(flagg){
      cout<<"Possible"<<endl;
    for(int i=1;i<=num2;i++)
      cout<<i<<endl;
    for(int i=n-1;i>num3;i--)
      cout<<i<<endl;
    cout<<num3<<endl;
    }else{
      cout<<"Impossible"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1664
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        if(T.substring(0, S.length()).equals(S)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

}


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

int main(void){
	long long N,a,b,c;
	long long Y;
	cin>>N>>Y;
	a=b=c=-1;
	for(int i=0;i<=N;i++){
	    for(int j=0;j+i<=N;j++){
	        if(1000*(N-j-i)+5000*j+10000*i==Y){
	            a=i;b=j;c=N-j-i;
	        }
	    }
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}
	
	
	
	

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t D,N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> D>>N;
	int32_t base = 1;
	for (size_t i = 0; i < D; i++)
	{
		base *= 100;
	}

	if (N == 100) {
		out<<base * 101<<endl;
	}
	else {
		out << base * N << endl;
	}

	return 0;
}
#endif

#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;
int32_t A;
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	int32_t ans = 0;
	for (size_t i = 0; i < N; i++)
	{

		in >> A;
		while ((A & 1) == 0) {
			A /= 2;
			ans++;
		}
	}
	out << ans << endl;
	return 0;
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef long long ll;
const int maxn = 30005;
const int mod = 1000000007;

bool f[maxn][10];
bool g[maxn][100];
bool ans[1000];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  string s;
  cin>>n>>s;
  for(int i=0;i<n;i++){
    f[i][s[i]-'0']=1;
    if(i) {
      for (int j = 0; j < 10; j++) {
        f[i][j]|=f[i-1][j];
      }
    }
  }
  for(int i=1;i<n;i++){
    for(int j=0;j<100;j++){
      g[i][j] = g[i-1][j];
    }
    for(int j=0;j<10;j++){
      if(f[i-1][j])g[i][(s[i]-'0')*10+j]=1;
    }
  }
  for(int i=2;i<n;i++){
    for(int j=0;j<100;j++){
      if(g[i-1][j]){
        int tt = (s[i]-'0')*100 + j;
        ans[tt]=1;
      }
    }
  }
  int ret = 0;
  for(int i=0;i<1000;i++)ret+=ans[i];
  cout<<ret<<endl;
  return 0;
}

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

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

Measured memory_bytes: 256
k = gets.to_i
a = 7
if (k % 2 == 0 || k % 5 == 0)
    puts -1
else
    x = 7 % k
    c = 1
    while (x != 0)
        x = (x * 10 + 7) % k 
        c += 1
    end
end
puts c


Measured memory_bytes: 14312
#include <stdio.h>
#include <string.h>
#include <vector>

#define lli long long int
#define bigmod 1000000007
#define pb push_back

using namespace std;

lli memo[100040][40];

lli combine(lli a, lli b) {
	lli ret;
	if (a == b)
		return 1;
	if (b == 0)
		return 1;
	if (b == 1)
		return (a % bigmod);
	if (memo[a][b] != -1)
		return memo[a][b];
	if (a - b < b)
		return combine(a, a - b);
	ret = (combine(a - 1, b) + combine(a - 1, b - 1)) % bigmod;
	memo[a][b] = ret;
	return ret;
}

int main() {
	lli k, m, n, ans = 1, temp;
	bool valid[31610];
	vector<lli> prima;
	scanf("%lld %lld", &k, &m);
	memset(valid, true, sizeof valid);
	for (lli i = 2; i < 31608; i++)
		if (valid[i]) {
			prima.pb(i);
			n = i * i;
			while (n < 31607) {
				valid[n] = false;
				n += i;
			}
		}
	temp = 0;
	memset(memo, -1, sizeof memo);
	while ((m > 1) && (temp < 3401)) {
		n = 0;
		while (m % prima[temp] == 0) {
			n++;
			m /= prima[temp];
		}
		temp++;
		ans *= combine(n + k - 1, min(n, k - 1));
		ans %= bigmod;
	}
	if (m > 1) {
		ans *= k;
		ans %= bigmod;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 36224
N = int(input())

SUM = N*(N+1)/2
# print(str(SUM))

Fizz_count = N//3
Buzz_count = N//5
FizzBuzz_count = N//15

## r>1
def GeometricProgression(a_1,r,n):
    return int(a_1*(r^n -1)/r-1)

def Touhi(a_1,d,n):
    return int(n*(2*a_1+(n-1)*d)/2)

# print(Touhi(1,1,5))

SUM_Fizz = Touhi(3,3,Fizz_count)
SUM_Buzz = Touhi(5,5,Buzz_count)
SUM_FizzBuzz = Touhi(15,15,FizzBuzz_count)

"""
print(str(SUM_Fizz))
print(str(SUM_Buzz))
print(str(SUM_FizzBuzz))
"""

result = int(SUM - SUM_Fizz - SUM_Buzz + SUM_FizzBuzz)
print(result)

Measured memory_bytes: 9212
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define reo(i,n) for(int (i) = 1 ; (i) <= (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(n,i) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
#define cyes cout<<"Yes\n"
#define cno cout<<"No\n"
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ 0,0,-1,1 }, dy{ 1,-1,0,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 (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------------------
int n;
signed main() {
	int a, b;
	cin >> a >> b;
	string s = to_string(a), t = to_string(b);
	string u = "", v = "";
	rep(i, b) u += s;
	rep(i, a) v += t;
	cout << min(u, v) << endl;
}

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

using namespace std;
typedef long long ll;
const int N = 210;
int _w;

int n;
ll a[N];
char s[N];

namespace Basis {
	ll b[62];
	void init() {
		memset(b, 0, sizeof b);
	}
	void insert( ll x ) {
		for( ll i = 61; i >= 0; --i )
			if( x & (1LL << i) ) {
				if( b[i] ) x ^= b[i];
				else {
					b[i] = x;
					break;
				}
			}
	}
	bool check( ll x ) {
		for( ll i = 61; i >= 0; --i )
			if( x & (1LL << i) ) {
				if( b[i] ) x ^= b[i];
				else return false;
			}
		return x == 0;
	}
}

int main() {
	int T;
	_w = scanf( "%d", &T );
	while( T-- ) {
		_w = scanf( "%d", &n );
		for( int i = 1; i <= n; ++i )
			_w = scanf( "%lld", a+i );
		_w = scanf( "%s", s+1 );
		Basis::init();
		bool flag = true;
		for( int i = n; i >= 1; --i )
			if( s[i] == '0' ) {
				Basis::insert( a[i] );
			} else {
				if( Basis::check( a[i] ) == false ) {
					flag = false;
					break;
				}
			}
		puts( flag ? "0" : "1" );
	}
	return 0;
}


Measured memory_bytes: 3560
# 単一始点最短路
def bellman_ford(s):
    # 始点sから各頂点への最短距離
    d = [inf] * n
    d[s] = 0

    ref = inf
    for cnt in range(n * 2):
        for s, t, w in g:
            if d[s] != inf and d[t] > d[s] + w:
                d[t] = d[s] + w
        if cnt == n - 1:
            ref = d[n - 1]

    if ref == d[n - 1]:
        return max(0, -ref)
    else:
        return -1


inf = float('inf')

n, m, p = map(int, input().split())

g = []
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    g.append((a, b, -(c - p)))  # (始点,終点,正負を逆にした重み)

ans = bellman_ford(0)
print(ans)
# 無限なら-1


Measured memory_bytes: 46700
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll x,y;
int main(){
	cin >> x >> y;

	ll c = 1;ll a = x;
	while (1) {
		if(a * 2 <= y) {
			c++;
			a = a * 2;
		}else
			break;
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define F first
#define S second
#define fi(i,a,b) for(int i=a; i<=b; i++)
#define fid(i,a,b) for(int i=a; i>=b; i--)
#define VanLoi "a"
#define gb(i, j) ((i >> j) & 1)
#define reset(x) memset(x, 0,sizeof(x))
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int, int>
#define Block 400

using namespace std;

int n, t1[maxn], t2[maxn];
string S, T;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen(VanLoi".inp", "r", stdin);
    //freopen(VanLoi".out", "w", stdout);
    cin >> S;
    cin >> T;
    fi(i, 1, S.length()) {
        if (S[i - 1] == 'A') t1[i] = t1[i - 1] + 2;
            else t1[i] = t1[i - 1] + 1;
    }
    fi(i, 1, T.length()) {
        if (T[i - 1] == 'A') t2[i] = t2[i - 1] + 2;
            else t2[i] = t2[i - 1] + 1;
    }
    cin >> n;
    fi(z, 1, n) {
        int x1, x2, y1, y2;
        cin >> x1 >> x2 >> y1 >> y2;
        int tg = t1[x2] - t1[x1 - 1], tg1 = t2[y2] - t2[y1 - 1];
        if (tg % 3 == tg1 % 3) cout << "YES" << '\n';
            else cout << "NO" << '\n';
    }
    return 0;
}


Measured memory_bytes: 5456
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,c,k,t;
    cin>>n>>c>>k;
    std::deque<long long int> deq;
    for (int i=0;i<n;i++) {
        cin>>t;
        deq.emplace_back(t);
    }
    sort(deq.begin(),deq.end());
    const long long INF=1LL<<60;
    long long int limit=INF;
    long long int count=1;
    long long int tmp=c;
    for (int i=0;i<n;i++) {
        if (deq[i]<=limit) {
            limit=min(limit,deq[i]+k);
            tmp--;
        } else {
            count++;
            tmp=c-1;
            limit=deq[i]+k;
        }
        if (tmp==0) {
            if (i!=n-1) {
                count++;
                tmp=c;
                limit=INF;
            }
        }
    }
    cout<<count<<endl;
}

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

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a == b) {
            cout << "Yes";
        } else {
            cout << "No";
        }
        cout << endl;
    }
}



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

int main(){
	int N;
	cin >> N;
	int C[N-1], S[N-1], F[N-1];
	for(int i = 0; i < N-1; i++)
		cin >> C[i] >> S[i] >> F[i];
	for(int i = 0; i < N-1; i++){
		int time = 0;
		int station = i;
		time += S[i] + C[i];
		station++;
		while(station != N-1){
			int gotime = max(time, S[station]);
			int wait = 0;
			while(wait < gotime)
				wait += F[station];
			wait -= time;
			time += wait + C[station];
			station++;
		}
		cout << time << endl;
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;

    ll x=0,y=0,flag=false,t=0,temp=0;

    for(ll i=0; i<n; i++)
    {
        ll tt,xx,yy;
        cin>>tt;
        cin>>xx>>yy;
       if(i==0) temp = tt;
       else temp = tt-t;
       // cout<<t<<" "<<tt<<" "<<temp<<endl;
        t =tt;
        int flagg=0;

        if(!flag)
        {
            while(true)
            {

                //cout<<temp<<endl;
                if(temp==0) break;
                if(x==xx&&y==yy)
                {
                    //cout<<"ok temp = "<<temp<<endl;
                    if((temp)%2==0)
                    {
                        flagg=0;
                        break;
                    }
                    else
                    {
                        flagg=1;
                        break;
                    }
                }
                if(x<xx)
                {
                    x++;
                   // t++;
                   temp--;
                }
                else if(x>xx)
                {
                    x--;
                   // t++;
                   temp--;
                }
                if(y<yy)
                {
                    y++;
                    //t++;
                    temp--;
                }
                else if(y>yy)
                {
                    y--;
                    //t++;
                    temp--;
                }

               // cout<<x<<" "<<y<<endl;

            }
            //cout<<"flagg = "<<flagg<<endl;

            if(!flagg)
            {
                 if(x==xx&&y==yy) flag=0;
                 else flag=1;
            }
            else flag=1;
        }
    }
    if(!flag) cout<<"Yes\n";
    else cout<<"No\n";

}



Measured memory_bytes: 256
# Your code here!
a,b,c,d=gets.split
a=a.to_i
b=b.to_i
c=c.to_i
d=d.to_i

e=a+b
f=c+d

if e<f
    puts "Right"
elsif e>f
puts "Left"

else 
    puts "Balanced"
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll han(ll a,int r){
  if(a==0)return r;
  else if(r==2){
    if(a%2==0)return 0;
    else return 1;
  }
  else{
    if(a%2==0)return 1;
    else return 0;
  }
}
int main(){
  ll l;cin>>l;
  ll a[l];for(ll i=0;i<l;i++)cin>>a[i];
  ll dp[l][21];
  ll inf=1000000000000000000;
  for(ll i=0;i<l;i++)fill(dp[i],dp[i]+21,inf);
  dp[0][0]=a[0];
  dp[0][11]=han(a[0],1);
  dp[0][13]=han(a[0],2);
  for(ll i=0;i<l-1;i++){
    dp[i+1][0]=dp[i][0]+a[i+1];
    dp[i+1][1]=min(dp[i][1]+han(a[i+1],1),dp[i][0]+han(a[i+1],1));
    dp[i+1][2]=min(dp[i][1]+a[i+1],dp[i][2]+a[i+1]);
    dp[i+1][3]=min(dp[i][3]+han(a[i+1],2),dp[i][0]+han(a[i+1],2));
    dp[i+1][4]=min(dp[i][3]+a[i+1],dp[i][4]+a[i+1]);
    dp[i+1][5]=min(dp[i][1]+han(a[i+1],2),dp[i][5]+han(a[i+1],2));
    dp[i+1][6]=min(dp[i][3]+han(a[i+1],1),dp[i][6]+han(a[i+1],1));
    dp[i+1][7]=min(dp[i][6]+han(a[i+1],2),dp[i][7]+han(a[i+1],2));
    dp[i+1][8]=min(dp[i][5]+a[i+1],dp[i][8]+a[i+1]);
    dp[i+1][9]=min(dp[i][6]+a[i+1],dp[i][9]+a[i+1]);
    dp[i+1][10]=min(dp[i][7]+a[i+1],dp[i][10]+a[i+1]);
    dp[i+1][11]=dp[i][11]+han(a[i+1],1);
    dp[i+1][12]=min(dp[i][11]+a[i+1],dp[i][12]+a[i+1]);
    dp[i+1][13]=dp[i][13]+han(a[i+1],2);
    dp[i+1][14]=min(dp[i][13]+a[i+1],dp[i][14]+a[i+1]);
    dp[i+1][15]=min(dp[i][11]+han(a[i+1],2),dp[i][15]+han(a[i+1],2));
    dp[i+1][16]=min(dp[i][13]+han(a[i+1],1),dp[i][16]+han(a[i+1],1));
    dp[i+1][17]=min(dp[i][16]+han(a[i+1],2),dp[i][17]+han(a[i+1],2));
    dp[i+1][18]=min(dp[i][15]+a[i+1],dp[i][18]+a[i+1]);
    dp[i+1][19]=min(dp[i][16]+a[i+1],dp[i][19]+a[i+1]);
    dp[i+1][20]=min(dp[i][17]+a[i+1],dp[i][20]+a[i+1]);
    //cout<<dp[i+1][15]<<" "<<dp[i+1][18]<<endl;
  }
  ll ans=inf;
  for(ll i=0;i<21;i++){
    ans=min(ans,dp[l-1][i]);
    //cout<<dp[l-1][i]<<endl;
  }
  cout<<ans<<endl;
}
  
  

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

int main(){
  int A[3] = {};
  cin >> A[0] >> A[1] >> A[2];

  int cost[3] = {};
  cost[0] = abs(A[0] - A[1]) + abs(A[1] - A[2]);
  cost[1] = abs(A[0] - A[1]) + abs(A[0] - A[2]);
  cost[2] = abs(A[0] - A[2]) + abs(A[1] - A[2]);

  int result = min(cost[0], min(cost[1], cost[2]));

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   char S[3];
	cin>>S;
    cout<<endl;
  if(S[0]==S[1])
  {
    if(S[0]==S[2]){
  	cout<<"No"<<endl;
    return 0;
    }
    else{
        	cout<<"Yes"<<endl;
    return 0;
    }
  }
  else{
  	cout<<"Yes"<<endl;
    return 0;
  }
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
 
import static java.util.Comparator.*;
 
public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int A = Integer.parseInt(sc.next());
    	int B = Integer.parseInt(sc.next());
    	out.println(lcm(A,B));
    }
    // 最大公約数の取得			
    long gcd(long a, long b) {			
    	if (b == 0)		
    		return a;	
    	return gcd(b, a % b);		
    }			
    // 最小公倍数の取得			
    long lcm(long a, long b) {			
    	return a / gcd(a, b)  * b;		
    }			
}

Measured memory_bytes: 21716
#include <stdio.h>
int isprime(int n) {
  int i;
  for(i = 2; i * i <= n; i++) {
    if(n % i == 0) return 0;
  }
  return 1;
}

int main(){
  int i, n, max;
  while(1){
    scanf("%d", &n);
    if(n == 0) break;
    for(i = n;i > 0;i--){
      if(isprime(i) == 1 && isprime(i - 2) == 1){
        max = i;
                                             break;
      }
    }
    printf("%d %d\n", max - 2, max);
  }
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    map<int,int> cnt;
    REP(i,N){
        int a; cin>>a;
        cnt[a]++;
    }
    
    vint v;
    for(auto p:cnt){
        REP(i,p.second/2) v.push_back(p.first);
    }
    int ans=0;
    if(v.size()>=2)
        ans=v[v.size()-1]*v[v.size()-2];
    cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll n;
  cin >> n;

  ll now, ans = 0;

  for (ll i = 1; i <= n; i++) {
    now = 0;
    if (i % 2 == 0) {
      continue;
    }

    for (ll j = 1; j <= i; j++) {
      if (i % j == 0) {
        now++;
      }
    }
    if (now == 8) {
      ans++;
    }
  }
  cout << ans << "\n";
}

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

using namespace std;
long long int h[100001], n, c[100001], k;
int main(){
	cin >> n >> k;
	for(int i=1;i<=n;i++)cin >> h[i];
	c[n] = 0;
	c[n-1] = abs(h[n] - h[n-1]);

	for(int t=n-2;t>=1;t--){
		long long int min_c = 9999999999;
		for(int j=t+1;j <= min(t+k, n);j++){
			min_c = min(abs(h[j]-h[t]) + c[j], min_c);
		}
		c[t] = min_c;
	}		
	//for(int i = 1;i<=n;i++)cout<<c[i]<<endl;
	cout << c[1];
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	char c;

	scanf("%c", &c);

	switch (c)
	{
	case 'a':
	case 'i':
	case 'u':
	case 'e':
	case 'o':
		printf("vowel");
		break;
	default:
		printf("consonant");
		break;
	}
}

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

namespace _1_1_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = int.Parse(Console.ReadLine());

            int h = i / 3600;
            int m = i % 3600 / 60;
            int s = i % 60;


            Console.WriteLine("{0}:{1}:{2}",h,m,s);
        }
    }
}



Measured memory_bytes: 18012
#include <algorithm>
#include <array>
#include <assert.h>
#include <chrono>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <random>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;

typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<pll> vpll;

#ifdef OLBOEB
mt19937 rnd(228 + 1488 + 239 + 24111997 % 322 + std::hash<std::string>()("Tsypkokokokoko is gay"));
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

void print_time() {
#ifdef OLBOEB
  cout.flush();
  cerr << "\ntime: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
}


#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(x) ((ll)(x).size())
#define popcnt(x) (__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

template <typename T>
void update_max(T& x, T y) { x = max(x, y); }
template <typename T>
void update_min(T& x, T y) { x = min(x, y); }
template <typename T>
T min(T x, T y, T z) { return min(x, min(y, z)); }
template <typename T>
T max(T x, T y, T z) { return max(x, max(y, z)); }

ll get_bit(ll m, ll i) {
  return (m >> i) & 1;
}

void set_bit(ll& m, ll i) {
  m |= (1LL << i);
}

template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }




int main() {
  cout << fixed << setprecision(20);
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);


  ll h, n;
  cin >> h >> n;

  vl d(n);
  vl c(n);

  for (ll i = 0; i < n; ++i) {
    cin >> d[i] >> c[i];
  }

  for (ll i = 0; i < n; ++i) {
    ll dd = d[i];
    ll cc = c[i];
    do {
      dd *= 2;
      cc *= 2;
      d.pb(dd);
      c.pb(cc);
    } while (dd <= h);
  }

  n = sz(d);
  const ll INF = 1e12;
  vvl dp(2, vl(h + 1, +INF));
  dp[0][0] = 0;

  for (ll i = 0; i < n; ++i) {
    dp[1].assign(h + 1, +INF);
    for (ll hh = 0; hh <= h; ++hh ) {
      update_min(dp[1][hh], dp[0][hh]);
      ll newc = dp[0][hh] + c[i];
      ll newh = min(h, hh + d[i]);
      update_min(dp[1][newh], newc);
    }
    swap(dp[0], dp[1]);
  }

  cout << dp[0][h];

  print_time();
  return 0;
}


Measured memory_bytes: 768
import java.io.*;
import java.util.*;

public class Main {
    static long mod = (int)Math.pow(10,9)+7;
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		long t1 = sc.nextLong();
		long t2 = sc.nextLong();
		long a1 = sc.nextLong();
		long a2 = sc.nextLong();
		long b1 = sc.nextLong();
		long b2 = sc.nextLong();
		long p = (a1-b1)*t1;
		long q = (a2-b2)*t2;
		if(p < 0){
		    if(p+q < 0){
		        pw.println(0);
		    }else if(p+q == 0){
		        pw.println("infinity");
		    }else{
		        long ans = (-p/(p+q))*2;
		        if(-p%(p+q) != 0) ans++;
		        pw.println(ans);
		    }
		}else{
		    if(p+q > 0){
		        pw.println(0);
		    }else if(p+q == 0){
		        pw.println("infinity");
		    }else{
		        long ans = (-p/(p+q))*2;
		        if(-p%(p+q) != 0) ans++;
		        pw.println(ans);
		    }
		}
		pw.close();
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}



Measured memory_bytes: 23124
n = int(input())
a = list(map(int, input().split()))

li1 = []
li1.append(a[0])

long = len(a)

for i in range(long - 1):
    S = a[i+1] - a[i]
    li1.append(S)

li1.append(-a[-1])

li2 = [abs(li1[i+1] + li1[i]) for i in range(long)]
li3 = [abs(li1[i+1]) + abs(li1[i]) for i in range(long)]

ab_li1 = map(lambda x:abs(x), li1)

S = sum(ab_li1)

for i in range(long):
    print(S - li3[i] + li2[i])


Measured memory_bytes: 20136
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
    string n;
    cin>>n;
    for(int i=0;i<n.length();i++){
        if(n[i]==','){
            n[i]=' ';
        }
    }
    cout<<n<<endl;
}

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

int main() {
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> v(h);
	for (int i = 0; i < h; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int bits_h = 0; bits_h < (1<<h); bits_h++) {
		bitset<6> t_h(bits_h);
		for (int bits_w = 0; bits_w < (1<<w); bits_w++) {
			bitset<6> t_w(bits_w);
			int now = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (t_h[i]==1 || t_w[j]==1) continue;
					if (v[i][j] == '#') now++;
				}
			}
			if (now == k) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;

int color[12][12];
int ourx, enemyx;
void dfs() {

}

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

	ll n;
	cin >> n;
	vi v(n+1);
	rep(i, n) {
		cin >> v[i];
	}
	vi x = v;
	sort(all(v));
	rep(i, n) {
		if (x[i] < v[n / 2+1]) cout << v[n / 2 + 1] << endl;
		else cout << v[n / 2] << endl;
	}
	return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
typedef long long ll;
#define vll vector<long long> 
#define pll pair<ll,ll>
#define f(i,a,b) for(long long i=a;i<b;i++)
#define F first
#define S second
#define pb(i) push_back(i)
#define mp(x,y) make_pair(x,y)
#define all(v)  (v).begin(),(v).end()
#define sz 1001
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main(){
	FIO;string s,t,ans="";cin>>s>>t;
	ll n = s.size(),m = t.size();
	ll dp[n+1][m+1];
	f(i,0,n+1){
		f(j,0,m+1){
			if(i==0 or j==0) dp[i][j]=0;
			else if(s[i-1]==t[j-1]) dp[i][j] = 1+dp[i-1][j-1];
			else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
		}
	}
	ll p = n,q = m;
	while(p>0 and q>0){
		if(s[p-1]==t[q-1]){
			 ans += s[p-1];
			 p--;
			 q--;
		}
		else if(dp[p-1][q]>dp[p][q-1]) p--;
		else q--;
	}
	reverse(all(ans));
	cout<<ans<<"\n";
}

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

const long long N = 2e5 + 10;
vector<long long> g[N];
set<pair<long long, long long> > CheckAgain;
set<long long> vis;

long long dfs(long long node) {
    if(vis.count(node))
        return 0;
    vis.insert(node);
    long long ans = 1;
    for(long long i = 0; i < g[node].size(); i++) {
        ans += dfs(g[node][i]);
    }
    return ans;
}

int main() {
 	long long n, m;
 	cin >> n >> m;
 	for(long long i = 1; i <= m; i++) {
        long long u, v;
        cin >> u >> v;
        if(CheckAgain.count({u, v}) || CheckAgain.count({v, u}))
            continue;
        g[u].push_back(v);
        g[v].push_back(u);
 	}
 	long long ans = 0;
 	for(long long i = 1; i <= n; i++) {
        if(!vis.count(i))
            ans = max(ans, dfs(i));
 	}
 	cout << ans << endl;
}


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


int main(){
  int n;
  std::cin >> n;
  if(n%10==3)std::cout << "bon" << '\n';
  else if(n%10==2 || n%10==4 | n%10== 5| n%10== 7| n%10==9)std::cout << "hon" << '\n';
  else std::cout << "pon" << '\n';


  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    
    // 定義:数列を sequence[3] と置く
    int sequence[3];
    
    // 反復：3つ数列に数値を代入する
    for(int i = 0; i < 3; i++){
        cin >> sequence[i];
    }
    
    // ソート：昇順に数列を並べ替える
    sort(sequence, sequence+3);
    
    for(int i = 0; i < 3; i++){
        cout << sequence[i] << ((i != 2) ? " ":"\n");
    }
    
    return 0;
}


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

void solve(string s){
	set<string> st;
	for(int i=0; i<s.size(); ++i){
		string t = s.substr(0, i);
		string u = s.substr(i, s.size()-i);
		st.insert(t + u);
		st.insert(u + t);
		reverse(t.begin(), t.end());
		st.insert(t + u);
		st.insert(u + t);
		reverse(u.begin(), u.end());
		st.insert(t + u);
		st.insert(u + t);
		reverse(t.begin(), t.end());
		st.insert(t + u);
		st.insert(u + t);
	}
	cout << st.size() << "\n";
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	int m;
	cin >> m;
	for(int i=0; i<m; ++i){
		string s;
		cin >> s;
		solve(s);
	}
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  int c = 0;
  for(int i = 0;i < N;++i) {
    cin >> vec.at(i);
  }
  bool flg;
  for(int i = 0;i < N;++i) {
    if(vec.at(i) % 2 == 0) {
      if(vec.at(i) % 3 == 0 || vec.at(i) % 5 == 0) {
        flg = true;
      } else {
        flg = false;
        break;
      }
    }
  }
  if(flg) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}

Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;


int main() {
	int A, B;
	int ans=0;
	cin >> A >> B;
	for (int i = 0; i < 2; i++) {
		if (A >= B) {
			ans += A;
			A--;
		}
		else {
			ans += B;
			B--;
		}
	}
	cout << ans << endl;
}

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

int a, b, sum = 1, lst = 1;

int main() {
    scanf("%d%d", &a, &b);
    for (register int i = 2; i <= 999; ++i) {
        sum += i;
        if (lst - a == sum - b) {
            printf("%d", lst - a);
            return 0;
        }
        lst = sum;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

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

	string s; cin >> s;
	if (s == "ABC") {
		cout << "ARC" << endl;
	}
	else {
		cout << "ABC" << endl;
	}

	return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
using namespace std;
using ll = long long;

int main(void) {
    int n, k;
    cin >> n >> k;
    ll p[n + 1];
    p[0] = 0;
    rep (i, n) cin >> p[i + 1];

    vector<ll> sum(n + 1, 0);

    for (int i = 1; i <= n; i++) {
        sum[i] += sum[i - 1] + p[i];
    }



    ll _max = 0;
    ll _id;

    for (int i = 0; i < n - k + 1; i++) {
        if (_max < sum[i + k] - sum[i]) {
            _max = sum[i + k] - sum[i];
            _id = i;
        }
    }

    _id++;
    double ans = 0.0;

    for (int i = _id; i < _id + k; i++) {
        ans += (double) (p[i] * (p[i] + 1) / 2.0 / p[i]);
    }
    
    printf("%.10lf\n", ans); 
    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	multiset<int> st;

	for(int i = 0;i < n;i++){
		int a;
		cin >> a;

		auto p = st.lower_bound(a);
		if(p != st.begin()){
			p--;
			st.erase(p);
		}
		st.insert(a);
	}

	cout << st.size() << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> //std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> // std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
#include <numeric>  // std::accumulate(m.begin(), m.end(), 0LL);
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int a; std::cin >> a;
  std::string s; std::cin >> s;

  if ( a >= 3200 ) std::cout << s << std::endl;
  else std::cout << "red" << std::endl;
  return 0;
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i).sort
S, T = [gets.chomp, gets.chomp].sort_by(&:length)

ans = N.lcm(M)
a = (ans / N).lcm(ans / M)
U = N.times.select { |v| v % (ans / M) == 0}.map { |v| S[v] }.join('')
V = M.times.select { |v| v % (ans / N) == 0}.map { |v| T[v] }.join('')
puts U == V ? N.lcm(M) : -1

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

int main(){
    long long int a, b, x;
    cin >> a >> b >> x;
    if(a >  0) cout << b/x - (a-1)/x << endl;
    if(a == 0) cout << b/x + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
char s[1005][1005];
int dis[1005][1005];
bool vis[1005][1005];
queue<pii > Q;
int dx[] = {0,-1,0,1};
int dy[] = {1,0,-1,0};
void Solve() {
    read(N);read(M);
    for(int i = 1 ; i <= N ; ++i) {
        scanf("%s",s[i] + 1);
        for(int j = 1 ; j <= M ; ++j) {
            if(s[i][j] == '#') {
                Q.push(mp(i,j));
                vis[i][j] = 1;
            }
        }
    }
    int ans = 0;
    while(!Q.empty()) {
        pii u = Q.front();Q.pop();
        ans = max(dis[u.fi][u.se],ans);
        for(int k = 0 ; k < 4 ; ++k) {
            int tx = u.fi + dx[k],ty = u.se + dy[k];
            if(tx >= 1 && tx <= N && ty >= 1 && ty <= M) {
                if(!vis[tx][ty]) {
                    vis[tx][ty] = 1;
                    dis[tx][ty] = dis[u.fi][u.se] + 1;
                    Q.push(mp(tx,ty));
                }
            }
        }
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int H,W; cin >> H >> W;
  int h,w; cin >> h >> w;

  int num = H*W;
  num-=h*W;
  num-=w*(H-h);

  cout << num << endl;
  
  return 0;
}


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


int main(){
  long long int H, W;
  cin >> H >> W;
  if(H==1 || W==1){
    cout << 1 << endl;
    return 0;
  }
  cout << (H/2 + H%2) * (W/2 + W%2) + (H/2) * (W/2) << endl;
  return 0;
}


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

using namespace std;
using llong = long long int;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define stl_rep(itr, X) for (auto itr = X.begin(); itr != X.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const int MOD = 1000000007;
const int INF = 1000000000;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0); 
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<llong> H(n);
    rep(i, n) cin >> H[i];
    vector<int> flag(n, 1);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        if (H[b] >= H[a]) flag[a] = false;
        if (H[a] >= H[b]) flag[b] = false;
    }

    int ans = 0;
    rep(i, n) {
        if (flag[i]) ++ans;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4520
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <bitset>
#include <utility>
#include <ctime>
#include <cassert>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<pair<int, pair<int, int> > > viii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<vii> vvii;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) cin>>((a)[i])  
#define md 1000000007
#define MAXN 200005

int main()
{   
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    ain(a,n);
    sort(a,a+n);
    if(a[n-1]-a[0] > 1)
    {
      cout<<"No";
      return 0;
    }

    if(a[n-1] == a[0] and a[0] == n-1)
    {
      cout<<"Yes";
      return 0;
    }
    int c1 = 0;
    rep(i,n)
      if(a[i] != a[n-1])
        c1++;
    int c2 = n - c1;
    if(a[0] < c1 or a[n-1] > c1 + c2/2)
    {
      cout<<"No";
      return 0;
    }

    cout<<"Yes";

    return 0;
}


Measured memory_bytes: 640