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


Measured memory_bytes: 384
N, X = gets.split.map(&:to_i)

#レベルnバーガーの厚さ
def a(n)
  2**(n+2)-3
end

#レベルnバーガーに含まれるPの数
def p(n)
  2**(n+1)-1
end

def dfs(n, x)
  if x == 1
    if n > 0
      return 0
    else
      return 1
    end
  end

  if x == a(n)
    return p(n)
  end

  if x == 2 + a(n-1)
    return 1 + p(n-1)
  end

  if x < 2 + a(n-1)
    return dfs(n-1, x-1)
  else
    return 1 + p(n-1) + dfs(n-1, x-2-a(n-1))
  end
end

puts dfs(N,X)


Measured memory_bytes: 1788
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

double heron(double x , double y , double x1 , double y1 , double x2 , double y2){
	double d1 , d2 , d3 , s;
	d1 = sqrt(pow(x-x1 , 2) + pow(y-y1 , 2));
	d2 = sqrt(pow(x1-x2 , 2) + pow(y1-y2 , 2));
	d3 = sqrt(pow(x2-x , 2) + pow(y2-y , 2));
	s = (d1 + d2 + d3) / 2;
	return sqrt(s * (s - d1) * (s - d2) * (s - d3));	
}

int main(void){
	double area = 0 , x , y , x1 , x2 , y1 , y2;
	scanf("%lf,%lf" , &x , &y);
	scanf("%lf,%lf" , &x1 , &y1);
	scanf("%lf,%lf" , &x2 , &y2);
	area += heron(x , y , x1 , y2 , x2 , y2);
	x1 = x2;
	y1 = y2;
	while(scanf("%lf,%lf" , &x2 , &y2)!=EOF){
		area += heron(x , y , x1 , y1 , x2 , y2);
		x1 = x2;
		y1 = y2;
	}
	printf("%f\n" , area);
	return 0;
}

Measured memory_bytes: 0
n, q = map(int,input().split())
s = list(input())
t = [0]*(n)
j = 0
for j in range(n-1):
    if s[j]=="A" and s[j+1]=="C":
        t[j+1]=t[j]+1
    else:
        t[j+1]=t[j]
i = 0
for i in range(q):
    a,b = map(int,input().split())
    print((t[b-1])-(t[a-1]))

Measured memory_bytes: 8668
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ds := make([]int, n)
	for i := 0; i < n; i++ {
		var d int
		fmt.Scan(&d)
		ds[i] = d
	}
	sum := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			sum += ds[i]* ds[j]
		}
	}
	fmt.Println(sum)
}


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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> L(n * 2);
  for(int i = 0; i < n * 2; i++){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans = 0;
  for(int i = 0; i < n * 2; i += 2){
    ans += L[i];
  }
  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int a, b;
    cin >> a >> b;

    int ans[100][100];
    rep(i, 100) {
        rep(j, 100) {
            ans[i][j] = (i < 50)? 0 : 1;
        }
    }
    for (int i = 1; i <= a - 1; i++) {
        int x = i / 50;
        int y = i % 50;
        ans[51 + x * 2][2 * y - 1] = 0;
    }
    for (int i = 1; i <= b - 1; i++) {
        int x = i / 50;
        int y = i % 50;
        ans[1 + x * 2][2 * y - 1] = 1;
    }

    cout << "100 100" << endl;
    rep(i, 100) {
        rep(j, 100) {
            if (ans[i][j]) cout << "#";
            else cout << ".";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

var e [][]int
var path []int
var ind []int

func dfs(v, d int) int {
	if ind[v] != 0 {
		return ind[v]
	}
	ind[v] = d
	path = append(path, v)
	for _, t := range e[v] {
		x := dfs(t, d+1)
		if x > 0 {
			return x
		}
	}
	path = path[0 : d-1]
	ind[v] = 0
	return 0
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	e = make([][]int, n)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		a--
		b--
		e[a] = append(e[a], b)
	}

	// find a cycle
	for i := 0; i < n; i++ {
		ind = make([]int, n)
		x := dfs(i, 1)
		if x > 0 {
			path = path[x-1:]
			break
		}
	}

	if len(path) == 0 {
		fmt.Println("-1")
		return
	}

	visited := make([]bool, n)
	erased := make([]bool, n)
	next := make([]int, n)
	for i := 0; i < n; i++ {
		erased[i] = true
	}
	for i := 0; i < len(path); i++ {
		v := path[i]
		erased[v] = false
		next[v] = path[(i+1)%len(path)]
	}
	v := path[0]
	for !visited[v] {
		for _, u := range e[v] {
			if erased[u] {
				continue
			}
			nv := next[v]
			for nv != u {
				erased[nv] = true
				nv = next[nv]
			}
			next[v] = u
		}
		visited[v] = true
		v = next[v]
	}

	var ans []int
	nv := v
	for {
		ans = append(ans, nv)
		nv = next[nv]
		if nv == v {
			break
		}
	}
	fmt.Println(len(ans))
	for i := 0; i < len(ans); i++ {
		fmt.Println(ans[i] + 1)
	}
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	map<int,int> m;
	int extra=0;
	int i=0;
	while(m.find(i)==m.end())
	{
		m[i]=extra;
		i=a[i]-1;
		extra++;
	}
	ll x=m[i];
	ll y=extra-x;
	//cout<<x<<" "<<y;
	if(k>m[i])
	{
		k-=m[i];
		k=k%y;
		i=0;
		while(x--)
		{
			i=a[i]-1;
		}
		//cout<<i<<" ";
		while(k--)
		{
			i=a[i]-1;
		}
	}
	else
	{
		i=0;
		while(k--)
		{
			i=a[i]-1;
		}
	}
		cout<<i+1<<"\n";
	
	return 0;
}

Measured memory_bytes: 14440
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();
            int x = in.nextInt();
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                int ai = in.nextInt();
                cnt++;
                cnt += (d - 1) / ai;
            }
            out.print(cnt + x);


        }

    }
}



Measured memory_bytes: 21972
N=int(input())
S=input()

LW=[0]*N
for i in range(1,N):
  if S[i-1]=="W":
    LW[i]=LW[i-1]+1
  else:
    LW[i]=LW[i-1]

RE=[0]*N
for i in range(N-2,-1,-1):
  if S[i+1]=="E":
    RE[i]=RE[i+1]+1
  else:
    RE[i]=RE[i+1]

ans=10**9
for i in range(N):
  ans=min(ans,LW[i]+RE[i])
print(ans)


Measured memory_bytes: 75088
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

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

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

	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		while (H[i] > 0)
		{
			for (int j = i; j < n; ++j)
			{
				if (H[j] > 0)
					--H[j];
				else
					break ;
			}
			++ans;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 3588
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/any.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto i:v)output(i);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define sum(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
mat warshallFloyd(lint V,lint E,vec a,vec b,vec c){
    mat diff(V,vec(V,INF));
    rep(i,E){
        diff[a[i]][b[i]]=c[i];
        diff[b[i]][a[i]]=c[i];
    }
    rep(k,V)rep(i,V)rep(j,V){
        diff[i][j]=min(diff[i][j],diff[i][k]+diff[k][j]);
    }
    return diff;
}
int main(){
    lint n,m,R;
    cin>>n>>m>>R;
    vec r(R);
    rep(i,R)cin>>r[i];
    vec a(m),b(m),c(m);
    rep(i,m)cin>>a[i]>>b[i]>>c[i];
    rep(i,m){
        a[i]--;
        b[i]--;
    }
    mat diff=warshallFloyd(n,m,a,b,c);
    sort(all(r));
    lint ans=INF;
    do{
        lint cnt=0;
        rep(i,R-1){
            cnt+=diff[r[i]-1][r[i+1]-1];
        }
        ans=min(ans,cnt);
    }while(next_permutation(all(r)));
    cout<<ans;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a,b,c,d,e;
	scanf("%lld%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d,&e);
	n--;
	a=n/a;
	b=n/b;
	c=n/c;
	d=n/d;
	e=n/e;
	printf("%lld",max(a,max(b,max(c,max(d,e))))+5);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int nedan,money,manzoku,total;
  
  	scanf("%d",&nedan);
  	scanf("%d",&money);
  	scanf("%d",&manzoku);

 	total = money / nedan;
  	
  	if (total >= manzoku){
      	printf("%d",manzoku);
    }else{
      printf("%d",total);
    }
	
      
        
	return 0;
  
}



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

int n,m;

void test() {

	cin >> n;
	cin >> m;
	cout << n/m + (n%m != 0 );
}

signed main() {

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	#endif

	test();

	return 0;

}

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

int main(){
	int x, n, i, j;
	cin >> x;
	cin >> n;
	int p[n];

	if(n == 0){
		cout << x << endl;
		return 0;
	}

	for(int i=0; i<n; i++){
		cin >> p[i];
	}

	i = 0;
	while(1){
		for(j=0; j<n; j++){
			if(p[j] == x+i){
				j = 0;
				break;
			}
		}
		if(j != 0){
			cout << x+i << endl;
			return 0;
		}
		if(i >= 0){
			i = i*(-1) - 1;
		}else {
			i = i * (-1);
		}
	}

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int ans = 0;

    for(int i = 1; i <= n; i++) {

        if(i%2 != 0) {
            int cnt = 0;
          	int j;
            for(j = 1; j*j <= i; j++) {
                if(i%j == 0) cnt++;
            }
            if(cnt==4 && j*j != i) ans++;
        }

    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
  char op;
  int a,b,i;

  for(i=0;;i++) {
    scanf("%d %c %d\n",&a,&op,&b);

    if(op == '?') break;
    
    switch (op) {
      case '+': 
      printf("%d\n",a+b);
      break;
      
      case '-':
      printf("%d\n",a-b);
      break;
      
      case '*':
      printf("%d\n",a*b);
      break;
      
      case '/':
      printf("%d\n",a/b);
      break;
    }
    
  }

  return 0;
}


Measured memory_bytes: 2024
#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define INF 1LL << 60;
#include <string>
#include <typeinfo>
#include <bitset>

int main(){
  string S;
  ;
  cin >> S;
  ll ans;
  
  for(int i=0; i < (1 << S.size()-1); i++){
    int sum = S[0] - '0';
    vector<char> op(3);
    for(int j=0; j < S.size()-1; j++){
      if((i >> j & 1) == 1){
        sum += S[j+1] - '0';
        op[j] = '+';
      }
      else{
        sum -= S[j+1] - '0';
        op[j] = '-';
      }
    }
    if(sum == 7){
      for(int i=0; i<3; i++){
        cout << S[i] << op[i];
      }
      cout << S[3] << "=7" << endl;
      return 0;
    }
  }
  return 0;
}

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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, M;
VI G[200011];
char S[200011];
int D[200011][2];
bool del[200011];

void MAIN() {
    scanf("%d%d%s", &N, &M, S);
    REP (i, M) {
	int x, y;
	scanf("%d%d", &x, &y);
	x--; y--;
	G[x].push_back(y);
	G[y].push_back(x);
    }
    REP (i, N) {
	EACH (e, G[i]) D[i][S[*e]-'A']++;
    }

    VI st;
    REP (i, N) if (D[i][0] == 0 || D[i][1] == 0) {
	st.push_back(i);
	del[i] = true;
    }
    while (!st.empty()) {
	int v = st.back(); st.pop_back();
	EACH (e, G[v]) if (!del[*e]) {
	    D[*e][S[v]-'A']--;
	    if (D[*e][S[v]-'A'] == 0) {
		st.push_back(*e);
		del[*e] = true;
	    }
	}
    }

    int cnt = 0;
    REP (i, N) if (!del[i]) cnt++;
    if (cnt >= 2) puts("Yes");
    else puts("No");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

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

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int dx[4] ={ 1, 0, -1, 0 };
int dy[4] ={ 0, 1, 0, -1 };

int main()
{
    ll n;
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++)
    if(i%3!=0&&i%5!=0)
    ans+=i;
    cout<<ans<<endl;

}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdlib.h>
using namespace std;

#define INF 1e9
#define PI 3.141592653589793238
typedef long long ll;

int main() {
    int n,m; cin>>n>>m;
    cout<<(n+m-1)/m<<endl;


    return 0;
}

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

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

    if(s[2] == s[3] && s[4] == s[5]) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


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

int N;
vector<long long> semi_753;

void Make_semi_753(string n) {
  if (n != "") {
    if (stoll(n) > N) return;
    semi_753.push_back(stoi(n));
  }
  Make_semi_753(n + "3");
  Make_semi_753(n + "5");
  Make_semi_753(n + "7");
}

int main() {
  cin >> N;
  Make_semi_753("");
  sort(semi_753.begin(), semi_753.end());

  int ans = 0;
  for (int i = 0; i < semi_753.size(); i++) {
    string n = to_string(semi_753[i]);
    int three = 0, five = 0, seven = 0;
    for (int i = 0; i < n.size(); i++) {
      if (n[i] == '3') three++;
      else if (n[i] == '5') five++;
      else seven++;
    }

    if (three >= 1 && five >= 1 && seven >= 1) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 640
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]

f_row = []
f_col = []
for i in range(h):
    for j in range(w):
        if a[i][j] != '.':
            break
        if j == w-1:
            f_row.append(i)
for j in range(w):
    for i in range(h):
        if a[i][j] != '.':
            break
        if i == h-1:
            f_col.append(j)

for i in range(h):
    if i in f_row:
        continue
    for j in range(w):
        if j not in f_col:
            print(a[i][j], end='')
    print()


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };


LL ans = 0LL;

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

	LL N; 
	cin >> N;
	
	cout << "Christmas";
	int cnt = 25 - N;
	FOR(i, 0, cnt) {
		cout << " Eve";
	}
	cout << endl;

	return 0;
}


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

int main(){
	int K;
	cin >> K;
	int ans=0;
	for(int i=1;i<=K;i++)for(int j=1;j<=K;j++)for(int k=1;k<=K;k++)ans+=gcd(gcd(i,j),k);
	cout << ans << endl;
	return 0;
}

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

class Program
{

    public void Slove()
    {   
        var inputs = Console.ReadLine().Split();
        int k = int.Parse(inputs[0]);
        int sellRate = int.Parse(inputs[1]);
        int buyRate = int.Parse(inputs[2]);
        int add = buyRate - sellRate;
        if(add <= 2)
        {
            Console.WriteLine(k + 1);
            return;
        }
        int sbCount = (k - sellRate + 1) / 2;
        long biscuit = (long)sbCount * add + 1 + (k - sbCount * 2);

        Console.WriteLine(biscuit);

    }
    static void Main(string[] args)
    {
        var p = new Program();
        p.Slove();
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define MAX 1000
main() {
	int n, m, P[MAX], sum;
	while(1) {
		cin >> n >> m;
		if ( n == 0 && m == 0 ) break;
		sum = 0;
		for ( int i = 0; i < n; i++ ) {
			cin >> P[i];
			sum += P[i];
		}
		sort(P, P+n, greater<int>());
		for ( int i = m-1; i < n; i += m ) sum -= P[i];
		cout << sum << endl;
	}
}

Measured memory_bytes: 3004
#include<stdio.h>
int main(void){
  int N;
  scanf("%d",&N);
  int D1[N],D2[N];
  for(int i=0;i<N;i++){
    scanf("%d%d",&D1[i],&D2[i]);
  }
  int sum=0;
  for(int j=0;j<N-2;j++){
    if(D1[j]==D2[j] && D1[j+1]==D2[j+1] && D1[j+2]==D2[j+2]){
      sum=1;
      break;
    }
  }
  if(sum==1){
    printf("Yes");
  }
  else
    printf("No");
  return 0;
}

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



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

    long long sum=0;
    for (int i=1;i<=n;i++)
    {
        if (i%3==0||i%5==0)
            ;
        else sum+=i;
    }
    cout<<sum<<'\n';    
    return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int, uint>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 3;

void solve(){
    int H, W;
    cin >> H >> W;
    string A[101];
    for(int y = 0; y < H; ++y) cin >> A[y];

    map<char, int> cnt;
    for(int y = 0; y < H; ++y){
        for(int x = 0; x < W; ++x){
            ++cnt[A[y][x]];
        }
    }

    if (H % 2 == 0 && W % 2 == 0) {
        for(auto p : cnt){
            if (p.second % 4 != 0){
                cout << "No\n";
                return;
            }
        }
        cout << "Yes\n";
        return;
    }

    map<int, int> c;
    for(auto p : cnt){
        ++ c[p.second % 4];
    }

    if (H % 2 == 1 && W % 2 == 1) {
        if( (c[3] > 0)
        || (c[1] != 1)
        || (c[2] > (H - 1) / 2 + (W - 1) / 2) ){
            cout << "No\n";
            return;
        }
        cout << "Yes\n";
        return;
    }

    if (W % 2 == 1){
        swap(H, W);
    }

    if( (c[1] || c[3])
    || (c[2] > W / 2)){
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
    return;
}

int main() {
    #ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
    #else

    solve();

    #endif
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#define MAX_N 100005
using namespace std;
typedef long long ll;
typedef pair<int ,bool> p;
p fa[MAX_N];
int main(){
    int n,q;
    fa[1].first = 1;
    fa[1].second = true;
    while(~scanf("%d%d",&n,&q)&&n>0){
        ll ans = 0;
        for(int i = 2;i <= n;i++){
            scanf("%d",&fa[i].first);
            fa[i].second = false;
        }
        getchar();
        for(int i = 0;i<q;i++){
            char ch;int a;
            scanf("%c%d",&ch,&a);
            getchar();
            if(ch =='Q'){
                while(fa[a].second==false){
                    a = fa[a].first;
                }
                ans += a;
            }
            else{
                fa[a].second = true;
            }

        }
        printf("%lld\n",ans);
    }
}



Measured memory_bytes: 3924
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
    int x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
    return x*f;
}
inline ll readll(){
    ll x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
    return x*f;
}
const int maxn=100+10;
int a[maxn];
int main(){
	int n=read(),sum=read(),cnt=0;
	REP(i,1,n) a[i]=read();
	sort(a+1,a+n+1);
	REP(i,1,n) if(sum>=a[i]) sum-=a[i],++cnt;
	if(cnt==n && sum) --cnt;
	printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<utility>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;
using ll = long long;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

const long long MOD = 1e9+7;
const long long MAX = 3e5+1;
const long double PI = acos(-1);

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

    long double A, B, H, M;
    in(A); in(B); in(H); in(M);

    long double a1, a2, angle;
    a1 = (H + M/60.0L) / 12.0L;
    a2 = M/60.0L;
    angle = (long double) max(0.L, min(abs(a1-a2), 1.L - abs(a1 - a2)));
    angle *= 2L;
    angle *= PI;

    double ans = sqrt(A*A + B*B - 2*A*B*cos(angle));
    out(ans);


    return 0;
}


Measured memory_bytes: 4184
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    if(t == 1){
        cout << k - 1 << "\n";
        return 0;
    }
    for(auto&& i : a){
        cin >> i;
    }
    sort(rbegin(a), rend(a));
    int ans = max(0, a[0] - (k - a[0] + 1));
    
    cout << ans << "\n";
}

Measured memory_bytes: 256
n = int(input())
l = sorted(list(map(int, input().split())))
cnt = 0
for i in range(n):
    k = i + 1
    for j in range(i + 1, n):
        while k + 1 < n and l[k + 1] < l[i] + l[j]:
            k += 1
        cnt += k - j
print(cnt)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S, T; cin >> S >> T;
  int Ns = S.size();
  int Nt = T.size();
  int ans = Nt;
  REP(i, Ns-Nt+1){
    int cnt = 0;
    REP(j, Nt){
      if(S[i+j] != T[j]) cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10 , OO = 0x3f3f3f3f ;
const int mod = 1e9 + 7;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int n , m , k;

int main()
{
   // startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    /*
        3 4 240
        60 90 120 -- SumA : 60 150 270
        80 150 80 150 -- SumB : 0 80 230 310 460
                                0 1   2   3   4

    */
    char c;
    scanf("%c" , &c);
    if(c >= 'A' && c <= 'Z')
        puts("A");
    else 
        puts("a");



    return 0;
}

Measured memory_bytes: 3648
n=int(input())
c=list(input())
r=[]
w=[]
for i in range(n):
  if c[i]=='R':
    r.append(i)
  else:
    w.append(i)
r.reverse()
ans=0
for i in range(min(len(r),len(w))):
  if r[i]>w[i]:
    ans+=1
print(ans)

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

int main() {
  string s;
  int a;
  cin >> s;
  a = s.size();

  int count = 0;
  for (int i = 0; i < a; i++) {
    if (s.at(i) != s.at(a - i - 1)) {
      count++;
    }
  }

  cout << count / 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  bool flag = false;
  
  if (a == 5 && b == 7 && c == 5)
    flag = true;
  if (a == 7 && b == 5 && c == 5)
    flag = true;
  if (a == 5 && b == 5 && c == 7)
    flag = true;
  
  if(flag){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    long long int n, a[200010], b[200010], c[200010];

    cin >> n;

    for (int i = 0; i < n; i++)
        b[i] = 0;

    // a[i]: number on i'th ball
    // b[i]: count of balls with number i
    // c[i]: number of ways to pick 2 balls with number i

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

    long long int t = 0;        // total number of ways

    for (int i = 0; i < n; i++)
    {
        c[i] = ((b[i] * (b[i]-1)) / 2);
        t += c[i];
    }

    for (int i = 0; i < n; i++)
    {
        long long int x = b[a[i]]-1;

        cout << t - c[a[i]] + ((x * (x-1)) / 2) << "\n";
    }

    return 0;
}

Measured memory_bytes: 7296
#include<stdio.h>
#define MAX 1000000
#define FOR(i,m,n) for(i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
char f[MAX+1];
void getprime()
{
  int i,j;
  FOR(i,2,1000)if(!f[i])for(j=i*i;j<=MAX;j+=i)f[j]=1;
}
int max(int a,int b){return a>b?a:b;}
int main(void)
{
  int n,x,c[30],i,j,res;
  getprime();
  for(;;){
    scanf("%d%d",&n,&x);if(!n)break;
    int dp[MAX+1]={0};
    rep(i,n)scanf("%d",c+i),dp[c[i]]=c[i];res=0;
    rep(i,n){
      FOR(j,c[i],x+1){
	dp[j]=max(dp[j],dp[j-c[i]]+c[i]);
	if(!f[dp[j]]&&res<dp[j])res=dp[j];
      }
    }
    if(res)printf("%d\n",res);else puts("NA");
  }
  return 0;
}

Measured memory_bytes: 5292
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    string s;int w;
    cin>>s>>w;
    int n=sz(s);
    rep(i,n) {
        if(i%w==0) cout<<s[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		String input = scanner.nextLine();

		String AB[] = input.split(" ");

		int A = Integer.parseInt(AB[0]);

		int B = Integer.parseInt(AB[1]);

		int[] result = new int[3];

		result[0] = A + B;

		result[1] = A - B;

		result[2] = A * B;

		int max = result[0];

		for (int i:result){
			if(i > max) {
				max = i;
			}
		}

		System.out.println(max);
	}

}

Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main(void)
{
    int n;
    cin >>n;
    vector<int> costs;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        costs.push_back(tmp);
    }

    vector<long long> dp(n+1, LLONG_MAX);
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= 2; j++){
            if(i-j < 0){
                continue;
            }
            dp[i] = min(dp[i], dp[i-j]+abs(costs[i] - costs[i-j]));
        }
    }
    printf("%d\n", dp[n-1]);
    return 0;
}

Measured memory_bytes: 1528
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
Z = y[0]

if Z>=Y:
    Z = Y

if X<Z<=Y and x[N-1]<Z and y[M-1]>=Z:
    print('No War')
else:
    print('War')



Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long n,t,a,A=1,B=1,N;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> t >> a;
    N=max((A-1)/t,(B-1)/a)+1;
    A=N*t,B=N*a;
  }
  cout << A+B << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int INF=1e9+7;
int main(){
  vvll c(3,vll(3));
  rep(i,0,3){
    rep(j,0,3){
      cin>>c[i][j];
    }
  }
  bool ok=true;
  ll a12=c[1][0]-c[0][0],a23=c[2][0]-c[1][0];
  rep(i,1,3){
    if(c[1][i]-c[0][i]!=a12){ok=false;}
    if(c[2][i]-c[1][i]!=a23){ok=false;}
  }
  ll b12=c[0][1]-c[0][0],b23=c[0][2]-c[0][1];
  rep(i,1,3){
    if(c[i][1]-c[i][0]!=b12){ok=false;}
    if(c[i][2]-c[i][1]!=b23){ok=false;}
  }
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}


Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 2000100;



int main(){
        _
        int x,n; cin >> x>>n;
        vi a(n);
        rep(i,n)cin >> a[i];
        sort(all(a));
        int ans = inf,res = 0;
        rep1(i,-200,200){
            bool f = binary_search(all(a),i);
            if(f)continue;
            int p = abs(x-i);
            if(p<ans){
                res = i;
                ans = p;
            }
        }
        cout<<res<<endl;


return 0;
}



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

using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writerLn(int x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000]{ 1 };
vector<int>que;

void bfs(int u) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.back(); que.pop_back();
		for (int v : E[p]) {
			if (d[v] > d[p] && !ok[v]) {
				ok[v] = 1; cnt++; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	memset(d, -1, sizeof(d));
	d[0] = 0;
	deque<int>que;
	que.emplace_back(0);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (!~d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
		}
	}
	bfs(0);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]]);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 13584
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
using namespace std;

typedef long long ll;

int main(){
        ll N, M, num, Count=0;
        cin >> N >> M;
        vector<ll> A(N), B(N);
        priority_queue<ll> que;
        for(int i=0; i<N; i++){
                cin >> num;
                que.push(num);
        }
        for(int i=0; i<M; i++){
                num = que.top();
                num /= 2;
                que.pop();
                que.push(num);
        }
        while (!que.empty()) {
                Count += que.top();
                que.pop();
                }
        cout << Count;

}

Measured memory_bytes: 2936
s = int(input())
t = int(s**(1/2))
if s==1:
  print(0, 0, 1, 0, 0, 1)
elif t!=1 and s==t**2:
  t1 = t**2
  print(0, 0, t, 0, 0, t)
else:
  t1 = (t+1)**2
  t += 1
  t2 = abs(s-t1)
  ans = 0
  for i in range(int(t2**(1/2)), 0, -1):
    if t2%i==0:
      ans = i
      break
  print(0, 0, t, t2//ans, ans, t)

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

//const ll mod = 1000000007;
const ll INF = 1e9;
int N, M;
string S;

void solve() {
    //cout.precision(10);

    //N:no of squares
    //M:total roulette number
    //S:string of 0 and 1s

    cin >> N >> M >> S;

    //2 vector dist and MostLeft
    vector<int> dist(N + 1, INF);
    vector<int> MostLeft(N + 1, INF);
    dist[N] = 0;
    MostLeft[0] = N;

    int Next = N-1;
    int Left = N;

    int timer = 0;

    while(Next >= 0) {
        timer++;
        int newLeft = Left;

        while(Next >= Left - M && Next >= 0) {
            if(S[Next] == '0') {
                dist[Next] = timer;
                //why do this?
                newLeft = Next;
            }
            Next--;


        }

        //
        if(newLeft == Left) {
            cout << -1 << endl;
            return;
        }


        Left = newLeft;
        MostLeft[timer] = Left;

    }
    //end of while loop

    timer = dist[0];

    //what is this for
    for(int i = 0; i <= N; i++) {
        cerr << dist[i] << endl;
    }

    vector<int> ans;
    int now = 0;
    while(timer >= 1) {
        timer--;
        ans.push_back(MostLeft[timer] - now);
        now = MostLeft[timer];
    }

    //print out ans
    for(int i = 0; i < ans.size(); i++) {
        cout << ans[i];
        if(i + 1 != ans.size()) cout << " ";
    }
    cout << endl;
    return;
}

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


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

int main (){
    int N;
    int total = 0;
    cin >> N;

    int l[N], r[N];

    for(int i = 0; i < N; i++){
        cin >> l[i] >> r[i];
        total += (r[i] - l[i]) + 1;
    }

    cout << total << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

signed main(){
    int N;
    cin >> N;
    
    string S[N];
    int t[N];
    for(int i=0;i<N;i++){
        cin >> S[i] >> t[i];
    }
    string X;
    cin >> X;
    
    int tmp=0,ans=0;
    for(int i=0;i<N;i++){
        if(tmp>0) ans += t[i];
        if(S[i]==X) tmp++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
import itertools
k = int(input())
lun = [[1,2,3,4,5,6,7,8,9]]
lun_flatten = [1,2,3,4,5,6,7,8,9]
def l(n):
    tmp = lun[n-2]
    ans = []
    for i in tmp:
        a = int(str(i)[-1])
        t = 10 * i + a
        if a != 0:
            ans.append(t - 1)
        ans.append(t)
        if a != 9:
            ans.append(t+1)
    lun.append(ans)

i = 2
while len(lun_flatten) < k:
    l(i)
    lun_flatten =  list(itertools.chain.from_iterable(lun))
    i += 1

print(lun_flatten[k-1])

Measured memory_bytes: 13856
/*input
10
1 2 4 8 16 32 64 128 256 512
4
1 1 1 1
*/
#include "bits/stdc++.h"
#define db(x) cout<<#x<<"="<<(x)<<" "
#define el cout<<endl
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define re(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const int MXN = 1e6 + 10, MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
int n;
ll a[MXN], inv[MXN], sinv[MXN];
int main() {
    cin >> n;
    inv[1] = 1;
    rep(i, 2, n) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    rep(i, 1, n) sinv[i] = (sinv[i - 1] + inv[i]) % MOD;
    ll ans = 0;
    for (long long i = 1; i <= n; ++i)
    {
        cin >> a[i];
        ans = (ans + a[i] * (sinv[i] + sinv[n - i + 1] - 1))% MOD;
    }
    if (ans < 0) ans += MOD;
    rep(i, 1, n) ans = ans * i % MOD;
    cout << ans % MOD << endl;
    return 0;
}



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

using namespace std;
using llong = int;
using ldbl = long double;
using lpair = pair<llong, llong>;
using llpair = pair<lpair, llong>;

#define ALL(x) x.begin(), x.end()

class BIT
{
public:
    vector<int> bit;
    int M;

    BIT(int M):
        bit(vector<int>(M+1, 0)), M(M) {}

    int sum(int i) {
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, int x) {
        if (i > M) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }
};

int main() {
  llong N, Q;
  vector<llong> c;
  vector<llpair> rli;

  cin >> N >> Q;
  c.resize(N);
  rli.resize(Q);
  for (auto &in: c) {
    cin >> in;
  }
  for (int i = 0; i < Q; i++) {
    cin >> rli[i].first.second >> rli[i].first.first;
    rli[i].second = i;
  }
  sort(ALL(rli));

  vector<llong> ans(Q);
  BIT bit(N + 1);

  map<llong, llong> app;
  llong right = 1;
  for (auto now: rli) {
    lpair pos = now.first;
    llong id = now.second;
    while (right <= pos.first) {
      if (app.count(c[right-1])) {
        bit.add(app[c[right-1]], -1);
      }
      bit.add(right, 1);
      app[c[right-1]] = right;
      right++;
    }
    ans[id] = bit.sum(pos.first) - bit.sum(pos.second-1);
  }

  for (auto a: ans) {
    cout << a << endl;
  }

  return 0;
}

Measured memory_bytes: 38892
// C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;

int main()
{
    map<char, char>m;
    string s, t;

    cin >> s ;
    cin >> t;
    vector<int>start(26, -1);
    vector<int>goal(26, -1);
    bool ok = true;
    for (int i = 0; i < s.size(); i++) {
        
        int a = s[i] - 'a';
        int b = t[i] - 'a';

        if (start[a] != -1 || goal[b] != -1) {
            if (start[a] != b || goal[b] != a) {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            start[a] = b;
            goal[b] = a;
        }

        
    }

    
        cout << "Yes" << endl;

    
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3852
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n; cin >> n;
    string s; cin >> s;
    bool ok = false;
    for(int i = 0; i < s.size(); i++)
    {
        string t = s.substr(0, i);
        string u = s.substr(i);
        if(t == u) ok = true;
    }
    cout << (ok ? "Yes" : "No") << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    tmp = 100
    ans = 0
    while tmp < X:
        tmp = int(tmp*1.01)
        ans += 1
    print(ans)
resolve()

Measured memory_bytes: 63480