akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const double dINF = 1e+12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  ll N;
  double T, A;
  cin >> N >> T >> A;
  double H[N];
  rep(i,0,N)cin >> H[i];

  ll ans = 0;
  double Min = dINF;
  rep(i,0,N) {
    if (Min > abs(A - (T - H[i] * 0.006))) {
      Min = abs(A - (T - H[i] * 0.006));
      ans = i;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    h = int(stdin.readline())

    ans = 0

    while 2 ** (ans + 1) <= h:
        ans += 1

    print(2 ** (ans + 1) - 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Measured memory_bytes: 38256
N = int(input())
A = list(map(int, input().split()))
flag = 0
cnt = 1
for k in range(N-1):
  if (A[k] > A[k+1]):
    flag_tmp = flag
    flag = -1
    if flag_tmp == 1:
      cnt += 1
      flag = 0
  elif (A[k] < A[k+1]):
    flag_tmp = flag
    flag = 1
    if flag_tmp == -1:
      cnt += 1
      flag = 0
print(cnt)

Measured memory_bytes: 14252
// 0130
#include <iostream>
#include <deque>
#include <string>
const int C = 'a';
using namespace std;

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

	for(int i=0;i<n;i++){
		string str;
		cin>>str;

		deque<char> dq;
		dq.push_back(str[0]);
		int ch[26] = {0};
		ch[str[0]-C]++;

		for(int j=1;j<str.length();j+=3){
			if((str[j] == '-') && (str[j+1] == '>') && (ch[str[j+2]-C] == 0)){
				dq.push_back(str[j+2]);
				ch[str[j+2]-C]++;
			}

			if((str[j] == '<') && (str[j+1] == '-') && (ch[str[j+2]-C] == 0)){
				dq.push_front(str[j+2]);
				ch[str[j+2]-C]++;
			}
		}

		for(deque<char>::iterator itr = dq.begin();itr != dq.end();itr++)
			cout<<*itr;
		cout<<endl;

	}
	
	
	return 0;
}

Measured memory_bytes: 1200
from math import ceil

S=input()
N=len(S)
a=S.count("a")
b=S.count("b")
c=S.count("c")

maxi=max(a,b,c)
mini=min(a,b,c)
midi=a+b+c-maxi-mini

ans="NO"
if maxi<=ceil(N/3):
  if midi<=ceil(N/3):
    if mini<=ceil(N/3):
      ans="YES"
      
print(ans)

Measured memory_bytes: 3188
while 1:
    n = int(input())
    if n == 0:
        break

    score = list(map(int, input().split()))
    top = sum(score)
    bottom = sum(score)

    for _ in range(n-1):
        score = list(map(int, input().split()))
        total = sum(score)
        if top < total:
            top = total
        elif bottom > total:
            bottom = total

    print(top, bottom)



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

int main() {
  int N, M;
  cin >> N;
  vector<string> s(N);
  rep(i, N){
    cin >> s.at(i);
  }
  cin >> M;
  vector<string> t(M);
  rep(i, M){
    cin >> t.at(i);
  }
  vector<string> a;
  vector<int> b;
  rep(i,N){
    bool isFound = false;
    rep(j,a.size()){
      if(a.at(j)==s.at(i)){
        b.at(j)++;
        isFound = true;
        break;
      }
    }
    if(!isFound) {
      a.push_back(s.at(i));
      b.push_back(1);
    }
  }
  rep(i,M){
    bool isFound = false;
    rep(j,a.size()){
      if(a.at(j)==t.at(i)){
        b.at(j)--;
        isFound = true;
        break;
      }
    }
  }
  int ans = 0;
  rep(i,b.size()){
    if(b.at(i) > ans) ans = b.at(i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int N,M;
ll ans=0;

void dfs(int p,vector<vector<int>> E,vector<bool> used){  
    bool gg=true;
    used[p]=true;
    for (int i=0;i<N;i++){
        if (!used[i]) gg=false;
    }
    if (gg) {
        ans++;
        return;
    }

    bool cont=false;

    for (int i=0;i<E[p].size();i++){
        if (!used[E[p][i]]) {
            cont = true;
            gg = false;
            dfs(E[p][i],E,used);
        }
    }
    if (!cont) {
        return;
    }
}

int main(void){

    cin>>N>>M;
    vector<vector<int>> E(N);
    for (int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        E[a-1].push_back(b-1);
        E[b-1].push_back(a-1);
    }
    vector<bool> used(N,false);
    used[0]=true;
    dfs(0,E,used);
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int p[n];
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    sort(p,p+n);
    int sum = 0;
    for(int i = 0; i < k; i++){
        sum += p[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; ++i)
#define vi vector<int>
#define all(c) (c).begin(), (c).end()

template <typename T> T hungarian(vector<vector<T>> &A) {
    const T infty = numeric_limits<T>::max();
    const int N = (int)A.size();
    const int M = (int)A[0].size();
    vector<int> P(M), way(M);
    vector<T> U(N, 0), V(M, 0), minV;
    vector<bool> used;

    for(int i = 1; i < N; i++) {
        P[0] = i;
        minV.assign(M, infty);
        used.assign(M, false);
        int j0 = 0;
        while(P[j0] != 0) {
            int i0 = P[j0], j1 = 0;
            used[j0] = true;
            T delta = infty;
            for(int j = 1; j < M; j++) {
                if(used[j]) continue;
                T curr = A[i0][j] - U[i0] - V[j];
                if(curr < minV[j]) minV[j] = curr, way[j] = j0;
                if(minV[j] < delta) delta = minV[j], j1 = j;
            }
            for(int j = 0; j < M; j++) {
                if(used[j])
                    U[P[j]] += delta, V[j] -= delta;
                else
                    minV[j] -= delta;
            }
            j0 = j1;
        }
        do {
            P[j0] = P[way[j0]];
            j0 = way[j0];
        } while(j0 != 0);
    }
    return -V[0];
}

main() {
    while(1) {
        int n;
        cin >> n;
        if(!n) return 0;
        vi x(n), y(n), z(n);
        rep(i, n) cin >> x[i] >> y[i] >> z[i];
        vi id(n);
        rep(i, n) {
            vi v{x[i], y[i], z[i]};
            sort(all(v));
            x[i] = v[0], y[i] = v[1], z[i] = v[2];
        }
        vector<vi> a(n + 1, vi(n + 1));
        int ans = 0;
        rep(i, n) rep(j, n) {
            if(x[i] < x[j] and y[i] < y[j] and z[i] < z[j]) { a[i + 1][j + 1] = -x[i] * y[i] * z[i]; }
        }
        rep(i, n) ans += x[i] * y[i] * z[i];
        cout << ans + hungarian(a) << endl;
    }
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
int arr[102];
int main() {

int n;
cin>>n;
int mini=1e9;

for(int i=0;i<n;i++)cin>>arr[i];
    for(int i=1;i<100;i++)
    {  int sum=0;
        for(int j=0;j<n;j++){

sum+=pow(arr[j]-i,2);
        }
        mini=min(sum,mini);

    }
cout<<mini;
    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    lint a, b;
    cin >> a >> b;
    --a;

    lint ans = 0, tmp;
    REP(i, 1, 45){
        tmp = 0;
        if(a >= 0LL && (a >> i & 1LL)){
            tmp += (a + 1LL) % 2LL;
        }
        if(b >> i & 1LL){
            tmp += (b + 1LL) % 2LL;
        }
        tmp %= 2LL;
        if(tmp == 1LL){
            ans += 1LL << i;
        }
    }
    ++a;
    a /= 2LL;
    ++b;
    b /= 2LL;
    tmp = (b - a) % 2LL;
    ans ^= tmp;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#include<stdlib.h>
#define ll long long
const int Max = 4;

int a[4][2] = {0,-1,1,0,-1,0,0,1};
int goal[16][2]= {{3,3},{0,0},{0,1},{0,2},{0,3},{1,0},{1,1},{1,2},{1,3},{2,0},{2,1},{2,2},{2,3},{3,0},{3,1},{3,2}};
int mpp[Max][Max],mpp2[Max*Max];

int flag = 0,limit,Mi;
int ddd()
{
    int i,j;
    int sum = 0;
    for(i = 0; i<4; i++)
    {
        for(j = 0; j<4; j++)
        {
            if( mpp[i][j]!=0 )
                sum += abs(i-goal[mpp[i][j]][0])+abs(j - goal[mpp[i][j]][1]);
        }
    }
    return sum;
}

void dfs(int x,int y,int len,int f)
{
    int d = ddd();
    if(flag) return;
    if(len==limit)
    {
        if(d==0)
        {
            flag = 1;
            Mi = len;
            return ;
        }
        return;
    }

    for(int i = 0; i<4; i++)
    {
        int tx = x + a[i][0];
        int ty = y + a[i][1];
        if(tx>=0&&ty>=0&&ty<4&&tx<4 && (i+f)!=3 )
        {
            swap(mpp[x][y],mpp[tx][ty]);
            if(len+ddd()<=limit)
            {
                dfs(tx,ty,len+1,i);
                if(flag) return ;
            }
            swap(mpp[x][y],mpp[tx][ty]);
        }
    }
}
int main()
{
    int i,j;
    while(~scanf("%d",&mpp[0][0]))
    {
        int y,x;
        if(mpp[0][0]==0)
        {
            y = 0;
            x = 0;
        }
        for(i = 0; i<4; i++)
        {
            for((i==0)?j=1:j=0; j<4; j++)
            {
                scanf("%d",&mpp[i][j]);
                if(mpp[i][j]==0)
                {
                    x = i;
                    y = j;
                }
            }
        }
        /*for(i = 0;i<4;i++)
        {
        	for(j=0;j<4;j++)
        	{
        		printf("%d ",mpp[i][j]);
        	}
        	printf("\n");
        }*/
        flag = 0;
        limit = ddd();
//        printf("<<<<%d\n",limit);
        while(!flag)
        {
            dfs(x,y,0,-1);
                limit ++;
        }
        if(flag)
            printf("%d\n",Mi);
    }
    return 0;
}


Measured memory_bytes: 2732
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

int main() {
  double N;
  cin >> N;
  double amount = N / 1.08;

  if (floor(ceil(amount) * 1.08) == N) {
    cout << (long)ceil(amount) << endl;
  } else if (floor(floor(amount) * 1.08) == N) {
    cout << (long)floor(amount) << endl;
  } else {
    cout << ":(" << endl;
  }
}


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

#define iter(n) for(int iter_var = 0; iter_var < n; iter_var += 1)
#define rep(i, s, n) for(int i = s; i < n; i += 1)
#define lli long long int
#define INF 1e9
#define MOD 1000000007

using namespace std;

int lcs(string s, string t){

  int s_size = s.size();
  int t_size = t.size();
  vector<vector<int>> dp(s_size + 1, vector<int>(t_size + 1, 0));

  rep(i, 1, s_size + 1) rep(j, 1, t_size + 1){
    if(s[i - 1] == t[j - 1]){
      dp[i][j] = dp[i - 1][j - 1] + 1;
    } else {
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }

  return dp[s_size][t_size];
}

int main(){

  int n; cin >> n;
  iter(n){
    string s, t; cin >> s >> t;
    cout << lcs(s, t) << endl;
  }

  return 0;
}



Measured memory_bytes: 6856
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            long tmp = 0;
            for(int i = 0; i < N.Length; i++)
            {
                tmp += long.Parse(N.Substring(i,1));
            }
            if (long.Parse(N) % tmp == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


Measured memory_bytes: 27476
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
using namespace std;
ll dp[100009][11];
vector<ll> nex[100009],ma(100009),cen(100009),r(100009),col(100009);
void paint(ll cc, ll cr, ll tm){
	if(dp[cc][cr]==0){
		for(int i=cr;i>=0;i--){
			if(dp[cc][i]==0){
				dp[cc][i]=tm+1;
			}
		}
		//cout<<cc<<" "<<cr<<" "<<tm<<endl;
		if(cr>0){
			for(int i=0;i<nex[cc].size();i++){
				paint(nex[cc][i], cr-1, tm);
			}
		}
	}
	return;
}
	
int main(){
	ll n,m,q;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		ll tmpa, tmpb;
		cin>>tmpa>>tmpb;
		nex[tmpa].pb(tmpb);
		nex[tmpb].pb(tmpa);
	}
	cin>>q;
	for(int i=0;i<=100000;i++){
		for(int j=0;j<=10;j++){
			dp[i][j]=0;
		}
	}
	for(int i=1;i<=q;i++){
		cin>>cen[i]>>r[i]>>col[i];
	}
	for(int i=q;i>=1;i--){
		paint(cen[i],r[i],i);
	}
	for(int i=1;i<=n;i++){
		if(dp[i][0]==0){cout<<0<<endl;}
		else{ cout<<col[ dp[i][0] -1 ]<<endl;}
	}
	return 0;
}

Measured memory_bytes: 18676
import sys
import numpy as np
import re

s = input()
n=len(s)
#ss = [si for si in s]
ret = []


result = re.finditer(r'R*L*', s)

for m in result:
  mg = m.group()
  if mg=="":
    continue
  mg_R = mg.count("R")
  mg_L = mg.count("L")
  
  #0 pad
  ret.extend([0]*(mg_R-1))
    
  if (mg_R+mg_L)%2==0:
    r = int((mg_R+mg_L)/2)
    ret.extend([r,r])
    
  else:
    r1 = int((mg_R+mg_L)/2)
    r2 = int((mg_R+mg_L)/2)+1
    if mg_R > mg_L:
    	r1,r2 = r2,r1
    if max(mg_R,mg_L)%2==0: #大きいほうが偶数なら
      r1,r2 = r2,r1
    ret.extend([r1,r2])
  
  #0 pad
  ret.extend([0]*(mg_L-1))

print(" ".join(map(str, ret)))

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

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

int main() {
  int n, m; cin >> n >> m;
  vector<int> arr(m);
  for (int i = 0; i < m; ++i) {
    cin >> arr[i];
  }
  map<int, int> match;
  vector<int> match_nums = {2,5,5,4,5,6,3,7,6};
  for (int i = 1; i < 10; ++i) {
    match[i] = match_nums[i - 1];
  }
  vector<cpp_int> dp(n + 7, -1);
  dp[0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int a: arr) {
      if (dp[i] == -1) continue;
      if (dp[i + match[a]] < dp[i] * 10 + a) {
        dp[i + match[a]] = dp[i] * 10 + a;
      }
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.size();
    
    forn(i, 0, n) {
        if (i+1 < n && s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        if (i+2 < n && s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << "-1 -1\n";
}


Measured memory_bytes: 3692
N = input()

dic = {
    '1': 'p',
    '2': 'h',
    '3': 'b',
    '4': 'h',
    '5': 'h',
    '6': 'p',
    '7': 'h',
    '8': 'p',
    '9': 'h',
    '0': 'p',
}

print(dic[N[-1]]+'on')


Measured memory_bytes: 9032
MAX = 50
  
# Function to print Excel column name  
# for a given column number 
def printString(n): 
  
    # To store result (Excel column name) 
    ans=""
  
    # To store current index in str which is result 
    i = 0
  
    while n > 0: 
        # Find remainder 
        rem = n % 26
  
        # if remainder is 0, then a  
        # 'Z' must be there in output 
        if rem == 0: 
            ans= ans+'z'
            i += 1
            n = (n // 26) - 1
        else: 
            ans+= chr((rem - 1) + ord('a')) 
            i += 1
            n = n //26
    
  
    # Reverse the string and print result 
    ans=ans[::-1]
    #string=string.lower()
    print(ans)
  
n=int(input())
printString(n)
  

Measured memory_bytes: 61872
T = []
total = 0
min_offset = 10
for _ in range(5):
    t = int(input())
    offset = t % 10
    if offset > 0:
        t = (int(t / 10) + 1) * 10
        if offset < min_offset:
            min_offset = offset
    total += t
print(total+min_offset-10)


Measured memory_bytes: 2940
/*
 * バブルソート
 * 泡が水面に上がってくるように配列の要素を動かすソート方法。
 * 以下のようなアルゴリズムで並び替える。
 *
 * bubbleSort(A,N)　//N個の要素を含む0オリジンの配列A
 *  flag = 1 // 逆の隣接要素が存在する
 *  while flag
 *    flag = 0
 *    for j が N-1 から 1 まで
 *    　if A[j] < A[j-1]
 *         A[j] とA[j-1]を交換
 *      flag = 1
 *
 * input
 * n(ソートする配列の要素)
 * a b c d ... (ソート前の配列)
 *
 * output
 * a b c d ...(ソートした配列)
 * n(要素の交換回数)
 */
#include <stdio.h>
#include <stdbool.h>

int main()
{
	int n;
	scanf("%d", &n);

   //入力
	int array[n];
	for (int i = 0; i < n; i++)
		scanf("%d", &array[i]);

	bool flag = true;

   int count = 0;
   int tmp = 0;

   //ソート処理
	while (flag) {

      flag = false;
      
      for (int j = n-1; j >= 1; j--) {
         if (array[j] < array[j-1]) {
            tmp = array[j-1];
            array[j-1] = array[j];
            array[j] = tmp;
            count++;
            flag = true;
         }
      }
	}


   //出力
   for (int i = 0; i < n; i++) {
      printf("%d", array[i]);
      if (i + 1 < n)
         printf(" ");
      if (i == n-1)
         printf("\n");
   }

   printf("%d\n", count);
	return 0;
}



Measured memory_bytes: 2112
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  readln;
  int[int] list;
  foreach (line; stdin.byLine) {
    auto n = line.chomp.to!int;
    list[n] = 1 - list.get(n, 0);
  }
  int sum;
  foreach (k; list.keys) {
    sum += list[k];
  }
  sum.writeln;
}


Measured memory_bytes: 4988
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
#if DEBUG
    printfn "debuged"
#endif

    let scanner = Scanner()
    let s = scanner.Next()
    String.replicate (String.length s) "x"
    |> printfn "%s"

    0


Measured memory_bytes: 14032
// CODE by Kazhybay Askar

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
using namespace __gnu_pbds;

/*
find_by_order(k);
order_of_key(k);
ordered_set(int) s;
*/

/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
rng();
shuffle(permutation.begin(), permutation.end(), rng);
*/

/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC    optimize("Ofast")
#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#define F      first
#define S      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define nl     '\n'
#define ordered_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>

typedef unsigned long long ull;
typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

ll n,a[MAXN];

void solve(){
    cin>>n;
    ll m;
    cin>>m;
    ll sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    for(int i=1;i<=m;i++){
        if(double(a[i])<double(double(sum)/(4*m))){
            cout<<"No";
            return;
        }
    }
    cout<<"Yes";
}



int main(){
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}


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

using namespace std;

const int NMAX = 200005;

long long n, a[NMAX], L[NMAX], R[NMAX], st[NMAX];

int main(){
    //freopen("input.txt","r", stdin);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];

    int top = 0;
    st[0] = 0;
    for(int i = 1; i <= n; i++){
        while(top > 0 && a[st[top]] >= a[i]) top--;
        L[i] = st[top] + 1;
        st[++top] = i;
    }

    top = 0, st[0] = n+1;
    for(int i = n; i >= 1; i--){
        while(top > 0 && a[st[top]] >= a[i]) top--;
        R[i] = st[top] - 1;
        st[++top] = i;
    }

    long long res = 0, t1, t2;
    for(int i = 1; i <= n; i++){
        t1 = i-L[i];
        t2 = R[i] - i;
        res += (t1 + t2 + 1 +t1*t2)*a[i];
    }
    cout << res;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#define MOD 1000000007
#define INT long long int
#define REP(i,n) for(int(i)=0;(i)<(n);(i)++) 
using namespace std;
const long long INF = numeric_limits<long long>::max();


int main()
{
    int N;
    string S;
    cin>>N;
    cin>>S;
    bool ans[N];
    bool flag = false;
    for (int i=0;i<4;i++){
        flag = false;
        REP(j,N) ans[i]=false;
        REP(j,2){
            if ((i>>j)%2==1) ans[j] = true;
            else ans[j] = false;
        }
        if (S[0]=='o') ans[N-1] = ((ans[0]^ans[1]));
        else ans[N-1] = !(ans[0]^ans[1]);

        for (int j=1;j<N-1;++j){
            if (j==N-2){
                        
                bool tmp;
                if (S[j]=='o'){
                    tmp = ans[j-1]^ans[j];
                }else{
                    tmp = !(ans[j-1]^ans[j]);
                }
                if (tmp!=ans[N-1]){
                    flag = true;
                    break;
                }
            }else{
                bool tmp;
                if (S[j]=='o'){
                    ans[j+1] = ans[j-1]^ans[j];
                }else{
                    ans[j+1] = !(ans[j-1]^ans[j]);
                }
            }
            
        }
        if (flag) continue;
        bool tmp;
        if (S[N-1]=='o'){
            tmp = ans[N-1]^ans[N-2];
        }else{
            tmp = !(ans[N-1]^ans[N-2]);
        }
        if (tmp!=ans[0]){
            continue;
        }
        
        if (S[0]=='o'){
            tmp = ans[N-1]^ans[0];
        }else{
            tmp = !(ans[N-1]^ans[0]);
        }
        if (tmp!=ans[1]){
            continue;
        }
            
        for (int i=0;i<N;i++){
             if (!ans[i]) cout<<'S';
             else cout<<'W';
        }
        cout<<endl;
        return 0;
    }
    cout <<-1<<endl;

    return 0;
}

Measured memory_bytes: 640
=begin
N
A1 A2 ... An
=end

n = gets.chomp.split(" ").map(&:to_i)
as = gets.chomp.split(" ").map(&:to_i)

c_number = 0
b_count = 0

as.each do |a|
  if a == c_number + 1
    c_number += 1
  else
    b_count += 1
  end
end

if c_number == 0
  puts -1
else
  puts b_count
end


Measured memory_bytes: 16772
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;

int main(){
    string s;
    int n;
        cin >> n >> s;
    for(int i=0; i<s.size(); i++){
        int tmp = s[i]-'A'+n;
        if(tmp<26)
            printf("%c", s[i]+n);
        else 
            printf("%c", s[i]+n-26);
    }
        cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        int cnt = 0;
        string x = s.substr(0, i), y = s.substr(i, n - 1);
        set<char> a, b;
        for (int i = 0; i < x.size(); i++) a.insert(x[i]);
        for (int i = 0; i < y.size(); i++) b.insert(y[i]);
        for (auto t = a.begin(); t != a.end(); t++) {
            if (b.find(*t) != b.end()) cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    N, K = map(int, input().split())

    result = 0
    for i in range(1, N + 1):
        cnt = max(math.ceil(math.log(K / i, 2)), 0)
        result += (1 / N) * (1 / 2)**cnt
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
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 II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import defaultdict

def main():
    N = II()
    xy = []
    for _ in range(N):
        xy.append(LI())
    xy2g = defaultdict(int)
    g2xy = defaultdict(set)
    for x, y in xy:
        y = -y
        gx = xy2g[x]
        gy = xy2g[y]
        if gx == 0 or gy == 0:
            g = gx or gy or x
            xy2g[x] = xy2g[y] = g
            g2xy[g] |= {x, y}
        elif gx != gy:  # merge
            if len(g2xy[gx]) < len(g2xy[gy]):
                gx, gy = gy, gx
            for xy in g2xy[gy]:
                xy2g[xy] = gx
            g2xy[gx] |= g2xy[gy]
            g2xy[gy].clear()
    ans = -N
    for xys in g2xy.values():
        nx = sum(xy > 0 for xy in xys)
        ny = len(xys) - nx
        ans += nx * ny
    return ans

print(main())

Measured memory_bytes: 114396
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size()) 
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

vector <int> son[1050];
int dp[5050];
int in[5050];

bool tdp[1050][5050];
bool tdp2[5050];
void DFS(int n) {

	tdp[n][0] = true;
	int s = 0, i;
	for (auto it : son[n]) {
		DFS(it);
		s += in[it] + dp[it];
		
		for (i = 0; i <= in[n]; i++) tdp2[i] = false;
		for (i = 0; i <= in[n]; i++) {
			if (!tdp[n][i]) continue;
			if (i + in[it] <= in[n]) tdp2[i + in[it]] = true;
			if (i + dp[it] <= in[n]) tdp2[i + dp[it]] = true;
		}
		for (i = 0; i <= in[n]; i++) tdp[n][i] = tdp2[i];
	}
	
	for (i = in[n]; i >= 0; i--) if (tdp[n][i]) break;
	if (i < 0) {
		printf("IMPOSSIBLE\n");
		exit(0);
	}
	dp[n] = min(5001, s - i);
}
int main() {
	int N, i;
	scanf("%d", &N);
	for (i = 2; i <= N; i++) {
		int t;
		scanf("%d", &t);
		son[t].push_back(i);
	}
	for (i = 1; i <= N; i++) scanf("%d", &in[i]);

	DFS(1);
	return !printf("POSSIBLE\n");
}

Measured memory_bytes: 4864
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
//#include<algorithm>
//#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(ll X) {
	int keta = 0;
	char C[11];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

const ll mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

ll facN, facK;
int A[100001];

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


	int N = getint();
	int kazu = 0;
	rep1(i, N) {
		int a = getint();
		if (A[a]) kazu = A[a] + N - i;
		else A[a] = i;
	}

	A[0] = 1;
	rep1(i, N + 1) A[i] = (ll)A[i - 1] * i % mod;
	facN = A[N + 1];
	facK = A[kazu];
	A[N + 1] = modpow(A[N + 1], mod - 2);
	for (int i = N + 1; i > 0; i--) A[i - 1] = (ll)A[i] * i % mod;


	rep1(i, N + 1) {
		ll kotae = facN * A[i] % mod * A[N + 1 - i];
		if (kazu >= i - 1) {
			kotae = kotae - facK * A[i - 1] % mod * A[kazu - i + 1];
		}
		kotae %= mod;
		if (kotae < 0) kotae += mod;
		putint(kotae);
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

template <typename T>
inline void debug(vector<T> v) {
	cout << "[";
	for (size_t i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
	}
}

int main() {
	bool debug = false;
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	if (debug) {
		cout << "\x1b[41m" << "Debug Mode " << endl;
	}
	(debug) ? DebugMain() : Main();
	return 0;
}

inline void Main(){
	int N;
	string S;
	cin >> N;
	if (N == 1) {
		cout << "No" << endl;
		return;
	}

	cin >> S;
	Yes(S.substr(0, N / 2) == S.substr(N / 2, N - 1));
}

Measured memory_bytes: 256
/*
 * atcoder/dp_2nd/i.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long
#define MOD 1000000007

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 3100;
int N;
double P[MAX];

double dp[MAX][MAX] = {0.0};

void input() {
  cin >> N;
  loop(n,0,N) {
    cin >> P[n];
  }
}

void solve() {
  dp[0][0] = 1;
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      dp[i+1][j+1] += dp[i][j] * P[i]; // 次のコインでj+1枚表が出る確率 = 今回まででj枚表 x 次回表
      dp[i+1][j] += dp[i][j] * (1-P[i]);

    }
  }

  double p = 0.0;
  for (int j=(N/2)+1; j<=N; j++) p += dp[N][j];
  cout << p << endl;
}

int main() {
  cout.precision(15);
  input();
  solve();
  return 0;
}


Measured memory_bytes: 73984
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A;
    cin>> A;
    int B;
    cin>>B;
    int C;
    cin>>C;
    if(A<=C && B>=C){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
    }
    


Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val A = new Array[Int](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toInt


  //
  val dp = new Array[Int](N+1)
  dp(1) = A(1)
  var cnt = 1

  def check(i: Int, n: Int): Boolean = {
    dp(i) < n
  }

  // 条件を満たす最小の値を返す
  def binarySearch(min: Int, max: Int, n: Int): Int = {
    val mid: Int = (max + min) / 2
      (max - min) match{
      case 0 | 1 =>
        check(min, n) match{
          case true  => min
          case false => max
        }
      case _ =>
        (check(mid, n)) match{
          case true  => binarySearch(min, mid, n)
          case false => binarySearch(mid, max, n)
        }
    }
  }

  for (i <- 2 to N) {
    val now = A(i)
    if (now <= dp(cnt)) {
      cnt += 1
      dp(cnt) = now
    }
    else {
      val ind = binarySearch(1, cnt, now)
      dp(ind) = now
    }
  }

  println(cnt)
}


object LISlen{
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 39604
n = int(input())
a = list(map(int, input().split()))
cnt4 = 0
cnt2 = 0
cnt = 0
for i in range(n):
    if a[i] % 4 == 0:
        cnt4 += 1
    elif a[i] % 2 == 0:
        cnt2 += 1
    else:
        cnt += 1

if cnt2 == 0:
    if cnt <= cnt4 + 1:
        print("Yes")
    else:
        print("No")
else:
    if cnt <= cnt4:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
   int n;
   int prime[1000000] = {1,1};
   int a=2;
   vector<int> r;
   while (scanf("%d",&n) != EOF)
   {
      int count=0;
      for (int i=a; i<=sqrt(n); i++)
      {
	 if (prime[i] == 0)
	 {
	    for (int j=i*2; j<1000000; j+=i)
	    {
	       prime[j] = 1;
	    }
	 }
	 a=i;
      }
      for (int i=2; i<=n; i++)
      {
	 if (prime[i] == 0)count++;
      }
      r.push_back(count);
   }
   for (int i=0; i<r.size(); i++)
   {
      cout << r[i] << endl;
   }
   return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    bool flag = false;
    _rep(i,1,10){
        _rep(j,1,10){
            if(i * j == n){
                flag = true;
                break;
            }
        }
    }
    if(flag)print("Yes");
    else print("No");
}


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

int main(){
    int H,W,N;
    cin >> H >> W >> N;
    vector<vector<int> > vec(H,vector<int>(W,0));//全て0で初期化
    int count = 0;
    int sum = 0;
    if(H>=W){
        while(sum<N){
            sum += H; 
            count++;
        }
    }
    else{
        while(sum<N){
            sum += W;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const ll mod = 1e9 + 7;

char maze[1005][1005];
int dist[1005][1005];
bool done[1005][1005];
int w,h;
queue<pair<int,int>>p;
int dir_x[4] = {1,0,-1,0};
int dir_y[4] = {0,1,0,-1};

void search(int a,int b,int k){
    
    if(done[a][b])return;
    if(a < 0 || b < 0 || a >= h || b >= w)return;
    if(maze[a][b] == '.'){
        dist[a][b] = k;
        done[a][b] = true;
        p.push(make_pair(a,b));
        rep(i,4){
            search(a+dir_x[i],b+dir_y[i],k);
        }

    }

}




int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll ch,cw,dh,dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    --ch;--cw;--dh;--dw;

    rep(i,h)rep(j,w){
        cin >> maze[i][j];
        done[i][j] = false;
    }
    int k = 1;
    queue<pair<int,int>>b;
    b.push(make_pair(ch,cw));
    while(1){
        while(!b.empty()){
            auto pr = b.front();b.pop();
            search(pr.first,pr.second,k);
        }
        while(!p.empty()){
            auto pr = p.front();p.pop();
            for(int i = -2; i <= 2; ++i)for(int j = -2; j <= 2; j++){
                if(!done[pr.first+i][pr.second+j] && maze[pr.first+i][pr.second+j] == '.'){
                    b.push(make_pair(pr.first+i,pr.second+j));
                }
            }
        }
        if(b.empty())break;
        k++;

    }

    rep(i,h){
        rep(j,w){
            cerr << dist[i][j];
        }
        cerr << "\n";
    }
    if(dist[dh][dw] == 0){
        cout << -1 << endl;
    }else{
        cout << dist[dh][dw]-1 << endl;
    }
    return 0;


}


Measured memory_bytes: 9612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

int main() {
  ll n, m;
  cin >> n >> m;
  ll tmp = 0;
  for (ll i = m*10; i < m*10+10; i++) {
    if ((i*8)/100 == n) {
      cout << i << endl;
      tmp++;
      break;
    }
  }
  if (!tmp) cout << -1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
using namespace std;
int main()
{
	string s;
	cin >> s;
	int pos = s.size() - 1;
	vector<string> vec;
	bool Flag = true;
	while(pos >= 0)
	{
		if(s[pos] == 'm')
		{
			if(pos - 4 < 0)
			{
				Flag = false;
				break;
			}
		   	if(s.substr(pos - 4, 5) == "dream")
			{
				pos -= 5;
				//vec.push_back("dream");
			}
			else
			{
				Flag = false;
				break;
			}
		}
		else if(s[pos] == 'e')
		{
			if(pos - 4 < 0)
			{
				Flag = false;
				break;
			}
			if(s.substr(pos - 4, 5) == "erase")
				pos -= 5;
			else
			{
				Flag = false;
				break;
			}
		}
		else if(s[pos] == 'r' && pos >= 5)
		{
			int flag = 0;
			if(pos - 5 >= 0)
			{
				if(s.substr(pos - 5, 6) == "eraser")
					pos -= 6;
				else
					flag++;
			}
			if(pos - 6 >= 0)
			{
				if(s.substr(pos - 6, 7) == "dreamer")
					pos -= 7;
				else
					flag++;
			}
			if(flag == 2)
			{
				Flag = false;
				break;
			}
		}
		else 
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	if(Flag == false)
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <functional>
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {

	int n, f=0;

	while(cin >> n, n!=0) {
		if(!f) {
			f=1;
		}
		else {
			cout << endl;
		}
		multimap<int, string, greater<int> > team;
		for(int i=0; i<n; i++) {
			int a, b, c;
			char s[32];
			cin >> s >> a >> b >> c;
			team.insert(map<int, string>::value_type((3*a+c), s));
		}
		
		multimap<int, string, greater<int> >::iterator it=team.begin();
		while(it!=team.end()) {
			cout << it->second << "," << it->first << endl;
			it++;
		}
		team. clear();
	}

	return 0;

}

Measured memory_bytes: 0
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *


d = defaultdict(int)
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
for i in range(n):
    d[a[i]] += 1
count = 0
size = len(d)
for i, v in sorted(d.items(),key=lambda x:x[1]):
    if size <= k:
        break
    count += v
    size -= 1
print(count)


Measured memory_bytes: 41344
// {{{ by unolight
#pragma region
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
#pragma endregion
// }}}

void main() {
    int n;
    cin >> n;
    vector<LL> a(n), b(n);
    REP(i,n) {
        cin >> a[i] >> b[i];
    }    
    LL s=0;
    for ( int i=n-1; i>=0; i-- ) {
        a[i]+=s;
        LL x=(a[i]+b[i]-1)/b[i]*b[i];
        s+=x-a[i];
    }
    cout << s << '\n';
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}


Measured memory_bytes: 4840
#include <iostream>
#include <algorithm>
#include <string>

typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int H, W;
string board[50];

char bomb_count(int h, int w) {
    int count = 0;
    FOR(dh, -1, 2) FOR(dw, -1, 2)
        if (0 <= h + dh && h + dh < H &&
            0 <= w + dw && w + dw < W &&
            board[h + dh][w + dw] == '#')
            count++;
    return '0' + count;
}

int main() {
    cin >> H >> W;
    REP(i, H) cin >> board[i];

    REP(i, H) REP(j, W) if (board[i][j] == '.')
        board[i][j] = bomb_count(i, j);

    REP(i, H) cout << board[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int a,v,b,w;
	cin>>a>>v>>b>>w;
	int t;
	cin>>t;
	if(t*(v-w)>=abs(a-b)){
		cout<<"YES";
	}
	else
		cout<<"NO";
	#ifdef ANIKET_GOYAL
		// cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int p = i;
    while (p < n and s[p] == s[i]) {
      ++p;
    }
    ++ans;
    i = p - 1;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 512