akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll n,q;
char s[200010],t[200010],d[200010];

bool ok(ll m,bool key){
  fr(i,q){
    if(t[i]==s[m]){
      if(d[i]=='L') m--;
      else m++;
      if(m<0) return 1-key;
      if(m>=n) return key;
    }
  }
  return 0;
}

int main(){
  cin>>n>>q;
  ll ans=n;
  fr(i,n) cin>>s[i];
  fr(i,q) cin>>t[i]>>d[i];
  ll l=-1,r=n,m;
  while(r-l>1){
    m=(l+r)/2;
    if(ok(m,0)) l=m;
    else r=m;
  }
  ans-=l+1;
  l=-1;r=n;
  while(r-l>1){
    m=(l+r)/2;
    if(ok(m,1)) r=m;
    else l=m;
  }
  ans-=n-r;
  cout<<ans<<endl;
}

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

double solve(const int N, const double d, const double x)
{
    const double first_step = d + (2.0*N-1)/2 * x;
    if (N == 1)
        return first_step;
    else
    {
        const double d_ = (2*(N+1)*d + 5*x) / (2*N);
        const double x_ = (2*(N-1)*x + 6*x) / (2*N);
        return first_step + solve(N-1, d_, x_);
    }
}

int main()
{
    cout << fixed << setprecision(15);
    int N, d, x; cin >> N >> d >> x;
    cout << solve(N, d, x) << endl;
}


Measured memory_bytes: 6528
#include <iostream>
 
int main(){
	int array[32] = {1, 1, 1, 2, 1, 2, 1,
                     5, 2, 2, 1, 5, 1, 2, 1, 
                     14, 1, 5, 1, 5, 2, 2, 1, 
                     15, 2, 2, 5, 4, 1, 4, 1, 51};
  
	int n;
	std::cin >> n;
  
  	std::cout << array[n - 1] << std::endl;
 	return 0;     
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int i[10] = { };

int MaxPoint() {
	/*?????????????????§??????????????\????????????????????????????????§?????????
	???????????????????????§??????????????\??????*/
	int high=0,ret = 0;

	for (int root = 0; root < 10; root++) {
		//????????????????¬?????????¨??????????????????
			if (i[root] > high) {
					high = i[root];//?????§???????¨???¶???????????????	
					ret = root;
				}
	}
	
	return ret;
}

int main() {

	for (int n = 0; n < 10; n++)cin >> i[n];

	int SaidaiBasho; 

	for (int mawaru = 0; mawaru < 3; mawaru++) {
		SaidaiBasho = MaxPoint();
		cout << i[SaidaiBasho] << endl;
		i[SaidaiBasho] = 0;
	}
}

Measured memory_bytes: 3072
H,W=gets.split.map &:to_i
s=H.times.map{gets.chomp}
H.times{|i|
  W.times{|j|
    if s[i][j]!="#" then
      c=0
      ([0,i-1].max..[i+1,H-1].min).each{|h|([0,j-1].max..[j+1,W-1].min).each{|w|
        c+=1 if s[h][w]=="#"}}
      s[i][j]=c.to_s
    end
  }
}
s.each{|t|puts t}

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

using namespace std;

int main() {
    char s[120];
    while(~scanf("%s", s)) {
        bool flag, check;
        flag = check = false;
        int len = strlen(s);
        for(int i = 0; i < len; i++) {
            if(s[i] == 'C') flag = true;
            if(flag) {
                if(s[i] == 'F') check = true;
            }
        }
        if(check) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000

int D;
vector<int> c(26);
vector<vector<int>> s;

struct Data{
	vector<int> t;
	vector<vector<int>> penalty;
	int score;
	
	Data(){
		t.resize(D,0);
		penalty.resize(D+1,vector<int>(26,0));
		score = 0;
	}
};

void init(){
	cin>>D;
	for(int i=0;i<26;i++)scanf("%d",&c[i]);
	
	s.resize(D,vector<int>(26));
	for(int i=0;i<D;i++){
		for(int j=0;j<26;j++)scanf("%d",&s[i][j]);
	}
}

void Print(Data &d){
	for(int i=0;i<D;i++)printf("%d\n",d.t[i]+1);
}

Data generate(vector<int> t){
	Data ret;
	ret.t = t;
	vector<int> last(26,0);
	for(int i=0;i<t.size();i++){
		int temp = t[i];
		ret.score += s[i][temp];
		last[temp] = i+1;
		
		for(int j=0;j<26;j++){
			ret.penalty[i+1][j] = ret.penalty[i][j] + c[j];
			if(temp==j)ret.penalty[i+1][j] = 0;
			ret.score -= ret.penalty[i+1][j];
		}
	}
	return ret;
}

int change(Data &d,int ind,int nv){
	int o_score = d.score;
	int ov = d.t[ind];
	d.score += s[ind][nv];
	d.score -= s[ind][ov];
	d.t[ind] = nv;
	for(int i=ind+1;i<=D;i++){
		d.score += d.penalty[i][nv];
		if(i==ind+1){
			d.penalty[i][nv] = 0;
		}
		else{
			if(d.penalty[i][nv]!=0){
				d.penalty[i][nv] = d.penalty[i-1][nv]+c[nv];
			}
			else break;
		}
		d.score -= d.penalty[i][nv];
	}
	for(int i=ind+1;i<=D;i++){
		d.score += d.penalty[i][ov];
		if(i==ind+1){
			d.penalty[i][ov] = d.penalty[i-1][ov] + c[ov];
		}
		else{
			if(d.penalty[i][ov]!=0){
				d.penalty[i][ov] = d.penalty[i-1][ov]+c[ov];
			}
			else break;
		}
		d.score -= d.penalty[i][ov];
	}
		
	
	return d.score - o_score;
}

int main(){
	
	init();
	
	
	vector<int> t(D);
	for(int i=0;i<D;i++){
		int maxi = -10000000;
		int ind = 0;
		for(int j=0;j<26;j++){
			if(c[j]==0)continue;
			if(maxi < s[i][j]){
				maxi = s[i][j];
				ind = j;
			}
		}
		t[i] = ind;
	}
	Data d = generate(t);

	auto start = chrono::system_clock::now();
	while(true){
		if(chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count() > 1950){
			break;
		}
		for(int i=0;i<D;i++){
			for(int j=0;j<26;j++){
				if(c[j]==0)continue;
				int temp = d.t[i];
				if(temp==j)continue;
				int ts = d.score;
				if(change(d,i,j)<0)change(d,i,temp);
			}
		}
	}
	
	
	Print(d);
	
	return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))


signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    int ans=0;
    for(int i=1;i<=n;i++){
        int cnt=0;
        for(int j=1;j*j<=i;j++){
            if(i%j==0){
                cnt++;
                if(j*j!=i) cnt++;
            }
        }if(cnt==8&&i%2==1)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main()
{
    int n,i;
    int a[100];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i-1]);
    }
    for(i=n;i>0;i--)
    {
        printf("%d",a[i-1]);
        if(i!=1) printf(" ");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1028
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))

int main(void) {
	long long n, a, b;
	
	scanf("%lld %lld %lld", &n, &a, &b);
	if (a % 2 == b % 2) {
		printf("%lld\n", MAX(a-b,b-a) / 2);
	} else {
		printf("%lld\n", MIN(MIN(n-a,n-b),MIN(a-1,b-1))+(MAX(a,b)-MIN(a,b))/2+1);
	}
	
	return 0;
}

Measured memory_bytes: 128
# 二つの整数 A, B が入力されます。
# A+B の値を出力してください。
# ただし、A+B が 10 以上の場合は、代わりに error と出力してください。

input_line = gets.chomp.split
a = input_line[0].to_i
b = input_line[1].to_i

if a + b >= 10
  puts "error"
else
  puts a + b
end


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

const int N = 400010;
const int M = 21;

int a[N], v[N], dppre[1 << M], dpsuf[1 << M], pre[M][N], suf[M][N], ans[N];
int n, V, m;

int main(){
	scanf("%d%d", &n, &V);
	v[0] = V;
	for (int i = 1; ; ++ i){
		v[i] = v[i - 1] >> 1;
		if (!v[i]){
			m = i + 1;
			break;
		}
	}
	for (int i = 0; i < n; ++ i){
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < m; ++ i){
		pre[i][n - 1] = n - 1;
		for (int j = n - 2; j >= 0; -- j){
			if (a[j + 1] - a[j] <= v[i]){
				pre[i][j] = pre[i][j + 1];
			}
			else{
				pre[i][j] = j;
			}
		}
	}
	for (int i = 0; i < M; ++ i){
		suf[i][0] = 0;
		for (int j = 0; j < n - 1; ++ j){
			if (a[j + 1] - a[j] <= v[i]){
				suf[i][j + 1] = suf[i][j];
			}
			else{
				suf[i][j + 1] = j + 1;
			}
		}
	}
	memset(dppre, -1, sizeof(dppre));
	for (int i = 0; i < 1 << m; ++ i){
		dpsuf[i] = n;
	}
	for (int i = 0; i < 1 << m - 1; ++ i){
		int x = dppre[i];
		for (int j = 0; j < m - 1; ++ j){
			if (i >> j & 1){
				continue;
			}
			int &y = dppre[i | 1 << j];
			if (x == n - 1){
				y = n - 1;
			}
			y = std::max(y, pre[j + 1][x + 1]);
		}
		x = dpsuf[i];
		for (int j = 0; j < m - 1; ++ j){
			if (i >> j & 1){
				continue;
			}
			int &y = dpsuf[i | 1 << j];
			if (!x){
				y = 0;
			}
			y = std::min(y, suf[j + 1][x - 1]);
		}
	}
	for (int i = 0; i < 1 << m - 1; ++ i){
		int j = (1 << m - 1) - i - 1;
		int x = dppre[i] + 1, y = dpsuf[j] - 1;
		if (x >= y){
			++ ans[0];
			-- ans[n];
		}
		if (pre[0][x] >= y){
			++ ans[suf[0][x]];
			-- ans[pre[0][y] + 1];
		}
	}
	for (int i = 0; i < n; ++ i){
		ans[i + 1] += ans[i];
		printf(ans[i] ? "Possible\n" : "Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 81536
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Bool = bool;
using Int = long long int;
using Real = long double;
using Char = char;
using String = std::string;
template <class T, class U>
using Pair = std::pair<T, U>;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <size_t N>
using Bits = std::bitset<N>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    Int n;
    std::cin >> n;
    Int miss = 0;
    for (Int i = 1; i <= n; ++i) {
        Int p;
        std::cin >> p;
        if (p != i) ++miss;
    }

    std::cout << (miss <= 2 ? "YES" : "NO") << std::endl;
    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() {
    vector<string> s(3);
    vector<ll> n(3), c(3);
    rep1(i, 3){
        cin >> s[i];
        n[i] = s[i].size();
    }
    ll next = 0;
    c[0]++;
    while (c[0]<=n[0] && c[1]<=n[1] && c[2]<=n[2]){
        next = s[next][c[next]-1] - 'a';
        c[next]++;
    }
    if (c[0]>n[0]) cout << "A" << endl;
    if (c[1]>n[1]) cout << "B" << endl;
    if (c[2]>n[2]) cout << "C" << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, n;
  cin >> h >> n;
  while(n--) {
    int x;
    cin >> x;
    if((h -= x) <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 1000000007
#define inf 9000000000000000000LL
#define M 200005
 
using namespace std;
 
lli dp[2005];
int main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    lli n;
 
    cin >> n;
 
    lli ans =1;
    lli x=1;
    lli y = 1;
    for(int i=1;i<=n;i++)
    {
        ans *= 10;
        ans %= mod;
        x *= 9;
        y*= 8;
        x %= mod;
        y %= mod;
    }
 
    x*=2;
    x%=mod;
    ans -= x;
    ans += y;
 
    ans += mod;
    ans %= mod;
 
 
    cout << ans << endl;
}

Measured memory_bytes: 3620
x1,y1,x2,y2 = map(int,input().split())

x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x3 - (x2 - x1)
y4 = y3 - (y2 - y1)

print(x3,y3,x4,y4,sep=" ")


Measured memory_bytes: 2940
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	int[] name, d, w;

	void run(){
		n=sc.nextInt();
		name=new int[n];
		d=new int[n];
		w=new int[n];
		for(int i=0; i<n; i++){
			name[i]=sc.nextInt();
			d[i]=sc.nextInt();
			w[i]=sc.nextInt();
		}
		solve();
	}

	void solve(){
		// ツづづェツづーツ篠敖づづつ「ツづゥツ，ツつ「ツづ慊づつア
		double[][] dp=new double[1<<n][n];
		int[][] p=new int[1<<n][n];
		int[] ws=new int[1<<n];

		for(int k=0; k<1<<n; k++){
			for(int i=0; i<n; i++){
				ws[k|(1<<i)]=ws[k]+20*w[i];
			}
		}

		for(int k=1; k<1<<n; k++){
			Arrays.fill(dp[k], INF);
		}

		for(int k=0; k<1<<n; k++){
			for(int j=0; j<n; j++){
				for(int i=0; i<n; i++){
					if((k>>i&1)==0){
						double t=dp[k][j]+Math.abs(d[i]-d[j])/2000.0*(70+ws[k]);
						if(t+EPS<dp[k|(1<<i)][i]){
							dp[k|(1<<i)][i]=t;
							p[k|(1<<i)][i]=j;
						}
					}
				}
			}
		}

		/*
		for(int k=0; k<1<<n; k++){
			debug(k, dp[k]);
		}

		debug();
		for(int k=0; k<1<<n; k++){
			debug(k, p[k]);
		}
*/
		int m=0;
		for(int i=0; i<n; i++){
			if(dp[(1<<n)-1][i]+EPS<dp[(1<<n)-1][m]){
				m=i;
			}
		}

		// if(1!=1)
		// return;

		// debug("ans");

		LinkedList<Integer> path=new LinkedList<Integer>();

		for(int i=m, sup=(1<<n)-1; sup!=0;){
			//debug(i, name[i]);
			path.addFirst(i);
			int j=p[sup][i];
			sup&=~(1<<i);
			i=j;
		}

		for(int i=0; i<path.size(); i++){
			print(name[path.get(i)]+(i==path.size()-1?"\n":" "));
		}

	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 19000
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

vector<vector<pii>> mempar;
vector<vector<pii>> memsize;

int turn=0;

struct UnionFind{
    vector<int> par,sizes;
    UnionFind(int n):par(n+1),sizes(n+1,1){
        rep2(i,1,n)par[i]=i;
    }
    int find(int x){
        if(x==par[x])return x;
        else{
            int res=find(par[x]);
            par[x]=res;
            mempar[x].pb({turn,res});
            return res;
        }
        // return (x==par[x]?x:par[x]=find(par[x]));
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return ;
        if(sizes[x]<sizes[y]){
            swap(x,y);
        }
        par[y]=x;
        mempar[y].pb(pii{turn,x});
        sizes[x]+=sizes[y];
        memsize[x].pb(pii{turn,sizes[x]});
    }
    bool same(int x,int y) {return (find(x)==find(y));}
    int size(int x) {return sizes[find(x)];}
};


main(){
    int n;
    cin>>n;
    ll ans=0;
    vec a;
    rep(i,n)a.pb(in());
    rep(i,n){
        ans+=a[i]/2;
        a[i]%=2;
        if(i<n-1&&a[i+1]&&a[i]){
            ans+=1;
            a[i+1]--;
        }
    }
    cout<<ans;
}

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

using namespace std;

int main(){
    int K;
    string S;

    cin >> K >> S;

    int S_len = (int)S.size();
    
    if (S_len <= K){
        cout << S << endl;
    }
    else{
        for (int i = 0; i < K; i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N), B(M), acc(N + 1, 0), bcc(M + 1, 0);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    rep(i, N) {
        acc[i + 1] += acc[i] + A[i];
    }
    rep(i, M) {
        bcc[i + 1] += bcc[i] + B[i];
    }
    ll ans = 0;
    rep(i, N + 1) {
        ll a = acc[i];
        ll r = K - a;
        if (r < 0) continue;
        ll c = upper_bound(bcc.begin(), bcc.end(), r) - bcc.begin();
        ans = max(ans, i + c - 1);
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi std::vector<int>
#define vvi std::vector<std::vector<int> >
#define vpi std::vector<pi >
#define pi std::pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (int var = (from); var <= ((int)(to)); var++)
#define DOWNTO(var, from, to) for (int var = (from); var >= ((int)(to)); var--)
#define FOR(var, to)		  UPTO(var, 0, (to)-1)
#define DOWN(var, from)	   DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static const int MOD = 1000000007;
static const int INF = ((1<<30)-1);
static const s64 LINF = ((1LL << 62)-1);

struct Comb {
	std::vector<std::vector<s64> > a;
	Comb(int n) { // O(n^2)
		a.resize(n+1);
		FOR(i,n+1) {
			a[i].resize(i+1, 1);
			UPTO(j,1,i-1) a[i][j] = a[i-1][j] + a[i-1][j];
		}
	}
	s64 ncr(int n, int r) {
		assert(n >= 0);
		assert(n <= (int)a.size());
		assert(r >= 0);
		assert(r <= n);
		return a[n][r];
	}
};

#define gc(c) (c)=getchar()
int ri() {
	int c,s=0,r=0;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}
s64 rs64() {
	s64 r;
	int c,s;
	for(;;){gc(c);if(c=='-'){s=1;break;}if(c>='0'&&c<='9'){r=c-'0';break;}}
	for(;;){gc(c);if(c<'0'||c>'9')break;r*=10;r+=c-'0';}
	if(s)r=-r;
	return r;
}

int int_less(const void *a, const void *b) {
	return (*(const int*)a - *(const int*)b);
}
int int_greater(const void *a, const void *b) {
	return (*(const int*)b - *(const int*)a);
}
std::string operator*(const std::string &s, int n){ std::string res; FOR(i,n) res += s; return res; }

template<class T> std::ostream& operator<<(std::ostream& os, std::vector<T> a) { for (auto i : a) os << i << " "; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, std::set<T> a) { for (auto i : a) os << i << " "; return os; }
template<class A, class B> std::ostream& operator<<(std::ostream&os, std::pair<A,B> a) { os << a.fi << "," << a.se; return os; }


int main() {
	s64 n;std::cin>>n;
	s64 min = 1000000000000000001LL;
	FOR(i,5) {
		s64 a;
		std::cin >> a;
		min = std::min(min, a);
	}
	
	std::cout << 5 + (n - 1) / min << std::endl;
	
	return 0;
}


Measured memory_bytes: 256
while True:
  H,W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print('#' * W)
  for i in range(1, H-1):
    print('#', end='')
    for j in range(1, W-1):
      print('.', end='')
    print('#')
  print('#' * W)
  print()


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

#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define dl          '\n'
//#define mod         (ll)1000000007
#define mod         (ll)998244353
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = 1e18;
ld pi = 3.141592653589;

ll bpow(ll x, ll v) {   
    if (v == 0)
        return 1 % mod;
    if (v % 2 == 1)
        return (x * bpow(x, v - 1)) % mod;
    ll r = bpow(x, v / 2);
    return (r * r) % mod;   
}

ll solve(){ 
    ll n; cin>>n;
    cout<<(n/500)*1000 + ((n - (n/500)*500)/5)*5;
}
int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;



int main(){
    ll N;
    cin >> N;
    ll X;
    cin >> X;
    if(X==1||X==2*N-1){
        cout<<"No"<<endl;return 0;
    }
    if(N==2){
        cout<<"Yes"<<endl;
        cout<<1<<endl<<2<<endl<<3<<endl;return 0;
    }
    cout<<"Yes"<<endl;
    vector<ll> ans(2*N,0);
    if(X!=2*N-2){
        ans[N-1]=X+2;
        ans[N]=X;
        ans[N+1]=X-1;
        ans[N+2]=X+1;
    
    ll mark=1;
    ll in=1;
    while(mark<=2*N-1){
        if(mark==N-1){
            mark+=4;continue;
        }
        if(in==X-1){
            in+=4;
        }
        ans[mark]=in;
        mark++;in++;
    }
    }
    else if(X==2*N-2){
        ans[N-1]=X-2;
        ans[N]=X;
        ans[N+1]=X+1;
        ans[N+2]=X-1;
    
    ll mark=1;
    ll in=1;
    while(mark<=2*N-1){
        if(mark==N-1){
            mark+=4;
        }
        if(in==X-2){
            in+=4;
        }
        ans[mark]=in;
        mark++;in++;
    }
    }
    for(ll i=1;i<2*N;i++){
        cout<<ans[i]<<endl;
    ;}

    return 0;
}


Measured memory_bytes: 3072
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
using namespace std;
int main()
{
    ll n,div,rem,fived;
    cin>>n;
    div=n/100;
    rem=n%100;
    fived=rem/5;
    if(rem%5)
        fived++;
    if(fived<=div)
    cout<<"1"<<endl;
    else
    cout<<"0"<<endl;

    return 0;
}





Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define maxn 1000
#define maxs 20001
using namespace std;
typedef long long LL;

struct data {
	int w,s,v;
}ar[maxn];

int n;
LL ans;
LL dp[maxs];

bool comp(const data& a, const data& b) {
	if(a.s + a.w == b.s + b.w)
		return a.w > b.w;
	return a.s + a.w < b.s + b.w;
}

int main() {
	scanf("%d",&n);
	for( int i = 0 ; i < n ; i++ )
		scanf("%d%d%d",&ar[i].w,&ar[i].s,&ar[i].v);
	sort( ar , ar+n , comp );
	memset(dp, -1, sizeof(dp));
	dp[0] = 0;
	for( int i = 0 ; i < n ; i++ ) {
		for( int j = ar[i].s ; j >= 0 ; j-- )
			if( dp[j] != -1 && j + ar[i].w < maxs )
				dp[j+ar[i].w] = max( dp[j+ar[i].w] , dp[j] + ar[i].v );
	}
	for( int i = 0 ; i < maxs ; i++ )
		ans = max( ans , dp[i] );
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 892
//BISMILLAHHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
using namespace std;
typedef long long int            ll;
typedef unsigned long long int   ull;
#define min3(a,b,c)              min(a,min(b,c))
#define F                        first
#define S                        second
#define PB                       push_back
#define MP                       make_pair
#define PI                       2*acos(0.0)
#define MOD                      998244353
int main()
{
    string s,t;
    int n=0;
    cin>>s>>t;
    for(int i=0; i<t.size(); i++){
        if(s[i]!=t[i])n++;
    }
    cout<<n<<endl;
}


Measured memory_bytes: 3920
#include <iostream>

#include <deque>

#include <stdio.h>

#include <cstdio>

#include <algorithm>

#include<bits/stdc++.h>

#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define sp <<" "
#define nw <<"\n"
#define ca "Case "<<tc++<<": "
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define ull unsigned LL
#define check cout<<"* ";
#define show_vector for(int q=0;q<s.size();q++){cout<<s[q]<<" ";}
#define REP(i,n) for (int i=0;i<(n);++i)
#define N_MAX 26

const int inf=1<<30;
const long long int INF=1e10;
const int MOD=1e9+7;
const int maxn = 1e5+10;

using namespace std;

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

int main(){
    int x;
    cin>>x;
    long long int low=0,high=1000000000,mid,sum,ans;
    while(low<=high){

        mid=(low+high) / 2;

        sum=(mid*(mid+1))/2;

        if(sum==x){
            ans=mid;
            break;
        }
        if(sum>x){
            ans=mid;
            high=mid-1;
        }
        if(sum<x){
            low=mid+1;
        }
    }

    cout<<ans nw;

}


Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
int MAX = 1000000000;
int Array[100005];

int main(){
    int N , K , S , i;
    scanf( "%d%d%d" , &N , &K , &S );

    for( i = 1 ; i <= K ; ++i )
        Array[i] = S;
    
    if( S < MAX ){
        for( i = K + 1 ; i <= N ; ++i )
            Array[i] = S + 1;
    }
    else{
        for( i = K + 1 ; i <= N ; ++i )
            Array[i] = 1; 
    }

    for( i = 1 ; i <= N ; ++i )
        printf( "%d " , Array[i] );
    
    puts( "" ); 
    return 0;
}

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

long long int H, W, a, b, c;

int main(){
    scanf("%lld%lld", &H, &W);
    if((H % 3 == 0) || (W % 3 == 0)){
        return 0 & puts("0");
    }
    a = min(H, W);
    b = (H * 2 + 3) / 6;
    c = (W * 2 + 3) / 6;
    b = (W & 1) ? max(abs(b * W - (W / 2) * (H - b)), abs(b * W - (W / 2 + 1) * (H - b))) : abs(b * W - (W / 2) * (H - b));
    c = (H & 1) ? max(abs(c * H - (H / 2) * (W - c)), abs(c * H - (H / 2 + 1) * (W - c))) : abs(c * H - (H / 2) * (W - c));
    cout << min(a, min(b, c)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         998244353
#define mode        1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265359

const int N = 2e5+5;


void solve()
{
      ll n;
      string s;
      cin>>n>>s;
      ll rc=0,bc=0;
      for(char x : s)
      {
             if(x=='R') rc++;
             else bc++;
      }
      if(rc>bc) cout<<"Yes";
      else cout<<"No";
}

int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n , l = IN()
	#s = input()
	al = LIN()
	for i in range(len(al)-1):
		if al[i]+al[i+1] >= l:
			break
	else:
		print('Impossible')
		return 
	print('Possible')
	last_tie = i + 1
	pa(('lt',last_tie))
	for i in range(1, last_tie):
		print(i)
	for i in range(n-1, last_tie, -1):
		print(i)
	print(last_tie)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 14300
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
#include<unordered_set>
#include<map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const int INF = 2000000000;
std::pair<string,pair<int,int>> Q[101];
    ll N,M,K;
    ll A[100010],B,C,X;
    bool F;
    bool ad=false;
    ll ans=0;
    string S;
int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>M;
    REP(i,N){cin>>A[i];X+=A[i];}
    REP(i,N){
        int a=X/(4*M);
        if(X%(4*M)!=0)a++;
        if(A[i]>=a)K++;
    }

    cout<<(K>=M?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = sorted([int(i) for i in (input().split())])
if len(set(A))==1:
    print(0)
    exit()
else:
    ans =sum([(a)**2 for a in A]) 
    for i in range(min(A),max(A)+1):
        if ans > sum([(a-i)**2 for a in A]):
            ans = sum([(a-i)**2 for a in A])
print(ans)    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long x; cin >> x;
  long long n = x;
  long long s = 0;
  while(x != 0){
    s += x % 10;
    x /= 10;
  }
  if (n % s == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);

using ll = int64_t;
using ull = uint64_t;

using namespace std;

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

    int n, k;
    cin >> n >> k;
    vector<bool> T(n + 1);
    for (int i = 0; i < k; ++i) {
        int d;
        cin >> d;
        for (int j = 0; j < d; ++j) {
            int a;
            cin >> a;
            T[a] = true;
        }
    }
    int res = 0;
    for (bool item : T) {
        if (not item) ++res;
    }
    cout << res - 1;

    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int n, k; cin >> n >> k;
	vector<int> A(n);
	for (auto &x : A) { cin >> x; }

	vector<bool> DP(k + 1, false);
	
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j < n; j++) {
			if (i + A[j] <= k) { DP[i + A[j]] = (DP[i] == 0 | DP[i+A[j]]); }
		}
	}

	cout << (DP[k] ? "First" : "Second") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <unordered_set>

unsigned f(unsigned x){
    x |= (x >> 1);
    x |= (x >> 2);
    x |= (x >> 4);
    x |= (x >> 8);
    x |= (x >> 16);
    return (x+1) >> 1;
}

int main(void){
    Cin(int, n);
    Cins(unsigned, n, a);
    
    unsigned x = 0;
    For(i, n) x ^= a[i];

    int ans = 0;
    while(x != 0){
        unsigned mask = f(x);
        // Cout(">", mask);
        For(i, n){
            unsigned t = a[i] & (-a[i]);
            if(t == mask){
                x ^= a[i];
                a[i] --;
                x ^= a[i];
                a[i] = 0;
                ans ++;
        
                goto next;
            }
        }
        Cout(-1);
        return 0;
        
        next:;
    }
    Cout(ans);
}





Measured memory_bytes: 640
while True:
    try:
        a = map(float,raw_input().split())
        m = a[0]*a[4]-a[1]*a[3]

        x = (a[4]*a[2] - a[1]*a[5])/m
        y = (a[0]*a[5] - a[2]*a[3])/m

	if x == -0:
            x = 0
	if y == -0:
            y = 0

	print "%.3f %.3f" % (x,y)

    except EOFError:
	break

Measured memory_bytes: 4256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,k,a[1<<18],d[1<<18],oa[1<<18];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	for(int i=1;i<=k;i++){
		memcpy(oa,a,sizeof a);
		memset(d,0,sizeof d);
		for(int j=1;j<=n;j++)d[max(j-a[j],1)]++,d[min(j+a[j],n)+1]--;
		for(int j=1;j<=n;j++)a[j]=a[j-1]+d[j];
		if(!memcmp(a,oa,sizeof a))break;
	}
	for(int i=1;i<=n;i++)printf("%d%c",a[i]," \n"[i==n]);
	return 0;
}

Measured memory_bytes: 6496
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  string S;
  string T;
  cin >> S >> T;
  
  int counter = 0;
  for(int i=0 ; i <3;++i){
  	if(S[i] == T[i]) ++counter;
  }
  cout << counter << endl;
}

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

#include <unordered_map> 
#include <cstdio>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n

using namespace std;

// Some typedef's
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

// UTILITY FUNCTIONS

// String
char toUpper(const char &c) { return isupper(c) ? c : c - 'a' + 'A'; }
char toLower(const char &c) { return islower(c) ? c : c + 'a' - 'A'; }
bool isvowel(char c){  c = toLower(c);return (c == 'a' or c == 'e' or c == 'i' or c == 'i' or c == 'o' or c == 'u' || c == 'y');}
void toLowerCase(string &s){rep(s.size()){  if (!islower(s[i]))  {    s[i] = tolower(s[i]);  }}}
void toUpperCase(string &s){rep(s.size()) { s[i] = toupper(s[i]); }}
bool ispal(string s){  ll lo, hi;  lo = 0;  hi = s.length() - 1;  while (lo <= hi)  {    if (s[lo] != s[hi])    {      return 0;    }    lo++;    --hi;  }  return 1;}
template <class T>string toString(T n){  string v = "";  while (n)  {    v.pb(n % 10 + '0');    n /= 10;  }  reverse(all(v));  return v;}

// Maths
template <typename t>t gcd(t a, t b){  a = abs(a), b = abs(b);  return ((b == 0) ? a : gcd(b, a % b));}
template <typename t>t lcm(t a, t b) { return (a * (b / gcd(a, b))); }
template <typename T>T modpow(T base, T exp, T modulus){  base %= modulus;  T result = 1;  while (exp > 0)  {    if (exp & 1)      result = (result * base) % modulus;    base = (base * base) % modulus;    exp >>= 1;  }  return result;}
template <typename T>void cumulative(T *a, T *b, T n){  rep(n) { i ? b[i] = b[i - 1] + a[i] : b[i] = a[i]; }}

// Some constants
const int inf = 1e9 + 7;
const double eps = 1e-6;
const double pi = 1.00 * acos(-1.00);

//------------------------------------------------------------------------


const int N = 1e6;
map<ll, vii> adj;
bool color[N] = {0};

void dfs(ll u){
  color[u] = 1;
  for(auto x: adj[u]){
    if(color[x.fr] == 0){
      dfs(x.fr);
    }
  }
}




void solve(ll testcase){
  ll n;
  cin >> n;
  ll k;
  cin >> k;
  ll tmp = n;
  double ans;
  if(n > k){
    ans = 1.00 * (n-k+1) / (1.00 * n);
    n = k - 1;
  }
  rep(n){
    ll val = i + 1;
    double tpr = 1.00 / tmp;
    while(val < k){
      val *= 2;
      tpr /= 2.00;
    }
    ans += tpr;
  }
  cout <<setprecision(12)<< fixed;
  cout << ans << endl;
}

int main()
{
  std::ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef ONLINE_JUDGE
#else
  //freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  ll t = 1;
  // cin >> t;
  ll cas = 0;
  while (t--)
  {
    solve(++cas);
  }
}


Measured memory_bytes: 256
let a, b, c, d = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let rec lcm a b = a / gcd a b * b
let c_b = b / c + b / d - b / lcm c d
let c_a = (a - 1) / c + (a - 1) / d - (a - 1) / lcm c d
let _ = b - a + 1 - (c_b - c_a) |> Printf.printf "%d\n"

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

int main() {
    int N;
    cin >> N;
    map<string, int> S;
    while (N--)
    {
        string x;
        cin >> x;
        S[x]++;
    }
    vector<pair<int, string>> ans;

    for (auto a : S)
    {
        ans.push_back(make_pair(a.second, a.first));
    }
    sort(ans.begin(), ans.end());

    for (int i = 0; i < ans.size(); i++)
    {
        if (ans[i].first == ans.back().first)
        {
            cout << ans[i].second << endl;
        }
        
    }
        
    
  return 0;
}

Measured memory_bytes: 29428
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# 引かれる数の左からi桁目に+10 & 引く数のi-1桁目に+1 を適宜行う

def calc(x):
    if 0 <= x <= 5:
        return x
    else:
        return 10-x+1

S = list(input())
L = len(S)

dp0 = [0]*L
dp1 = [0]*L
dp0[0] = calc(int(S[0]))
dp1[0] = calc(int(S[0])+1)

for i in range(1,L):
    n = int(S[i])
    if n == 0:
        dp0[i] = dp0[i-1]
    else:
        dp0[i] = min(dp0[i-1]+n, dp1[i-1]+10-n)
    if n == 9:
        dp1[i] = dp1[i-1]
    else:
        dp1[i] = min(dp0[i-1]+n+1, dp1[i-1]+9-n)

print(dp0[-1])

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

#define LL long long

int W, H, K;

inline LL solve(int W, int H)
{
	LL ans = 0;
	for(int c = 1; c < W; c++)
		for(int d = 0; d < H && c * d <= 2 * K + W - 2; d++)
		{
			int R = 2 * K - 2 + __gcd(W, d) - c * d;
			if(R >= 0)
			{
				int a = R / W + 1, t = min(H - 1 - d, R / W);
				if(a + d < H && a * W - __gcd(a, c) - __gcd(W - c, a + d) <= R) t ++;
				ans += t * (1 + (d > 0));
			}
		}
	return ans;
}

int main()
{
	scanf("%d %d %d", &W, &H, &K);
	printf("%lld\n", 2ll * (solve(W, H) + solve(H, W)));
	return 0;
}


Measured memory_bytes: 3836
N = int(input())
city = []
score = dict()
arr = []
for i in range(N):
  c, s = input().split()
  arr.append([c, int(s)])
  city.append(c)
  if c in score:
    score[c].append(int(s))
  else:
    score[c] = [int(s)]
city.sort()
ans = []
for i, var in enumerate(city):
  t = score[var].index(max(score[var]))
  u = score[var].pop(t)
  ans.append(arr.index([var,u]) + 1)
for i in ans:
  print(i)

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//main code

int main(int argc, char const* argv[])
{
	int r,g,b,n;
	cin >> r >> g >> b >> n;
	LL ans = 0;
	for (int i = 0; i <= 3000; i++) {
		for (int j = 0; j <= 3000; j++) {
			int tmp = n - i*r - j*g;
			if (tmp % b == 0 and tmp >= 0) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int main() {
    int H, W;
    cin >> H >> W;

    int a[H + 1][W + 1];
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> a[i][j];
        }
    }

    int count = 0;
    vector<P> f, b;
    for (int i = 1; i <= H; i++) {
        if (i % 2) {
            for (int j = 1; j <= W; j++) {
                if (j == W && i != H && a[i][j] % 2) {
                    a[i + 1][j]++;
                    f.push_back(P(i, j));
                    b.push_back(P(i + 1, j));
                    count++;
                } else if (j != W && a[i][j] % 2) {
                    a[i][j + 1]++;
                    f.push_back(P(i, j));
                    b.push_back(P(i, j + 1));
                    count++;
                }
            }
        } else {
            for (int j = W; j >= 1; j--) {
                if (j == 1 && i != H && a[i][j] % 2) {
                    a[i + 1][j]++;
                    f.push_back(P(i, j));
                    b.push_back(P(i + 1, j));
                    count++;
                } else if (j != 1 && a[i][j] % 2) {
                    a[i][j - 1]++;
                    f.push_back(P(i, j));
                    b.push_back(P(i, j - 1));
                    count++;
                }
            }
        }
    }

    cout << count << endl;

    for (int i = 0; i < f.size(); i++) {
        cout << f[i].first << " " << f[i].second << " ";
        cout << b[i].first << " " << b[i].second << endl;
    }
}


Measured memory_bytes: 5228