akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char text[] = str.toCharArray();  //配列に変換
		int n = sc.nextInt();
		char temp;  //この場所でいいのか？？

		for(int i = 0; i < n; i++) {
			String com = sc.next();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(com.equals("print")) {
				for(int j = a; j <= b; j++) {
					System.out.print(text[j]);
				}
				System.out.println();
			}
			else if(com.equals("reverse")) {
				//b-aの偶奇で場合分け
				if((b - a) % 2 == 0) {
					for(int j = a; j <= (a + b) / 2 - 1; j++) {
						temp = text[j];
						text[j] = text[a + b - j];
						text[a + b - j] = temp;
					}
				}
				else {
					for(int j = a; j <= (a + b - 1) / 2; j++) {
						temp = text[j];
						text[j] = text[a + b - j];
						text[a + b - j] = temp;
					}
				}
			}
			else if(com.equals("replace")) {
				String rep = sc.next();
				char text2[] = rep.toCharArray();
				for(int j = a; j <=  b; j++) {
					text[j] = text2[j-a];
				}
			}
		}

	}

}


Measured memory_bytes: 33516
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<iostream>
using namespace std;
int main(){
	int a,b,ans=0,h[111]={0},l[111]={0};
	char s[111][111];
	cin>>a>>b;
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			cin>>s[i][j];
		}
		}
	for(int i=1;i<=a;i++){
		int sum=0;
		for(int j=1;j<=b;j++){
			if(s[i][j]=='.')sum++;
		}
		if(sum==b)h[i]=1;
	}
	for(int i=1;i<=b;i++){
		int sum=0;
		for(int j=1;j<=a;j++){
			if(s[j][i]=='.')sum++;
		}
		if(sum==a)l[i]=1;
	}
	for(int i=1;i<=a;i++){
		if(h[i]!=1){
		for(int j=1;j<=b;j++){
			if(l[j]==0)
				printf("%c",s[i][j]);
		}
		printf("\n");
		}
	}
}


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

using namespace std;
static const int N = 100;
static const int INFTY = (1<<21); // ?????????????????????(2^21)

int n,M[N][N];
int d[N]; // ?????¢??§?¨??????¶???(color)???????????????

void bfs(int s){
	queue<int> q; // ?¨??????????????????????queue????????¨
	q.push(s);
	for(int i=0;i<n;i++) d[i] = INFTY; // ???????????????????????§??°?????\?????????
	d[s] = 0;
	int u;
	while(!q.empty()){
		u = q.front(); q.pop(); // ?????\???????????????u???????????????
		for(int v=0;v<n;v++){
			if(M[u][v] == 0) continue; // ??????u????????????v??????????????????????????°??????
			if(d[v] != INFTY) continue; // ??????v????????§????¨???????????????¨???????????°??????
			d[v] = d[u] + 1; // ??????v????????????u?????°?????????+1?????°??????????????\?????????
			q.push(v); // ?????\????????????v?????\??????
		}
	}
	for(int i=0;i<n;i++){
		cout << i+1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl; // ??????i?????°????????????INFTY??????-1???????????\???????????°????????????????????????
	}
}

int main(){
	int u, k, v;

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

	for(int i=0;i<n;i++){
		cin >> u >> k;
		u--;
		for(int j=0;j<k;j++){
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	bfs(0);

	return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main()
{
	int i,j=0,k=1,n,t;
	bool f=true;
	cin>>n;
	for(t=1;t*(t+1)/2<n;t++);
	cout<<t; 
	return 0;
}




Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#ifndef ATCODER_DSU_HPP
#define ATCODER_DSU_HPP 1

#include <algorithm>
#include <cassert>
#include <vector>

namespace atcoder {

// Implement (union by size) + (path compression)
// Reference:
// Zvi Galil and Giuseppe F. Italiano,
// Data structures and algorithms for disjoint set union problems
    struct dsu {
    public:
        dsu() : _n(0) {}
        dsu(int n) : _n(n), parent_or_size(n, -1) {}

        int merge(int a, int b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            int x = leader(a), y = leader(b);
            if (x == y) return x;
            if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
            parent_or_size[x] += parent_or_size[y];
            parent_or_size[y] = x;
            return x;
        }

        bool same(int a, int b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            return leader(a) == leader(b);
        }

        int leader(int a) {
            assert(0 <= a && a < _n);
            if (parent_or_size[a] < 0) return a;
            return parent_or_size[a] = leader(parent_or_size[a]);
        }

        int size(int a) {
            assert(0 <= a && a < _n);
            return -parent_or_size[leader(a)];
        }

        std::vector<std::vector<int>> groups() {
            std::vector<int> leader_buf(_n), group_size(_n);
            for (int i = 0; i < _n; i++) {
                leader_buf[i] = leader(i);
                group_size[leader_buf[i]]++;
            }
            std::vector<std::vector<int>> result(_n);
            for (int i = 0; i < _n; i++) {
                result[i].reserve(group_size[i]);
            }
            for (int i = 0; i < _n; i++) {
                result[leader_buf[i]].push_back(i);
            }
            result.erase(
                    std::remove_if(result.begin(), result.end(),
                                   [&](const std::vector<int>& v) { return v.empty(); }),
                    result.end());
            return result;
        }

    private:
        int _n;
        // root node: -1 * component size
        // otherwise: parent
        std::vector<int> parent_or_size;
    };

}  // namespace atcoder

#endif  // ATCODER_DSU_HPP


using namespace std;
using namespace atcoder;

class ADisjointSetUnion {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, q;
        in >> n >> q;
        dsu ds(n);
        while (q--) {
            int t, u, v;
            in >> t >> u >> v;
            if (t) out << ds.same(u, v) << '\n';
            else ds.merge(u, v);
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ADisjointSetUnion solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 3900
def op(bit):
    if bit:
        return '+'
    else:
        return '-'


def main():
    string = input()
    nbs = list(string)

    for i in range(2**3):
        temp_string = nbs[0] + op(i % 2) + nbs[1] + op((i >> 1) % 2) \
                    + nbs[2] + op((i >> 2) % 2) + nbs[3]
        result = eval(temp_string)
        if result == 7:
            print(temp_string + '=7')
            return


if __name__ == '__main__':
    main()


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

int main() {
  int N, A;
  cin >> N >> A;
  int B;
  B = N - 500 * ( N / 500 );
  
  if ( A < B ) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


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

using namespace std;

using ll = int64_t;
using ull = uint64_t;
using ld = long double;

const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INV2 = (MOD + 1) / 2;

ll pw(ll x, ll y) {
    if (y == 0) {
        return 1;
    } else if (y % 2 == 0) {
        return pw(x * x % MOD, y / 2);
    } else {
        return pw(x, y - 1) * x % MOD;
    }
}

pair<ll, ll> solve(const vector<ll>& a) {
    if (a.size() == 1) {
        return {pw(2, a[0]), 0};
    } else {
        int mn = a[0];
        for (int x : a) {
            mn = min(mn, x);
        }
        bool eq = true;
        for (int x : a) {
            if (mn != x) {
                eq = false;
            }
        }
        if (eq) {
            ll fr = pw(2, a.size());
            return {pw(2, a[0]), (fr + MOD - 2) % MOD};
        }
        vector<pair<ll, ll> > segs;
        int ptr = 0;
        while (ptr < a.size()) {
            if (a[ptr] == mn) {
                int go = ptr;
                while (go < a.size() && a[go] == a[ptr]) {
                    go++;
                }
                ll tot = pw(2, go - ptr);
                segs.emplace_back(2, (tot + MOD - 2) % MOD);
                ptr = go;
            } else {
                int go = ptr;
                vector<ll> td;
                while (go < a.size() && a[go] > mn) {
                    td.push_back(a[go] - mn + 1);
                    go++;
                }
                segs.push_back(solve(td));
                ptr = go;
            }
        }

        ll tot = 1;
        for (const auto& x : segs) {
            tot = (tot * (x.first + x.second)) % MOD;
        }
        ll good = 1;
        for (const auto& x : segs) {
            ll cur = (x.first * INV2) % MOD;
            good = (good * cur) % MOD;
        }
        good = (good * 2) % MOD;
        ll bad = (tot + MOD - good) % MOD;
        return {good * pw(2, mn - 1) % MOD, bad};
    }
}
int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (ll& x : a) {
        cin >> x;
    }
    auto res = solve(a);
    cout << (res.first + res.second) % MOD << "\n";
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
        const int MAX = 4;
        int a[MAX], b[MAX];

        while (true) {
                for (int i = 0; i < MAX; i++) {
                        if (!(cin >> a[i])){
                                return 0;
                        }
                }
                for (int i = 0; i < MAX; i++) {
                        cin >> b[i];
                }
                int hit = 0, blow = 0;
                for (int i = 0; i < MAX; i++) {
                        if (a[i] == b[i]) {
                                hit++;
                        }
                        for (int j = 0; j < MAX; j++) {
                                if (i != j && a[i] == b[j]) {
                                        blow++;
                                }
                        }
                }
                cout << hit << " " << blow << endl;
        }

        return 0;
}

Measured memory_bytes: 3032
X = int(input())
ans = 0
cake = int(X/4)
donut = int(X/7)

for a in range(cake+1):
  for b in range(donut+1):
    total = a*4 + b*7
    if total == X:
      ans = 1

if ans >= 1:      
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define display(v) for (auto x : v) cout << x << ", "
#define print(x) cout << (#x) << " = [ ";display(x); cout << "]\n"
#define endl '\n'
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
 
// DEBUG TEMPLATE by livw
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifdef INCLUDEWHENOFFLINE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif




int main()
{
    fastio;
    
    ll a, b;
    cin >> a >> b;
    ll ans = a * b;
    ans /= __gcd(a, b);
    cout << ans;
    return 0;
}


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

int cnt[2];

int main() {
	string s;
	cin >> s;
	for(int i = 0; i < (int)s.size(); i++){
		cnt[s[i] - '0']++;
	}
	cout << min(cnt[0], cnt[1]) * 2 << "\n";
	return 0;
}


Measured memory_bytes: 512
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var inputstr = scanner.Text()
	i, _ := strconv.Atoi(inputstr)
	if i == 0 {
		fmt.Printf("1")
	} else {
		fmt.Printf("0")
	}
}


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

dp10 = [[False]*10 for _ in range(N+1)]
dp100 = [[False]*100 for _ in range(N+1)]
dp1000 = [[False]*1000 for _ in range(N+1)]

for i in range(N):
    n = int(S[i])
    for j in range(10):
        dp10[i+1][j] = dp10[i][j] or n==j
    for j in range(100):
        dp100[i+1][j] = dp100[i][j] or (n==j%10 and dp10[i][j//10])
    for j in range(1000):
        dp1000[i+1][j] = dp1000[i][j] or (n==j%10 and dp100[i][j//10])
ans = 0
for i in range(1000):
    if dp1000[N][i]:
        ans += 1
print(ans)


Measured memory_bytes: 304780
#include <algorithm>
#include <iostream>
#include <cstdio>

using namespace std ;

typedef long long LL ;
typedef pair<LL,int> pii;
const int N=1e5+100;

pii p[N];
int n , m ;
LL res ;

int main ()
{
	int i ;
	scanf("%d%d",&n,&m);
	for ( i=1 ; i<=n ; i++ ) scanf("%lld%d",&p[i].first,&p[i].second);
	sort(p+1,p+n+1);
	for ( i=1 ; i<=n && m>0 ; i++ ) 
	{
		if ( p[i].second>m ) res+=(LL)m*p[i].first;
		else res+=p[i].first*p[i].second;
		m-=p[i].second;
	}
	printf("%lld\n",res);
	return 0 ;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0;i < m;i++){
        cin >> x[i];
    }
    sort(x.begin(),x.end());
    vector<ll> dist(m-1);
    if (n >= m){
        cout << 0 << endl;
        return 0;
    }
    else{
        for (int i = 0;i < m - 1;i++){
            dist[i] = x[i+1] - x[i];
        }
    }

    ll sum = 0;
     sort(dist.begin(),dist.end());
    for (int i = 0;i < m-n;i++){
        sum += dist[i];
    }

    cout << sum << endl;
}

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

int main()
{
    int n,sum,sq,temp;
    cin>>n;
    sum = 0;
    n--;
    sq = sqrt(n);
    for(int i=1;i<=sq;i++){
        sum+=((n/i)*2);
    }
    sum-=sq;
    for(int i=1;i<sq;i++){
        temp = (sq-i)*2;
        sum-=temp;
    }
    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 3664
N = int(input())
A = list(map(int, input().split()))


ex = 0


ans = 0
j = 0
ex = 0
for i in range(N):
    while j <= N-1 and ex + A[j] == ex ^ A[j]:
        ex += A[j]
        j += 1

    ans += j-i  
    ex -= A[i]

print(ans)



Measured memory_bytes: 24712
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		//入力表示
		long X = scanner.nextLong();

		long c500 = X / 500;
		// 500 円硬貨の数 6 
		long r500 = X % 500; // 端数
		long c5 = r500 / 5;
		// 5 円硬貨の数 8
		System.out.println(c500 * 1000 + c5 * 5);

		scanner.close();
	}
}


Measured memory_bytes: 22996
#include <stdio.h>
#include <stdlib.h>

int compare_int( const void *a, const void *b); 

int main()
{
	int *a;
	int *b;
	int n;
	int flag=0;

	scanf("%d",&n);

	a=(int *)malloc(n*sizeof(int));
	b=(int *)malloc(n*sizeof(int));

	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
	}

	for(int i=1; i<n; i++){
		if(a[i]>a[i-1])
			a[i]--;
	}

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

	qsort(b,n,sizeof(int),compare_int);


	if(memcmp(a,b,sizeof(int)*n)==0)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

int compare_int( const void *a, const void *b)
{  

	return(*(int *)a-*(int *)b);  
}

Measured memory_bytes: 1404
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

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

  for (int h = 1; h <= 3500; h++) {
    for (int n = 1; n <= 3500; n++) {
      int a = N * h * n, b = 4 * h * n - N * n - N * h;
      if (b > 0 && a % b == 0 && a / b >= 1) {
        cout << h << " " << n << " " << a / b << endl;
        return 0;
      }
    }
  }
  return 0;
}


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

class Program
{
    static void Main(string[] args) {
        int[] S = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine((S[0]-s[0])*(S[1]-s[1]));
    }
}

Measured memory_bytes: 13268
#include<stdio.h>
int main(){
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
if(x-r>=0 && x+r<=w && y-r>=0 && y+r<=h){
printf("Yes\n");
}
else{
printf("No\n");
}
	return 0;
}

Measured memory_bytes: 584
Module Module1

    Sub main()
        'Dim str As String() = {1, 2, 3, 4, 5}

        Dim user2 = Split(Console.ReadLine(), " ")
        Dim lista2 As Long() = Array.ConvertAll(user2, Function(j As String) CLng(j))
        Dim suretsu = New List(Of Long)(lista2)

        Dim result As Integer

        For i = 0 To suretsu.Count - 1
            If suretsu(i) = 0 Then result = i + 1
        Next

        Console.WriteLine(result)

    End Sub
  end module

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

#define _max(_x, _y) ((_x)>(_y)?(_x):(_y))
#define _min(_x, _y) ((_x)>(_y)?(_y):(_x))
#define _abs(_x) ((_x)>0?(_x):(-(_x)))

int main(void)
{
char S[101];
long len;

  scanf("%s", S);
  len = strlen(S);
  memset(S, 'x', len);
  printf("%s\n", S);

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
void selectionSort();
void bubbleSort();

struct card {
	int value;
	char mark;
};

void write(card[]);
bool isStable(card[]);
int n;
card c[40],c1[40],c2[40];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c[i].mark >> c[i].value;
	}
	for (int i = 0; i < n; i++) {
		c1[i] = c2[i] = c[i];
	}

	bubbleSort();
	selectionSort();
	write(c1);
	if (isStable(c1)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

	write(c2);
	if (isStable(c2)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	return 0;
}

void selectionSort() {
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i; j <= n - 1; j++) {
			if (c2[j].value < c2[minj].value) {
				minj = j;
			}
		}
		if (i != minj) {
			card copy = c2[i];
			c2[i] = c2[minj];
			c2[minj] = copy;
		}
	}
}

void bubbleSort() {
	bool flag = true;
	while (flag) {
		flag = false;
		for (int i = n - 1; i >= 1; i--) {
			if (c1[i - 1].value > c1[i].value) {
				card copy = c1[i];
				c1[i] = c1[i - 1];
				c1[i - 1] = copy;
				flag = true;
			}
		}
	}
}
void write(card x[]) {
	for (int i = 0; i < n; i++) {
		cout << x[i].mark << x[i].value;
		if (i == n - 1) cout << endl;
		else cout << " ";
	}
}

bool isStable(card x[]) {
	bool isStable = true;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			if (x[i].value == x[j].value) {
				for (int k = 0; k < n; k++) {
					if (x[i].mark == c[k].mark && x[i].value == c[k].value) break;
					else if (x[j].mark == c[k].mark && x[j].value == c[k].value) {
						//cerr << "i:" << i << " j:" << j << " k:" << k << endl;
						return false;
					}
				}
			}
		}
	}
	return true;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define MAX INT_MAX
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;
vector<int> town[100000],cost[100000];
int main(void)
{
	int V,E,R;
	int S,T,D;
	int flg[100000];
	int length[100000];
	
	int X,Y;
	int i;
	priority_queue<P,vector<P>,greater<P>> que;
	P pp;
	
	cin>>V>>E>>R;
	
	for(i=0;i<E;i++){
		cin>>S>>T>>D;
		town[S].push_back(T);
		cost[S].push_back(D);
	}
	
	fill(length,length+V,MAX);
	fill(flg,flg+V,0);
	
	que.push(P(0,R));
	while(que.size()!=0){
		pp=que.top();
		que.pop();
		X=pp.F;
		Y=pp.S;
		if(X<length[Y]){
			length[Y]=X;
			flg[Y]=1;
			
			for(i=0;i<town[Y].size();i++){
				if(flg[town[Y][i]]==0){
					que.push(P(X+cost[Y][i],town[Y][i]));
				}
			}
		}
	}
	
	for(i=0;i<V;i++){
		if(length[i]==MAX){
			cout<<"INF"<<endl;
		}
		else{
			cout<<length[i]<<endl;
		}
	}
	return 0;
}

		
	
	
	
	
	

	



Measured memory_bytes: 18604
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(1,4):
  print("{0:.6f}".format(sum([abs(a-b)**i for a,b in zip(x,y)])**(1/i)))
print("{0:.6f}".format(max([abs(a-b) for a,b in zip(x,y)])))


Measured memory_bytes: 5652
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
string S;

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

  cin >> S;
  int trgt = 0;
  int cnt = 0;
  char pre[2] = "";
  while (trgt < S.size()){
    char now[2] = "";
    now[0] = S[trgt];
    if (strcmp(now, pre) != 0){
      pre[0] = now[0];
      pre[1] = now[1];
      cnt += 1;
      trgt += 1;
      continue;
    }
    trgt += 1;
    now[1] = S[trgt];
    if (strcmp(now, pre) != 0){
      pre[0] = now[0];
      pre[1] = now[1];
      cnt += 1;
      trgt += 1;
    }
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 720
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

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

fn main() {
    let v: Vec<i32> = read_vec();
    let k = v[0];
    let x = v[1];
    for i in (x - k + 1)..(x + k) {
        print!("{}", i);
        if (i != x + k - 1) {
            print!(" ");
        } else {
            println!("");
        }
    }
}


Measured memory_bytes: 4352
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt=0;
        for(int i=0; i<n; i++){
            long a = sc.nextInt();
            while(a%2==0){
                cnt++;
                a = a / 2;
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 37396
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#define VIZ2 {printf("graph G{\n"); for(int i=1;i<=n;i++) for es(i,e) if(vb[e]>=i)printf("%d--%d;\n",i,vb[e]); puts("}");}
#define SZ 666666
//orz kczno1    POD only
template<typename T>
struct vec{T *a;int n;void clear(){n=0;}
void pb(const T &x){if((n&-n)==n)a=(T*)realloc(a,(n*2)*sizeof(T));a[n++]=x;}
inline T* begin(){return a;}inline T* end() {return a+n;}};
int n,k;
const int MOD=924844033;
int rs[SZ],rn=0,f[2005][2005][2][2];
ll fac[SZ];
int main()
{
	fac[0]=1;
	for(int i=1;i<SZ;++i)
		fac[i]=fac[i-1]*i%MOD;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;++i)
	{
		int p=0;
		for(int j=i;j<=n;j+=k) ++p;
		rs[++rn]=p;
	}
	rs[++rn]=0; int ls=0; f[0][0][0][0]=1;
	for(int i=1;i<=rn;++i)
	{
		for(int j=0;j<=n;++j)
		{
			(f[ls][j][0][0]+=f[ls][j][0][1])%=MOD;
			(f[ls][j][0][0]+=f[ls][j][1][1])%=MOD;
			(f[ls][j][0][0]+=f[ls][j][1][0])%=MOD;
			f[ls][j][0][1]=f[ls][j][1][0]=f[ls][j][1][1]=0;
		}
		for(int r=1;r<=rs[i];++r)
		{
			++ls;
			#define forb(x) for(int x=0;x<=1;++x)
			forb(x1) forb(x2) forb(y1) forb(y2)
			{
				if((!x1)&&(!y1)) continue;
				if((!x2)&&(!y2)) continue;
				int g=(x1&&(!y1))+(x2&&(!y2));
				for(int k=0;k<=n;++k)
					(f[ls][k+g][y1][y2]+=f[ls-1][k][x1][x2])%=MOD;
			}
		}
	}
	ll ans=0;
	for(int i=0;i<=n;++i)
		if(i&1) ans-=f[ls][i][0][0]*fac[n-i]%MOD;
		else ans+=f[ls][i][0][0]*fac[n-i]%MOD;
	ans=(ans%MOD+MOD)%MOD;
	printf("%d\n",int(ans));
}


Measured memory_bytes: 69888
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    string s; cin >> s;
    vector<string> word = {"dream","dreamer","erase","eraser"};
    vector<bool> dp(100005,false);
    dp.at(0) = true;
    rep(i,s.size()){
        if(dp.at(i) == false) continue;
        for(auto wo : word){
            if(wo == s.substr(i,wo.size())) dp[i+wo.size()] = true;
        }
    }

    dp[s.size()] ? cyes : cno;
    return 0;   
}


Measured memory_bytes: 640
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

need = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1] * (N + 10)
dp[0] = 0
for i in range(N) :
    if dp[i] < 0 :
        continue
        
    for j in A :
        dp[i+need[j]] = max(dp[i+need[j]], dp[i]*10+j)
        
print(dp[N])

Measured memory_bytes: 50908
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ui unsigned int
#define ull unsigned ll
#define foi(n) for(ll i=0;i<n;i++)
#define foj(n) for(ll j=0;j<n;j++)
#define fok(n) for(ll k=0;k<n;k++)
#pragma GCC optimize("O3", "unroll-loops")
#define fixed(); cout << fixed << setprecision(20);
#define fast(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

/*****************************************************************************/


#define graph          vector<vector<int>>
#define V              vector
typedef pair<int, int> pii;
typedef pair<ll, ll>   pll;
typedef V<int>         vi;
typedef V<ll>          vll;
typedef V<string>      vs;
typedef V<double>      vd;
typedef V<pii>         vpii;              
typedef V<pll>         vpll;             
typedef pair<int,pii>  piii;             
typedef priority_queue<pii, vector<pii>, greater<pii> > pqq;   

/*****************************************************************************/

#define mp                   make_pair
#define eb                   emplace_back
#define pb                   push_back
#define pf                   push_front
#define popb                 pop_back
#define popf                 pop_front
#define hashmap              unordered_map
#define hashset              unordered_set
#define lb                   lower_bound
#define ub                   upper_bound
#define all(a)               (a).begin(), (a).end()
#define rall(a)              (a).rbegin(), (a).rend()
#define ff                   first
#define ss                   second
#define lbpos(v,x)           (int)(lower_bound(all(v),x)-v.begin())//=v.size()==>No LB 
#define ubpos(v,x)           (int)(upper_bound(all(v),x)-v.begin())//=v.size()==>No UB

/*****************************************************************************/

//for declaring most used global variables and constants
ll mod=1e9+7;


//for string with space use std::getline(cin,string_name);
//*****************UVAISH ZAFRI(Rush_For_AC)**********************
long long power(long long a, long long b,ll m) {
    if (b == 0)
        return 1;
    long long res = power(a, b / 2,m)%m;
    if (b % 2)
        return (res * res * a)%m;
    else
        return (res * res)%m;
}		

int32_t main() {
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);

	#endif
    
   ll n;
   cin>>n;
   n=!n;
   cout<<n<<endl;


       return 0;
}


	

Measured memory_bytes: 3612
from collections import deque



n, q = map(int, input().split())

L = [deque() for _ in range(n)]


for _ in range(q):

    command, *list_num = input().split()

    if   command == "0":
        # insert(t, x)
        t = int(list_num[0])
        x = int(list_num[1])

        L[t].append(x)
    elif command == "1":
        # dump(t)
        t = int(list_num[0])

        print(*L[t])
    elif command == "2":
        # splice(s, t)
        s = int(list_num[0])
        t = int(list_num[1])

        if not L[s]:
            continue

        if L[t]:
            if   len(L[s]) == 1:
                L[t].append(L[s][0])
            elif len(L[t]) == 1:
                L[s].appendleft(L[t][0])
                L[t] = L[s]
            else:
                L[t].extend(L[s])
        else:
            L[t] = L[s]

        L[s] = deque()
    else:
        raise



Measured memory_bytes: 30740
#include<bits/stdc++.h>
#define ll long long
using namespace std;
map<ll,ll> mp;
map<ll,ll>::iterator it;
int main()
{
	// freopen("E:\Sublime Text 3\input.txt","r",stdin);
	// freopen("E:\Sublime Text 3\output.txt","w",stdout);
	ll n,a,two=0;
	cin>>n;

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

	ll num=0;
	for (it=mp.begin();it!=mp.end();it++)
	{
		ll x=it->second;

		if(x%2==0)
			two++;
		num++;
	}

	if(two%2)
		cout<<num-1<<endl;
	else
		cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 6528
s=list(input())
s+="2"
a=[]
c=0
for i in range(len(s)-1):
  c+=1
  if s[i]!=s[i+1]:
    a.append(c)
    c=0
ansl=[]
for i in range(len(a)//2):
  t1=a[2*i]//2;r1=a[2*i]-t1
  t2=a[2*i+1]//2;r2=a[2*i+1]-t2
  flag=["0" for j in range(a[2*i]-1)]+[str(r1+t2)]+[str(r2+t1)]+["0" for j in range(a[2*i+1]-1)]
  ansl+=flag
print(" ".join(ansl))


Measured memory_bytes: 11560
import java.util.Scanner;
public class Main{

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a[] = new int[3];

a[0]=sc.nextInt();
a[1]=sc.nextInt();
a[2]=sc.nextInt();
if( (a[2] > a[1])&& (a[1]>a[0])) System.out.println("Yes");
else System.out.println("No");

}

}


Measured memory_bytes: 26208
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout <<"debug "<< i << "\n"

//const ll MOD = 998244353;
const ll MOD = 1e9+7;

ll max[20][100010];
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,l,q;

  std::cin>>n;
  std::vector<ll> x(n);
  rep(i,0,n)std::cin>>x[i];

  std::cin>>l>>q;

  rep(i,0,n)max[0][i]=(ll)(std::upper_bound(all(x),x[i]+l)-x.begin())-1;

  rep(k,1,20){
    rep(i,0,n){
      max[k][i]=max[k-1][max[k-1][i]];
    }
  }



  rep(sdf,0,q){
    ll a,b,ans=MOD;
    std::cin>>a>>b;
    a--;b--;
    if(a>b)std::swap(a,b);
    ll now=a,temp=0;
    for(ll i=(1<<19),pow=19;i>0;i/=2,pow--){
      if(max[pow][now]>=b){
        ans=std::min(ans,temp+i);
      }else{
        temp+=i;
        now=max[pow][now];
      }
    }
    std::cout<<ans<<"\n";
  }

  return 0;
}

Measured memory_bytes: 17280
a, b, x = map(int, input().split())

import math
if x > (a**2*b)/2:
    c = (a**2*b - x)*2 / (a**2)
    theta = math.atan(c/a)
    print(math.degrees(theta))
else:
    c = x * 2 / (b*a)
    theta = math.atan(b/c)
    print(math.degrees(theta))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
    string s, r;
    cin >> s >> r;
    ll ans = 0;
    REP(i, 3)
    if (s[i] == r[i]) ans +=1;
    cout << ans;
 }




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

class BinaryTree
{
private:
  struct Node
  {
    // Member variables of 'Node'
    int key;
    std::shared_ptr<Node> parent_ptr;
    std::shared_ptr<Node> left_ptr;
    std::shared_ptr<Node> right_ptr;

    // Default constructor
    Node():
      key(0),
      parent_ptr(nullptr),
      left_ptr(nullptr),
      right_ptr(nullptr)
    {}

    // Construcotr
    explicit Node(int k, std::shared_ptr<Node> p, std::shared_ptr<Node> l, std::shared_ptr<Node> r):
      key(k),
      parent_ptr(p),
      left_ptr(l),
      right_ptr(r)
    {}
  };

  // Member variables of 'BinaryTree'
  std::shared_ptr<Node> root_ptr;

public:
  // Default constructor
  BinaryTree():
    root_ptr(nullptr)
  {}

  // Specify 'key' then insert into the tree
  void insert(int key)
  {
    std::shared_ptr<Node> temp_parent_ptr = nullptr;
    std::shared_ptr<Node> temp_child_ptr = root_ptr;

    while (temp_child_ptr != nullptr)
    {
      temp_parent_ptr = temp_child_ptr;
      if (key < temp_child_ptr->key)
        temp_child_ptr = temp_child_ptr->left_ptr;
      else
        temp_child_ptr = temp_child_ptr->right_ptr;
    }

    std::shared_ptr<Node> new_node_ptr = std::make_shared<Node>(key, temp_parent_ptr, nullptr, nullptr);

    // If this is the first element,
    // then new_node is the root
    if (temp_parent_ptr == nullptr)
      root_ptr = new_node_ptr;
    // If new_node's key is smaller than parent's,
    // then insert into left
    else if (key < temp_parent_ptr->key)
      temp_parent_ptr->left_ptr = new_node_ptr;
    // If new_node's key is larger than parent's,
    // then insert into left
    else
      temp_parent_ptr->right_ptr = new_node_ptr;
  }

  // Print keys as preorder tour
  void printPreorder(std::shared_ptr<Node> node_ptr)
  {
    // Escape condition of the recursive function
    if (node_ptr == nullptr)
      return;

    // Recursively output the key value.
    std::cout << ' ' << node_ptr->key;
    printPreorder(node_ptr->left_ptr);
    printPreorder(node_ptr->right_ptr);
  }

  // Print keys as inorder tour
  void printInorder(std::shared_ptr<Node> node_ptr)
  {
    // Escape condition of the recursive function
    if (node_ptr == nullptr)
      return;

    // Recursively output the key value.
    printInorder(node_ptr->left_ptr);
    std::cout << ' ' << node_ptr->key;
    printInorder(node_ptr->right_ptr);
  }

  // Print keys as both preorder and inorder
  void print()
  {
    printInorder(root_ptr);
    std::cout << std::endl;
    printPreorder(root_ptr);
    std::cout << std::endl;
  }
};

int main()
{
  int m;
  std::cin >> m;

  BinaryTree tree;
  for (int i = 0; i < m; ++i)
  {
    std::string command;
    int key;

    std::cin >> command;
    if (command == "insert")
    {
      std::cin >> key;
      tree.insert(key);
    }
    else
      tree.print();
  }

  return 0;
}


Measured memory_bytes: 42192
program B

  implicit none
  integer H
  integer N
  integer i
  integer sum
  integer,allocatable, dimension(:) :: A
  read *, H,N
  sum = 0
  allocate(A(N))
  A = 0
  read *, A
  do i = 1, N
      sum = sum + A(i)
      ! print *, sum
  end do
  if ( sum < H ) then
    print '(a)', 'No'
  else
    print '(a)', 'Yes'
  end if

end program B


Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>

using namespace std;

struct Point{
	int x,y;
};

const Point DIR[4] = {{1,0},{0,1},{-1,0},{0,-1}};

class Searcher{
private:
	int w,h;
	char map[20][20];
	Point init;
	
	int cnt;
	bool visited[20][20];
	
public:
	//面倒なので、中で実装する
	Searcher(int w,int h, char map[20][20],Point init){
		this->w = w;
		this->h = h;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				this->map[i][j] = map[i][j];
				visited[i][j] = false;
			}
		}
		this->init = init;
		cnt = 0;
	}
	
	int solve(){
		dfs(init);
		return cnt;
	}
	
private:
	bool inField(Point pos){
		return 0<= pos.x && pos.x < w && 0<= pos.y && pos.y < h;
	}

	void dfs(Point pos){
		cnt++;
		visited[pos.y][pos.x] = true;
		for(int i=0;i<4;i++){
			Point next = {pos.x + DIR[i].x, pos.y + DIR[i].y};
			if(inField(next)==true){
				if(visited[next.y][next.x] == false && map[next.y][next.x] == '.'){
					dfs(next);
				}
			}
		}
	}
};

int main(){
	while(true){
		int w,h;
		cin >> w >> h;
		if(w==0){
			break;
		}
		char map[20][20];
		Point init;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin >> map[i][j];
				if(map[i][j]=='@'){
					init = (Point){j,i};
					map[i][j] = '.';
				}
			}
		}
		Searcher searcher(w,h,map,init);
		int result = searcher.solve();
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>
#include <string.h>
int main(void)
{
     int i,len;
     char s[4096],p[4096],s2[4096];
     scanf("%s %s",s,p);
     sprintf(s2,"%s%s",s,s);
     
     
     
     if(strstr(s2,p)==NULL){
         printf("No\n");
     }
        else{
         printf("Yes\n");
         
     }
     
    return 0;   
    
}



Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000+15
typedef long long ll;
int main(){
  ll N,M;
  scanf("%d%d",&N,&M);
  string a,b;
  cin>>a>>b;
  ll gd=__gcd(N,M);
  ll gcda=N/gd;
  ll gcdb=M/gd;
  for(int i=0;i<gd;i++){
    if(a[gcda*i]!=b[gcdb*i]){
      cout<<"-1";
      return 0;
    }
  }
  cout<<N*M/gd<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<ext/pb_ds/priority_queue.hpp>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define Chkmin(a,b) a=a<b?a:b
#define Chkmax(a,b) a=a>b?a:b
using namespace std;
using namespace __gnu_pbds;
template<typename T>inline void read(T &x)
{
    T s=0,f=1;char k=getchar();
    while(!isdigit(k)&&(k^'-'))k=getchar();
    if(!isdigit(k)){f=-1;k=getchar();}
    while(isdigit(k)){s=s*10+(k^48);k=getchar();}
    x=s*f;
}

typedef long long ll;

static ll n,m,d;

inline void solve()
{
	read(n);read(m);read(d);
	if(d>0)
		printf("%.10lf\n",2.0*(n-d)/n*(m-1)/n);
	else
		printf("%.10lf\n",1.0*(m-1)/n);
}

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


Measured memory_bytes: 256
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

inline int read() {
    int res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}

int n, ans;
int a[N], ps[N];

int main() {
    std::cin >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        ps[i] = ps[i - 1] + a[i];
    }
    for (int i = 1; i <= n; i++) {
        ans += ps[i - 1] * a[i];
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int a=1,b=0,c=0;
  char s,t,gomi;
  while(cin>>s>>gomi>>t){
    if(s>t)swap(s,t);//テ、ツクツヲテ」ツ?ウテヲツ崢ソテ」ツ??
    if(s=='A'&&t=='B')swap(a,b);
    if(s=='B'&&t=='C')swap(b,c);
    if(s=='A'&&t=='C')swap(a,c);
  }
  if(a)cout<<"A"<<endl;
  if(b)cout<<"B"<<endl;
  if(c)cout<<"C"<<endl;
}

Measured memory_bytes: 3084
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


def main():
    
    
    a,b,c=map(int,input().split())
    print(sum((c%i==0)for i in range(a,b+1)))
        
    
    
    
    
    
if __name__ == '__main__':
    main()


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

#define ISLOOSE(a,b)    (disdis(a, b) + get<2>(a) * get<2>(a) <= get<2>(b) * get<2>(b))

using namespace std;

double disdis(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	return (get<0>(a) - get<0>(b)) * (get<0>(a) - get<0>(b)) + (get<1>(a) - get<1>(b)) * (get<1>(a) - get<1>(b));
}

double heron(double a, double b, double c)
{
	double s = (a + b + c) / 2;
	return sqrt(s*(s - a)*(s - b)*(s - c));
}

double heron2(double a, double b, double c, double d, double e, double f)
{
	return sqrt((a*d*(b + c + e + f - a - d) + b*e*(c + a + f + d - b - e) + c*f*(a + b + d + e - c - f) - a*b*f - a*e*c - d*b*c - d*e*f) / 144.0);
}

tuple<double, double, double> com(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	if (ISLOOSE(a, b)) {
		return a;
	}
	else if (ISLOOSE(b, a)) {
		return b;
	}
	else {
		double l = heron(get<2>(a), get<2>(b), sqrt(disdis(a, b))) * 2 / sqrt(disdis(a, b));
		double d1 = sqrt(get<2>(a) * get<2>(a) - l * l);
		double d2 = sqrt(get<2>(b) * get<2>(b) - l * l);
		return tuple<double, double, double>(get<0>(a) + (get<0>(b) - get<0>(a)) * d1 / (d1 + d2), get<1>(a) + (get<1>(b) - get<1>(a)) * d1 / (d1 + d2), l);
	}
}

double two(const tuple<double, double, double>& a, const tuple<double, double, double>& b)
{
	if (ISLOOSE(a, b)) {
		return (double)get<2>(a);
	}
	else if (ISLOOSE(b, a)) {
		return (double)get<2>(b);
	}
	else {
		double d = sqrt(disdis(a, b));
		return heron(get<2>(a), get<2>(b), d) * 2 / d;
	}
}

double three(const tuple<double, double, double>& a, const tuple<double, double, double>& b, const tuple<double, double, double>& c)
{
	tuple<double, double, double> temp;

	if (ISLOOSE(a, b) && ISLOOSE(a, c))
		return get<2>(a);
	if (ISLOOSE(b, a) && ISLOOSE(b, c))
		return get<2>(b);
	if (ISLOOSE(c, a) && ISLOOSE(c, b))
		return get<2>(c);

	if (ISLOOSE(temp = com(a, b), c))
		return get<2>(temp);
	if (ISLOOSE(temp = com(b, c), a))
		return get<2>(temp);
	if (ISLOOSE(temp = com(c, a), b))
		return get<2>(temp);

	return heron2(get<2>(a) * get<2>(a), get<2>(b) * get<2>(b), get<2>(c) * get<2>(c), disdis(b, c), disdis(c, a), disdis(a, b))
		* 3.0 / heron(sqrt(disdis(a, b)), sqrt(disdis(b, c)), sqrt(disdis(c, a)));
}

int main()
{
	int n;
	double res;
	cout << fixed << setprecision(7);
	while (cin >> n, n) {
		vector< tuple<double, double, double> > str(n);
		for (int i = 0; i < n; i++) {
			cin >> get<0>(str[i]) >> get<1>(str[i]) >> get<2>(str[i]);
		}
		if (n == 1) {
			cout << (double)get<2>(str[0]) << endl;
		}
		else if (n == 2) {
			cout << two(str[0], str[1]) << endl;
		}
		else {
			res = 100000000.0;
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					for (int k = j + 1; k < n; k++) {
						res = min(res, three(str[i], str[j], str[k]));
					}
				}
			}
			cout << res << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3204
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x1,y1,x2,y2 = iim()
difx = x2-x1
dify = y2-y1
x3 = x2-dify
y3 = y2+difx
x4 = x3-difx
y4 = y3-dify

print(x3,y3,x4,y4)


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

int main()
{
    map<string, int> m;
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        string judge;
        cin >> judge;
        m[judge]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3632