akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

ll gcd (ll a, ll b){
    ll k = a % b;
    while (k > 0){
        a = b;
        b = k;
        k = a % b;
    }
    return b;
}

int main() {
    string s, t; cin >> s >> t;
    int ans = 0;
    rep(i,s.size()){
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
const ll MOD = 1e9 + 7;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin>>n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    vector<ll> pref(n + 1, 0);
    for(int i = 0; i < n; i++){
        pref[i + 1] = pref[i] + a[i];
        pref[i + 1] %= MOD;
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ans += (a[i]*(pref[n] - pref[i + 1]));
        ans %= MOD;
    }
    if(ans < 0){
        ans += MOD;
    }
    cout<<ans;
}

Measured memory_bytes: 6364
#include <iostream>

using namespace std;

int main(int argc, const char** argv) {

  // n k x y
  int info[4];
  int cost = 0;

  for (size_t i = 0; i < 4; i++)
  {
    cin >> info[i];
  }

  if (info[0]<=info[1])
  {
    cost = info[0] * info[2];
  }
  else
  {
    cost = info[1] * info[2] + (info[0] - info[1]) * info[3];
  }

  cout << cost << endl;

  return 0;
}

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

int a[200001], c[200002], n, k;

int main()
{
  cin>>n>>k;
  
  int s, f;
  
  for(int i=1; i<=n; i++)
  {
    cin>>a[i];
  }
  
  for(int j=1; j<=k; j++)
  {
    memset(c, 0, sizeof(c));
    
    for(int i=1; i<=n; i++)
    {
      ++c[max(1, i-a[i])];
      --c[min(n+1, i+a[i]+1)];
    }
    
    s=0;
    f=1;
    
    for(int i=1; i<=n; ++i)
    {
      a[i]=s+=c[i];
      
      if(a[i]<n)
      {
        f=0;
      }
    }
    
    if(f)
    {
      break;
    }
  }
  
  for(int i=1; i<=n; i++)
  {
    cout<<a[i]<<' '<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 5184
#include <iostream>
using namespace std;
int main() {
    int n, t, sum = 0;
    cin >> n;
    t = n;
    while(n) {
        sum += n%10;
        n /= 10;
    }
    if(t % sum == 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
  cin >> head;
  input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? " " : "");
  outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
  cout << head << (sizeof...(tail) ? "\n" : "");
  outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
  cout << head;
  outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
  return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
  return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

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

  var(int, N);

  set<int> st;
  rep(i, N) {
    var(int, d);
    st.insert(d);
  }

  outl(st.size());

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<iomanip>
   
int main()
{
    int a, b, r, d;
    double f;
    cin >> a >> b;
 
    d = a / b;
    r = a % b;
    f = (a * 1.0) / b;
    cout << d << " " << r << " " << fixed << setprecision(10) << f << endl;
 
    return 0;
}

Measured memory_bytes: 1248
N = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(1, 101):
    flag = False
    for j in range(N):
        if h[j] >= i and flag == False:
            flag = True
            count += 1
        elif h[j] < i and flag == True:
            flag = False
print(count)

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
const int maxn=200005;
int vis[27],res,r[maxn],l[maxn],cnt;
char s[maxn];
int main()
{
	cin>>s;
	int len=strlen(s);
	res=26;r[0]=len-1;
	for(int i=len-1;i>=0;i--)
		if(!vis[s[i]-'a'])
		{
			vis[s[i]-'a']=1;res--;
			if(!res)
			{
				l[cnt]=i;r[++cnt]=i-1;
				memset(vis,0,sizeof(vis));res=26;
			}
		}
	int last=0;l[cnt]=0;
	char t;
	for(int i=cnt;i>=0;i--)
	{
		memset(vis,0,sizeof(vis));res=26;
		for(int j=last;j<=r[i];j++)vis[s[j]-'a']=1;;
		for(int j=0;j<26;j++)
			if(!vis[j])
			{
				printf("%c",j+'a');
				t=j+'a';break;
			}
		for(int j=last;j<len;j++)
			if(s[j]==t)
			{
				last=j+1;break;
			}
	}
	
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<vector>
#include<ctime>
#define ll long long
#define pr(x) cerr<<#x<<"="<<x<<endl
using namespace std;
int n,o,a[1000000],ans,i;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&o);
		a[o-1]++,a[o]++,a[o+1]++;
	}
	for (i=1;i<=100000;i++)
	{
		ans=max(ans,a[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
N=int(input())
line=input().split()
A=[0]*N
for i in range(0,N):
    A[i]=int(line[i])
for i in range(N):
    """
    for k in range(N):
        print(A[k],end="")
        if k==N-1:
            print()
        else:
            print(" ",end="")
    """
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j-=1
        A[j+1]=v
    for k in range(N):
        print(A[k],end="")
        if k==N-1:
            print()
        else:
            print(" ",end="")



Measured memory_bytes: 6316
import java.util.stream.*;

class Main{
	public static void main(String[] A){
		System.out.println(
				IntStream.range(2,11110).map(i->i*5+1)
						.filter(o->IntStream.range(2,o).noneMatch(p->o%p==0))
						.limit(new java.util.Scanner(System.in).nextInt())
						.mapToObj(String::valueOf)
						.collect(Collectors.joining(" "))
						);
	}
}


Measured memory_bytes: 27092
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n; LL x;

vector<LL> va, vamin; LL a;

int main() {
    GI(n); GLL(x);

    FORN(i, n) {
        GLL(a);
        va.PB(a);
        vamin.PB(a);
    }

    LL res = 1LL * INF * INF;

    FORN(xcnt, n) {
        LL curr = 0;
        FORN(i, n) curr += vamin[i];
        res = min(res, curr + xcnt * x);

        FORN(i, n) {
            vamin[i] = min(vamin[i], va[(i - xcnt - 1 + n) % n]);
        }
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
def newton(a,b):
	if b == a:
		return a
	if a>b:
		(a,b) = (b,a)
	while b%a != 0:
		b = b%a
		(a,b) = (b,a)
	return a
N = int(input())
A = [int(i) for i in input().split()]
l = []
r = []

l.append(A[0])
r.append(A[-1])

for i in range(1,N):
	l.append(newton(l[-1],A[i]))
	r.append(newton(r[-1],A[-(i+1)]))
m = max(l[-2],r[-2])
for i in range(1,N-1):
	m = max(m,newton(l[i-1],r[N-2-i]))
print(m)


Measured memory_bytes: 15352
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        if (n % 2 == 0) {
            int[] b = new int[n];
            for (int i = 0 ; i < n / 2; i++) {
                b[2* i] = 2 * i + 1;
                b[2* i + 1] = 2 * i + 1;
            }
            for (int i = 0 ; i < n ; i++) {
                if (a[i] == b[i]) {

                } else {
                    System.out.println(0);
                    return;
                }
            }
        } else {
            int[] b = new int[n];
            for (int i = 1 ; i <= n / 2; i++) {
                b[2* i - 1] = 2* i;
                b[2 * i] = 2 * i;
            }
            for (int i = 0 ; i < n ; i++) {
                if (a[i] == b[i]) {

                } else {
                    System.out.println(0);
                    return;
                }
            }
        }
        long ans = 1;
        long mod = 1000000007;
        for (int i = 0 ; i < n / 2 ; i++) {
            ans *= (long) 2;
            ans %= mod;
        }
        System.out.println(ans);
    }

}

Measured memory_bytes: 50284
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(1<=a<=13&&1<=b<=13&&1<=c<=13)
{
if((a+b+c)>=22)
printf("bust\n");
else
printf("win\n");
}

return 0;
}

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


int main()
{
	string s;
	cin >> s;
	int count[26] = {0};
	int count2=0;
	for(char x : s){
		count[x-'A']++;
	}
	for (int i = 0;i<26 ;i++){
		if(count[i]==2){
			count2++;
		}
	}
	if(count2 == 2){
		cout << "Yes";
	}
	else
		cout << "No";

	
}	


Measured memory_bytes: 3584
N=io.read("n")
A={}
A[1]=0
for i=2,N+1 do
  A[i]=io.read("n")
end
table.insert(A,0)
local total=0
for i=2,N+2 do
  total=total+math.abs(A[i]-A[i-1])
end
for i=2,N+1 do
  if A[i]>=math.min(A[i-1],A[i+1]) and A[i]<=math.max(A[i-1],A[i+1]) then
    print(total)
    elseif A[i]<math.min(A[i-1],A[i+1]) then
      print(total-2*(math.min(A[i-1],A[i+1])-A[i]))
      elseif  A[i]>math.max(A[i-1],A[i+1]) then
        print(total-2*(A[i]-math.max(A[i-1],A[i+1])))
  end
end

Measured memory_bytes: 4080
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int X, Y, fare;
	cin >> X >> Y;
	fare = X + Y / 2;
	cout << fare << endl;
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define ll long long
#define lnode node*2,start,mid
#define rnode node*2+1,mid+1,end
#define rep(i,a,b) for(ll i=a;i<=(b);i+=1)
#define input freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
#define To_string(num,str) {stringstream ss;ss<<num;ss>>str;}
#define To_num(str,num) {stringstream ss;ss<<str;ss>>num;}
const double pi=acos(-1.0);
const int maxn=(1e5+10);
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
using namespace std;
struct node
{
    int id;
    int now;
}a[maxn];
bool cmp(node a,node b)
{
    return a.now<b.now;
}
int main()
{   cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[i].id=i;
        a[i].now=x;
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)
        cout<<a[i].id<<" ";
    return 0;
}


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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9;
inline int mod(ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit(ll b, ll i) { return b & (1 << i); }
inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
// struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

signed main(){
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i,n) cin >> a[i];
    
    reps(i, k, n-1){
        if(a[i-k] < a[i]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4840
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    
    int n,x,t;
    cin>>n>>x>>t;
    int fct = n/x + (n%x!=0);
    cout<<fct*t<<endl;
        
}

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

int main() {
    int X;
    cin >> X;
    
    
    int ans = 1;
    
    int i = 1;
    
    int num;
    
    for(i = 2; i < X; ++i){
        num = i * i;
        if(num <= X){
            while(num <= X){
                num *= i;
            }
            ans = max(ans, num / i);
            
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
// For actual content check from line 100
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC

#define FORG(i,a,n) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?++i:--i) //for - general
#define FORZ(i,n) for(lld i=0;i<(lld)n;++i) //for - zero
#define FORGI(i,a,n,inc) for(lld i=(lld)a;a<n?i<(lld)n:(lld)n<i;a<n?i+=inc:i-=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<(lld)n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));
 
#define SORTall(m) sort(m.begin(),m.end());
#define all(m) m.begin(),m.end()
 
#define st first
#define nd second
#define pb push_back
#define DEC(x) fixed<<setprecision(x)
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
#define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

#ifdef DEBUGON
	vector<string> vec_splitter(string s) 
	{
		for(char& c: s) c = c == ',' ?  ' ': c;
		stringstream ss; ss << s;
		vector<string> res;
		for(string z; ss >> z; res.push_back(z));
		return res;
	}

	void debug_out(vector<string> args, int idx) { cerr << endl; }
	template <typename Head, typename... Tail>
		void debug_out(vector<string> args, int idx, Head H, Tail... T) 
		{
			if(idx > 0) cerr << ", ";
			stringstream ss; ss << H;
			cerr << args[idx] << " = " << ss.str();
			debug_out(args, idx + 1, T...);
		}

	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);	
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
	assert(e>=0);
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	assert(e>=0);
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

int lognk(lld n, lld k) // logk(n)
{
	assert(n>=0 and k>=0 and k!=1);
	if(n==0)
		return -1;

	return lognk(n/k,k)+1;
}

const long double pi = acos(-1);
#define endl '\n'
#define mod 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	lld n=0;
	string a,b;
	cin>>a>>b;

	FORZ(i,a.length())
	if(a[i]!=b[i])
		n++;

	cout<<n;
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	//cin>>t;

 	#ifdef PRIMES
 		sieve();
 	#endif

 	#ifdef CHOOSE
 		nCrModInit();
 	#endif

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    ll rui[n][3] = {};
    char rgb[] = {'R', 'G', 'B'};

    char s[n];
    rep(i, n){
        cin >> s[i];
        
        if(s[i] == 'R')rui[i][0]++;
        else if(s[i] == 'G')rui[i][1]++;
        else rui[i][2]++;
    }

    rep(i, n-1){
        rep(j, 3){
            rui[i+1][j] += rui[i][j];
        }
    }

    ll ans = 0;
    rep(i, n){
        for(ll j = i+1; j < n; ++j){
            if(s[i] == s[j])continue;

            rep(k, 3)if(rgb[k] != s[i] && rgb[k] != s[j]){
                ll add = rui[n-1][k] - rui[j][k];
                if(2*j - i < n && s[2*j - i] == rgb[k])add--;

                ans += max((ll)0, add);
            }
        }
    }

    cout << ans << endl;
}

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

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()

using namespace std;

const int INF = 1e18 + 9;
const int Mod = 1e9 + 7;
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,p[100005]={0};
    int ans=0;
    cin >> a;
    bool y=true;
    rep(i,0,a){
        int x;
        cin >> x;
        p[x]++;
    }
    if(a%2){
        if(p[0]!=1)y=false;
        for(int i=2;i<a;i=i+2){
            if(p[i]!=2)y=false;
        }
    }else{
        for(int i=1;i<a;i=i+2){
            if(p[i]!=2)y=false;
           // cout << y << endl;
        }
    }
    ans=1;
    rep(i,0,a/2){
        ans*=2;
        ans%=Mod;
    }
    if(y){
        cout << ans%Mod << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}




Measured memory_bytes: 1024
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
  int64_t N, K;
  cin >> N >> K;

  vector<long double> cum_sum(N + 1);
  cum_sum[0] = 0.0;
  for (size_t n = 0; n < N; ++n) {
    int64_t p;
    cin >> p;
    cum_sum[n + 1] = cum_sum[n] + ((1 + p) / 2.0);
  }
  long double res = 0.0;
  for (size_t k = 0; k <= N - K; ++k) {
    long double val = cum_sum[k + K] - cum_sum[k];
    if (res < val) {
      res = val;
    }
  }
  
  cout << setprecision(8) << res << endl;
  
  return 0;
}


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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N, D, X;
  cin >> N >> D >> X;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int day = 1;
    int cnt = 1;
    while (day <= D) {
      ans++;
      day = cnt * a[i] + 1;
      cnt++;
    }
  }

  // 解答
  cout << ans + X << endl;

  return 0;
}


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


int a,b,c,d,e;
long long k;
using namespace std;
int main(){
    cin>>a>>b>>c>>k;
    if(a-b>1000000000000000000 && a-b<-1000000000000000000){
        cout<<"Unfair"<<endl;
    }else if(k%2==0){
        cout<<(int)a-b<<endl;
    }else{
        cout<<(int)b-a<<endl;
    }
}

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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;

//素因数分解
map<ll, int> factor(ll n) {
	map<ll, int> f;
	for (ll i = 2; i * i <= n; i++) {
		int x = 0;
		while (n % i == 0)n /= i, x++;
		if (x != 0)f[i] = x;
	}
	if (n != 1)f[n] = 1;
	return f;
}

ll intpow(ll a, ll n) {
	if (n == 0)return 1;
	if (n == 1) return a;
	if (n % 2 == 0)return intpow(a * a, n / 2);
	else return intpow(a * a, n / 2) * a;
}

int main(void) {
	ll N, P; cin >> N >> P;

	auto f = factor(P);

	ll ans = 1;

	for (auto x : f) {
		while (x.second >= N) {
			ans *= x.first;
			x.second -= N;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

def solve(dic):
    return



N = I()
dic = defaultdict(list)
for i in range(N):
    C, D = LS()
    D = int(D)
    dic[C].append(D)


for key in dic.keys():
    dic[key].sort()

M = I()
order = []
for i in range(M):
    #tmp = input()
    tmp = LS()[0]
    order.append(tmp)

flag = True
prev = mod

if N >= M :
    for layer in order[::-1] :
        while True:
            if len(dic[layer]) == 0 :
                flag = False
                break
            now = dic[layer].pop(-1)

            if now >= prev :
                continue
            else :
                prev = now
                break
else :
    flag = False


print("Yes" if flag else "No")


Measured memory_bytes: 44676
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	Vec a(n);
	rep(i, n) cin >> a[i];

	map<P, ll> mp;

	rep(i, n){
		REPN(k, i / 2, i / 2 + 1) mp[{i, k}] = -LINF;
		mp[{1, 0}] = 0;
		mp[{0, 0}] = 0;
		mp[{-1, 0}] = 0;
		mp[{-2, 0}] = 0;
		mp[{-3, 0}] = 0;
		REPN(j, i - 5, i - 2){
			REPN(k, i / 2, i / 2 + 1){
				if(mp.find({j, k - 1}) != mp.end()) chmax(mp[{i, k}], mp[{j, k - 1}] + a[i]);
			}
		}
	}

	ll ans = -LINF;
	rep(i, n) if(mp.find({i, n / 2}) != mp.end()) chmax(ans, mp[{i, n / 2}]);
	co(ans);

	return 0;
}


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

using namespace std;

#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define dbg(x) cout << #x << "=" << x << endl
#define dbg2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>  vi;
typedef vector<ll>  vl;
typedef vector<pii>  vpii;
typedef vector<pl>  vpl;
typedef vector<vi>  vvi;
typedef vector<vl>  vvl;
const int mod = 1000000007;

int main()
{
    int n{};
    cin >> n;
    vector<int> arr(n + 1);
    for(int i = 1; i < n; i++){
        int x{};
        cin >> x;
        arr[x]++;
    }
    for(int i = 1; i <= n; i++) cout << arr[i] << '\n';
}


Measured memory_bytes: 4044
#include<iostream>
#include<vector>
#include<algorithm>
#define INF (1LL<<61)

using namespace std;

typedef unsigned long long ull;

int main(void){
  
  int n;
  cin >> n;
  
  vector<ull> cost(n);
  for(int i=0;i<n;i++){
    cin >> cost[i];
    if(i>0)cost[i]+=cost[i-1];
  }
  
  static ull dp[4001][4001],k[4001][4001];
  fill(dp[0],dp[4001],INF);

  for(int i=0;i<n;i++){
    dp[i][i]=0;
    k[i][i]=i;
  }

  for(int w=1;w<=n;w++){
    for(int i=0,j=i+w;j<n;i++,j++){
      for(int r=k[i][j-1];r<=k[i+1][j];r++){
	ull c=dp[i][r]+dp[r+1][j]+cost[j]-((i>0)?cost[i-1]:0);
	if(dp[i][j]>c)dp[i][j]=c,k[i][j]=r;
      }
    }
  }
  cout << dp[0][n-1] << endl;
  
  return 0;
}

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

def power_func(a,b,p):
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

y = 1000000007
print((power_func(10,N,y)-2*power_func(9,N,y)+power_func(8,N,y))%y)

Measured memory_bytes: 9200
const val MOD: Long = (1e9+7).toLong()

fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map{it.toLong()}

    if (a%2 == 1L) {
        if (b%2 == 0L) {
            val x = (((b-1)-(a+1)+1)/2)%2
            println((a xor b) xor x)
        } else {
            val x = ((b-(a+1)+1)/2)%2
            println(a xor x)
        }
    } else {
        if (b%2 == 0L) {
            val x = (((b-1)-a+1)/2)%2
            println(b xor x)
        } else {
            val x = ((b-a+1)/2)%2
            println(x)
        }
    }
}


Measured memory_bytes: 36020
// In The Name OF Allah
// Mehrkish Makuei
// Islamic Republic Of Iran

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

typedef long long ll;
#define Mehrkish ios::sync_with_stdio(false),		cin.tie(0),		cout.tie(0)
#define pb push_back

const int maxx = 2e5 + 19;
int n, m, a[maxx], c[maxx], b[maxx], ans, jvb, sum, z, l, x, y, k, minn = 99999999;
string s[119], t, w;
bool flag = true;
vector <ll> v;
char ch;

void Input(){
	cin >> ch;
}

void Solve(){
	if ( ch == 'A' ) cout << "T" << endl;
	if ( ch == 'T' ) cout << "A" << endl;
	if ( ch == 'C' ) cout << "G" << endl;
	if ( ch == 'G' ) cout << "C" << endl;
}


int main(){
	Mehrkish;
	Input(),	Solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    rep1(i, n) cin >> a[i];
    ll ans = 0;
    ll now = 0;
    rep1(i, n){
        if (i==0) now = a[i];
        else {
            if (a[i]<a[i-1]){
                ans += a[i-1] - a[i];
                a[i] = a[i-1];
            }
            else now = a[i];
        }
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 4792
#include <stdio.h>
#define rep(x)for(i=0;i<x;i++)

int main(){
	int n,i,l=0,r=0;char s[210];
	scanf("%d\n%s",&n,s);
	rep(n){
		if(s[i]=='(')l++;
		else if(s[i]==')')l--;
		if(l<0){r++;l++;}
	}
	rep(2e9)n*=n;
	rep(r)printf("(");
	printf("%s",s);
	rep(l)printf(")");
	return 0;
}

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

#define LIM	123456*2
bool p[LIM];

void init() {
	fill(p, p + LIM, true); //true????´???°
	p[0] = p[1] = false;
	for (int i = 4; i < LIM; i += 2) p[i] = false;
	for (int i = 3; i < LIM; i += 2) 
		if (p[i]) for (int j = i * 2; j < LIM; j += i) p[j] = false;
}

int main() {
	init();
	int n;
	while (cin >> n, n) {
		int cnt = 0;
		for (int i = n + 1; i <= n * 2; i++) if (p[i] == true)cnt++;
		cout << cnt << endl;
	}
}

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

#define rep(i,n) for(int i=1;i<=n;i++)
typedef pair<int,int> P;
int n,m,h,k,s[1002];
P ba[100002];
int r[1002];

int solve(){
  cin>>n>>m>>h>>k;
  if(n==0)return 0;
  rep(i,n)cin>>s[i];
  int S=0;
  rep(i,m){
    int a,b;
    cin>>a>>b;
    ba[i-1]=P(b,a);
  }
  sort(ba,ba+m);
  rep(i,m){
    int a=ba[m-i].second;
    swap(s[a],s[a+1]);
  }
  rep(i,k)S+=s[i];
  rep(i,n)r[i]=i;
  int ans=0;
  rep(i,m){
    int a=ba[i-1].second;
    if(r[a]<=k&&k<r[a+1]){
      ans=min(ans,s[r[a+1]]-s[r[a]]);
    }
    if(r[a+1]<=k&&k<r[a]){
      ans=min(ans,s[r[a]]-s[r[a+1]]);
    }
    swap(r[a],r[a+1]);
  }
  ans+=S;
  cout<<ans<<endl;
  return 1;
}

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

Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector<long long> p(a), q(b), r(c);
	for(int i=0; i<a; ++i) cin >> p[i];
	for(int i=0; i<b; ++i) cin >> q[i];
	for(int i=0; i<c; ++i) cin >> r[i];

	sort(p.begin(),p.end(),greater<>());
	sort(q.begin(),q.end(),greater<>());
	for(int i=0; i<x; ++i) r.push_back(p[i]);
	for(int i=0; i<y; ++i) r.push_back(q[i]);
	sort(r.begin(),r.end(),greater<>());
	
	cout << accumulate(r.begin(),r.begin()+x+y,(long long)0) << endl;
}

Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	long long a, b, c, k;
	cin >> a >> b >> c >> k;
	
	long long ans = min(a, k);
	k -= ans;
	if (k > 0) {
		int val = min(b, k);
		k -= val;
	}
	if (k > 0) {
		int val = min(c, k);
		ans -= val;
	}
	
	cout << ans << '\n';
}

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

using namespace std;

int main(){
	while(true){
		int m, h;
		string cards;
		cin >> cards;
		if(cards == "-") break;
		cin >> m;
		while(m){
			cin >> h;
			string substr = cards.substr(0, h);
			cards.erase(0, h);
			cards += substr;
			m--;
		}
		cout << cards << endl;
	}

	return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  char c; cin >> c;
  ll num = c - 'A';
  if (0<=num && num<26) cout << 'A' << endl;
  else cout << 'a' << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cmath>

using namespace std;

double pi = 3.141592653589793;
// 再帰的にコッホ曲線をプロット
float koch_curve(float x0, float y0, float x1, float y1, int n) {
  if (n == 0) {
    cout << x0 << " " << y0 << endl;
  } else {
    // 中間点
    float c1[2], c2[2], c3[2];
    // 中間点の計算
    c1[0] = x0/3*2 + x1/3; c1[1] = y0/3*2 + y1/3;
    c2[0] = (x0+x1)/2 + (-1)*(y1-y0)/3 * sin(pi/3);
    c2[1] = (y0+y1)/2 + (x1-x0)/3 * sin(pi/3);
    c3[0] = x0/3 + x1/3*2; c3[1] = y0/3 + y1/3*2;
    koch_curve(x0, y0, c1[0], c1[1], n-1);
    koch_curve(c1[0], c1[1], c2[0], c2[1], n-1);
    koch_curve(c2[0], c2[1], c3[0], c3[1], n-1);
    koch_curve(c3[0], c3[1], x1, y1, n-1);
  }
}
  
int main() {
  // 繰り返し回数
  int n;
  cin >> n;
  koch_curve(0, 0, 100, 0, n);
  //右端の点の表示
  cout << 100 << " " << 0 << endl;
}


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

using namespace std;
using ll = long long;

const long long inf = 1e9;
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;
typedef priority_queue<int> Pqi;
typedef priority_queue<ll> Pql;

int n, m, k;

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	VI v(n+1);
	fr(i,0,n) {
		cin >> v[i+1];
	}
	map<int,int> ma1,ma2;
	for (int i = 1;i <= n-1;i+= 2) {
		ma1[v[i]]++;
		ma2[v[i+1]]++;
	}
	vector<pii> v1,v2;
	for (auto x:ma1) {
		v1.pb({(n/2) - x.second,x.first});
	}
	for (auto x:ma2) {
		v2.pb({(n/2) - x.second,x.first});
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	if (v1[0].second != v2[0].second) {
		cout << v1[0].first + v2[0].first << endl;
		return 0;
	}
	int ans = 1e9;
	if (v1.size() == 1 && v2.size() == 1) {
		cout << min(v1[0].first,v2[0].first) + (n/2) << endl;
		return 0;
	}
	if (v1.size() == 1) {
		ans = min(v1[0].first + v2[1].second,v2[0].first + (n/2));
		cout << ans << endl;
		return 0;
	}
	if (v2.size() == 1) {
		ans = min(v2[0].first + v1[1].second,v1[0].first + (n/2));
		cout << ans << endl;
		return 0;
	}
	ans = min(v2[0].first + v1[1].first,v1[0].first + v2[1].first);
	cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 6524
#include<stdio.h>
int main()
{
    int a[105];
    int n,d,x,i,sum=0;
    scanf("%d %d %d",&n,&d,&x);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(d%a[i]==0)
            sum=sum+(d/a[i]);
        else
        sum=sum+(d/a[i]+1);
    }
    sum=sum+x;
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

int n;
int a[10000], b[10000];
pi c[10000];
vector<int> e[10000];
bool done[10000];
int deg[10000];
int out[10000];

int main() {
    cin >> n;
    rep(i,n-1) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        e[a[i]].push_back(b[i]);
        e[b[i]].push_back(a[i]);
        deg[a[i]]++; deg[b[i]]++;
    }
    rep(i,n) c[i].second = i;
    rep(i,n) cin >> c[i].first;
    sort(c, c+n);
    queue<int> que;
    int cnt = 0;
    int ans = 0;
    rep(i,n) {
        if (deg[i] == 1) {
            out[i] = c[cnt++].first;
            ans += c[cnt-1].first;
            que.push(i);
        }
    }
    while (!que.empty()) {
        int p = que.front(); que.pop();
        rep(i,e[p].size()) {
            deg[e[p][i]]--;
            if (deg[e[p][i]] == 1) {
                out[e[p][i]] = c[cnt++].first;
                ans += c[cnt-1].first;
                que.push(e[p][i]);
            }
        }
    }
    ans -= c[n-1].first;
    cout << ans << endl;
    rep(i,n) {
        cout << out[i];
        if (i == n-1) cout << endl;
        else cout << " ";
    }
}


Measured memory_bytes: 1152
#include <iostream>
using namespace std;
void ABC90(void);
void ABC91(void);
void ABC92(void);
void ABC93(void);
void ABC94(void);
void ABC95(void);
void ABC96(void);
void ABC97(void);
void ABC98(void);
void ABC99(void);

int main(void){
    ABC96();
}

void ABC96(){
    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;
int main(){
	int n, h, w; cin>>h>>w>>n;
	int mx=max(h,w);
	for(int i=0;i<=100;i++){
		if(mx*i>=n) {
			cout<<i<<'\n';
			break;
		}
	}	
	return 0;
}

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

void color(int v,bool c){
  if(vertex[v]!=-1){
    if(vertex[v]!=c) throw "nonbin";
    return;
  }
  vertex[v]=c;
  for(int i=0;i<edge[v].size();i++){
    color(edge[v][i],!c);
  }
  return;
}

void dfs(int v,vector<int> &used,vector<int>& con){
  if(used[v]) return;
  used[v]=true;
  con.push_back(v);
  for(int i=0;i<edge[v].size();i++){
    dfs(edge[v][i],used,con);
  }
  return;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,e;
  cin>>n>>e;
  edge.resize(n);
  for(int i=0;i<e;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  vector<vector<int>> chunk;
  vector<int> used(n);
  for(int i=0;i<n;i++){
    if(!used[i]){
      vector<int> con;
      dfs(i,used,con);
      chunk.push_back(con);
    }
  }
  
  vertex.resize(n,-1);
  vector<int> dis;
  int smsum=0;
  for(int i=0;i<chunk.size();i++){
    try{
      color(chunk[i][0],0);
    }catch(const char* ex){
      cout<<-1<<endl;
      return 0;
    }
    int cnt1=0;
    for(int j=0;j<chunk[i].size();j++){
      cnt1+=vertex[chunk[i][j]];
    }
    smsum+=min(cnt1,int(chunk[i].size())-cnt1);
    dis.push_back(abs(cnt1-(int(chunk[i].size())-cnt1)));
  }
  map<int,int> m;
  for(int i=0;i<dis.size();i++){
    if(!m.count(dis[i])){
      m[dis[i]]=1;
    }
    else m[dis[i]]++;

  }
  
  vector<vector<int>> s;
  for(auto it=m.begin();it!=m.end();it++){
    vector<int> ss;
    int val=it->first;
    int time=it->second;

    for(int i=0;i<=time;i++){
      ss.push_back(val*i);
    }
    s.push_back(ss);
  }

  set<int> ob(s[0].begin(),s[0].end());

  for(int i=1;i<s.size();i++){

    set<int> nexob;
    for(auto v:s[i]){
      for(auto vv:ob){
	nexob.insert(v+vv);
      }
    }
    ob=nexob;
  }


  
  long long int res=0;
  for(auto v:ob){
    long long int b=(smsum+v);
    long long int a=(n-smsum-v);
    res=max(res,a*b-e);
  }
  cout<<res<<endl;  
  
  return 0;
}

Measured memory_bytes: 19092
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define Fr(i,a,b) for(int i=a;i<=b;i++)
#define RF(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define pii pair< int, int>
#define vpii vector<pii>
using namespace std;
vvi a;
string s;
vvi dp;
int recurse(int x,int y){
	if(x==a.size()){
		return 1;
	}
	if(dp[x][y]!=-1){
		return dp[x][y];
	}
	ll u=0;
	for(int i=0;i<a.size();i++){
		if(a[x][i]==1&&(y&(1<<i))==0){
			u+=recurse(x+1,(y|(1<<i)));
		}
	}
	return dp[x][y]=u%mod;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
  
    	int v;
    	cin>>v;
    	a.clear();;
    	a.resize(v);
    	dp.clear();
    	int x;
    	Fr(i,0,v-1){
    		Fr(j,0,v-1){
    			cin>>x;
    			a[i].pb(x);
    		}
    	}
    	dp.resize(v,vi((1<<v)+1,-1));
    	cout<<recurse(0,0)<<endl;
    
    return 0;
}


Measured memory_bytes: 360832
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end
a,b,c=get_i.sort!
if a==5 and b==5 and c==7
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 1788
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
l = [] 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        w = a[b]
    else:
        w = a[b-26]
    l.append(w)
print("".join(l))

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n, a, b;
  Solver(LL n) : n(n){};

  void solve() {
    int ans = INF;
    for (int i = 1; i < n; ++i) {
      ans = min(ans, digsum(i) + digsum(n - i));
    }
    cout << ans << "\n";
    ;
  }
  int digsum(int x) {
    int ret = 0;
    while (x > 0) {
      ret += x % 10;
      x /= 10;
    }
    return ret;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  long long n = 0;
  std::cin >> n;

  Problem::Solver sol(n);
  sol.solve();
  return 0;
}


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

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    string ans = (((A+B) % 3 == 0 or A % 3 == 0 or B % 3 == 0) ? "Possible" : "Impossible");
    cout << ans << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
l = list(map(int, input().split()))
arr = []
check = [0] * (n + 2)
check[1] = 1
c = 0
num = 1
yo = 0
while 1:
    arr.append(l[c])
    if l[c] == 1:
        yo = 1
        break
    if check[l[c]]:
        arr.pop()
        c = l[c]
        break
    check[l[c]] = 1
    num -= -1
    c = l[c] - 1
# print(arr, c)
for i in range(len(arr)):
    if arr[i] == c:
        c = i + 1
        break
# print(c)
if yo == 1:
    print(arr[k % len(arr) - 1])
elif k < c: print(arr[k - 1])
else:
    ne = arr[c - 1: ]
    k = k - (c - 1)
    print(ne[k % len(ne) - 1])

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


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

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n;
  cin >> n;
  double ans = 0.0;
  for(int i=0; i<n; i++){
    double a;
    cin >> a;
    ans += 1.0/a;
  }
  ans = 1.0/ans;
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


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

int main() {
    int a, b;
    cin>> a>>b;
    int d = a+b;
    int r = d %2 ;
    if (a > 0 && b > 0)
    {
        cout<<"Positive";
    }
    else if (a < 0 && b < 0)
    {
        if (r==0)
        {
            cout<<"Negative";
        }
        else
        {
            cout<<"Positive";
        }
    }
    else if (a < 0 && b > 0)
    {
        cout<<"Zero";
    }
    else if (a > 0 && b < 0)
    {
        cout<<"Zero";
    }
    
    
    
    return 0;
}


Measured memory_bytes: 3600
a,b =map(int, input().split())
ans = []
for i in range(1,10**4+1):
  if int(i * (8/100)) == a and int(i*(10/100)) == b:
    ans.append(i)
  if len(ans) >= 2:
    break
print('-1' if ans == [] else min(ans))

Measured memory_bytes: 3060