akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define LL long long
#define LP pair<LL, LL>
const LL inf = 1e17;
struct segtree {
	int n = 1;
	vector<LP> node;//cost, place
	void init(int N) {
		node.clear();
		while (N > n) n *= 2;
		node.resize(n * 2, { inf, inf });
	}

	void update(int k, LL x, int a) {

		k += n - 1;
		node[k] = { x, a };
		while (k > 0) {
			k = (k - 1) / 2;
			int l = k * 2 + 1;
			int r = k * 2 + 2;
			if (node[l].first < node[r].first) node[k] = node[l];
			else node[k] = node[r];
		}
	}

	LP mini(int a, int b, int k = 0, int l = 0, int r = -1) {

		if (r < 0) r = n;
		if (b <= l || r <= a) return { inf, inf };
		if (a <= l && r <= b) return node[k];
		LP ln = mini(a, b, k * 2 + 1, l, (l + r) / 2);
		LP rn = mini(a, b, k * 2 + 2, (l + r) / 2, r);
		if (ln.first < rn.first) return ln;
		else return rn;
	}
};

struct edge {
	LL to;
	LL cost;
	bool operator<(const edge &e1) const {
		return e1.cost < cost;
	}
};

int N;
int idx[200010];
LL D;
bool used[200010];
vector<LL> A;
vector<LP> B;
vector<edge> G[200010];

LL prim() {
	priority_queue<edge> pq;
	pq.push(edge{ 0, 0 });
	LL total = 0;
	while (!pq.empty()) {
		edge e = pq.top();
		pq.pop();
		if (!used[e.to]) {
			used[e.to] = true;
			total += e.cost;
			for (auto u : G[e.to]) {
				if (!used[u.to]) pq.push(u);
			}
		}
	}
	return total;
}

void build() {
	segtree seg;
	seg.init(N);

	for (int i = 0; i < N; i++) {
		seg.update(idx[i], A[i] + D * (N - i - 1), idx[i]);
		if (i != 0) {
			LP lp = seg.mini(0, idx[i]);
			if (lp.first == inf) continue;

			lp.first -= D * (N - i - 1) - A[i];
			G[B[lp.second].second].push_back(edge{ i, lp.first });
			G[i].push_back(edge{ B[lp.second].second, lp.first });
		}
	}

	seg.init(N);
	for (int i = N - 1; i >= 0; i--) {
		seg.update(idx[i], A[i] + D * i, idx[i]);
		if (i != N - 1) {
			LP lp = seg.mini(0, idx[i]);
			if (lp.first == inf) continue;

			lp.first -= D * i - A[i];
			G[B[lp.second].second].push_back(edge{ i, lp.first });
			G[i].push_back(edge{ B[lp.second].second, lp.first });
		}
	}
}

void init() {
	cin >> N >> D;
	for (int i = 0; i < N; i++) {
		LP tmp;
		cin >> tmp.first;
		tmp.second = i;
		A.push_back(tmp.first);
		B.push_back(tmp);
	}
	sort(B.begin(), B.end());

	for (int i = 0; i < N; i++) {
		idx[B[i].second] = i;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	init();
	build();
	cout << prim() << endl;
	return 0;
}

Measured memory_bytes: 44508
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <iostream>
using namespace std;
bool CMP(char A,char B)
{
	return A>B;
}
char CH1[105],CH2[105];
int main()
{
	int N,M;
	int I,J,K;
	scanf("%s%s",&CH1,&CH2);
	sort(CH1,CH1+strlen(CH1));
	sort(CH2,CH2+strlen(CH2),CMP);
	for(I=0;I<strlen(CH2)-1;I++)
	{
		if(CH1[I]<CH2[I])
		{
			printf("Yes");
			return 0;
		}
		else if(CH1[I]>CH2[I])
		{
			printf("No");
			return 0;
		}
	}
	if(strlen(CH1)<strlen(CH2))
	{
		printf("Yes");
		return 0;
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
A = 100
B = 50
C = 10
n, m = gets.chomp.split(" ").map(&:to_i)
m = m/100
fin = 0
res = []

if (A * n < m) then
  puts "-1 -1 -1"
else
  for a in 0..n do
    for b in 0..(n-a) do
      if (n-a-b)*A + b*B + a*C == m then
        res = [a, b, n-a-b]
	      fin = 1
        break
      end
    end
    if fin == 1
      break
    end
  end

  if fin == 0 then
    puts "-1 -1 -1"
  else
    puts res.reverse.join(" ")
  end
end


Measured memory_bytes: 1788
#include <stdio.h>

int main(void)
{
    int i, n, c;
    char s[100][2];

    scanf("%d", &n);
    for (i=0; i<n; i++) scanf("%s", s[i]);

    c=0;
    for (i=0; i<n; i++) {
        if (s[i][0]=='Y') { c=1; break; }
    }

    if (c==1)   printf("Four\n");
    else        printf("Three\n");

    return 0;
}

Measured memory_bytes: 128
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
A, B, C, D = list(map(int,input().rstrip().split()))
lcm = int(C/gcd(C,D)*D)
ans = B-A+1
ans -= B//C-(A-1)//C
ans -= B//D-(A-1)//D
ans += B//lcm-(A-1)//lcm
print(ans)

Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll x[220000];
int main(){
  ll n,t,tmp=0;
  cin>>n>>t;
  ll ans=t;
  rep(i,0,n)cin>>x[i];
  rep(i,0,n-1){
    if(x[i+1]-x[i]<=t)ans+=(x[i+1]-x[i]);
    else ans+=t;
  } 
  cout<<ans;
}



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

#define mp make_pair
#define pb push_back
#define ll long long int
#define sd(x) scanf("%lld",&x)
#define inf 1e18+9
#define pll pair<ll,ll>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define bits(x) __builtin_popcountll(x)
#define ld long double
#define test() ll test; cin>>test; while(test--)
#define fi first
#define se second


int main() {
	fastio;
	ll a;
	ld b;
	cin>>a>>b;

	ld ans = (ld)a*b*(ld)1.0;
	ll answer = ans;
	cout<<answer<<endl;


}

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

int main()
{
    char k[3];
  int a,b,c,d;
  char a1,b1,c1,d1;
  cin>>a1>>b1>>c1>>d1;
  a=a1-'0',b=b1-'0',c=c1-'0',d=d1-'0';
  if(a+b+c+d==7)
    k[0]='+',k[1]='+',k[2]='+';
  else if(a+b+c-d==7)
     k[0]='+',k[1]='+',k[2]='-';
  else if(a+b-c+d==7)
   k[0]='+',k[1]='-',k[2]='+';
  else if(a+b-c-d==7)
   k[0]='+',k[1]='-',k[2]='-';
  else if(a-b+c+d==7)
   k[0]='-',k[1]='+',k[2]='+';
  else if(a-b+c-d==7)
   k[0]='-',k[1]='+',k[2]='-';
  else if(a-b-c+d==7)
   k[0]='-',k[1]='-',k[2]='+';
  else if(a-b-c-d==7)
   k[0]='-',k[1]='-',k[2]='-';
    cout<<a<<k[0]<<b<<k[1]<<c<<k[2]<<d<<'='<<'7'<<endl;
}

Measured memory_bytes: 256
from heapq import nsmallest
l, r = map(int, input().split())

ans = 10 ** 9
if r - l > 2019:
    ans = 0
else:
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            prod = (i * j) % 2019

            if prod < ans:
                ans = prod
print(ans)

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,h; cin>>n>>h;
	vector<int>b;
	int amx=0;
	for(int i=0;i<n;++i){
		int A,B; cin>>A>>B;
		amx=max(amx,A);
		if(B>amx)b.emplace_back(B);
	}
	sort(b.begin(),b.end());
	int ans=0;
	for(int i=b.size()-1;i>=0;--i){
		if(b.at(i)<=amx||h<=0)break;
		h-=b.at(i),++ans;
	}
	if(h>0)ans+=h/amx;
	if(h>0&&h%amx)++ans;
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <algorithm>
#include<vector>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	vector<int> a(110);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		bool flag = false;
		int j = 1;
		while (flag == false) {
			if (d[i] == j) {
				a[j] += 1;
				flag = true;
			}
			else {
				j++;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < 110; i++) {
		if (a[i]>0) {
			ans += 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>

using namespace std;

long long arr[100000];
int n;
long long l;
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("inout.txt", "w", stdout);
    scanf("%d %I64d\n", &n, &l);
    for (int i = 0; i < n; i++)
        scanf("%I64d", arr + i);
    for (int i = 0; i < n - 1; i++) {
        if (arr[i] + arr[i + 1] >= l) {
            printf("Possible\n");
            for (int j = 0; j < i; j++) {
                printf("%d\n", j + 1);
            }
            for (int j = n - 2; j >= i + 1; j--)
                printf("%d\n", j + 1);
            printf("%d\n", i + 1);
            return 0;
        }
    }
    printf("Impossible\n");
    return 0;
}


Measured memory_bytes: 1536
from collections import defaultdict
from bisect import bisect
s = input()
t = input()
S = defaultdict(list)
for i, c in enumerate(list(s)):
    S[c].append(i + 1)
now = 0
num = 0
for c in t:
    if c not in S:
        print(-1)
        exit()
    P = S[c]
    x = bisect(P, now)
    if x < len(P):
        num += P[x] - now
        now = P[x]
    else:
        num += len(s) - now
        num += P[0]
        now = P[0]
print(num)


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

void solve(long long N, long long K)
{
    long long sum = (K)*pow(K - 1, N - 1);
    cout << sum << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var HWD = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var H = HWD[0];
            var W = HWD[1];
            var D = HWD[2];
            var A = new Location[H * W];
            for (var i = 0; i < H; i++)
            {
                var a = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                for (var j = 0; j < a.Length; j++)
                {
                    A[a[j] - 1] = new Location { X = j, Y = i };
                }
            }

            var costs = new int[H * W];
            for (var i = 0; i < D; i++)
            {
                var prev = A[i];
                for (var j = D; i + j < H * W; j += D)
                {
                    var current = A[i + j];
                    costs[i + j] = Math.Abs(current.X - prev.X) + Math.Abs(current.Y - prev.Y) + costs[i + j - D];
                    prev = current;
                }
            }

            var Q = int.Parse(Console.ReadLine());
            for (var i = 0; i < Q; i++)
            {
                var LR = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                var L = LR[0] - 1;
                var R = LR[1] - 1;
                Console.WriteLine(costs[R] - costs[L]);
            }

        }

        public class Location
        {
            public int X { get; set; }
            public int Y { get; set; }
        }
    }
}


Measured memory_bytes: 23344
n=int(input())
a=[[]for i in range(n+1)]
for i in range(n-1):
    b,c=map(int,input().split())
    a[b].append(c)
    a[c].append(b)
b=[1]
c=[1]
l=[0]*(n+1)
l[1]=1
while len(b)>0:
    d=[]
    for i in b:
        for j in a[i]:
            if l[j]==0:
                d.append(j)
                c.append(j)
                l[j]=1
    b=d[:]
c=c[::-1]
e=sorted(list(map(int,input().split())))
b=[0]*n
for i in range(n):
    b[c[i]-1]=e[i]
print(sum(e[:-1]))
print(*b)

Measured memory_bytes: 6168
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Atcoder_Answer
{
    class Program
    {
        const int mod = 1000000007;

        static void Main(string[] args)
        {
            char[] S = ReadLine().ToCharArray();
            int RetValue = 0;

            for (int loop = 0; loop < S.Length / 2; loop++) if (S[loop] != S[S.Length - loop - 1]) RetValue++;

            WriteLine(RetValue);
        }

    }

    public static class Extension
    {
        #region 拡張:bool
        #region キャスト関連
        public static int ToInt(this bool Bool)
        {
            if (Bool) return 1;
            else return 0;
        }

        public static string ToString(this bool Bool, string TrueStr, string FalseStr)
        {
            if (Bool) return TrueStr;
            else return FalseStr;
        }
        #endregion
        #endregion

        #region 拡張:int
        #region キャスト関連
        public static char ToAlphaBets(this int Base) => (char)Base;
        #endregion
        #endregion

        #region 拡張:char
        #region 変換関連
        public static char NextAlpha(this char Char) => (char)((Char) + 1); //次の文字を取得
        #endregion
        #endregion

        #region 拡張:int[]
        public static long Sum(this int[] Array)
        {
            int Ret = 0;
            for (int loop = 0; loop < Array.Length; loop++) Ret += Array[loop];
            return Ret;
        }
        #endregion

        #region 拡張: string
        public static string Multi(this string THIS, int Value) 
        {
            string RetValue = "";

            for (int loop = 0; loop < Value; loop++) RetValue += THIS;

            return RetValue;
        }
        #endregion
    }
}


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

inline void chmin(int &a, int b) { a = min(a,b); }
inline void chmax(int &a, int b) { a = max(a,b); }

const int INF = (int)1e9 + 7;
int N, M;
vector<int> HP;
enum { Single, All };
struct magic { int mp, dmg, type; };    // Single, All
vector<magic> spells;

int solve() {
    int max_hp = *max_element(HP.begin(), HP.end());
    vector<vector<int>> dp(2, vector<int>(max_hp + 1, INF));
    for (int i = 0; i < 2; i++) dp[i][0] = 0;
    for (magic e : spells) {
        for (int i = 0; i < max_hp; i++) {
            chmin(dp[e.type][min(max_hp, i + e.dmg)], dp[e.type][i] + e.mp);
        }
    }
    for (int i = max_hp; i > 0; i--) {
        chmin(dp[Single][i - 1], dp[Single][i]);
    }
    int ans = INF;
    for (int dmg = 0; dmg <= max_hp; dmg++) {
        int tmp = dp[All][dmg];
        for (int hp : HP) {
            tmp = min(INF, tmp + dp[Single][max(hp - dmg, 0)]);
        }
        chmin(ans, tmp);
    }
    return ans;
}

bool input() {
    cin >> N;
    if (!N) return 0;
    HP.resize(N);
    for (int& e : HP) cin >> e;
    cin >> M;
    spells.resize(M);
    for (magic& e : spells) {
        string name, tgt;
        cin >> name >> e.mp >> tgt >> e.dmg;
        e.type = tgt == "All";
    }
    return 1;
}

signed main() {
    while (input()) cout << solve() << endl;
    return 0;
}


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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] money = Console.ReadLine().Split(' ');

            int N = int.Parse(money[0]);
            int A = int.Parse(money[1]);
            int B = int.Parse(money[2]);

           
            int train = N * A;
            int taxi = B;
            if (train < taxi) 
            {
                Console.WriteLine(train);
            }
            else
            {
                Console.WriteLine(taxi);
            }
        }
    }

}


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

#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int> vi; const int inf = 1e9 + 7;
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cout << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cout << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cout << "["; for (T i = a; i != b; ++i) {if (i != a) cout << ", "; cout << *i;} cout << "]\n";}

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

	int n; cin >> n;
	map<int, vi> mp;
	vi a(n); FOR (i, 0, n - 1) cin >> a[i], mp[a[i]].push_back(i);
	sort(all(a)); a.erase(unique(all(a)), a.end());
	reverse(all(a));

	vector<ll> ans(n);
	set<int> s(all(mp[a[0]]));
	
	ll val = a[0];
	FOR (i, 1, sz(a) - 1) {
		ans[*s.begin()] += sz(s)*(val - a[i]);
		for (int it : mp[a[i]]) s.insert(it);
		val = a[i];
	}
	ans[*s.begin()] += sz(s)*val;

	FOR (i, 0, n - 1) cout << ans[i] << "\n";



	return 0;
}


Measured memory_bytes: 17920
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int f(ll x){
  int cnt = 0;
  while(x%2 == 0){
    x/=2;
    cnt++;
  }
  return cnt;
}
int main() {
  ll n,m;
  cin >> n >> m;
  vl a(n);
  rep(i,n){
    cin >> a[i];
    a[i]/=2;
  }
  bool ok = true;
  rep(i,n-1){
    ok&=(f(a[i]) == f(a[i+1]));
  }
  if(!ok){
    print(0);
    return 0;
  }
  ll l = 1;
  rep(i,n){
    l = lcm(l,a[i]);
  }
  //show(l);
  ll ans = (m/l+1)/2;
  print(ans);
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll =  long long;
#define endl '\n'


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;cin>>n;
	string s;
	cin>>s;
	int x = 0, cnt = 0;
	for(int i = 0; i < n; ++i){
		if(s[i]=='R') ++x;
	}
	for(int i = 0; i < x; ++i){
		cnt += (s[i]=='W');
	}
	for(int i = x; i < n; ++i){
		cnt += (s[i]=='R');
	}
	cout<<cnt/2<<endl;
	return 0;
}

Measured memory_bytes: 3756
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;

long long int N, M, K, W, H, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	string t = s;
	reverse(t.begin(), t.end());
	if (s == t) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}

	return 0;
}


Measured memory_bytes: 256
n, a, b = map(int,input().split())
mod7 = 10 ** 9 + 7
def power(a,b,mod):
    p = 1
    q = a
    while b != 0:
        if b % 2 == 1:
            p = (p * q) % mod
        q = (q * q) % mod
        b = b // 2
    return p

def fact(n, mod):
    p = 1
    for i in range(1,n+1):
        p = (p * i) % mod
    return p


def combi(n,a,mod):
    inv_af = power(fact(a,mod),mod-2,mod)
    p = 1
    for i in range(a):
        p = (p * (n-i)) % mod
    return inv_af * p % mod

Answer = (power(2, n, mod7) - combi(n, a, mod7) - combi(n, b, mod7) - 1) % mod7
print(Answer)

Measured memory_bytes: 3064
/*
AizuOnline A0000
Title Aka-beko and 40 Thieves
@kankichi573
*/
#include <stdio.h>
#include <string.h>
char dat[101];
char seni_hyou[7][2]={{0,0},{2,4},{0,3},{5,6},{2,0},{6,4},{4,2}};
//
int solve()
{
        int i,pos;

        pos=1;
        for(i=0;i<strlen(dat);i++)
        {
                pos=seni_hyou[pos][dat[i]-'0'];
                if(pos<1)
                        return(0);
                //printf("pos=%d\n",pos);
        }
        return(pos==6);
}
main()
{
        int ret;

        while(EOF!=scanf("%s",dat) && (dat[0]!='#'))
        {
                ret=solve();
                printf("%s\n",ret?"Yes":"No");
        }
return(0);
}

Measured memory_bytes: 524
#![allow(unused_macros)]
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(unused_imports)]
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => (::std::cmp::max($x, max!( $($y),+)));
}

macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => (::std::cmp::min($x, min!( $($y),+)));
}

// solution 
use std::cmp;
use std::collections::{HashMap, HashSet, BTreeMap, BTreeSet};
fn main() {
    input! {
        A: usize,
        B: usize,
        T: usize,
    }

    println!("{}", B*(T/A));
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
        double x1,y1,x2,y2;
        cin >> x1 >> y1;
        cin >> x2 >> y2;
        double d=pow(x1-x2,2) + pow(y1-y2,2);
        cout << fixed << setprecision(5) << sqrt(d);
        cout << endl;
        
    
}



Measured memory_bytes: 3276
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	r := sc.nextInt()
	fmt.Println(r * r)
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

long long int x;
long long int y;

unsigned long long int upper_mul(unsigned long long int a, unsigned long long int b, unsigned long long int up) {  //if a*b>up return -1 otherwise return a*b
	if (b == 0) {
		return 0;
	}
	if (up / b<a) {
		return -1;
	}
	return a*b;
}
unsigned long long int  upper_add(unsigned long long int a, unsigned long long int b, unsigned long long int c) {
	unsigned long long int r = a + b;
	if (r > c) {
		return -1;
	}
	return r;
}

int main() {
	scanf("%lld%lld", &x, &y);
	int cnt = 0;
	long long int c = x;
	while (c != -1&&c<=y) {
		cnt++;
		c = upper_mul(c, 2, y + 1LL);
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
n,m,l=map(int,input().split())
s=[[float("INF")for i in range(n)]for i in range(n)]
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall as fw
for i in range(m):
    a,b,c=map(int,input().split())
    s[a-1][b-1]=c
    s[b-1][a-1]=c
s=fw(s)
t=[[float("INF")for i in range(n)]for i in range(n)]
for i in range(n):
    for j in range(n):
        if s[i][j]<=l:
            t[i][j]=1
t=fw(t)
for i in range(int(input())):
    a,b=map(int,input().split())
    if t[a-1][b-1]!=float("INF"):
        print(int(t[a-1][b-1])-1)
    else:
        print(-1)

Measured memory_bytes: 20968
// Problem A

#include <iostream>
#include <utility>

using namespace std;

bool les(int x1,int y1,int x2,int y2){
	int t1 = x1*x1 + y1*y1;
	int t2 = x2*x2 + y2*y2;

	if( t1 < t2 ){
		return true;
	}else if( t1 == t2 && y1 < y2 ){
		return true;
	}
	return false;
}

int main(){
	
	int h,w,x1;

	while(1){
		cin >> h;
		cin >> w;
		if( h == 0 && w == 0)
			break;
		x1 = h*h + w*w;
		int cur_h,cur_w,w2,h2;
		cur_h = 1500;
		cur_w = 1500;
		for(w2 = 1; w2 < 150; w2++){
			for(h2 = 1; h2 < 150; h2++){
				if(h2 >= w2)
					break;
				if(!les(w,h,w2,h2))
					continue;
				if(les(w2,h2,cur_w,cur_h)){
					cur_w = w2;
					cur_h = h2;
				}
			}
		}
		if(cur_h > cur_w)
			swap(cur_h,cur_w);

		cout << cur_h << " " << cur_w << endl;
	}
return 0;
}

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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pd pair<double, int>
#define pib pair<pi, bool>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 10001
#define MAXL 1000001
#define mod 1000000007

signed main()
{
  int n, a, b;
  cin >> n >> a >> b;
  for (int i = 0; i < 1000; i++)
  {
    if (n * i > b)
      break;
    else if (a <= n * i && b >= n * i)
    {
      cout << "OK\n";
      return 0;
    }
  }
  cout << "NG\n";
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int a, b;
int main()
{
	int c,d=0,e=0;
	while (scanf("%d", &c) != 0) {
		if (c == 0)break;
		for (int i = 1; i <= c; i++) {
			scanf("%d %d", &a, &b);
			if (a > b)d += a + b;
			else if (a < b)e += a + b;
			else {
				d += a;
				e += b;
			}
		}
		printf("%d %d\n", d, e);
		d = e = 0;
	}
}

Measured memory_bytes: 2552
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int gcd(int x, int y) {
    if(y == 0) {
        return x;
    }

    return gcd(y, x%y);
}

int main() {
    int n, m;
    string s, t;
    cin >> n >> m >> s >> t;
    int g = gcd(n, m);
    int n1 = n/g;
    int m1 = m/g;

    rep(i, g) {
        if(s[i*n1] != t[i*m1]) {
            cout << -1 << endl;
            return 0;
        }
    }

    ll ans = (ll)g*n1*m1;

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main(){
  int a, b, c, ans;
  double k,l;
  scanf("%d%d%d%lf",&a,&b,&c,&k);
  l = pow((double)2,k);
  if (a >= b && a >= c)
    ans = a*l + b + c;
  else if(b >= a && b >= c)
    ans = a + b*l + c;
  else
    ans = a + b + c*l;
  printf("%d",ans);
}

Measured memory_bytes: 128
N=int(input())
S=str(input())
m=0
for i in range(N):
    a=[]
    x=S[:i]
    y=S[i:]
    for j in range(len(x)):
        if x[j] in y:
            if x[j] not in a:
                a.append(x[j])
    if len(a)>m:
        m=len(a)
                
print(m)

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

int main(){
  string S;
  cin >> S;
  
  if(S.at(0)==S.at(1) && S.at(2)==S.at(3) && S.at(0)!=S.at(3)){
    cout << "Yes" << endl;
  }
  else if(S.at(0)==S.at(2) && S.at(1)==S.at(3) && S.at(0)!=S.at(3)){
    cout << "Yes" << endl;
  }
  else if(S.at(0)==S.at(3) && S.at(1)==S.at(2) && S.at(0)!=S.at(2)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int n,a[N],b[N],L[N],R[N],f[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  set<int>al;
  for(int i=1;i<=n;i++)cin>>a[i],L[a[i]]++;
  for(int i=1;i<=n;i++)cin>>b[i],R[b[i]]++;
  for(int i=1;i<=n;i++)if(L[i]+R[i]>n)return cout<<"No\n",0;
  reverse(b+1,b+1+n);
  cout<<"Yes\n";
  int l=-1;
  vector<int>v;
  for(int i=1;i<=n;i++){
    if(a[i]==b[i]){
      l=a[i];
      v.pb(i);
    }
  }
 // cout<<"ok"<<endl;
  int idx=0;
  for(int i=1;i<=n&&idx<v.size();i++){
    if(a[i]!=b[i] && a[i]!=l && b[i]!=l){
      swap(b[i],b[v[idx++]]);
    }
  }
//  cout<<"this"<<endl;
  for(int i=1;i<=n;i++)cout<<b[i]<<' ';
  return 0;
}

Measured memory_bytes: 7000
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        long[] arr = Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
        long ansMod = arr[0] % arr[1];
        long ansModTwo = arr[1] - ansMod;
        Console.WriteLine(ansMod < ansModTwo ? ansMod : ansModTwo);

    }

  

}



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

int n,now,nxt;
long long kane=1000,kabu;

int main(){
  cin>>n>>now;
  while(--n){
    kane+=kabu*now;kabu=0;
    cin>>nxt;
    if(nxt>now){
      kabu=kane/now;
      kane%=now;
    }
    now=nxt;
  }
  cout<<kane+kabu*now<<endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }

int main() {
    double n;
    cout << fixed << setprecision(10);
    while(cin >> n){
        if(n == 0)break;
        else{
            vector<int> s(n,0);
            rep(i,n)cin >> s.at(i);
            double average = accumulate(s.begin(),s.end(),int(0))/n;
            double sum = 0;
            rep(i,n)sum += pow(s[i] - average,2);
            double dispersion = sqrt(sum/n);
            cout << dispersion << endl;
        }
    }
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

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

struct Edge {
    int to;     // 辺の行き先
    ll weight; // 辺の重み
    Edge(int t, ll w) : to(t), weight(w) { }
};

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

    vector<vector<Edge>> G(N);
    // 座標、街の番号の順でpairをつくる
    vector<pair<ll, int>> pairsX(N);
    vector<pair<ll, int>> pairsY(N);

    REP(i, N)
    {
        ll x, y;
        cin >> x >> y;
        pairsX[i] = make_pair(x, i);
        pairsY[i] = make_pair(y, i);
    }

    // 街のX, Y座標をそれぞれ昇順にソート
    sort(pairsX.begin(), pairsX.end());
    sort(pairsY.begin(), pairsY.end());

    // グラフに辺を貼る
    // 考える辺はソートしたX, Y 座標のなかで隣り合うものだけでよい
    // 二重辺になったとしても、あとのアルゴリズムで問題ない

    // X座標について
    REP(i, N - 1)
    {
        int from, to;
        ll weight;
        from = pairsX[i].second;
        to = pairsX[i + 1].second;
        weight = pairsX[i + 1].first - pairsX[i].first;
        // 無向グラフを考える
        G[from].push_back(Edge(to, weight));
        G[to].push_back(Edge(from, weight));
    }
    // Y座標について
    REP(i, N - 1)
    {
        int from, to;
        ll weight;
        from = pairsY[i].second;;
        to = pairsY[i + 1].second;
        weight = pairsY[i + 1].first - pairsY[i].first;
        // 無向グラフを考える
        G[from].push_back(Edge(to, weight));
        G[to].push_back(Edge(from, weight));
    }

    // 最小全域木をつくる
    bool visited[N] = {false};
    vector<int> visitedV;
    priority_queue<P, vector<P>, greater<P> > edgeQ;
    ll ans = 0;

    int v = 0;
    visitedV.push_back(v);
    visited[v] = true;
    while(visitedV.size() != N)
    {
        for(int i = 0; i != G[v].size(); ++i)
        {
            edgeQ.push(P(G[v][i].weight, G[v][i].to));
        }
        while(true)
        {
            P p = edgeQ.top();
            int vTo = p.second;
            ll weight = p.first;
            if (!visited[vTo])
            {
                visitedV.push_back(vTo);
                visited[vTo] = true;
                v = vTo;
                ans += weight;
                break;
            }
            edgeQ.pop();
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 21616
//https://atcoder.jp/contests/arc072/tasks/arc072_b
/*
* Author : MaxSally
*/
/********   All Required Header Files ********/
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i <= k ; ++i)
#define rrep(i, j, k) for (int i = j; i >= k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define Flag(n) cout << "here " << n << endl
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

const int N = 0;

int main(){
    io;
    //freopen("input.txt", "r", stdin);
    ll x, y; cin >> x >> y;
    /*if(__builtin_popcount((x ^ y) + 1) == 1){
        cout << "Brown";
    }else{
        cout << "Alice";
    }*/
    if(x + y <= 1){
        cout << "Brown";
    }else{
        if(abs(x - y) <= 1){
            cout << "Brown";
        }else{
            cout << "Alice";
        }
    }
    return 0;
}


Measured memory_bytes: 256
S=[False,False,False,False,False,False,False,False,False,False,False,False,False]
H=[False,False,False,False,False,False,False,False,False,False,False,False,False]
C=[False,False,False,False,False,False,False,False,False,False,False,False,False]
D=[False,False,False,False,False,False,False,False,False,False,False,False,False]
n=int(input())

for i in range(n):
    data=input().split()
    num=int(data[1])
    
    if(data[0]=='S'):
        S[num-1]=True
    if(data[0]=='H'):
        H[num-1]=True
    if(data[0]=='C'):
        C[num-1]=True
    if(data[0]=='D'):
        D[num-1]=True

for i in range(13):
    if not S[i]:
        print('S',i+1)
        
for i in range(13):
    if not H[i]:
        print('H',i+1)

for i in range(13):
    if not C[i]:
        print('C',i+1)

for i in range(13):
    if not D[i]:
        print('D',i+1)


Measured memory_bytes: 5620
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
//const long mod=(long)1e9+7;
inline void solve(void){
  int H,A;in(H,A);
  out((H+A-1)/A);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;

int main()
{
    int N,M,color[100010],parent[100010];
    cin>>N>>M;
    vector<vector<int> > L(N);

    rep(i,M){
        int a,b;
        cin>>a>>b;
        L[a-1].push_back(b-1);
        L[b-1].push_back(a-1);
    }

    //BFS
    queue<int> Q;
    int arrived = 0;
    rep(i,N){color[i]=WHITE;}
    color[0]=GRAY;
    Q.push(0);
    while(!Q.empty()){
        int u = Q.front();Q.pop();
        arrived+=1;
        for(auto v : L[u]){
            if(color[v]==WHITE){
                parent[v]=u;
                color[v]=GRAY;
                Q.push(v);
            }
        }
        color[u]=BLACK;
    }
    if(arrived!=N){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    for(int i=1;i<N;i++){
        cout << parent[i]+1 << endl;
    }


    return 0;
}

Measured memory_bytes: 10708
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

string saiki(long long x){
if(x==0)return "";
 x--;
return saiki(x/26)+=char('a'+x%26);
}
 
int main(){
    long long n;
    cin>>n;
    cout<<saiki(n);
    return 0;
}

Measured memory_bytes: 3084
n = int(input())
t = [int(i) for i in input().split()]
m = int(input())
d = [[int(i) for i in input().split()] for i in range(m)]
x = sum(t)
for i in range(m):
	y = d[i][1]-t[d[i][0]-1]
	print(x+y)

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

int main() {
	int A,B,C,D,E,F;;
	cin >> A >> B >> C >> D >> E >> F;
	vector<int> cand_water, cand_sugar;
	for (int i=0;100*A*i<=F;i++) 
		for (int j=0;100*A*i+100*B*j<=F;j++)
			cand_water.push_back(100*A*i+100*B*j);
	int max_sugar = E*F/100;
	for (int i=0;C*i<=max_sugar;i++)
		for (int j=0;C*i+D*j<=max_sugar;j++)
			cand_sugar.push_back(C*i+D*j);
	double noudo = 0;
	int ans_water, ans_sugar;
	ans_water, ans_sugar = 0, 0;
	for (int water : cand_water){
		for (int sugar : cand_sugar) {
			if ((water+sugar>0) && (water+sugar<=F) && (E*water>=100*sugar)) {
				double cand_noudo = double(100*sugar)/double(sugar+water);
				if(noudo<=cand_noudo) {
					noudo = cand_noudo;
					ans_water = water;
					ans_sugar = sugar;
				}
			}
		}
	}
	printf("%d %d\n", ans_water+ans_sugar, ans_sugar);
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin >> S;

    string ans="Yes";

    if(S[2]!=S[3] || S[4]!=S[5]){
        ans="No";
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int a, b; cin >> a >> b;
    if (a <= b) {
        cout << a << endl;
    } else {
        cout << a - 1 << endl;
    }
}


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

int main()
{
    
        ll a, b, c, i, j, k, l, m, n, x, y, z;
        char ch;
        string s;

        cin >> n >> m;
        vector<ll> A(n);
        x=0;
        for(i=0; i<n; i++){
            cin >> A[i];
            x += A[i];
        }
        y=0;
        z = x/(4*m);
        if(x%(4*m) != 0) z++;
        for(i=0; i<n; i++){
            if(A[i] >= z) y++;
        }
        if(y >= m) cout << "Yes\n";
        else cout << "No\n";
    

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<queue>
#include<string.h>
#include<string>
#include<map>
#include<stack>
#include<vector>
#define mod 998244353
using namespace std;
struct str {
	int end, cost;
};
struct str2 {
	int cur;
	double cost, time;
	bool operator < (const str2&A)const {
		return cost > A.cost;
	}
};
priority_queue<str2> pq;
vector<str> vec[5611];
vector<int> back[600];
int n, t, w,k, h, m, s, e, q;
vector<str> arr[6600];
int bd[600];
int ans[600];
int chk[5010];
str temp[100];
int main() {
	scanf("%d %d %d", &n, &h, &w);
	int cnt = 0;
	if (h > n || w > n) {
		printf("0");
		return 0;
	}
	else {
		cnt = (n-h)+1;
		int cnt2 = (n-w) + 1;
		printf("%d", cnt*cnt2);
	}
	return 0;
}

Measured memory_bytes: 512
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int k;
    cin >> k;
    string s;
    cin >> s;
    int n = SZ(s);
    if(n > k){
        cout << s.substr(0, k) << "...";
    }else{
        cout << s;
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

int main(){
  string ans = "Yay!";
  int k;
  vector<int> a(5);
  rep(i,5,0) cin >> a[i];
  cin >> k;
  rep(i,5,0){
    if(a[i] - a[0] > k){
      ans = ":(";
      break;
    }
  }
  cout << ans << endl;
}

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

const int maxn = 2e5 + 5;
long long sum,x,s[maxn],ans,n,j,y;
long long a[maxn];

int main()
{
    while(scanf("%lld",&n) != EOF)
    {
        map<long long,long long> q;
        sum = 0;
        j = 0;
        ans = 0;
        for(int i = 1;i <= n;i++)
        {
            scanf("%lld",&a[i]);
            sum += a[i];
            s[++j] = sum;
            q[sum]++;
        }
        for(int i = 1;i <= j;i++)
        {
            x = s[i];
            y = q[x];
            if(x == 0) ans++;
            ans += y * (y - 1) / 2;
            q[x] = 1;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 15872