akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

class Program
{
    #region library
    static int n = 0;
    static int r = 0;
    static int c = 0;
    static int x = 0;
    static int y = 0;
    static string s = "";
    static string[] ss;
    static long sum = 0;
    static long cnt = 0;
    static long max = -1;
    static long min = 2147483647;
    static bool flg = false;
    static bool flg2 = false;
    static string alpha = "abcdefghijklmnopqrstuvwxyz";
    static int[] arr;
    static char[,] map;
    static int[,] imap;
    static string rl()
    {
        return Console.ReadLine();
    }
    static string[] rls()
    {
        return Console.ReadLine().Split();
    }
    static void wl(object obj = null)
    {
        Console.WriteLine(obj);
    }
    static void w(object obj)
    {
        Console.Write(obj);
    }
    static int Int(string s)
    {
        return int.Parse(s);
    }
    static void yes()
    {
        wl("YES");
    }
    static void no()
    {
        wl("NO");
    }
    static void Sum()
    {
        wl(sum);
    }
    static void Cnt()
    {
        wl(cnt);
    }
    static void setarray(int num = -1)
    {
        if (n == 0)
        {
            arr = new int[n];
        }
        if(num == -1) ss = rls();
        for (int i = 0; i < n; i++)
        {
            if (num == -1)
                arr[i] = Int(ss[i]);
            else
                arr[i] = num;
        }
    }
    static void setmap(char def = '@')
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        map = new char[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == '@') s = rl();
            for (int j = 0; j < c; j++)
            {
                map[i, j] = (def == '@') ? s[j] : def;
            }
        }
    }
    static void setimap(int def = -1)
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        imap = new int[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == -1) s = rl();
            for (int j = 0; j < c; j++)
            {
                imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def;
            }
        }
    }
    #endregion

    static void Main(string[] args)
    {
        s = rl();
        string s2 = rl();
        for (int i = 0; i < s.Length; i++)
        {
            string s3 = s.Substring(i) + s.Substring(0, i);
            if (s3 == s2)
            {
                wl("Yes");
                return;
            }
        }
        wl("No");
    }
}



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

int main(){

    int N,K;
    cin >> N >> K;
    double res = 0;
    for(int i = 1; i <= N; i++){
        double tmp = i;
        double l = 1.0;
        while(tmp<K){
            tmp *=2;
            l /= 2;
        }
        res += l/(double)N;
    }
    printf("%.12f\n",res);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int S, h, m, s;
        
        S = sc.nextInt();
        
        h = S / 60 / 60;
        m = S / 60 % 60;
        s = S % 60;
        
        System.out.println(h + ":" + m + ":" + s);
    }
}


Measured memory_bytes: 26308
#include <cstdio>
#include <vector>

using namespace std;

int main()
{
    int no_of_elements;
    scanf("%d", &no_of_elements);
    vector <int> A(no_of_elements + 1);

    double sum = 0;
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);

        sum += A[i];
    }

    float mean = sum/no_of_elements;
    int int_mean = mean;

    if(mean - int_mean >= 0.5)
        int_mean++;

    int cost = 0;
    for(int i = 1; i <= no_of_elements; i++)
        cost += (A[i] - int_mean)*(A[i] - int_mean);

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  int C,D,E,F;
  C = A + B;
  D = A - B;
  E = A*B;
  F = max(C,D);
  if (E>F){
      cout <<E<<endl;
  }
  else{
    cout << F <<endl;
}
  }

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Foods Loved by Everyone
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 30;
const int MAX_M = 30;

/* typedef */

/* global variables */

int cs[MAX_M];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      int aj;
      scanf("%d", &aj);
      aj--;
      cs[aj]++;
    }
  }

  int cnt = 0;
  for (int i = 0; i < m; i++)
    if (cs[i] == n) cnt++;
  printf("%d\n", cnt);

  return 0;
}


Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int main () {
	SpeedForce;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; ++i) {
		if(i%3 && i%5) sum += i;
	}
	cout << sum << '\n';

	return Accepted;
}

// B...a

Measured memory_bytes: 17728
#include <iostream>
#include <stdio.h>
#include <time.h>
#define FOR1 for(int i=0;i<n;i++)
#define FOR2 for(int j=0;j<n;j++)
using namespace std;
int main(){
	int table[50][50],n,sum=0,line=0,row=0;
	while(1){
	cin>>n;
	if(n==0){
		break;
	}
	FOR1{
		FOR2{
			cin>>table[i][j];
			sum+=table[i][j];
		}
	}
	FOR1{
		FOR2{
			printf("%5d",table[i][j]);
			line+=table[i][j];
		}
		printf("%5d\n",line);
		line=0;
	}
	FOR1{
		FOR2{
			row+=table[j][i];
		}
		printf("%5d",row);
		row=0;
	}
	printf("%5d\n",sum);
	sum=0;
	}
	return 0;
}

Measured memory_bytes: 3112
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int[] DTS = ria();

		string ans = "No";
		if(DTS[0] <=  DTS[2] * DTS[1]) ans = "Yes"; 

		Console.WriteLine(ans);
		Console.ReadLine();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 27492
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <stack>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e6 + 10;
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;

inline int read()
{
    int x = 0, f = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9'){
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9'){
        x = (x<<1) + (x<<3) + (ch^48);
        ch = getchar();
    }
    return x * f;
}

char s[maxn];
stack<char> st;

int main()
{
    scanf("%s", s+1);
    for (int i = 1; s[i]; ++i)
    {
        if (s[i] == 'T' && !st.empty() && st.top() == 'S') st.pop();
        else st.push(s[i]);
   
    }
    printf("%d\n", st.size());

    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}
/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*ここから*/
int main() {
    int N,X;
    cin >> N >> X;
    int ans = 0;
    vector<int> L(N);
    int D=0;
    for(int i=0;i<N;i++){
        cin >> L[i];
    }
    for(int i=0;i<N;i++){
        /**/
        D += L[i];
        if(D>X){
            break;
        }
        ans++;
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>

using namespace std;


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

	long long n, w, i, j, k, ans, MAXV = 1000, v;
	cin >> n >> w;
	vector<long long> ww(n), vv(n);
	for (i = 0; i < n; i++) cin >> ww[i] >> vv[i];

	v = MAXV * n;
	vector<long long> dp(v + 1, (1LL << 60));		// min weight to get to this value
	dp[0] = 0;
	for (i = 0; i < n; i++) {
		for (j = v; j >= 0; j--) {
			if (j - vv[i] >= 0) dp[j] = min(dp[j], dp[j - vv[i]] + ww[i]);
		}
	}

	ans = 0;
	for (i = 0; i <= v; i++) {
		if (dp[i] <= w) ans = max(ans, i);
	}
	cout << ans << "\n";

	return 0;
}




Measured memory_bytes: 1024
# frozen_string_literal: true

m, d = gets.split.map(&:to_i)
cnt = 0

(4..m).each do |i|
  (22..d).each do |j|
    d1 = j % 10
    d10 = j / 10
    cnt += 1 if d1 >= 2 && d10 >= 2 && d1 * d10 == i
  end
end

puts cnt

Measured memory_bytes: 1788
##### 解けた #####

import string
import numpy as np

a=set(list(string.ascii_lowercase)) # aの集合
S=set(list(input())) # Sの集合
ans=sorted(list(a-S)) # aには含まれるが、Sには含まれないアルファベットのリスト、アルファベット順

if len(ans)>0: # 含まれないものがある場合
    print(ans[0])
else: # 全て含まれる場合
    print("None")

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

int main() {
  
  int N=0, K=0;
  string S;
  
  cin >> N >> K;
  cin >> S;
  
  S[K-1] = S[K-1] - ('A' - 'a');
  
  cout << S << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
int tot,n,si[N],head[N],to[N],nex[N];
bool flag;
vector<int>v[N],vv[N];
void add(int u,int v)
{
    to[++tot]=v;nex[tot]=head[u];head[u]=tot;
    to[++tot]=u;nex[tot]=head[v];head[v]=tot;
}
bool vis[N];
set<int>s;
queue<int>q;
void dfs(int u)
{
    vis[u]=true;
    q.push(vv[u].size());
    if(vv[u].size()>=2) flag=true;
    for(int i=0;i<vv[u].size();i++)
        s.insert(vv[u][i]);
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];
        if(!vis[v])
        {
            dfs(v);
        }
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        vv[x].push_back(y);
        v[y].push_back(x);
    }
    for(int i=1;i<=100000;i++)
    {
        if(v[i].size()<=1) continue;
        for(int j=0;j<v[i].size()-1;j++)
        {
            add(v[i][j],v[i][j+1]);
        }
    }
    long long ans=0;
    for(int i=1;i<=100000;i++)
        if(!vv[i].size()) vis[i]=true;
    for(int i=1;i<=100000;i++)
        if(!vis[i])
    {
        s.clear();
        flag=false;
        dfs(i);
        while(!q.empty())
        {
            if(flag) ans+=s.size()-q.front();q.pop();
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 107392
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

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

   String nyuA=sc.nextLine();
int X=Integer.parseInt(nyuA);

int ans=1;

for(int b=2;b<=X;b++){
int power=b*b;
for(int p=2;;p++){
if(power>X)break;
ans=Math.max(ans,power);
power*=b;
}
}
System.out.println(ans);
}

}



Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int nx[4] = {1,0,-1,0};
int ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if (abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) PRINT("Yes");
    else PRINT("No");
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

string S;
string T;
int cnt;

int main(){
	cin >> S >> T;
	for (int i = 0; i < S.size(); i++){
		if (S[i] != T[i])cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int arr[60];
	int n;
	
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	
	int sum = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			sum += arr[i] * arr[j];
		}
	}
	
	cout << sum << endl;
		
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false)

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

signed main(void){
  Accepted_MAGIC;
  
  int N, M; cin >> N >> M;
  cout << N*(N-1)/2 + M*(M-1)/2 << endl;
}

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

int main(void)
{
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a,b) << " ";
    if(a + b <= n){cout << 0 << endl;}
    else{cout << a + b - n << endl;}
    return 0;
}

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

namespace atcoder
{
	class Program
	{
		static int In => int.Parse(Console.ReadLine());
		static int[] Ins => Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
		static void Out(bool b) => Console.WriteLine(b ? "Yes" : "No");

		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			string t = Console.ReadLine();
			string ans = "UNRESTORABLE";
			for (int i = 0;i < s.Length - t.Length + 1;i++)
			{
				bool chk = true;
				char[] tmp = s.ToArray();
				for(int j = 0;j < t.Length;j++)
				{
					if (s[i + j] != '?' && s[i + j] != t[j])
					{
						chk = false;
						break;
					}
					else
					{
						tmp[i + j] = t[j];
					}
				}
				if (chk)
				{
					for (int j = 0; j < tmp.Length; j++)
					{
						if (tmp[j] == '?') tmp[j] = 'a';
					}
					ans = new String(tmp);
				}
				
			}
			Console.WriteLine(ans);
			//Console.ReadLine();
		}
	}
}


Measured memory_bytes: 13268
#include <iostream>

using namespace std;

int main(){
int a,b,c;
  cin>>a>>b;
  
  if(a==b){
    c=a+b;
  }
  else if(a>b){
    c=a+a-1;
  }
  else{
    c=b+b-1;
  }
  
  cout<<c<<'\n';
  
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        
        int N = Integer.parseInt(stdR.readLine());
        int[] A = new int[N];
        
        String[] s = stdR.readLine().split(" ");
        
        for(int i = 0; i < N; i++){
            A[Integer.parseInt(s[i]) - 1] = i + 1;
        }
        
        StringBuilder sb = new StringBuilder();
        
        for(int i = 0; i < N; i++){
            sb.append(A[i]);
            if( i != N - 1) sb.append(" ");
        }
        
        System.out.println(sb.toString());
    }
}


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

int gcd(int p, int q) {
    if (p % q == 0) {
        return q;
    }
    return gcd(q, p % q);
}

int main() {
    int k;
    int ans = 0;
    cin >> k;

    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= k; j++) {
            for (int l = 1; l <= k; l++) {
                ans += gcd(i, gcd(j, l));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <iomanip>
using namespace std;
int main(){
	int n,m;
	int p[100000],y[100000];
	vector<pair<int,int> > pp[100000];
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>p[i]>>y[i];
		p[i]--;
		pp[p[i]].push_back(make_pair(y[i],i));
	}
	long long id[100000];
	for(int i=0;i<n;i++){
		sort(pp[i].begin(),pp[i].end());
		for(int j=0;j<pp[i].size();j++){
			id[pp[i][j].second]=(p[pp[i][j].second]+1)*1e6+j+1;
		}
	}
	for(int i=0;i<m;i++){
		stack<int> st;
		while(id[i]){
			st.push(id[i]%10);
			id[i]/=10;
		}
		for(int j=0;j<12-st.size();j++){
			cout<<0;
		}
		while(!st.empty()){
			cout<<st.top();
			st.pop();
		}
		cout<<endl;
	}
	return 0;
}


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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin >> n;
  vint l(n);vin(l);
  vsort(l);
  int sum=0;
  rep(i,n-1)sum+=l[i];
  if(sum>l[n-1])cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
#define PAI 3.14159265358979
// ver1.6
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int n;
  cin >> n;
  string memo;
  Vi a(26,INF);
  rep(i,0,n){
    Vi b(26);
    cin >> memo;
    rep(j,0,memo.size()) b[memo[j]-'a']++;
    rep(j,0,26) a[j] = min(a[j],b[j]);
  }
  rep(i,0,26){
    rep(j,0,a[i]){
      char c = 'a' + i;
      cout << c;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		for(int i=0 ; i<targetArray.length ; i++) {
			if(targetArray[i] == aaa)
				return true;
		}
		return false;
	}
}

Measured memory_bytes: 24748
from collections import defaultdict
N = int(input())
dic = defaultdict(int)

m = 0
B = set()
for i in range(N):
    a,b = map(int,input().split())
    dic[b] += a
    B.add(b)
    if m < b: m = b
B = sorted(B)

flag = True
sub = 0
for b in B:
    sub += dic[b]
    if b-sub < 0:
        flag = False
        break

if flag: print('Yes')
else: print('No')

Measured memory_bytes: 39952
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

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

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(x) x.begin(), x.end()
#define lp(i, n) for (int i = 0; i < n; i++)
#define mem(a, v) memset(a, v, sizeof(a))
#define X real()
#define Y imag()
#define angle(a) (atan2(a.Y, a.X))
#define vec(a, b) ((b) - (a))
//#define length(a) (hypot(a.Y , a.X))
#define normalize(a) (a) / length(a)
#define dotP(a, b) ((conj(a) * b).X)
#define crossP(a, b) ((conj(a) * b).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(a) dotP(a, a)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(v, m) conj(v / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll n, ll x) {
  if (!x)
    return 1;
  if (x % 2)
    return n * fastpow(n, x - 1);
  ll p = fastpow(n, x / 2);
  p %= mod;
  p *= p;
  p %= mod;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll ret = num % mod;
  while (ret < 0)
    ret += mod;
  return ret;
}

ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
long double dist(pair<ll, ll> &a, pair<ll, ll> &b) {
  return sqrt(
      ((a.f - b.f) * (a.f - b.f) * 1.0 + (a.se - b.se) * (a.se - b.se)));
}
/*vector<int> ap;
bool np[MX];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <MX; j+=i) np[j] = 0;
        }
    }
    for(ll i = 2 ; i< MX ; i++) if(np[i]) ap.pb(i);
}*/
const ll MX = 1e5+5;
void mult(ll &a,ll b){
	a*=b;
	a%=b;
}
vector<int> adj[MX];
ll dp[MX][2];
ll solve(int node ,int par, bool color){
	ll &ret = dp[node][color];
	if(~ret) return ret;
	ret = 0;
	ll ans = 1;
	for(int i :  adj [node]){
		if(i == par) continue;
		if(color) ans= ans*solve(i,node,0)%mod;
		else ans = ans*(solve(i,node,0)%mod+solve(i,node,1)%mod)%mod;
	}
	ret = ans;
	return ret;
	
}
int main()
{
    IO;
    int n;
    cin>>n;
    for(int i = 0 ; i < n-1 ; i++){
		int a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	mem(dp,-1);
	cout<<(solve(1,-1,0)%mod + solve(1,-1,1)%mod)%mod;
    
    return 0;
}



Measured memory_bytes: 15616
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b;
  if (b - a >= 5000)
    Cout(0);
  else {
    ans = LINF;
    rrep(i, a, b + 1) {
      rrep(j, i + 1, b + 1) {
        cnt = (i * j) % 2019;
        ans = min(ans, cnt);
      }
    }
    Cout(ans);
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.next().split("");
        long ans = Stream.of(a).distinct().count();
        if (ans == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 28884
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int n;
	cin >> n;
	
	if (n % 10 == 9 || n >= 90) puts("Yes");
	else puts("No");
	
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"sort"
	"strconv"
	"strings"
)

func solution(n int, p, q []int) int {
	i := dictionaryOrder(p)
	j := dictionaryOrder(q)
	log.Printf("i: %d, j: %d", i, j)
	return abs(i, j)
}

func abs(x, y int) int {
	z := x - y
	if z < 0 {
		return z * -1
	}
	return z
}

func dictionaryOrder(nums []int) int {
	var ans int
	l := len(nums)
	for i := 0; i < l; i++ {
		n := nums[i]
		arr := make([]int, len(nums)-i)
		copy(arr, nums[i:])
		a := ascNumber(arr, n) - 1
		if a == 0 {
			ans += 0
		} else {
			ans += a * factorical(l-i-1)
		}
	}
	ans++
	return ans
}

func ascNumber(nums []int, n int) int {
	sort.Ints(nums)
	var i int = 1
	for _, v := range nums {
		if v == n {
			break
		}
		i++
	}
	return i
}

func factorical(n int) int {
	if n == 0 || n == 1 {
		return 1
	}
	return n * factorical(n-1)
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 10240*10240)

	n, err := strconv.Atoi(readLine(reader))
	checkError(err)
	p := make([]int, n)
	ss := strings.Split(readLine(reader), " ")
	for i := range ss {
		p[i], err = strconv.Atoi(ss[i])
		checkError(err)
	}
	q := make([]int, n)
	ss = strings.Split(readLine(reader), " ")
	for i := range ss {
		q[i], err = strconv.Atoi(ss[i])
		checkError(err)
	}
	fmt.Println(solution(n, p, q))
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[200001], b[200001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i], b[i] = a[i];
    sort(b, b + n, greater<int>());
    for (int i = 0; i < n; ++i)
    {
        if (a[i] == b[0])
            cout << b[1];
        else
            cout << b[0];
        cout << '\n';
    }
}


Measured memory_bytes: 3200
import bisect

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

dic = [[0] for i in range(n+1)]
city = []
for i in range(m):
    p,y = map(int,input().split())
    city.append((p,y))
    idx = bisect.bisect_left(dic[p],y)
    dic[p].insert(idx,y)

num = "000000"
for i in city:
    p,y = i[0],i[1]
    if len(str(p)) < 6:
        kami = num[:6-len(str(p))] + str(p)
    else:
        kami = str(p)
    simo = bisect.bisect_left(dic[p],y)
    if len(str(simo)) < 6:
        simo = num[:6-len(str(simo))] + str(simo)
    else:
        simo = str(simo)
    print(kami + simo)


Measured memory_bytes: 35608
k, q = map(int, input().split())
d = list(map(int, input().split()))
 
for _ in range(q):
	n, x, m = map(int, input().split())
 
	res = 0
	for i in range(k):
		a = d[i] % m
		if a == 0:
			a += m
		res += a * ((n - i -2)//k + 1)
	print( (n-1) - ((x+res)//m - x//m) )


Measured memory_bytes: 45660
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;


const long long MOD = 1000000007;

template<typename T>
constexpr std::pair<T, T> eea(T a, T b) noexcept {
	T x = 1, y = 0, p = 0, q = 1;
	while (b != 0) {
		T s = a;
		a = b;
		T t = s / b;
		b = s % b;

		T i = x, j = y;
		x = p;
		y = q;
		p = i - t * p;
		q = j - t * q;
	}

	return pair<T, T>(x, y);
}

template<typename T>
constexpr T binaryPow_mod(T radix, T index, T mod) noexcept {
	radix %= mod;
	T rtv = 1;
	while (index > 0) {
		if (index & 1) {
			rtv *= radix;
			rtv %= mod;
		}

		radix *= radix;
		radix %= mod;

		index = index >> 1;
	}

	return rtv;
}

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

	ll n, a, b;
	cin >> n >> a >> b;

	ll ans = binaryPow_mod((ll)2, n, MOD)-1;
	ll c = n;
	rep(i, max(a, b)+1) {
		if (i + 1 == a) {
			ans -= c;
			if (ans < 0) ans += MOD;
		}
		if (i + 1 == b) {
			ans -= c;
			if (ans < 0) ans += MOD;
		}

		c *= n - (i + 1);
		c %= MOD;
		ll inv = eea((ll)i + 2, MOD).first;
		if (inv < 0) inv += MOD;
		c *= inv;
		c %= MOD;
	}

	cout << ans << "\n";

	return 0;
}
 

Measured memory_bytes: 256
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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 DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n); REP(i, n) cin >> a[i];
    ll tmp = a[0], rem = accumulate(ALL(a), 0LL) - a[0];
    ll ans = tmp + rem;
    rep(i, 1, n) {
        chmin(ans, abs(rem - tmp));
        tmp += a[i];
        rem -= a[i];
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	int n, t;
	vector<bool> v;
	cin >> n;
	v.assign(1000000001, false);
	for (int i = 0; i < n; i++) {
		cin >> t;
		if (v[t] == true) {
			cout << "NO" << endl;
			return 0;
		}
		else {
			v[t] = true;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 122368
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;  
int main()
{
	string s;
	cin>>s;
	if(s[s.length()-1]=='s')
	{
		cout<<s<<"es";
	}
	else
	{
		cout<<s<<"s";
	}
}

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


long long gcd(long long m,long long n){
    if(n==0){
        return m;
    }
    return gcd(n,m%n);
}

long long lcm(long long a,long long b){
    long long g=gcd(a,b);
    return a/g*b;
}

int main(){
  int n;
  cin>>n;
  long long t[n];
  for(int i=0;i<n;i++){
      cin>>t[i];
  }
  long long ans=t[0];
  for(int i=1;i<n;i++){
      ans=lcm(t[i],ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;
use std::collections::VecDeque;

fn main() {
    input!(n: usize, s: chars);
    let mut to = vec![vec![]; n];

    for i in 1..(n - 1) {
        if s[i] == '1' {
            continue;
        }
        if s[i - 1] == '0' || s[i + 1] == '0' {
            continue;
        }
        let mut left = i - 1;
        while left >= 1 && s[left - 1] == '1' {
            left -= 1;
        }

        let mut right = i + 1;
        while right + 1 < n && s[right + 1] == '1' {
            right += 1;
        }
        for x in left..i {
            to[x].push(i + 1);
        }
        for x in (i + 1)..(right + 1) {
            to[i - 1].push(x);
        }
    }

    let mut dp = vec![0; n + 1];
    for i in 0..n {
        dp[i + 1] = cmp::max(dp[i + 1], dp[i]);
        for &to in to[i].iter() {
            let cost = to - i - 1;
            dp[to + 1] = cmp::max(dp[to + 1], dp[i] + cost);
        }
    }
    println!("{}", dp[n]);
}


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

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

	cout << max(max(a*c,a*d), max(b*c,b*d)) << endl;
	return 0;
}


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

int main() {
    cin >> R;
    if(R<1200){
        cout<<"ABC"<<endl;
    }else if(R<2800) {
        cout<<"ARC"<<endl;
    }else if(R<=4208) {
        cout<<"AGC"<<endl;
    }
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input = input.trim().toLowerCase();
input = input.replace(/\s+/g,"");
var alpha = "abcdefghijklmnopqrstuvwxyz";
for(var i=0;i<alpha.length;i++){
    var count = 0;
    for(var j=0;j<input.length;j++){
        if(alpha[i] === input[j]){
            count++;
        }
    }
    console.log(alpha[i] + " : " + count);
}



Measured memory_bytes: 15320
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define RREP(i, a, n) for(int i=n-1; i>=a; --i)

int n, k;
int a[202020];
int main(void)
{
    cin>>n>>k;
    REP(i, 0, n) cin>>a[i];

    REP(i, k, n){
        if(a[i]>a[i-k]){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, a, b) for (int i = (a); i < (b); i++)
typedef long long ll;
using namespace std;

int main()
{
    int n, r;
    cin >> n >> r;
    int ans;
    if (n < 10)
    {
        ans = r + 100 * (10 - n);
    }
    else
    {
        ans = r;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
		
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

#define N 5010
vll dp(N, vl(N));

ll mod_pow(ll x, ll p, ll M) {
	ll a = 1;
	while (p) {
		if (p % 2)
			a = a*x%M;
		x = x*x%M;
		p /= 2;
	}
	return a;
}

ll mod_inverse(ll a, ll m) {
	return mod_pow(a, m - 2, m);
}


int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int i, j, k;
	int m = s.size();

	dp[0][0] = 1;
	for (i = 0; i < n; i++) {
		for (j = 0; j <= i; j++) {
			if (j == 0) {
				dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
			}
			else {
				dp[i + 1][j - 1] = (dp[i + 1][j - 1] + dp[i][j]) % MOD;
			}
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 2) % MOD;
		}
	}

	ll ans = dp[n][m];
	ans = (ans * mod_inverse(mod_pow(2, m, MOD), MOD)) % MOD;
	while (ans < 0) {
		ans += MOD;
	}
	cout << ans << endl;
	
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main() {
  string s;
  bool al[26];
  cin >> s;

  rep(i,0,26){
    al[i] = false;
  }

  for(int i = 0; s[i] != '\0'; i++){
    al[s[i]-'a'] = true;
  }

  rep(i,0,26){
    if(al[i] == false){
      printf("%c\n", (char)(i +'a'));
      return 0;
    }
  }
  printf("None\n");
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
  int D, T, S;
  cin >> D >> T >> S;
  double time = (double)D / (double)S;
  if (time > T) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}

Measured memory_bytes: 3672
import sys
sys.setrecursionlimit(10**7)

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
a.append(n+1)
seq = [a[0]]

for i in range(m):
    d = a[i+1] - a[i] - 1
    if d == 0:
        print(0)
        sys.exit()
    seq.append(d)

memo = [-1] * (10**5 + 7)
def fib(i):
    if i == 0: return 0
    elif i == 1: return 1
    elif memo[i] != -1: return memo[i]
    else:
        memo[i] = fib(i-1) + fib(i-2)
        return memo[i]

ans = 1
for s in seq:
    ans *= fib(s)
print(ans % 1000000007)


Measured memory_bytes: 494196
#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,res,x;
	scanf("%d %d",&a,&b);
	res=abs(a-b);
	if(res==0 || res==1)
	printf("Yay!");
	else
	printf(":(");
	return 0;
}
	

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << min(B / A, C) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N, T;
	cin >> N >> T;
	int t[N];
	for(int i = 0; i < N; i++) cin >> t[i];
	ll ans = T;
	for(int i = 1; i < N; i++) ans += min(T, t[i] - t[i - 1]);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

double memo[3005][3005];
double datas[3005];
int n;
double solve(int x, int y)
{
	if(x+y==n)
	{
		if(x>y) return 1.00;
		else return 0.00;
	}
	if(memo[x][y]>-1.00) return memo[x][y];
	return memo[x][y]=datas[x+y]*solve(x+1, y)+(1-datas[x+y])*solve(x, y+1);
}
int main()
{
	scanf("%d", &n);
	for(int a=0;a<n;a++)
	{
		scanf("%lf", &datas[a]);
	}
	for(int a=0;a<=3000;a++)
	{
		for(int b=0;b<=3000;b++)
		{
			memo[a][b]=-1.00;
		}
	}
	printf("%.10lf\n", solve(0, 0));
	return 0;
}

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

int main() {
	long long N, K; cin >> N >> K;
	vector<long long>A(N);
	for (long long i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	for (long long i = K; i < N; i++) {
		if (A.at(i) > A.at(i - K)) {
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 4840