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

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int a=gi();
	    int b=gi();
	    //int c=gi();



        System.out.println((a-1)*(b-1));
//        if (a%3==0 || b%3==0 || ((a+b)%3==0) ) {
//        	System.out.print("Possible");
//        }else {
//            System.out.print("Impossible");
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
}

Measured memory_bytes: 35556
n = int(input())
op = ""
for i in range(1,n+1):
	if (i % 3 == 0):
		op += " " + str(i)
	else:
		x = i
		while True:
			if (x % 10 == 3):
				op += " " + str(i)
				break
			x = int(x / 10)
			if x < 1:
				break
print(op)
			


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

static inline bool is_number(char ch)
{
	return ch <= '9' && ch >= '0';
}

int main(int argc, char **argv)
{
	int a, b, count = 0;
	std::string str;

	std::cin >> a >> b;
	std::cin >> str;

	if((unsigned int)(a + b + 1) != str.size()){
		goto bad;
	}

	for(count = 0;count < a;++count){
		if(!is_number(str.at(count))){
			goto bad;
		}
	}

	if(str.at(count++) != '-'){
		goto bad;
	}

	b += count;

	for(;count < b;++count){
		if(!is_number(str.at(count))){
			goto bad;
		}
	}

	std::cout << "Yes" << std::endl;
	return 0;

bad:
	std::cout << "No" << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0);
using namespace std;

const long long INF = 1e6;
const long long N = 1e3 + 7;
const long long mod = 1e9;
const long double eps = 1E-7;

ll a , b , cnt , n;
vector < ll > v, v1;
set< ll > st;
string s;
int main(){
    cin >> s;
    if( s[2] == s[3] and s[4] == s[5] )
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
n = int(input())

b = list(map(int,input().split()))

ans = b[n-2]


for i in  range(n-2,0,-1) :
   if b[i-1] > b[i] :
      ans= b[i] + ans
      
   else :
      
      ans = b[i-1] + ans

print(ans+b[0])	


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

int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<>());
  if (s < t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

from fractions import gcd
lcm = c * d // gcd(c, d)
#lcm = int(c * d / gcd(c, d))

a_num = (a-1)//c + (a-1)//d - (a-1)//lcm
b_num = (b)//c + (b)//d - (b)//lcm

print(b-a+1 - (b_num - a_num))

Measured memory_bytes: 5104
<?php
fscanf(STDIN, '%d', $N);
for ($i=0; $i<$N; $i++){
    fscanf(STDIN, '%s', $S[$i]);
}

$array_count_values = array_count_values($S);
// 配列を出現回数順に並び替える
asort($array_count_values);

// 最大個数を求める
$max_count = max($array_count_values);

// 最大個数の要素のみの配列にする
$array_count_max_strings = array_filter($array_count_values, function ($num) use($max_count) {
    return $num===$max_count;
});

// keyを配列にする
foreach($array_count_max_strings as $key => $value) {
    $array_ans[] = $key;
}

// 辞書順に並べ替える
natsort($array_ans);

// 全て出力する
foreach ($array_ans as $value) {
    echo $value . "\n";
}

?>


Measured memory_bytes: 57836
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    int a, p,n;
    std::cin >> a >> p;

    n = a*3 + p;


    std::cout << n/2 << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
    #include<string.h>
    int main(void) {
      int i,j,cou=0,N,M,X,A[101],cou2=0;
      scanf("%d %d %d",&N,&M,&X);
      for(i=0;i<M;i++){
          scanf("%d",&A[i]);
      }
        for(i=0;i<M;i++){
            if(X>A[i]){
                cou++;
            }
        }
        for(i=0;i<M;i++){
            if(X<A[i]){
                cou2++;
            }
        }
        if(cou>cou2){
            printf("%d",cou2);
        }else{
            printf("%d",cou);
        }
      
      return 0;
    }

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
static const int MAX_V = 1000001;
static const int MAX_N = 200001;
int arr[MAX_N];
int vals[MAX_V];

int main()
{
    int N, i, j, ans =0;
    scanf("%d",&N);
    memset(vals, 0, sizeof (vals));
    for(i = 0; i< N; i++) scanf("%d",&arr[i]);
    sort(arr, arr+ N);

    for(i = 0; i < N;i++) {
        if(vals[arr[i]] <= 1) for(j=arr[i]; j<MAX_V; j+=arr[i]) vals[j]++;
    }
    for(i = 0; i < N; i++) if(vals[arr[i]] == 1) ans++;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 6364
#include <cstdio>
#include <vector>
#include <algorithm>

int main() {
  size_t N;
  int X;
  scanf("%zu %d", &N, &X);

  std::vector<int> m(N);
  for (auto& mi: m) {
    scanf("%d", &mi);
    X -= mi;
  }

  std::sort(m.begin(), m.end());
  int res = N;
  res += X / m[0];
  printf("%d\n", res);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

typedef long long ll;
const ll MOD = (ll)1e9 + 7;
ll add(ll x, ll y)
{
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y)
{
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y)
{
	return (x * y) % MOD;
}

const int N = 304;
int n, m;
ll dp[2][N][N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d", &n, &m);
	dp[0][1][0] = 1;
	while(m--)
	{
		for (int i = 0; i <= n; i++)
			for (int j = 0; j <= n; j++)
				dp[1][i][j] = 0;
		for (int i = 0; i <= n; i++)
			for (int j = 0; i + j <= n; j++)
			{
				if (dp[0][i][j] == 0) continue;
				dp[1][i + j][0] = add(dp[1][i + j][0], mult(dp[0][i][j], i));
				dp[1][i][j] = add(dp[1][i][j], mult(dp[0][i][j], j));
				dp[1][i][j + 1] = add(dp[1][i][j + 1], mult(dp[0][i][j], n - i - j));
			}
		for (int i = 0; i <= n; i++)
			for (int j = 0; j <= n; j++)
				dp[0][i][j] = dp[1][i][j];
	}
	printf("%lld\n", dp[0][n][0]);

	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  ll n;
  cin>>n;
  vector<ll> a(n+1);
  vector<ll> b(n);
  rep(i,n+1) cin>>a[i];
  rep(i,n)   cin>>b[i];
  ll ans=0;
  rep(i,n){
    if(a[i]>=b[i]){
      ans+=b[i];
      continue;
    }
    if(a[i]<b[i]&&b[i]<=a[i]+a[i+1]){
      ans+=b[i];
      a[i+1]-=b[i]-a[i];
      continue;
    }
    if(a[i]<b[i]&&b[i]>a[i]+a[i+1]){
      ans+=a[i]+a[i+1];
      a[i+1]=0;
      continue;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4848
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
if a[0] > x:
  print(0)
  exit()

count = 0
for i in a:
  if i <= x:
    count += 1
    x -= i

# 端数
if x != 0 and count == N:
    count -= 1

print(count)

Measured memory_bytes: 3064
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;
typedef long long ll;
int main() {
	//file("a");
	int n,T,a,x,v;
	double ans=2147483647;
	cin>>n>>T>>a;
	for(int i=1;i<=n;i++){
		cin>>x;
		double tep=T-0.006*x,l=abs(a-tep);
		if(l<ans)
			v=i,ans=l;
	}
	cout<<v;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;
int H, W;
int a[2100][2100];
int h[2100][2100];
int w[2100][2100];


int dfs1(int x, int y, int t){
    if(a[x][y] == 1){
        h[x][y] = -1;
        return t-1;
    }

    int z;
    if(x+1 < H){
        z = dfs1(x+1, y, t+1);
    }
    else{
        z = t;
    }
    h[x][y] = z;
    return z;
}

int dfs2(int x, int y, int t){
    if(a[x][y] == 1){
        w[x][y] = -1;
        return t-1;
    }

    int z;
    if(y+1 < W){
        z = dfs2(x, y+1, t+1);
    }
    else{
        z = t;
    }
    w[x][y] = z;
    return z;
}



int main(){
    cin >> H >> W;

    string s[2100];
    for(int i = 0; i < H; i++){
        cin >> s[i];
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            h[i][j] = w[i][j] = -2;
            if(s[i][j] == '#'){
                a[i][j] = 1;
            }
            else{
                a[i][j] = 0;
            }
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(h[i][j] == -2){
                dfs1(i, j, 1);
            }
            if(w[i][j] == -2){
                dfs2(i, j, 1);
            }
        }
    }

    int res = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(a[i][j] == 0) {
                // cout << i << " " << j << endl;
                res = max(h[i][j] + w[i][j] - 1, res);
            }
        }
    }

    /*for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << h[i][j] << " ";
        }
        cout << endl;
    }

    cout << endl;

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << w[i][j] << " ";
        }
        cout << endl;
    }*/

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 55680
rc=list(map(int,input().split()))
r=rc[0]
c=rc[1]

data=[]
data_retu=[]

for i in range(r):
    data.append(list(map(int,input().split())))

data_retu=[[data[i][j] for i in range(r)] for j in range(c)]
retu_sum=[sum(data_retu[i]) for i in range(c)]
data.append(retu_sum)
for i in range(r+1):
    for j in range(c):
        print(str(data[i][j])+" ",end="")
    print(sum(data[i]))



Measured memory_bytes: 6264
#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++)

int main() {
  ll n, m;
  cin >> n >> m;
  bool flag = 0;
  for (ll i = 0; i <= n; i++) {
    ll tmp = 2*i + 4*(n-i);
    if (tmp == m) flag = 1;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t N, A, B;
  cin >> N >> A >> B;
  
  int64_t b;
  if (N%(A+B)<A){
    b=(N/(A+B))*A+N%(A+B);
  } else {
    b=(N/(A+B)+1)*A;
  }
  
  cout << b << endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int i, j;
	int a[3];
	int temp;

	scanf("%d %d %d", &a[0], &a[1], &a[2]);

	for (i = 0; i < 3; i++) {
		for (j = 2; j > i; j--) {
			if (a[j] < a[j - 1]) {
				temp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = temp;
			}
		}
	}

	printf("%d %d %d\n", a[0], a[1], a[2]);

	return 0;
}

Measured memory_bytes: 2716
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
#define N (int)1e6+10
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;

signed main()
{
    
	nuenxfiu
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	//int t;
	//cin>>t;
	
	//for(int k=1;k<=t;k++)
	//{
		
		int x;
		cin>>x;
		
		if(x>=400 and x<600)
		cout<<8<<endl;
		else if(x>=600 and x<800)
		cout<<7<<endl;
		else if(x>=800 and x<1000)
		cout<<6<<endl;
		else if(x>=1000 and x<1200)
		cout<<5<<endl;
		else if(x>=1200 and x<1400)
		cout<<4<<endl;
		else if(x>=1400 and x<1600)
		cout<<3<<endl;
		else if(x>=1600 and x<1800)
		cout<<2<<endl;
		else if(x>=1800 and x<2000)
		cout<<1<<endl;
		
		
		
	//}
     return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define fst first
#define snd second
#define all(c) ((c).begin()), ((c).end())

struct edge {
  int src, dst;
  int weight;
};
struct graph {
  int n;
  vector<edge> edges;
  graph(int n = 0) : n(n) { }
  void add_edge(int src, int dst, int weight) {
    n = max(n, max(src, dst)+1);
    edges.push_back({src, dst, weight});
  }
  vector<int> p; 
  int root(int i) { 
    return p[i] < 0 ? i : p[i] = root(p[i]); 
  }
  bool unite(int i, int j) {
    if ((i = root(i)) == (j = root(j))) return false;
    if (p[i] > p[j]) swap(i, j);
    p[i] += p[j]; p[j] = i;
    return true;
  }
  int kruskal() {
    p.assign(n, -1);
    sort(all(edges), [](edge x, edge y) {
        return x.weight < y.weight; 
    });
    int result = 0;
    for (auto e: edges) 
      if (unite(e.src, e.dst)) 
        result += e.weight;
    return result;
  }
};

int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  REP(i,N) cin >> x[i] >> y[i];

  vector<pair<int,int>> xi(N), yi(N);
  REP(i,N) {
    xi[i] = make_pair(x[i], i);
    yi[i] = make_pair(y[i], i);
  }
  sort(all(xi));
  sort(all(yi));

  graph g(N);
  REP(i,N - 1){
    g.add_edge(xi[i].snd, xi[i + 1].snd, abs(xi[i].fst - xi[i + 1].fst));
    g.add_edge(yi[i].snd, yi[i + 1].snd, abs(yi[i].fst - yi[i + 1].fst));
  }
  int ret = g.kruskal();

  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 7284
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    //ans += (n-k)*(n-k+1)/2;
    //cout << ans << endl;
    if(k==0) ans = n * n;
    else{
        for(ll i = k+1; i <= n; i++){
            ll a = n/i;
            ans += (i-k)*a;
            ll b = n%i;
            if(b>=k) ans += (b-k+1);
            //cout << i << " " << ans << endl;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	xm := make(map[int]int)
	sum := 0
	b := 1
	ans := 0
	for i := len(s) - 1; i >= 0; i-- {
		xm[sum]++
		sum += int(s[i]-'0') * b
		sum %= 2019
		ans += xm[sum]
		b = b * 10 % 2019
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3464
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<set>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)


int main(){
    int M;
    ll K;
    cin>>M>>K;
    ll num=1;
    for(int i=0;i<M;i++){
        num*=2;
    }
    if(num<=K){
        cout<<-1<<endl;
        return 0;
    }else if(M==0){
        if(K==0) cout<<"0 0"<<endl;
        else cout<<-1<<endl;
    }else if(M==1){
        if(K==0) cout<<"0 0 1 1"<<endl;
        else cout<<-1<<endl;
    }else{
        for(ll i=0;i<num;i++){
            if(i==K) continue;
            cout<<i<<" ";
        }
        cout<<K<<" ";
        for(ll i=num-1;i>=0;i--){
            if(i==K) continue;
            cout<<i<<" ";
        }
        cout<<K<<endl;
    }

}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
	pair<int, int>,
	null_type,
	less<pair<int, int>>,
	rb_tree_tag,
	tree_order_statistics_node_update>
ordered_set;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

int main()
{
    IOS;
    ll x;
    cin>>x;
    ll ans=(x/500)*1000;
    x%=500;
    ans+=(x/5)*5;
    cout<<ans<<endl;
}     

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

int main(){
  int X,A,B;
  cin>>X>>A>>B;
  int h =B-A;
  if(h<=0){
    cout<<"delicious"<<endl;
  }else if(h<=X){
    cout<<"safe"<<endl;
  }else{
    cout<<"dangerous"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N, X = map(int, input().split())
L_list = list(map(int, input().split()))
btimes = 1
longs = 0
for idx, ite in enumerate(L_list):
    longs += ite
    if longs > X:
        break
    btimes += 1
print(btimes)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
string x;
int l;
int main()
{
	cin>>x;
	bool fl1=false,fl2=false;
	l=x.length();
	for(int i=0;i<=l;i++)
	{
		if(x[i]=='C')fl1=true;
		else
		if(x[i]=='F'&&(fl1))fl2=true;
		else continue;
	}
	if(fl2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (abs(b - c) % 2)cout << "Borys" << endl;
	else cout << "Alice" << endl;
	return 0;
}

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

#define int long long

int32_t main(){ 

    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    int  p = 100, step = 0;
    while(p < n){
        p += p/100;
        step++;
    }
    cout << step;
    
    return 0;
} 

Measured memory_bytes: 3580
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF (ll)(1e18)
#define inf 0x7fffffff
#define inff 100000
#define ff first
#define ss second
#define sz(x) ((int) (x).size())
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define rep(i,N) for(int i = 0;i < N;i++)
#define frep(i,a,b) for(int i = a;i <= b;i++)
#define pii pair<int , int>
#define pll pair<ll , ll>
#define vii vector<int>
#define vpii vector< pii >
#define fill(A,v) memset(A,v,sizeof(A))
#define setbits(x) __builtin_popcountll(x)
#define print(A,j,k) for(int ii=j;ii<k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
#define SQRT 350
#define CASES int t;cin>>t;while(t--)
#define FILE freopen("inp.txt" , "r" , stdin);
#define ld long double
 
const int MOD = 1e9 + 7;
const int N = 1e6 + 5;

int main(int argc, char const *argv[])
{
    fast;

    ll a , b , c;
    cin >> a >> b >> c;

    ll v = max(a , max(b , c));
    
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << "0\n";
        return 0;
    }

    if (v == a) {
        cout << b * c << '\n';
    }
    else if (v == b) {
        cout << a * c << '\n';
    }
    else {
        cout << a * b << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

const int INF = 1001001001;
const double PI = 3.141592653589793238;

int main(){
    int a, b, x;
    cin >> a >> b >> x;
    double ans1 = atan(a*b*b/2.0/x);
    double ans2 = atan(2.0*b/a - 2.0*x/a/a/a);
    if (x < a * a * b / 2.0) cout << setprecision(10) << ans1*180/PI << endl;
    else cout << setprecision(10) << ans2*180/PI << endl;
    // cout << setprecision(10) <<
}


Measured memory_bytes: 384
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>
#pragma comment(linker, "/STACK:67108864")

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000000
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);
const LL mod = 1000000007;

using namespace std;

int n;
LL d,a,xi,hi;
vector<PLL> p;


int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin >>n >>d>>a;
  FOR(i,n){
    cin>>xi>>hi;
    p.push_back(MP(xi,hi));
  }
  sort(ALL(p));

  map<LL,LL> buffs;
  LL buffsum = 0;

  LL ans=0;

  for(PLL pt:p) {
    //subtract previous buffs
    LL h = pt.second;
    vector<LL> todel;
    for (auto it:buffs) {
      if (it.first < pt.first) {
        buffsum -= it.second;
        todel.push_back(it.first);
      } else {
        break;
      }
    }
    for(auto item:todel) buffs.erase(item);

    h -= buffsum;

    if (h <= 0) continue;

    LL need = h / a;
    if (h%a)need++;
    ans+=need;
    buffsum += need*a;
    buffs[pt.first +2*d] += need*a;
  }
  cout <<ans<<endl;
  return 0;
}


Measured memory_bytes: 9708
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a[3];
  FOR(i,0,3)cin>>a[i];
  sort(a,a+3);
  int k;cin>>k;
  FOR(i,0,k){
    a[2]*=2;
  }
  int ans=0;
  FOR(i,0,3)ans+=a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt int Q[100005]={0}
#define mp make_pair
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<int>()) 
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(int i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(int i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
 
int main()
{                       
    fastio();
    ll N;
    cin>>N;
    cout<<(N/500)*1000+((N%500)/5)*5<<endl;
}

Measured memory_bytes: 256
/*     !ya khoda!     */
#include <bits/stdc++.h>

#define ll long long
#define ld long double

#define pp push
#define po pop()
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
#define I insert
#define E erase

#define F first
#define S second

#define mkp make_pair
#define pll pair<ll,ll>
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define all(a) a.begin(),a.end()

#define coutghat(x)      cout<<tolower(x);
#define coutashar(x,d)   cout<<fixed<<setprecision(x)<<(ld)d
#define IOS ios_base::sync_with_stdio(false) , cin.tie(0);

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)
//#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;
/*==========================================================================*/
using namespace std;
ll poow(ll x,ll n,ll Mod=1e9+7) { return (n==0?1:poow(x*x%Mod,n/2)*(n&1?x:1)%Mod); }
//#pragma optimize O3
// 107,109, 211,223, 307, 401,409, 503,509, 601,607, 701,709, 809, 907, 1009
/*==========================================================================*/
const int N=5e6+10  , M=1e4+10  , SQ=320 , LG=23 , base=2;
const int mod=1e9+7 , MOD=1e9+9;
const ll  INF=1e9   , inf=1e18 , super_inf=~0ull/4;
ll n,a[N],b[N] , p;
string s;
/*==========================================================================*/
ll check(ll x)
{   ll sum=0,p=0;
	for(int i=0;i<n;++i)   b[i]=a[i];
	b[0]+=x;
	for(int i=0;i<n;++i)
    {
		b[i]+=p;
		p=b[i]/10;
		b[i]%=10;
	}

	for(int i=0;i<n;++i)   sum+=b[i];
	if(sum<=x)   return 1;
	else         return 0;
}
/*==========================================================================*/
int main()
{
    IOS;
    cin>>s , n=s.size();
	reverse(all(s));
	for(int i=0;i<n;++i)   a[i]=s[i]-'0';
	for(int i=0;i<n;++i)   a[i]*=9;

	n+=20 , p=0;
	for(int i=0;i<n;++i)
    {
		a[i]+=p;
		p=a[i]/10;
		a[i]%=10;
	}

	ll l=0,r=INF;
	while(r-l>1)
    {   ll mid=l+r>>1;
		if(check(mid))   r=mid;
		else             l=mid;
	}

	cout<<(r+8)/9<<"\n";
	return 0;
}


Measured memory_bytes: 9116
N = int(input())
A = list(map(int, input().split())) # 0からN(N+1個)
B = list(map(int, input().split())) # 0からN-1(N個)

ans = 0

for i in range(N): # 0からN-1
    if A[i] <= B[i]:
        ans += A[i]
        B[i] = B[i] - A[i]
        A[i] = 0
        if A[i+1] <= B[i]:
            ans += A[i+1]
            A[i+1] = 0
        else:
            ans += B[i]
            A[i+1] = A[i+1] - B[i]
    else:
        ans += B[i]
        A[i] = A[i] - B[i]

print(ans)




Measured memory_bytes: 19004
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 105;

char str[N];

bool isPalindrome(char ch[]) {
	int len = strlen(ch);
	for (int i=0, j=len-1; i<j; ++i, --j) {
		if (ch[i] != ch[j]) return false;
	}
	return true;
}

int main() {
	int cs = 0;
	while (scanf("%s", str) != EOF) {
		if (isPalindrome(str)) ++cs;
	}
	printf ("%d\n", cs);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
//#include <ttmath.h>
#define endl '\n'
#define modulo 1000000007
#define int long long
#pragma GCC optimize("-Ofast")
#define float double
#define PI 3.141592653589793238462643
#define sinDegrees(x) sin((x) * PI / 180.0)
#define tanDegrees(x) tan((x) * PI / 180.0)
#define atanDegrees(x) atan(x)* 180.0 / PI
using namespace std;
int power(int x, unsigned int y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return (power(x, y / 2) * power(x, y / 2));
    else
        return (x * power(x, y / 2) * power(x, y / 2));
}
/*#include "testlib.h"
int main(int argc, char* argv[])
{
iostream::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
registerGen(argc, argv, 1);
int n,k;
n=rnd.next(1,50);
k=rnd.next(1,n);
cout<<n<<' '<<k;
}*/
bool comp(pair<int,int>a,pair<int,int>b)
{
    if(a.first==b.first){
    return a.second>b.second;
    }
    return a.first>b.first;
}
int32_t main()
{
    //freopen("output.txt","w", stdout);
    iostream::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 main()
{
	int n; cin >> n;

	vector<int> a(n), b(n), c(n - 1);

	int ans = 0;

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

	for (int i = 0; i < n - 1; i++) {	
		if ( a[i + 1] == a[i] + 1) {
			ans += c[a[i] - 1];
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
	ll x,y;
}b[1010];
ll n,ans,sej,tot,e[10010],hd[1010],nt[1010],dep[1010],a[1010],mx,sz[1010];
void build(ll x,ll y){
	tot++;
	e[tot]=y;
	nt[tot]=hd[x];hd[x]=tot;
}
void dfs(ll x,ll fa){
	ll i;
	sz[x]=0;
	dep[x]=dep[fa]+1;mx=max(mx,dep[x]);
	for(i=hd[x];i;i=nt[i]){
		if(e[i]==fa)continue;
		sz[x]++;
		dfs(e[i],x);
	}
	a[dep[x]]=max(a[dep[x]],sz[x]);
}
int main(){
	ll i,j,x,y,now;
	scanf("%lld",&n);
	for(i=1;i<n;i++){
		scanf("%lld%lld",&x,&y);
		build(x,y);build(y,x);
		b[i].x=x;b[i].y=y;
	}
	ans=n+1;sej=1e18;
	for(i=1;i<=n;i++){
		mx=0;
		dfs(i,0);
		now=1;
		for(j=1;j<mx;j++)now*=a[j],a[j]=0;
		if(mx<ans){
			ans=mx;sej=now;
		}
		 else if(mx==ans&&now<sej)sej=now;
	}
	for(i=1;i<n;i++){
		mx=0;dep[b[i].y]=0;
		dfs(b[i].x,b[i].y);
		dep[b[i].x]=0;
		dfs(b[i].y,b[i].x);
		now=2;
		for(j=1;j<mx;j++)now*=a[j],a[j]=0;
		//printf("%lld %lld %lld\n",i,mx,now);
		if(mx<ans){
			ans=mx;sej=now;
		}
		 else if(mx==ans&&now<sej)sej=now;
	}
	printf("%lld %lld",ans,sej);
}

Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;


int main() {
	int n, m;
	char key, val;
	vector<string> dst;
	while (true)
	{
		map<char, char> keymap;
		cin >> n;
		if (n == 0)break;
		while (n-- > 0) {
			cin >> key >> val;
			keymap[key] = val;
		}
		cin >> m;
		string newstr;
		while (m-- > 0) {
			cin >> key;
			newstr+=((keymap.find(key) != keymap.end() ? keymap[key] : key));
		}
		dst.push_back(newstr);
	}
	for (vector<string >::iterator it = dst.begin(); it < dst.end(); it++)
		cout << (*it) << endl;
	return 0;
}


Measured memory_bytes: 3124
from numpy import loadtxt, int64, bincount, reshape, argmax

A = loadtxt(open(0), int64, skiprows=1, ndmin=2)

N = ans = len(A)

while A.any():
    b = bincount(A[:, 0])
    A = reshape(A[A != b.argmax()], (N, -1))
    ans = min(ans, b.max())

print(ans)


Measured memory_bytes: 16588
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
from bisect import bisect_left,bisect_right
for i in B:
   ans+=(bisect_left(A,i))*(N-bisect_right(C,i))
print(ans)

Measured memory_bytes: 29668
i;main(h,w){
  scanf("%d%d",&h,&w);
  for(;i++<w+1;)putchar('#');
  for(;~(i=getchar());){
    if(i==10)putchar('#');
    putchar(i);
    if(i==10)putchar('#');
  }
  for(i=0;i++<w+1;)putchar('#');
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
bool is_prime(int x){
  if(x<=1) return false;
  for (int i=2; i*i <=x; ++i)
    if(x%i==0) return false;
  return true;
}
signed main(){
  int x;
  cin >> x;
  
  int p=x;
  while(!is_prime(p))p++;
  
  cout << p << endl;
  return 0;
}
    
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
#define PR(x) cout << (x) << "\n"
#define PS(x) cout << (x) << " "
#define PRYES(x) PR((x) ? "Yes" : "No")
const long long INF = numeric_limits<long long>::max();
// SourceTest用出力マクロ
#ifdef SOURCE_TEST
#define SPR(x) PR(x)
#define SPS(x) PS(x)
#else
#define SPR(x) \
    {}
#define SPS(x) \
    {}
#endif
int main() {
    ll N;
    cin >> N;
    PR((N == 0) ? 1 : 0);
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
#define int long long


signed main() {


	int H, W,Ch,Cw,Dh,Dw;
	char S[2000][2000];
	int kaisu[2000][2000];
	queue<pair<int, int>>  mk,kk;
	//mk(未開拓)kk(既開拓)

	pair<int, int> tmp;
	
	cin >> H >>W>>Ch>>Cw>>Dh>>Dw;
	for (int i = 0; i < 2000; i++) {
		for (int j = 0; j < 2000; j++) {
			kaisu[i][j] = -2;
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> S[i + 1][j + 1];
			kaisu[i + 1][j + 1] = -1;
		}
	}
	for (int i = 0; i < H+1; i++) {
		S[i][0] = '#';
		S[i][W + 1] = '#';
	}
	for (int j = 0; j < W + 1; j++) {
		S[0][j] = '#';
		S[H+1][j] = '#';
	}

	mk.push(make_pair(Ch, Cw));
	kaisu[Ch][Cw] = 0;

	int count = 0;
	for (int sasakama = 0; sasakama < H*W*5; sasakama++) {
		if(mk.size()!=0){
			tmp = mk.front();
			int h = tmp.first;
			int w = tmp.second;
			if (S[h + 1][w] == '.' && kaisu[h + 1][w] == -1) {
				mk.push(make_pair(h + 1, w));
				kaisu[h+1][w] = count;
			}
			if (S[h - 1][w] == '.' && kaisu[h - 1][w] == -1) {
				mk.push(make_pair(h - 1, w));
				kaisu[h-1][w] = count;
			}
			if (S[h][w+1] == '.' && kaisu[h][w+1] == -1) {
				mk.push(make_pair(h, w+1));
				kaisu[h][w+1] = count;
			}
			if (S[h][w-1] == '.' && kaisu[h][w-1] == -1) {
				mk.push(make_pair(h, w-1));
				kaisu[h][w-1] = count;
			}
			kk.push(tmp);
			if (h == Dh&&w == Dw) {
				break;
			}
			mk.pop();
		} else if (kk.size() != 0) {
			count++;
			int kurikaeshi = kk.size();
			for (int i = 0; i < kurikaeshi; i++) {
				tmp = kk.front();
				int h = tmp.first;
				int w = tmp.second;
				for (int j = -2; j < 3; j++) {
					for (int k = -2; k < 3; k++) {
						if (h + j >= 1 && h + j <= H&&w + k >= 1&& w + k <= W){
							if (S[h + j][w + k] == '.' && kaisu[h + j][w + k] == -1) {
								mk.push(make_pair(h + j, w + k));
								kaisu[h + j][w + k] = count;
							}
						}
					}
				}
				kk.pop();
			}
		}
		if (sasakama == H*W * 5 - 1) {
			count = -1;
			break;
		}
	}


	cout << count <<endl;

	cin >> count;

	return 0;


}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  for (int i = 0; i < s.size() - 1; i++) {
    if (s.at(i) == 'A' && s.at(i + 1) == 'C') {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            char[] c = String.valueOf(i).toCharArray();
            if(c[0] == c[4] && c[1] == c[3]) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 30420
N = int(input())
N_o = int(N/1.08)
if int(N_o * 1.08) == N:
    print(N_o)
else:
    if int((N_o+1)*1.08) == N:
        print(N_o+1)
    elif  int((N_o-1)*1.08) == N:
        print(N_o-1)
    else:
        print(':(')

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;

typedef long long LL;

LL ans = 0;

LL check(LL arg)
{
	return arg % 1000000007;
}

LL k(LL arg)
{
	LL myans = 1;

	for (LL l = 1; l <= arg; l++) 
		myans = check(myans * l);

	return myans;
}

int main()
{
	long long N, M;
	cin >> N >> M;
	if (abs(N - M) > 1)
	{
		cout << 0 << endl;
	}
	if ((N - M) == 1)
	{
		cout << check(k(N) * k(M)) << endl;
	}
	if ((M - N) == 1)
	{
		cout << check(k(N) * k(M)) << endl;
	}
	if (M == N)
	{
		cout << check(check(k(N) * k(M)) * 2) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long int li;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    ll ans=0;
    ll k,n,a,b,c,d;
    cin >> n;
    ans = 180 *(n-2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,m  = map(int, input().split())
hs = list(map(int, input().split()))
edges = [[] for i in range(n)]
for i in range(m):
    a,b  = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

cnt = 0
for v in range(n):
    flg = True
    for u in set(edges[v]): #次の展望台
        if hs[u] >= hs[v]:
            flg = False
    if flg:
        cnt += 1

print(cnt)
    

Measured memory_bytes: 101888
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())


using namespace std;



int main(){
	string s;
	cin>>s;
	rep(i,s.size()){
		string t(s.substr(i,8));
		sort(all(t));
		if(t=="AADINNUY"){
			i+=7;
			cout<<"AIZUNYAN";
		}else cout<<s[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    string s;
    cin >> n >> s >> k;
    rep(i, n) {
        if (s[i] != s[k - 1]) {
            s[i] = '*';
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
object Main {
    def pack(l: List[String]): List[(Int, Int, String)] = {
        if (l.isEmpty) Nil
        else {
            val (x, y) = l.span(_ == l.head)
            (x.size, x.head.size, x.head) :: pack(y)
        }
    }

    def main(args: Array[String]) = {
        val in = io.StdIn.readLine.split(" ")
        val a = pack(in.toList.sorted)
        println(a.maxBy(_._1)._3 + " " + a.maxBy(_._2)._3)
    }
}

Measured memory_bytes: 43796
import bisect
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
sA=[0]*n
sB=[0]*m
sA[0]=A[0]
sB[0]=B[0]
for i in range(1,n):
  sA[i]=sA[i-1]+A[i]
for i in range(1,m):
  sB[i]=sB[i-1]+B[i]

ans=bisect.bisect_right(sB,k)
for i in range(n):
  if k-sA[i]<0:break
  j=bisect.bisect_right(sB,k-sA[i])
  ans=max(ans,j+i+1)
print(ans)

Measured memory_bytes: 47516
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
let lines = [];
reader.on("line", line => {
  lines.push(line);
});
reader.on("close", () => {
  const pai = 3.14
  let ans = pai * lines[0] * 2
  console.log(ans);
});

Measured memory_bytes: 30088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int k;
	string s;
	cin>>k>>s;
	if(s.size()<=k)
	 cout<<s;
	else
	{
		string t=s.substr(0,k);
		t+="...";
		cout<<t;
	}
	return 0;
}

Measured memory_bytes: 3628
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % MOD;
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

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

	ll num = sqrt(N) + 1;

	ll mi = 1e10;
	for (ll n = 1; n <= num; n++) {
		if (N % n == 0) {
			mi = min(mi, max(dig(N / n, 10), dig(n, 10)));
		}
	}

	cout << mi << endl;
}

Measured memory_bytes: 8064
fn main() {
    let (h, w) = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        let mut integers = line.split_whitespace().map(|e| e.parse::<usize>().unwrap());
        (integers.next().unwrap(), integers.next().unwrap())
    };

    let mut s: Vec<Vec<char>> = Vec::new();
    for _ in 0..h {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        s.push(line.chars().collect());
    }

    let mut l: Vec<Vec<usize>> = Vec::new();
    let mut r: Vec<Vec<usize>> = Vec::new();
    let mut u: Vec<Vec<usize>> = Vec::new();
    let mut d: Vec<Vec<usize>> = Vec::new();
    for x in 0..h {
        l.push(Vec::new());
        r.push(Vec::new());
        u.push(Vec::new());
        d.push(Vec::new());
        l[x].resize(w, 0);
        r[x].resize(w, 0);
        u[x].resize(w, 0);
        d[x].resize(w, 0);
    }

    for x in 0..h {
        for y in (0..w).rev() {
            r[x][y] = if s[x][y] == '#' {
                0
            } else {
                if y == w - 1 {
                    1
                } else {
                    r[x][y + 1] + 1
                }
            }
        }
    }

    for x in 0..h {
        for y in 0..w {
            l[x][y] = if s[x][y] == '#' {
                0
            } else {
                if y == 0 {
                    1
                } else {
                    l[x][y - 1] + 1
                }
            }
        }
    }

    for y in 0..w {
        for x in (0..h).rev() {
            u[x][y] = if s[x][y] == '#' {
                0
            } else {
                if x == h - 1 {
                    1
                } else {
                    u[x + 1][y] + 1
                }
            }
        }
    }

    for y in 0..w {
        for x in 0..h {
            d[x][y] = if s[x][y] == '#' {
                0
            } else {
                if x == 0 {
                    1
                } else {
                    d[x - 1][y] + 1
                }
            }
        }
    }

    let mut answer = 0;
    for x in 0..h {
        for y in 0..w {
            if s[x][y] == '.' {
                let t = l[x][y] + r[x][y] + u[x][y] + d[x][y] - 3;
                answer = std::cmp::max(answer, t);
            }
        }
    }

    println!("{}", answer);

}


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

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

  if(n == 0) cout << m*(m-1)/2;
  else if(m == 0) cout << n*(n-1)/2;
  else cout << m*(m-1)/2 + n*(n-1)/2; 
  
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <functional>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
int main(){
    int n;
    cin >> n;
    ll a,b;
    cin >> a >> b;
    vector<ll> x(n);
    for(int i = 0;i < n;i++)cin >> x[i];
    ll ans = 0;
    for(int i = 0;i < n-1;i++){
        if((x[i+1] - x[i]) * a > b)ans += b;
        else ans += (x[i+1]-x[i])*a;
    }
    cout << ans << endl;
}


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

int main() {
  int x[5];
  for (int i = 0; i < 5; ++i) {
    cin >> x[i];
  }

  int ans[5] = {1, 1, 1, 1, 1};
  for (int i = 0; i < 5; ++i) {
    if (x[i] == 0) continue;
    ans[x[i] - 1] = 0;
  }

  for (int i = 0; i < 5; ++i) {
    if (ans[i] == 1) {
      cout << i + 1 << endl;
    }
  }
}


Measured memory_bytes: 3628