akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>

using namespace std;

int main(){
cout << fixed << setprecision(20);
long double a,b,h,m,ang_a,ang_b;
long double dis;
cin>>a>>b>>h>>m;
//cout<<a<<b<<h<<m<<endl;
ang_a=0.5*(60*h+m);
ang_b=6*m;
//cout<<ang_a<<ang_b<<endl;
//cout<<cos(ang_a-ang_b)<<endl;
dis=a*a+b*b-2*a*b*cos(abs(ang_b-ang_a)*M_PI/180);
dis=sqrt(dis);
//cout<<abs(ang_b-ang_a)*M_PI/180<<endl;
//cout<<cos(abs(ang_b-ang_a)*M_PI/180)<<endl;
cout<<dis<<endl;
return 0;
}

Measured memory_bytes: 4044
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];

void Solve() {

	int n,c;
	cin >> n >> c;
	int ct[31][31];
	for (size_t i = 1; i <= c; i++)
	{
		for (size_t j = 1; j <= c; j++)
		{
			cin >> ct[i][j];
		}
	}

	vector<int> values[3];
	for (size_t i = 1; i <= n; i++)
	{
		for (size_t k = 1; k <= n; k++)
		{
			int v;
			cin >> v;
			values[(i + k) % 3].push_back(v);
		}
	}
	ll zerot[31];
	ll ont[31];
	ll tt[31];
	for (size_t i = 1; i <= c; i++)
	{
		zerot[i] = 0;
		for (size_t j = 0; j < values[0].size(); j++)
		{
			zerot[i] += ct[values[0][j]][i];
		}
		ont[i] = 0;
		for (size_t j = 0; j < values[1].size(); j++)
		{
			ont[i] += ct[values[1][j]][i];
		}
		tt[i] = 0;
		for (size_t j = 0; j < values[2].size(); j++)
		{
			tt[i] += ct[values[2][j]][i];
		}
	}

	ll best = zerot[1] + ont[2] + tt[3];
	for (size_t i = 1; i <= c; i++)
	{
		for (size_t j = 1; j <= c; j++)
		{
			for (size_t k = 1; k <= c; k++)
			{
				if (i == j) continue;
				if (i == k) continue;
				if (j == k) continue;
				best = min(best, zerot[i] + ont[j] + tt[k]);
			}
		}
	}
	cout << best << endl;
}


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



Measured memory_bytes: 7664
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
using namespace std;


int main(){
	int k, x;
	cin >> k >> x;
	if (k*500 >= x){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n;
	cin >> n;
	map<string, bool> used;
	string last;
	cin >> last;
	used[last] = true;
	while(--n)
	{
		string word;
		cin >> word;
		if(used.count(word) || word[0] != last[last.size() - 1]) return cout << "No\n", 0;
		used[word] = true;
		last = word;
	}
	cout << "Yes\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
typedef long long ll;
using namespace std;
int main()
{
    int n;
    cin >> n;
    REP(i, n / 4 + 1)
    {
        REP(j, n / 7 + 1)
        {
            if (4 * i + 7 * j == n)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int n,m;
int i,j;
char a,b,c;
char list[1000];

int main(){
	while(1){
		scanf("%d",&n);
		if(n==0)return 0;
		for(i=0;i<1000;i++)list[i]=i;
		for(i=0;i<n;i++){
			scanf(" %c %c",&a,&b);
			list[a]=b;
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf(" %c",&c);
			printf("%c",list[c]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 1000
N = int(input())
A = list(map(int, input().split()))
# C = [str(i) for j in range(1, N+1) for i in A if i == j]
# index と　value を入れ替える
C = [0]*N
# print(C)
for k in range(N):
    C[A[k]-1] = str(k+1)
    # C[k] = k
# print(C)
# C = [str(A.index(i)+1) for i in range(1,N+1)]
L = ' '.join(C)
print(L)

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

syou = N//15
amari = N%15
answer = 0
def fizzbuzzSum(syou,amari):
  start = 15*syou
  end = start + amari
  ans = 0
  for i in range(start,end+1):
    if(i%3==0 or i%5==0):
      continue
    ans += i
  return ans
if syou == 0:
  answer = fizzbuzzSum(syou,amari)
else:
  answer = fizzbuzzSum(syou,amari)
  answer += 60 *(syou**2) 

print(answer)
  
  
    

Measured memory_bytes: 9200
N = int(input())
A = [int(a) for a in input().split()]

ANS = [0] * N
for i in range(N)[::-1]:
    ans = A[i]
    for j in range(i+1, N+1, i+1):
        ans ^= ANS[j-1]
    ANS[i] = ans

print(sum(ANS))
print(*[i+1 for i in range(N) if ANS[i]])

Measured memory_bytes: 71440
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
struct node{
    ll x;
    int no;
}a[300005];
bool cmp(node a,node b){
    return a.x>b.x;
}
int main(){
    int x,y;
    int A,B,C;
    cin>>x>>y>>A>>B>>C;
    int tmp=0;
    ll ans=0;
    int cnt=0;
    for(int i=0;i<A;i++){
        cin>>a[cnt].x;
        a[cnt++].no=0;
    }
    for(int i=0;i<B;i++){
        cin>>a[cnt].x;
        a[cnt++].no=1;
    }
    for(int i=0;i<C;i++){
        cin>>a[cnt].x;
        a[cnt++].no=2;
    }
    sort(a,a+cnt,cmp);
    for(int i=0;i<cnt;i++){
        if(a[i].no==2 && tmp<x+y){
            tmp++;
            ans+=a[i].x;
        }
        if(a[i].no==0 && x>0 && tmp<x+y){
            x--;
            ans+=a[i].x;
        }
        if(a[i].no==1 && y>0 && tmp<x+y){
            y--;
            ans+=a[i].x;
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 4992
X = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s = input()
s = list(s[i] for i in range(len(s)))
for x in X:
  if x not in s:
    print(x)
    break
else:
  print('None')

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

int main() {
    int n, m;
    while (cin >> n >> m, n) {
        vector<vector<int>> candy(m);
        while (n--) {
            int d, v; cin >> d >> v; d--;
            candy[d].emplace_back(v);
        }
        int sum = 0;
        for (int d = 0; d < m; d++) {
            sort(candy[d].rbegin(), candy[d].rend());
            sum += candy[d][0];
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int X,Y;
  cin >> X >> Y;
  if (Y % 2 == 0 && 2*X <= Y && Y <= 4*X) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
int main()
{
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int c;
        cin>>c;
        if(c>=k) ans++;
    }
        cout<<ans;
}


Measured memory_bytes: 256
import bisect

s_len, t_len, q = map(int, input().split())

shrines = []
temples = []
for _ in range(s_len):
    shrines.append(int(input()))
for _ in range(t_len):
    temples.append(int(input()))


def distance(s_i, t_i, x):
    """
    s_i と t_i を最短でまわる距離。無効なインデックスなら inf を返す
    """
    if 0 <= s_i < s_len and 0 <= t_i < t_len:
        s = shrines[s_i]
        t = temples[t_i]
        if s >= x <= t:
            return max(s, t) - x
        elif s <= x >= t:
            return x - min(s, t)
        else:
            return abs(s - t) + min(abs(x - t), abs(x - s))
    else:
        return float('inf')


def solve(x):
    s_i = bisect.bisect_left(shrines, x)
    t_i = bisect.bisect_left(temples, x)
    return min([
        distance(s_i, t_i, x),
        distance(s_i, t_i - 1, x),
        distance(s_i - 1, t_i, x),
        distance(s_i - 1, t_i - 1, x),
    ])


for _ in range(q):
    print(solve(int(input())))


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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n == 0)
			break;
		
		char  c[100];
		for(int i=0; i<n; i++){
		  cin>>c[i];
		}

		int cnt[26] = {0};
		for(int i=0; i<n; i++){
		  cnt[(int)(c[i]-'A')]++;

		  int max1=-1;
		  int max2 = -1;
		  for(int j=0; j<26; j++){
		    if(cnt[j]>max1){
		      max2 = max1; 
		      max1=cnt[j];
		    }
		    else if(cnt[j]>max2){
		      max2 = cnt[j];
		    }
		  }

		  if(max1-max2>n-(i+1)){
		    for(int j=0; j<26; j++){
		      if(cnt[j]==max1){
			cout<<(char)(j+'A')<<' ';
			break;
		      }
		    }
		    cout<<(i+1)<<endl;
		    break;
		  }

		  if(i==n-1){
		    cout<<"TIE"<<endl;
		    break;
		  }
		}
	}
	
	return 0;
}

Measured memory_bytes: 3068
#!/usr/bin/env python3
import sys


def solve(K: int, X: int):
    output = ''
    for i in range(X - K + 1, X + K):
        output += str(i) + ' '
    print(output[:-1])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(K, X)

if __name__ == '__main__':
    main()


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

namespace Atc_0033
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            int[] Nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            long result = 0;

            bool d = false;

            while (true)
            {
                d = false;

                for (int i = 0; i < Nums.Length; i++)
                {
                    if (Nums[i] % 2 == 0)
                    {
                        Nums[i] = Nums[i] / 2;

                        d = true;

                        break;
                    }

                }

                if (!d)
                {
                    break;
                }

                result++;
            }

            Console.WriteLine(result);
        }
    }
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int main(){
    int n,k;
    cin >> n >> k;
    if(n%k>0)
        cout << 1;
    else
        cout << 0;
}

Measured memory_bytes: 256
n = int(input())
tables = []
for i in range(n):
    tables.append([0 for i in range(26)])
    s = input()
    for ss in s:
        num = ord(ss) - 97
        tables[i][num] += 1

new_table = [0 for _ in range(26)] 
for i in range(26):
    num = i
    x = 10**9
    for j in range(n):
        x = min(x, tables[j][num])
    new_table[i] = x

ans = ""
for i in range(26):
    if new_table[i] > 0:
        ans += chr(i+97) * new_table[i]
print(ans)
        

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;

const int MAXN=1e5+5;

int n;
int head[MAXN],ecnt;
struct node{
    int v,nxt;
}E[MAXN*2];

void addedge(int u,int v){
    E[++ecnt]=(node){v,head[u]};
    head[u]=ecnt;
}

bool dfs(int u,int fa=0){
    int cnt=0;
    for(int i=head[u];i;i=E[i].nxt){
        int v=E[i].v;
        if(v==fa) continue;
        cnt+=dfs(v,u);
    }
    if(cnt>=2){
        puts("First");
        exit(0);
    }
    return cnt^1;
}

int main(){

    scanf("%d",&n);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        addedge(u,v);
        addedge(v,u);
    }
    if(dfs(1)) puts("First");
    else puts("Second");

    fclose(stdin);
    fclose(stdout);
}


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

int main(){
    int total = 0,n,m;
    cin>>n>>m;
    int arr[n];
    for (int i=0;i<n;++i){
        cin>>arr[i];
        total+=arr[i];
    }
    // sort(arr,arr+n,greater<int>());
    int count = 0;
    for (auto x : arr){
        if (x*4ll*m>=total){
            count++;
        }
    }
    if (count>=m){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    // cout<<(double)((1/(4*m))*total);
}

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

# 辞書型を使い、valueでソートする
dic = {}
for i in range(N):
  dic[i] = A[i]

dic = sorted(dic.items(), key=lambda x:x[1])
for d in dic:
  print(d[0]+1, end=" ")

Measured memory_bytes: 29932
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int sum[200010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[200010];
    rep(i, N) cin >> A[i];
    int ans = 0;
    rep(i, N) sum[i + 1] = sum[i] + A[i];
    rep(i, N) {
        int tmp1 = (sum[N] - sum[i + 1] + mod) % mod;
        int tmp = (A[i] * tmp1) % mod;
        ans = (ans + tmp) % mod;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6776
#include<stdio.h>
int main()
{
int a,b,c,max,d,min,e,f;
scanf("%d %d %d",&a,&b,&c);
 max=a;
 min=a;
  if(b>max) max=b;
  if(c>max) max=c;
  if(b<min) min=b;
  if(c<min) min=c;

  printf("%d",max-min);
return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
    ll N, M;
    cin>>N>>M;
    vector<ll> prime;
    map<ll, int> amap;
    int maxsize = 0;
    for(ll i=2;i*i<=M;++i){
        if(M%i==0){
            prime.push_back(i);
            while(M%i==0){
                amap[i]++;
                M /= i;
            }
            maxsize = max(maxsize, amap[i]);
        }
    }
    if(M>1){
        prime.push_back(M);
        amap[M]++;
    }
    maxsize += N;
    vector<ll> ue(maxsize+1);
    vector<ll> shita(maxsize+1);
    ue[0] = 1;
    ue[1] = 1;
    for(ll i=2;i<=maxsize;++i){
        ue[i] = i*ue[i-1];
        ue[i] %= mod;
    }
    shita[0] = 1;
    shita[1] = 1;
    ll two;
    ll h;
    ll tmp;
    for(int i=2;i<=maxsize;++i){
        shita[i] = 1;
        h = mod - 2;
        while(h>0){
            two = 1;
            tmp = ue[i];
            while(2*two<=h){
                two *= 2;
                tmp *= tmp;
                tmp %= mod;
            }
            h -= two;
            shita[i] *= tmp;
            shita[i] %= mod;
        }
    }
    ll ans = 1;
    for(int i=0;i<prime.size();++i){
        ans *= ue[N-1+amap[prime[i]]]*shita[N-1]%mod*shita[amap[prime[i]]]%mod;
        ans %= mod;
    }
    cout<<ans<<endl;
}


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

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c >= 22 )
  	cout<<"bust";
  else
  	cout<<"win";


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int n, a[200005], x, d[1000010], sol;
 
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a, a+n);
    for(int i=0;i<n;i++){
        x=a[i];
        if(d[x]!=0){
            d[x]++;
            continue;
        }
        for(int j=x;j<=a[n-1];j+=x){
            d[j]++;
        }
    }
    for(int i=0;i<n;i++){
        if(d[a[i]]==1){
            //cout<<a[i]<<" ";
            sol++;
        }
    }
    cout<<sol;
    return 0;
}

Measured memory_bytes: 8268
#include<iostream>
#include<cstdio>
#include<cmath>
#include<map>
using namespace std;
typedef long long int LL;
char board[305][305];

char check2(int x,int y,int n){
	if(x<0)x+=n;
	if(y<0)y+=n;
	return board[x][y];
}

bool check(int x,int y,int n){
	int i,j;
	int p,q;
	bool s=true;
	for(i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(check2(i-x,j-y,n)!=check2(j-x,i-y,n))return false;
		}
	}
	return true;
}
			

int main(){
	int i,j,k;
	int a,b,c;
	int s=0;
	int n;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>board[i];
	}
	for(i=0;i<n;i++){
		if(check(0,i,n))s+=n-i;
	}
	for(i=1;i<n;i++){
		if(check(i,0,n))s+=n-i;
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define MOD 1000000007

int main() {
    ll N, M, a[100000], ai = 0, dp[100001] = {1};
    cin >> N >> M;
    REP(i, M) cin >> a[i];

    FOR(i, 1, N + 1) {
        if (a[ai] == i) {
            ai++;
            continue;
        }
        if (dp[i - 1] > 0) dp[i] += dp[i - 1];
        if (i > 1 && dp[i - 2] > 0) dp[i] += dp[i - 2];
        dp[i] %= MOD;
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s,t;
	cin>>s>>t;
	ll ans=0;
	for(ll i=0;i<s.size();i++){
		if(s[i]!=t[i]){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3832
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	const int MAX=100001;
	ll N,A,B;
	ll h[MAX]={};
	cin>>N>>A>>B;
	for(int i=0;i<N;i++){
		cin>>h[i];
	}
	//二分探索
	ll hi=1e9+1,lo=0;
	while(hi-lo>1){
		ll mid=(hi+lo)/2;
		ll hc[MAX]={};
		ll count=0;
		for(int i=0;i<N;i++){
			hc[i]=h[i]-mid*B;
			if(hc[i]>0){
				if(hc[i]%(A-B)==0){
					count+=hc[i]/(A-B);
				}
				else{
					count+=hc[i]/(A-B)+1;
				}
			}
		}
		if(count<=mid){
			hi=mid;
		}
		else{
			lo=mid;
		}
		//cout<<hi<<" "<<lo<<" "<<count<<endl;
	}
	cout<<hi<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(void) {
    int a,b;
    cin >> a >> b;
    if(a < b)
        cout << "a < b" << endl;
    else if(a > b)
        cout << "a > b" <<endl;
    else
        cout << "a == b" << endl;

    return 0 ;

}


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <deque>
#include <math.h>
#include <cstring>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <stack>
#include<cassert>
#include <cfloat>
#include <list>
using namespace std ;
#define ll long long
#define submitStage int TCF = 1 ;
#define testStage int TCF = 1000 ;
#define testMyStupedCode TCF--
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
void ReadFromFile( string name , string extention ){
    string fullPath = name + "." + extention ;
    freopen( fullPath.c_str() , "r" , stdin ) ;
}
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline char C(){
    char c ;
    scanf( "%c" , &c ) ;
    return c ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        p >>= 1;
    }
    return res;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}

const int N = 1e5 + 5;
int dp[N];
int inDeg[N], vst[N];
vector<int> adj[N];
void DFS(int u){
     vst[u] = 1;
     for (int v : adj[u]) {
          dp[v] = max(dp[v], dp[u] + 1);
          --inDeg[v];
          if(!inDeg[v])
               DFS(v);
     }
}
int main(){
     //freopen("//Users//Mr.X//Desktop//tests//tst.text", "r", stdin);
     int n = D(), m = D();
     for(int i = 0; i < m; ++i){
          int u = D(), v = D();
          adj[u].push_back(v);
          ++inDeg[v];
     }
     for(int i = 1; i <= n; ++i)
          if(!inDeg[i] && !vst[i])
               DFS(i);
     int ans = 0;
     for(int i = 1; i <= n; ++i)
          ans = max(dp[i], ans);
     printf("%d", ans);
     return 0;
}


Measured memory_bytes: 9984
// https://atcoder.jp/contests/abc155/tasks/abc155_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    // bool flag = true;
    REP(i, N) {
        int t;
        cin >> t;
        if (t % 2 == 0) {
            if (t % 3 != 0 && t % 5 != 0) {
                // flag = false;
                cout << "DENIED\n";
                return 0;
            }
        }
    }
    cout << "APPROVED\n";

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

const int MN = 205;

int N, A[MN][MN], vis[MN], bel[MN], col[MN], cnt, o;
int nd[MN][MN];
int Ans;

void dfs(int u, int t) {
	vis[u] = 1, col[u] = t, bel[u] = cnt, nd[cnt][++nd[cnt][0]] = u;
	for (int v = 1; v <= N; ++v) if (A[u][v]) {
		if (!vis[v]) dfs(v, t ^ 1);
		else if (col[v] == col[u]) o = 0;
	}
}

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= N; ++j)
			scanf("%1d", &A[i][j]);
	o = 1;
	for (int i = 1; i <= N; ++i) if (!vis[i]) ++cnt, dfs(i, 0);
	if (!o) return puts("-1"), 0;
	for (int i = 1; i <= cnt; ++i) {
		int c = nd[i][0], mx = 0;
		for (int j = 1; j <= c; ++j) {
			static int que[MN], dis[MN];
			int u = nd[i][j], l, r;
			que[l = r = 1] = u;
			for (int k = 1; k <= c; ++k) dis[nd[i][k]] = 0;
			dis[u] = 1;
			while (l <= r) {
				int u = que[l++];
				for (int v = 1; v <= N; ++v) if (A[u][v])
					if (!dis[v]) dis[v] = dis[u] + 1, que[++r] = v;
			}
			if (mx < dis[que[r]]) mx = dis[que[r]];
		}
		Ans += mx;
	}
	printf("%d\n", Ans);
	return 0;
}

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

const int INF = 1e9;
int main()
{
	int ans = -INF;
	int a, b;
	cin >> a >> b;
	ans = max(ans, a+b);
	ans = max(ans, a-b);
	ans = max(ans, a*b);

	cout << ans << endl;
}


Measured memory_bytes: 256
n=int(input())
for i in range(1,1000):
  if i*(i+1)//2==n:
    D=[[0]*i for l in range(i)]
    stopcnt=i
    cnt=0
    a,b=0,0
    print('Yes')
    print(i+1)
    for j in range(n):
      D[a][j-b]=j+1
      cnt+=1
      if cnt==stopcnt:
        a+=1
        b+=stopcnt-1
        cnt=0
        stopcnt-=1
    for a in range(i):
      for b in range(a,i):
        D[b][a]=D[a][b]
    DD=[]
    for j in range(i):
      DD.append(D[j][j])
    D.append(DD)
    for j in D:
      print(len(j),*j)
    exit()
print('No')


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T) {
    for (long long i = 0; i < S.size(); i++) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return;
        }
    }
    if (T.size() == S.size() + 1) {
        cout << "Yes" << endl;
        return;
    } else {
        cout << "No" << endl;
        return;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can
// remove this line by using your custom template)
int main() {
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3628
from collections import Counter
N,K,L=map(int,input().split())

def root(x):
  while p[x]>=0:
    x=p[x]
  return x

def unite(x,y):
  x,y=root(x),root(y)
  if x==y: return
  if x>y: x,y=y,x
  p[x]+=p[y]
  p[y]=x

def g(x):
  global p
  p=[-1]*N
  for _ in range(x):
    a,b=map(int,input().split())
    unite(a-1,b-1)
  return [root(i) for i in range(N)]

z=[*zip(g(K),g(L))]
cnt=Counter(z)
print(*[cnt[t] for t in z])

Measured memory_bytes: 54104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
template<class T> T in(){T x;cin>>x;return x;}
int H,A;
string S, T;

ll solve(){
	ll ans=0;
	ans = (H+A-1)/A;
	return ans;
}

int main(){
	// N = in<int>();
	// S = in<string>();
	cin>>H;
	cin>>A;
	// cin>>S;
	cout<< solve() <<endl;
	// printf("%f\n",solve());
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T> void print_container(T &container) { for (auto &t : container) { cout << t << " ";} cout << endl;}
template<class T> void printArr(T &a , int n) { for (int i = 0; i < n; i++) {cout << a[i] << " ";} cout << endl;}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n, k;
int a[N];

bool ok(int x) {
	int steps = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] <= x) {
			continue;
		} else if (a[i] % x == 0) {
			steps += (a[i] / x - 1);
		} else {
			steps += (a[i] ) / x;
		}
	}

	if (steps <= k)return 1;
	else return 0;
}

void solve() {

	cin >> n >> k;

	int low = 0, high = n + 1;

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

	high++;
	while (high - low > 1) {
		int mid = (low + high) / 2;
		if (ok(mid)) {
			high = mid;
		} else {
			low = mid;
		}
	}

	cout << high << endl;

}

int32_t main() {
	IOS;
	solve();

	return 0;
}




Measured memory_bytes: 5092
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
 
using namespace std;
typedef long long LL;

LL GCD(LL a,LL b){
    if(a < b)swap(a,b);
    if(a % b)return GCD(b,a % b);
    return b;
}

LL LCM(LL a, LL b){
    return a * b / GCD(a,b);
}

int main(){
    int N,M;
    string S,T;

    cin >> N >> M;
    cin >> S >> T;

    LL lcm = LCM(N,M);
    LL nx = lcm / N;
    LL mx = lcm / M;
    
    for(LL i = 0;i < lcm;i += mx * nx){
        if(i / nx < N && i / mx < M){
            if(S[i / nx] != T[i / mx]){
                cout << -1 << endl;
                return 0;
            }
        }
    }

    cout << lcm << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

void bubbleSort(int numbers[], int array_size)
{
  int i, j, temp;

  for (i = 0; i < (array_size - 1); i++) {
    for (j = (array_size - 1); j > i; j--) {
      if (numbers[j-1] > numbers[j]) {
        temp = numbers[j-1];
        numbers[j-1] = numbers[j];
        numbers[j] = temp;
      }
    }
  }
}


int main(void){
  int N,L[200],M,sum=0;
  int i;
  scanf("%d",&N);
  M=N*2;
  for(i=0;i<M;i++){
    scanf("%d",&L[i]);
  }
  bubbleSort(L,M);
  for(i=0;i<N;i++){
    sum+=L[2*i];
  }
  printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 128
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

MOD = 10**9+7
N, K = map(int, input().split())
A = list(map(int, input().split()))
sortA = sorted(A)

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    factinv.append((factinv[-1] * inv[-1]) % MOD)

ans = 0
for i in range(N-K+1):
    ans = (ans - sortA[i]*cmb(N-i-1, K-1, MOD)) % MOD
for i in range(K-1, N):
    ans = (ans + sortA[i]*cmb(i, K-1, MOD)) % MOD

print(ans)


Measured memory_bytes: 78188
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;


int main()
{
	int p, q;
	while (scanf("%d %d", &p, &q) != EOF)
	{
		map<int, int> rem;
		int i;
		p *= 10;
		for (i = 1; p != 0 && !rem[p]; ++i)
		{
			rem[p] = i;
			printf("%d", p/q);
			p %= q;
			p *= 10;
		}
		printf("\n");
		if (p)
		{
			for (int j = 1; j < i; ++j)
			{
				if (j < rem[p])
					printf(" ");
				else
					printf("^");
			}
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa;cin>>nyaa;

void solve() {
	int n; cin >> n;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vector<int> v;
	vector<vector<bool>> u(n);
	ll ans = 0;
	per(j, 60) {
		int cnt = 0;
		ll k = (ll)1 << j;
		rep(i, n) {
			if (k&a[i])cnt++;
		}
		if (cnt % 2 == 0) {
			v.push_back(j);
			rep(i, n) {
				if (k&a[i])u[i].push_back(true);
				else u[i].push_back(false);
			}
		}
		else {
			ans += k;
		}
	}
	ll s = 0;
	int le = 0;
	ll asum = 0;
	rep(j, v.size()) {
		/*cout << "!" << endl;
		rep(i, n) {
			rep(k, v.size()) {
				cout << u[i][k];
			}
			cout << endl;
		}*/
		Rep(i, le, n) {
			if (u[i][j]) {
				swap(u[i], u[le]); le++;
				rep(x, n) {
					if (x == le - 1)continue;
					if (u[x][j]) {
						rep(k, v.size()) {
							u[x][k] = u[x][k] ^ u[le - 1][k];
						}
					}
				}

				break;
			}
		}
	}
	rep(i, le) {
		rep(j, v.size()) {
			if (u[i][j]) {
				asum^=(ll)1<<v[j];
			}
		}
	}
	//cout << ans << endl;
	ans += 2 * asum;
	cout << ans << endl;
}

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


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  vector<int> a(5);
  for(int i = 0; i < 5; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  for(int i = 0; i < 5; i++){
    cout << a[i];
    if(i != 4)cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(b%a==0||c%a==0||b/a<c/a) re("OK")
	re("NG")
	return 0;}

Measured memory_bytes: 3620
from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]
A = Counter(A).most_common()
A = sorted(A)[::-1]
cnt = 0
l = []
ans = [0]
for i, v in A:
  if v >= 4:
    ans.append(i*i)
  if 2<=v:
    cnt += 1
    l.append(i)
    if cnt == 2:
      ans.append(l[0]*l[1])
print(max(ans))  

Measured memory_bytes: 21540
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    int x, y, z;
    cin >> x >> y >> z;
    cout << (x + y - 1) / y * z;
}


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

int main(){
    long long A,B,C,x,y,z,count,tmp1,tmp2;
    cin >> A >> B >> C;
    count = 0;
    x = A;y = B;z = C;
    while(count >= 0){
        if(x%2 == 1 || y%2 == 1 || z%2 == 1) break;
        else{
            count++;
            tmp1 = x/2;
            tmp2 = y/2;
            x = (y + z)/2;
            y = z/2 + tmp1;
            z = tmp1 + tmp2;
            if(x == A && y == B && z == C) count = -1;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<long long> vll, vLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int c,a,b;
    cin >> a >> b >> c;
    cout << min(b,c) <<" "<< max(0,b+c-a) << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int)
N = int(input())
for i in range(1, N+1):
    K = i
    for j in range(2, N+1):
        if K >= j:
            while(K % j == 0):
                d[j] += 1
                K = K//j
T = defaultdict(int)
for k, v in d.items():
    if v >= 2:
        T[2] += 1
    if v >= 4:
        T[4] += 1
    if v >= 14:
        T[14] += 1
    if v >= 24:
        T[24] += 1
    if v >= 74:
        T[74] += 1

ans = 0
ans += T[4]*(T[4]-1)*(T[2]-2)//2
ans += T[14]*(T[4]-1)
ans += (T[2]-1)*T[24]
ans += T[74]
print(ans)

Measured memory_bytes: 68736
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <sstream>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  string tmp = "";
  bool flag = true;
  set<string> st;
  for(int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if(tmp.empty() == false && tmp[tmp.size()-1] != s[0]) flag = false; 
    tmp = s;
    st.insert(s);
  }

  if(flag == true && st.size() == n) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		String ans = "";

		for (int i = 0; i < s.length(); i++) {
			switch (s.substring(i, i + 1)) {
			case "1":
				ans += "1";
				break;
			case "0":
				ans += "0";
				break;
			case "B":
				if (ans.length() != 0) {
					ans = ans.substring(0, ans.length() - 1);
				}
				break;
			}
		}

		System.out.println(ans);

		sc.close();

	}
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

S

# wwwwwbbbbbを目指す
# 各地点に対して、左側(exclusive)にあるbを持つ

Lb = [0] * (N+1)
for i,s in enumerate(S,1):
    Lb[i] = Lb[i-1] + (1 if s == '#' else 0)

answer = N + 100
black = Lb[-1]
for i in range(N+1):
    j = i+1
    # [0,i), [i,N) に分ける
    left = Lb[i]
    right = N - i - (black - Lb[i])
    cost = left + right
    if answer > cost:
        answer = cost

print(answer)

Measured memory_bytes: 11240
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = 0
    for i in range(1, N + 1):
        c = N // i
        cc = (1 + c) * c // 2
        ret += i * cc
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


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

int main(){
	int n;
	cin >> n;
	vector<long long> a(3*n);
	
	for(int i =0;i<3*n;i++){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	long long ans =0;
	for(int i =0;i<n;i++){
		ans += a.at(2*i+1);
	}
	cout << ans<< endl;
}

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

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        if(a%2){
            cout << "first" << endl;
            return 0;
        }
    }
    cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 256
class Main{
  public static void main(String[]z){
    Scanner x=new Scanner(System.in);
    int n=x.nextInt();x.nextLine();
    for(;n>0;n--){
      String s=x.nextLine();
      System.out.println(s.replaceAll("Hoshino","Hoshina"));
    }
  }
}

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

int main(){
  string s;
  cin >> s;
  if (s == "SSS"){
    cout << 0 << endl;
  }
  else if (s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR"){
    cout << 1 << endl;
  }
  else if (s == "RRR"){
    cout << 3 << endl;
  }
  else{
    cout << 2 << endl;
  }
}

Measured memory_bytes: 3600
while line = gets
line = line.chomp.to_f

  if line <= 48.0
    puts "light fly"
    elsif line > 48.0 && line <= 51.0
    puts "fly"
    elsif line > 51.0 && line <= 54.0
    puts "bantam"
    elsif line > 54.0 && line <= 57.0
    puts "feather"
    elsif line > 57.0 && line <= 60.0
    puts "light"
    elsif line > 60.0 && line <= 64.0
    puts "light welter"
    elsif line >64.0 && line <= 69.0
    puts "welter"
    elsif line > 69.0 && line <= 75.0
    puts "light middle"
    elsif line > 75.0 && line <= 81.0
    puts "middle"
    elsif line > 81.0 && line <= 91.0
    puts "light heavy"
    else
    puts "heavy"
  end
end


Measured memory_bytes: 6844
#include <cstdio>

int main () {
    int n, b, f, r, v;
    int m[4][3][10];
    for (int i=0; i<4; i++) {
        for (int j=0; j<3; j++) {
            for (int k=0; k<10; k++) {
                m[i][j][k] = 0;
            }
        }
    }
    scanf("%d", &n);
    for(int i=0; i<n; i++) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        m[b-1][f-1][r-1] += v;
    }

    for (int i=0; i<4; i++) {
        for (int j=0; j<3; j++) {
            for (int k=0; k<10; k++) {
                printf(" %d", m[i][j][k]);
            }
            printf("\n");
        }
        if (i < 3) printf("####################\n");
    }
}

Measured memory_bytes: 1040
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input! {
        row: usize,
        col: usize,
        h: usize,
        w: usize,
    }

    println!("{}", row * col - h * col - ((row - h) * w));
}


Measured memory_bytes: 4352
n = int(input())
ans = 10**20
a = n ** 0.5
a = int(a)
for i in range(a+1):
  if i ==0:
    continue
  if n % i != 0:
    continue
  j = n/i
  j = int(j)
  ans = min(ans, i+j-2)
print(ans)

Measured memory_bytes: 3060
//============================================================================
// Name        : JOI.cpp
// Author      :2015 ho3
// Version     :???11:08
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>

using namespace std;
long long N,M,K;
long long A[20001]={};
long long dp[20001];
long long mmD[20001][1001];
const long long INF=100000000000000000;

long long calc(long long n1){
	if(dp[n1]>-1)return dp[n1];
	long long ans=INF;
	for(long long i=1;i<M+1&&i<n1+1;++i){
			ans=min(ans,calc(n1-i)+K+i*mmD[n1-i][i]);
	}
	dp[n1]=ans;
	return ans;
}

int main() {
	cin>>N>>M>>K;
	for(long long i=1;i<N+1;i++)cin>>A[i];

	fill(dp,dp+20001,-1);
	long long maxD[1001]={};
	long long minD[1001]={};

	for(int i=0;i<N+1;i++){
		maxD[0]=0;
		minD[0]=INF;
		for(int j=1;j<M+1&&(i+j)<N+1;j++){
			maxD[j]=max(maxD[j-1],A[i+j]);
			minD[j]=min(minD[j-1],A[i+j]);
			mmD[i][j]=maxD[j]-minD[j];
		}
	}
	dp[0]=0;
//	long long R;
//	for(int i=1;i<N;i++){
//		for(int j=0;j<M+1;j++)
//		R=calc(i,j);
//	}
//	R=calc(N,0);
//	cout<<R<<endl;
	cout<<calc(N)<<endl;
	return 0;
}

Measured memory_bytes: 159812
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <cmath>
#include <cctype>

using namespace std;

int main()
{
	char str[400];
	int m, h;

	while (1) {
		cin >> str;
		int len = strlen(str);
		if (strcmp(str, "-") == 0) break;
			cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> h;
			for (int j = 0; j < h; j++) {
				str[len + j] = str[j];
			}
			for (int j = 0; j < len; j++) {
				str[j] = str[j + h];
			}
		}
		str[len] = '\0';
		cout << str << endl;
	}

	return (0);
}

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

#define print cout <<

template <typename T>
vector<T> getValues(int num);

bool isTriangle(int a, int b, int c);
bool notEqual(int a, int b, int c);

int main(){
    int N;
    cin >> N;
    auto inputs = getValues<int>(N);
    int ans = 0;
    for(int i=0;i<N;i++){
      for(int j=i+1;j<N;j++){
        for(int k=j+1;k<N;k++){
          if(isTriangle(inputs.at(i),inputs.at(j),inputs.at(k))){
            if(notEqual(inputs.at(i),inputs.at(j),inputs.at(k))){
              ans++;
            }
          }
        }
      }
    }
    print ans << endl;

}

template <typename T>
vector<T> getValues(int num){
    vector<T> values(num);
    for(int i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

bool isTriangle(int a, int b, int c){
  if(((a+b)>c) && ((a+c)>b) && ((c+b)>a)){
    return true;
  }
  return false;
}

bool notEqual(int a, int b, int c){
  if(a==b || a==c || b==c){
    return false;
  }
  return true;
}


Measured memory_bytes: 3604