akhauriyash/Code-Regression huggingface dataset:
import random
from collections import defaultdict


class RollingHash():

    def __init__(self, S, b=3491, m=999999937):
        """任意の基数と法でハッシュを生成する"""
        n = len(S)
        self.prefix = prefix = [0] * (n+1)
        self.power = power = [1] * (n+1)
        self.b = b
        self.m = m
        for i in range(n):
            c = ord(S[i])
            prefix[i+1] = (prefix[i] * b + c) % m
            power[i+1] = (power[i] * b) % m
    
    def get(self, l, r):
        """S[l, r) のハッシュを求める"""
        return (self.prefix[r] - self.power[r-l] * self.prefix[l]) % self.m
    
    def concat(self, h1, h2, l2):
        """S1+S2 のハッシュを、それぞれのハッシュから求める"""
        return (self.power[l2] * h1 + h2) % self.m
    
    def lcp(self, l1, r1, l2, r2):
        """S[l1, r1) とS[l2, r2) の最大共通接頭辞を求める"""
        low = 0
        high = min(r1-l1, r2-l2) + 1
        while high - low > 1:
            mid = (high + low) // 2
            if self.get(l1, l1 + mid) == self.get(l2, l2 + mid):
                low = mid
            else:
                high = mid
        return low


def read():
    N = int(input().strip())
    S = input().strip()
    return N, S


def solve(N, S):
    ans = []
    for m in [999999937, 10**9+7]:
        b = random.randint(10000, m-1)
        rh = RollingHash(S, b=b, m=m)
        low = 0
        high = (N+1) // 2 + 1
        dmax = defaultdict(int)
        dmin = defaultdict(int)
        while high - low > 1:
            dmax.clear()
            dmin.clear()
            mid = (high + low) // 2
            for i in range(0, N-mid+1):
                h = rh.get(i, i+mid)
                dmax[h] = max(dmax[h], i+1)
                dmin[h] = max(dmin[h], N+1-i)
            is_match = False
            for h in dmax.keys():
                if dmax[h] - (N+2 - dmin[h]) >= mid:
                    is_match = True
                    break
            if is_match:
                low = mid
            else:
                high = mid
        ans.append(low)
    return min(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Measured memory_bytes: 5700
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  int len,minv = 1000;
  string s;
  cin >> s;
  len = s.size();
  for (int i = 0; i < len - 2; i++){
    int tmp = (s[i] -'0') * 100 + (s[i+1] - '0') * 10 + s[i+2] -'0';
    minv = min(minv,abs(tmp - 753));
  }
  cout << minv <<'\n';
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    ll n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>a>>b;

    ll res = 0;

    if(b-a<10){
        for(ll i=a;i<=b;i++)
            res^=i;
    }

    else {
        for(ll i=a;i%4;i++)
            res^=i;
        for(ll i=b/4*4;i<=b;i++)
            res^=i;
    }

    cout<<res<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if((a > c && b < c) || (a < c && b > c)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {
	string s;
	string t;

	cin >> s >> t;
	bool yes = false;

	for (int i = 0; i < s.size(); i++) {
		int count = 0;
		for (int j = 0; j < s.size(); j++) {
			if (s[j] == t[(i + j) % s.size()])
				count++;
		}
		if (count == s.size())
			yes = true;
	}


	if (yes) {
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

#define MAX_V 200

int G[MAX_V][MAX_V];

int par[MAX_V];
int rnk[MAX_V];

// n要素で初期化
void init(int n){
	for(int i = 0; i < n; i++){
		par[i] = i;
		rnk[i] = 0;
	}
}

// 木の根を求める
int find(int x){
	if(par[x] == x){
		return x;
	}
	return par[x] = find(par[x]);
}

// xとyの属する集合を併合
void unite(int x, int y){
	int x_par = find(x);
	int y_par = find(y);
	if(x_par == y_par){
		return;
	}
	
	if(rnk[x_par] < rnk[y_par]){
		par[x_par] = y_par;
	}else{
		par[y_par] = x_par;
		if(rnk[x_par] == rnk[y_par]){
			rnk[x_par]++;
		}
	}
}

bool same(int x, int y){
	return (find(x) == find(y));
}

struct edge{
	long long int u, v, cost;
};

bool comp(const edge& e1, const edge& e2){
	return e1.cost < e2.cost;
}

int V, E;
vector<edge> es;

long long int kruskal(int ind){
	init(V);
	long long int res = 0;
	int cnt = 0;
	for(int i = 0; i < E; i++){
		edge e = es[i + ind];
		if(!same(e.u, e.v)){
			cnt++;
			unite(e.u, e.v);
			res = e.cost;
		}
	}
	if(cnt < V - 1){
		return INF;
	}
	return res;
}

int main(){
	
	while(true){
		cin >> V >> E;
		
		if(V == 0){
			break;
		}
		
		es.clear();
		
		for(int i = 0; i < E; i++){
			edge e;
			cin >> e.u >> e.v >> e.cost;
			e.u--;
			e.v--;
			es.push_back(e);
			e.cost = INF + e.cost;
			es.push_back(e);
		}
		
		sort(es.begin(), es.end(), comp);
		
		long long int ans = INF;
		
		for(int i = 0; i < E; i++){
			long long int mini = es[i].cost;
			long long int maxi = kruskal(i);
			ans = min(ans, maxi - mini);
		}
		
		if(ans > 100000){
			cout << "-1" << endl;
		}else{
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3424
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll N;

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

  cin >> N;

  ll ans = 0;
  ll t = N;
  ll bit = 0, digit = 0;
  while (t > 0) {
      ans += t%10;
      if (t < 10) digit = t;
      t /= 10;
      ++bit;
  }

  ans = max(ans, (digit-1) + 9*(bit-1));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
ans = [0] * n
# 偶奇のカウント
cnt_even = 0
cnt_odd = 0
# 'RL'が見つかったときの'R'の要素番号
index = 0
for i in range(n - 1):
    if s[i] == 'R' and s[i + 1] == 'L':
        index = i
    if i % 2:
        cnt_odd += 1
    else:
        cnt_even += 1
    # 'LR'部が境界
    if s[i] == 'L' and s[i + 1] == 'R' or i == n - 2:
        # 要素右端のコーナーケース
        if i == n - 2:
            if (i + 1) % 2:
                cnt_odd += 1
            else:
                cnt_even += 1
        if index % 2:
            ans[index] += cnt_odd
            ans[index + 1] += cnt_even
        else:
            ans[index] += cnt_even
            ans[index + 1] += cnt_odd
        cnt_even = 0
        cnt_odd = 0
print(*ans, sep=' ')


Measured memory_bytes: 6400
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
using namespace std;
const long long INF = 1LL << 60;    // 1.15x10^18
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;

vector<long long> dijkstra(const Graph &g, int s) {
    vector<long long> dist(g.size(), INF);
    using Pi = pair<long long, int>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    dist[s] = 0; que.emplace(dist[s], s);
    while (!que.empty()) {
        long long cost; int u; tie(cost, u) = que.top(); que.pop();
        if (dist[u] < cost) continue;
        for (auto &e: g[u]) {
            int v; long long nc; tie(v, nc) = e;
            if (chmin(dist[v], dist[u] + nc)) que.emplace(dist[v], v);
        }
    }
    return dist;
}

int main() {
    int n; cin >> n;
    Graph g(n);
    for (int i = 0; i < n - 1; i++) {
        int u, v, w; cin >> u >> v >> w; u--, v--;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
    }
    auto d = dijkstra(g, 0);
    for (int i = 0; i < n; i++) {
        cout << d[i] % 2 << endl;
    }
    return 0;
}

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

int main() {
  string str = "Good";
  int n, l, result;
  cin >> n >> l;
  if(l >= 0){
    result = (n - 1) * (l + 1 + l + n - 1) / 2;
  }else if(l < 0 && l + n - 1 > 0){
    result = n * (l + l + n - 1) / 2;
  }else{
    result = (n - 1) * (l + l + n - 2) / 2;
  }
  cout << result << endl;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
for i in range(N+1):
    for j in range(N - i + 1):
        if i * 10000 + j * 5000 + (N - i - j) * 1000 == Y:
            print(i, j, N - i - j)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3064
import java.util.Scanner;

class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();

		if((a * b) % 2 ==0)
			System.out.print("Even");
		else
			System.out.print("Odd");

	}
}

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

std::vector<char> vec, vec2;
std::string s1, s2;
int main() {
    std::cin >> s1 >> s2;
    std::sort(s1.begin(), s1.end());
    std::sort(s2.begin(), s2.end());
    std::reverse(s2.begin(), s2.end());
    if (s1 < s2) {
        std::cout << "Yes" << std::endl;
        return 0;
    }
    else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<ll,ll,ll,ll> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vs in(n);
	rep(i,n)cin>>in[i];
	cout<<string(m+2,'#')<<endl;
	rep(i,n)cout<<"#"<<in[i]<<"#"<<endl;
	cout<<string(m+2,'#')<<endl;
}










Measured memory_bytes: 256
#include<iomanip>
#include<string>
#include<math.h>
#include <algorithm>
#include<vector>
#include <stdlib.h>
#include<iostream>
using namespace std;
int main(){
    vector<int> a(1000);
    int N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++)
    {
        cin>>a[i];
    }
    stable_sort(&a[0],&a[N]);
    int sum =0;
    for(int i=0;i<K;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
        return 0;
}




Measured memory_bytes: 3604
// abc079_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string N;
    cin >> N;

    if ((N[0] == N[1] && N[1] == N[2]) || (N[2] == N[3] && N[1] == N[2])){
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}


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

void print_ans(bool flag){
    if(flag){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }   
}

int main(){
    long x;
    cin >> x;
    string s = to_string(x);
    int sum = 0;
    for(int i = 0; i < s.size(); i++){
        sum += s[i] - '0';
    }
    print_ans(x % sum == 0);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] K = Console.ReadLine().ToCharArray();
            Console.WriteLine(K[0]==K[2]?"Yes":"No");
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int[] arr = getArray(str);
            var v = arr.ToList();
            v.Sort(); v.Reverse();
            int i = 0;
            foreach (var s in v)
            {
                Console.Write(s);
                Console.Write(++i == v.Count ? '\n' : ' ');
            }
        }

        static int[] getArray(string[] strs)
        {
            var list = new List<int>();
            foreach(var v in strs)
            {
                list.Add(int.Parse(v));
            }
            return list.ToArray();
        }
    }
}

Measured memory_bytes: 18196
//hail to jwalaji
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
    lli n;
    cin>>n;
    double arr[n];
    for(lli i=0;i<n;i++){
        cin>>arr[i];
    }
    double dp[n+1][n+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1.0;
    for(lli i=1;i<=n;i++){
        for(lli j=0;j<=n;j++){
            if(j==0){
                dp[i][j]=dp[i-1][j]*(1-arr[i-1]);
            }
            else{
                dp[i][j]=dp[i-1][j-1]*arr[i-1]+dp[i-1][j]*(1-arr[i-1]);
            }
        }
    }
    /*for(lli i=0;i<=n;i++){
        for(lli j=0;j<=n;j++){
           cout<<dp[i][j]<<"      ";
        }cout<<endl;
    }*/
    double answer=0.0;
    for(lli j=(n+1)/2;j<=n;j++){
        answer+=dp[n][j];
    }
    cout<<setprecision(10)<<answer<<endl;
return 0;
}


Measured memory_bytes: 74104
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n,k;
  cin >> n >> k;
  ll a[n];
  REP(i,n) cin >> a[i];
  ll cnt[40];
  fill(cnt,cnt+40,0);
  REP(j,40){
    REP(i,n){
      if(a[i]>>j&1) cnt[j]++;
    }
  }
  k++;
  ll ans = 0;
  REP(j,40){
    if(!(k>>j&1)) continue;
    ll tmp = 0;
    //jビット目は0、j-1ビット目までは最適、j+1ビット目からはKと同じ
    REP(m,40){
      if(m<j){
        tmp += (1LL<<m)*max(cnt[m],n-cnt[m]);
      }else if(m>j){
        tmp += (k>>m&1) ? (1LL<<m)*(n-cnt[m]) : (1LL<<m)*cnt[m];
      }else{
        tmp += (1LL<<m) * cnt[m];
      }
    }
    ans = max(tmp,ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long int ll;
typedef unsigned long long int ull;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  string s,t;
  cin >>b>>a;
  if(b<10)a+=100*(10-b);
  cout <<a;
}

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define in1(n) cin>>n;
#define in2(n, k) cin>>n>>k;
#define in3(n, k, s) cin>>n>>k>>s;
#define scn(t) scanf("%d", &t)
#define scnld(t) scanf("%ld", &t)
#define scnlld(t) scanf("%lld", &t)
#define scnc(t) scanf("%c", &t)
#define scns(t) scanf("%s", t)
#define scnf(t) scanf("%f", &t)
#define scnlf(t) scanf("%lf", &t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define nloop(i, j, k, in) for (int i = j; i < k; i += in)
#define rloop(i, j, k, in) for (int i = j; i >= k; i -= in)
#define rep(i, j) nloop(i, 0, j, 1)
#define rrep(i, j) rloop(i, j, 0, 1)
#define inar(n, a) \
    rep(i, n)\
        cin>>a[i];
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define fast  \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
const double pi = acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

int main()
{
    fast
    int64 a, b ,n;
    in3(a, b, n)
    int64 x;
    if(n < b)
        x = n;
    else
        x = b-1;
    cout << floor(a * (1.0*x / b));
    return 0;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<int>> f(n, vector<int>(n, -1));
    for (int i = 0; i < n; ++i) {
        int m;
        cin >> m;
        for (int j = 0; j < m; ++j) {
            int x, y;
            cin >> x >> y;
            --x;
            f[i][x] = y;
        }
    }
    int ans = 0;
    auto check = [&](int s) {
        for (int i = 0; i < n; ++i)
            if (s >> i & 1)
                for (int j = 0; j < n; ++j)
                    if (f[i][j] != -1 && f[i][j] != (s >> j & 1))
                        return false;
        return true;
    };
    for (int s = 0; s < (1 << n); ++s)
        if (check(s))
            ans = max(ans, __builtin_popcount(s));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
	int n = 0, k = 0;
	scanf("%d %d", &n, &k);
	int w[100000];
	int max = 0;
	for (int i = 0; i < n; i++){
		scanf("%d", &w[i]);
		if (max < w[i]) max = w[i];
	}
	int p = 0;
	// pの最小値
	for ( int i = 0; i < n; i++){
		p += w[i];
	}
	int p_l = p;
	p /= k;
	if (p < max) p = max;
	int p_s = p;
	// 2分法で探索
	while(p_s < p_l){
		int sum = 0;
		int truck = 1;
		for(int i = 0; i < n; i++){
			sum += w[i];
			if( sum > p ) {
				sum = w[i];
				truck++;
				if (truck > k) break;
			}
		}
		if (truck <= k)  {
			p_l = p;
			p = (p_l + p_s) / 2;
		}
		else {
			p_s = p+1;
			p = (p_l + p_s) / 2;
		}
	}

	printf("%d\n", p_s);
}


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


int main(){long N;
cin >> N;
vector<long> a(N + 1);
erep(i, N) cin >> a.at(i);
vector<long> sum1(N + 1), sum2(N + 1);
rep(i, N){
    sum1.at(i + 1) = sum1.at(i) + a.at(i + 1);
}
sum2.at(N) = a.at(N);
for(long i = N; i >= 1; i--){
    sum2.at(i - 1) = sum2.at(i) + a.at(i - 1);
}
long ans = 1e10;
erep(i, N - 1){
    ans = min(ans, abs(sum1.at(i) - sum2.at(i + 1)));
}
// cout << sum2.at(6) << endl;
// cout << sum2.at(5) << endl;
cout << ans << endl;
return 0;
}



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

using namespace std;

int main() {
    int a, b, c;
    map < int, int> mp;
    scanf("%d %d %d", &a, &b, &c);
mp[a]++;
mp[b]++;
mp[c]++;
if (mp[5] == 2 & mp[7] == 1) printf("YES\n");
else printf("NO\n");
return 0;
}

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

using namespace std;

// Function come here..

int main(int argc, char **argv)
{
    // Problem solution come here...
    int a, b;
    cin >> a >> b;

    int r = a * b;
    r *= a * b;

    if (r % 2 != 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto &i : a) {
		cin >> i;
	}
	int alice = 0, bob = 0;
	for (int i = 0; i < n; i++) {
		auto itr = max_element(a.begin(), a.end());
		((i % 2 == 0) ? alice : bob) += *itr;
		a.erase(itr);
	}
	cout << alice - bob << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
ll arr[200005];
ll dp[200005][3];
bool vis[200005][3];
int n;
int bad;
ll fun(int pos,int nisi)
{
    if(pos>=n)
    {
        return 0;
    }
    if(vis[pos][nisi])
    {
        return dp[pos][nisi];
    }
    ll res=-1e18;
    if(nisi==0)
    {
        res=max(res,arr[pos]+fun(pos+2,nisi));
        res=max(res,fun(pos+1,1));
        if(bad==2)
        {
            res=max(res,fun(pos+2,bad));
        }
    }
    else if(nisi==bad)
    {
        res=max(res,arr[pos]+fun(pos+2,bad));
    }
    else
    {
        res=max(res,arr[pos]+fun(pos+2,nisi));
        res=max(res,fun(pos+1,bad));
    }
    vis[pos][nisi]=1;
    return dp[pos][nisi]=res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    if(n%2==0)
    {
        bad=1;
    }
    else
    {
        bad=2;
    }
    cout<<fun(0,0)<<endl;
    return 0;
}


Measured memory_bytes: 16640
import math
a, b, x = map(int,input().split())
if x >= a**2*b/2:
    y = (2*(a**2*b - x)) / a**3
    print(math.degrees(math.atan(y)))
else:
    y = (a*(b**2)) / (2*x)
    print(math.degrees(math.atan(y)))


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
typedef long long int ll;

int main(){
    int a, ans = 0 ;
    string x, y ;
    cin >> x;
    cin >> y;
    a = x.length();
    for (int i = 0;i < a;i++ ){
        if(x[i] != y[i]) ans++;

    }
    cout << ans << endl;

    
}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
	//*
	int n, k;
	cin >> n >> k;
	vl h(n);
	rep (i, n) cin >> h[i];
	sort(all(h));
	reverse(all(h));
	int i = 0;
	while (k) {
		i++;
		k--;
	}
	ll ans = 0;
	while (i < n) {
		ans += h[i];
		i++;
	}
	cout << ans << endl;
	//*/
}

Measured memory_bytes: 1792
use std::io::{BufRead, Read};

pub struct Scanner<R>
where
    R: BufRead,
{
    reader: R,
}

impl<R> Scanner<R>
where
    R: BufRead,
{
    pub fn new(reader: R) -> Self {
        Scanner { reader: reader }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: ::std::str::FromStr,
        <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
    {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .unwrap()
    }
}

use std::cmp::{max, min};

fn main() {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let mut sc = Scanner::new(stdin);

    let k: i32 = sc.next();
    let x: i32 = sc.next();

    let min_coord: i32 = max(-1000_000, x - k + 1);
    let max_coord: i32 = min(1000_000, x + k - 1);
    for i in min_coord..max_coord + 1 {
        print!("{} ", i);
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){

	for( int i = 0; i <= 8; i++ )
	{
		for( int j = 0; j <= 8; j++ )
		{
			printf("%dx%d=%d\n", i+1, j+1, (i+1)*(j+1));
		}
	}

    return 0;
}


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

int main(){
  long long n; cin>>n;
  long long dp[20001];
  dp[0]=0; dp[1]=1;
  for(int i=2;i<20001;i++){
    dp[i]=dp[i-1]+i;
  }
  int i=20000;
  while(n!=0){
    while(dp[i]>=n){
      i--;
    }
    i+=1;
    cout<<i<<endl;
    n-=i; 
  }
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define MOD (1e9+7)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e4 + 10;
inline int Max(int a, int b) { return a > b ? a : b; }
inline int Min(int a, int b) { return a > b ? b : a; }
namespace FastIO {
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
};
using namespace FastIO;
int N, K, tot, ver[maxn << 1], next[maxn << 1], head[maxn], dis[maxn], disa[maxn], disb[maxn];
inline void add(int u, int v)
{
    ver[++tot] = v, next[tot] = head[u], head[u] = tot;
}
void dfs(int u, int fa)
{
    dis[u] = dis[fa] + 1;
    for (ri i = head[u]; i; i = next[i]) {
        if (ver[i] == fa)
            continue;
        dfs(ver[i], u);
    }
}

inline int work1()
{
    int ans = inf;
    for (ri i = 1; i <= N; ++i) {
        dfs(i, 0);
        int num = 0;
        for (ri j = 1; j <= N; ++j) {
            int tmp = dis[j] - dis[i];
            if (tmp > K / 2) {
                ++num;
            }
        }
        ans = Min(ans, num);
    }
    return ans;
}
inline int work2()
{
    int ans = inf;
    for (ri i = 1; i <= N; ++i) {
        for (ri j = head[i]; j; j = next[j]) {
            int v = ver[j], u = i, num = 0;
            dfs(u, 0);
            memcpy(disa, dis, sizeof(dis));
            dfs(v, 0);
            memcpy(disb, dis, sizeof(dis));
            for (ri k = 1; k <= N; ++k) {
                int d1 = disa[k] - 1, d2 = disb[k] - 1;
                int mn = Min(d1, d2);
                if (mn > (K - 1) / 2) {
                    ++num;
                }
            }
            ans = Min(ans, num);
        }
    }
    return ans;
}
signed main()
{
    //freopen("C:\Users\hjw\Downloads\testdata (4).in", "r", stdin);
    N = read(), K = read();
    for (ri i = 1; i < N; ++i) {
        int u = read(), v = read();
        add(u, v), add(v, u);
    }
    int q;
    if (K & 1) {
        q = work2();
    } else {
        q = work1();
    }
    writeln(q);
    return 0;
}

Measured memory_bytes: 512
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().rstrip()

    l_black = 0
    r_white = S.count(".")
    ans = r_white
    for i in range(N):
        if S[i] == "#":
            l_black += 1
        else:
            r_white -= 1
        count = l_black + r_white
        if count < ans:
            ans = count

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3500
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d %d", &a, &b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else if(a==b){
		printf("a == b\n");
	}
	return 0;
}

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

struct UnionFind{
  vector<int> Parent;
  UnionFind(int n){
    Parent=vector<int>(n,-1);
  }
  int root(int a){
    if(Parent[a]<0) return a;
    return Parent[a]=root(Parent[a]);
  }
  int size(int a){
    return -Parent[root(a)];
  }
  bool connect(int a,int b){
    if(root(a)==root(b)) return false;
    if(size(a)<size(b)) swap(a,b);
    Parent[root(a)]+=Parent[root(b)];
    Parent[root(b)]=root(a);
    return true;
  }
};
int main()
{
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> edge;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    edge.push_back(make_pair(a-1,b-1));
  }
  int cnt=0;
  for(int i=0;i<m;i++){
    pair<int,int> tmp=edge[i];
    edge.erase(edge.begin()+i);
    UnionFind graph(n);
    for(int j=0;j<edge.size();j++){
      int a=edge[j].first,b=edge[j].second;
      graph.connect(a,b);
    }
    if(graph.size(0)!=n) cnt++;
    edge.insert(edge.begin()+i,tmp);
  }
  cout<<cnt;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    ll X;
    cin >> X;
    ll i = 100;
    int count = 0;
    while(i < X) {
        i = i * 1.01;
        ++count;
    }
    cout << count << endl;
}


Measured memory_bytes: 3636
fn read() -> Vec<char> {
    use std::io::*;
    let stdin = stdin();
    let s: Vec<char> = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    // s.split("").collect()
    s
}
fn main() {
    let mut vec: Vec<char> = read();
    let mut a = 0;
    for c in vec.iter() {
        if c == &'S' {
            a = a + 1;
        }
        if a > 0 && c == &'T' {
            a = a - 1;
        }
    }
    println!("{}", a * 2);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007
#define Vi vector<int>
#define Vl vector<long long>
#define pb(a) push_back(a)

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000001;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int d[51]={};

int main() {

	rep(i,10){
		rep(i2,10){
			rep(i3,10){
				rep(i4,10){
					d[i+i2+i3+i4]++;
				}
			}
		}
	}
	while(1){
		int n;
		cin>>n;
		if(cin.eof())return 0;
		cout<<d[n]<<endl;
	}

	return 0;
}



Measured memory_bytes: 3088
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Split(scanner.Text(), " ")
		var sum int

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			sum += num
		}

		fmt.Println(len([]rune(strconv.Itoa(sum))))
	}
}



Measured memory_bytes: 1104
n, *a = map(int, open(0).read().split())
a = [0] + a + [0]
cost = [abs(a[i]-a[i+1]) for i in range(n+1)]
sum_cost = sum(cost)
next_cost = [abs(a[i]-a[i+2]) for i in range(n)]
for i in range(n):
    print(sum_cost-cost[i]-cost[i+1]+next_cost[i])

Measured memory_bytes: 16300
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    int C,D;
    cin>>N>>A>>B>>C>>D;
    cin>>S;
    bool sharp = false;
    reps(i,A-1,C){
        if(sharp && S.at(i) == '#'){
            cout<<"No"<<endl;
            return 0;
        }
        if(S.at(i) == '#'){
            sharp = true;
            continue;
        }
        sharp = false;
    }
    sharp = false;
    reps(i,B-1,D){
        if(sharp && S.at(i) == '#'){
            cout<<"No"<<endl;
            return 0;
        }
        if(S.at(i) == '#'){
            sharp = true;
            continue;
        }
        sharp = false;
    }
    if(C<D) {
        cout<<"Yes"<<endl;
        return 0;
    }
    bool dot1 = false,dot2 = false;
    reps(i,B-2,D+1){
        if(dot1 && dot2 && S.at(i) == '.'){
            cout<<"Yes"<<endl;
            return 0;
        }
        if(dot1 && S.at(i) == '.'){
            dot2 = true;
            continue;
        }
        if(S.at(i) == '.'){
            dot1 = true;
            continue;
        }
        dot1 = false;
        dot2 = false;
    }
    cout << "No" << endl;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> road(M * 2);
  vector<int> ans(N, 0);
  for(int i = 0; i < M*2; i+=2){
    cin >> road.at(i) >> road.at(i+1);
    for(int i2 = 1; i2 < N+1; i2++){
      if(road.at(i) == i2) ans.at(i2-1)++;
      if(road.at(i+1) == i2) ans.at(i2-1)++;
    }
  }
  for(int i = 0; i<N; i++) cout << ans.at(i) << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x;
    int y;
    while(1){
        cin>>x >>y;
        if(x==0 && y==0) break;
        if(x<=y){
            cout<< x << " " << y << endl;
        }else if(x>y){
            cout<< y << " " << x << endl;
        }
    
    }
    return 0;
}


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

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

    int a[n], b[n], c[m], d[m];
    
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }

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

    for(int i = 0; i < n; i++){
        int mindis = INT_MAX;
        int ans;

        for(int j = 0; j < m; j++){
            int tmp = abs(c[j]-a[i]) + abs(d[j]-b[i]);
            if(mindis > tmp){
                mindis = tmp;
                ans = j;
            }
        }

        cout << ans+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n=int(input())
arr=list(map(int,input().split()))
while len(arr)>1: #最後の1つになるまで操作を続ける
 arr=sorted(arr) #配列を昇順ソート
 v1=arr.pop(0) #最小の2数を取り出し、それらを合成したものを配列に追加する
 v2=arr.pop(0)
 arr.append((v1+v2)/2)
print(arr[0]) #最後に残ったものが答えとなる

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<double> x(N+2);
    vector<string> u(N+2);
    rep(i,N) cin >> x[i] >> u[i];
    double ans = 0;
    rep(i,N) {
        if(u[i]=="JPY") ans+=x[i];
        else ans+=x[i]*380000;
    }
    cout << ans << endl;
    return 0;
}


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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<int> dp(35);
    dp[0] = 1;
    for (int i = 0; i < 30; ++i) {
        for (int j = 1; j <= 3; ++j) {
            dp[i+j] += dp[i];
        }
    }
    int n;
    while(cin >> n, n){
        cout << (dp[n]+3649)/3650 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3088
import sys
input = sys.stdin.readline

def main():
  n, m = map(int, input().split())
  U = 2**n
  dp = [ [float("inf")]*(2**n) for _ in range(m) ]
  dp[0][0] = 0
  for i in range(1, m):
    a, b = map(int, input().split())
    k = map(int, input().split())
    c = 0
    for l in k:
      c |= 1<<(l-1)
    for j in range(U):
      dp[i][j] = min(dp[i-1][j&(~c)]+a, dp[i-1][j])

  if dp[m-1][2**n-1] == float("inf"):
    print(-1)
  else:
    print(dp[m-1][2**n-1])
    
if __name__ == "__main__":
  main()

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

int main()
{
   int a,b,p,q,r; cin>>a>>b>>p>>q>>r;
   int diff=p*b-q*(b-a);
   double ans=b+(double)diff/(q+r);
   cout<<fixed<<setprecision(10)<<ans<<endl;
   return 0;
}



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

int main(){
    double L;
    cin >> L;
	long double V = pow(L/3,3);
  
    cout << fixed << setprecision(10) << V << endl;
}


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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

bool isOK(vector<ll>& v, ll mid, ll key) {
    if (v[mid] >= key) return true;
    else return false;
}

ll binary_search(vector<ll>& v, ll key) {
    ll ng = -1;
    ll ok = v.size();
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isOK(v, mid, key)) ok = mid;
        else ng = mid; 
    }
    return ok;
}

int main(){
    ll N; cin >> N;
    vector<ll> A(N, 0), B(N, 0), C(N, 0);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll cnt = 0;
    // rep(i, N) { //　中部を全てループする
    //     ll ok_A = binary_search(A, B[i]);
    //     ll ok_C = binary_search(C, B[i] + 1);
    //     cnt += ok_A * (N - ok_C);
    // }
    rep(i, N) {
        auto up_a_bi = lower_bound(A.begin(), A.end(), B[i]);
        auto up_a_ci = lower_bound(C.begin(), C.end(), B[i] + 1);
        ll ind_a = distance(A.begin(), up_a_bi);
        ll ind_c = distance(C.begin(), up_a_ci);
        cnt += ind_a * (N - ind_c);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 2560
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    string s1, s2;
    cin>>s1>>s2;

    for(int i=0; i<sz(s1); i++) {

        ans += (s1[i] != s2[i]);
    }

    cout<<ans<<endl; 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3824