akhauriyash/Code-Regression huggingface dataset:
n,y = map(int,input().split())
man,gosen,sen=0,0,0
man_max = y//10000
flag=False

for i in range(man_max+1):
  man = man_max-i
  #print("man :",man)
  temp_y = y - 10000*man
  temp_n = n - man
  gosen_max = temp_y//5000
  for j in range(gosen_max+1):
    gosen = gosen_max-j
    #print("gosen :",gosen)
    temp_temp_y = temp_y - 5000*gosen 
    temp_temp_n = temp_n - gosen
    if temp_temp_y/1000==temp_temp_n:
      sen = temp_temp_n
      flag=True
      break
  if flag:
    break

if flag:
  print(str(man) + " " + str(gosen) + " " + str(sen))
else:
  print("-1 -1 -1")

Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		System.out.print(s.charAt(0));
		System.out.print(s.length()-2);
		System.out.println(s.charAt(s.length()-1));
	}
}

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

int main() {
    int n, k;
    int a[100000];
    
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    
    cout << ceil((n - 1.0) / (k - 1.0)) << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main(){
  
  string s;
  while(cin >> s){
    
    for(int i=0;i<s.size();i++){
      if(s[i]!='@') cout << s[i];
      else {
	for(int j=0;j<(s[i+1]-'0');j++) cout << s[i+2];
	i += 2;
      }
    } 
    cout << endl;

  }

  return (0);
}

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int j = a*x+b*y;
  int k = (x > y)? (x-y)*a + 2*c*y : (y-x)*b + 2*c*x;
  int l = (x > y)? x*2*c : y*c*2;
  cout << min({j, k ,l}) << endl;
}


Measured memory_bytes: 256
n = gets.to_i
n.times do
    x = gets
    y = x.split(" ")
    inbus = y[0].to_i
    outbus = y[1].to_i
    if inbus < outbus
        num = []
        for i in inbus..outbus do
            num << i
        end
            puts num.join(" ")
    elsif inbus > outbus
        if inbus <= 5
            num = []
            for i in outbus..inbus do
                num << i
            end
                puts num.reverse.join(" ")
        elsif inbus >= 6
            if outbus <= 5
            num = []
            for i in inbus..9 do
                num << i
            end
            if outbus == 5
                num << 5
            elsif outbus == 4
                num << 5
                num << 4
            elsif outbus == 3
                num << 5
                num << 4
                num << 3
            elsif outbus == 2
                num << 5
                num << 4
                num << 3
                num << 2
            elsif outbus == 1
                num << 5
                num << 4
                num << 3
                num << 2
                num << 1
            elsif outbus == 0
                num << 5
                num << 4
                num << 3
                num << 2
                num << 1
                num << 0
            end
            puts num.join(" ")
            elsif outbus >= 6
            num = []
             for i in inbus..9 do
                 num << i
             end
             num << 5
             num << 4
             num << 3
             num << 2
             num << 1
             num << 0
             num << 1
             num << 2
             num << 3
             num << 4
             
             for i in 5..outbus do
                 num << i
             end
                 
          puts num.join(" ")
              
                 
        end
        
            
        end
    end
end



Measured memory_bytes: 6888
import java.util.*;

class Node{
	int depth;
	int parent_id;
	public ArrayList<Integer> children;
	
	Node(){
		children = new ArrayList<Integer>();
		parent_id=-1;
	}
	
	public void setParent_id(int parentid){
		this.parent_id=parentid;
	}
	public int getParent_id(){
		return parent_id;
	}
	public void setDepth(int d){
		this.depth=d;
	}
	public int getDepth(){
		return depth;
	}
}

public class Main {
    public static Node[] nodes;
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	
    	int id,num,k,j;
    	int N=sc.nextInt();
    	nodes=new Node[N];
        for(int i=0;i<N;i++){
        	nodes[i]=new Node();
        }
        for(int l=0;l<N;l++){
        	id=sc.nextInt();
        	num =sc.nextInt();
        	for(j=0;j<num;j++){
        		k=sc.nextInt();
        		nodes[id].children.add(k);
        		nodes[k].setParent_id(id);
        	}
        }
        
        for(int i=0;i<N;i++){
        	if(nodes[i].getParent_id()==-1){
        	    calcDepth(i,0);
        	}
        }
        StringBuilder ans = new StringBuilder();
        
        for(int i = 0; i < N; i++){
            ans.append("node ").append(Integer.toString(i)).append(": parent = ").append(Integer.toString(nodes[i].getParent_id()))
            .append(", depth = ").append(Integer.toString(nodes[i].getDepth())).append(", ");
 
            if(nodes[i].getParent_id() == -1){
                ans.append("root, ");
            }else if(nodes[i].children.size() == 0){
                ans.append("leaf, ");
            }else{
                ans.append("internal node, ");
            }
 
            ans.append("[");
            if(nodes[i].children.size() > 0){
                ans.append(Integer.toString(nodes[i].children.get(0)));
                for(k = 1; k < nodes[i].children.size(); k++){
                    ans.append(", ").append(Integer.toString(nodes[i].children.get(k)));
                }
            }
            ans.append("]\n");
        }
        System.out.print(ans.toString());
        
    }
        
    static void calcDepth(int id,int value){
        	nodes[id].setDepth(value);
        	for(int i=0;i<nodes[id].children.size();i++){
        		calcDepth(nodes[id].children.get(i),value+1);
        	}
    }
}


Measured memory_bytes: 137544
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;

// {{{ Decompose Prime
std::map<ll, ll> decomposePrime(ll n) {
    std::map<ll, ll> m;
    ll x = 2;
    while (x * x <= n) {
        if (n % x == 0) {
            m[x]++;
            n /= x;
        } else {
            x++;
        }
    }
    if (n > 1)
        m[n]++;
    return m;
}
// }}}

ll N;
ll a[1000000];
signed main() {
  cin >> N;
  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }
  a[0] = 0;
  for (ll i = 1; i < 1000000; i++) {
    a[i] = a[i-1] + i;
  }
  ll ans = 0;
  for (auto e : decomposePrime(N)) {
    auto it = upper_bound(begin(a), end(a), e.second);
    it--;
    ans += distance(begin(a), it);
  }
  cout << ans << endl;
  return 0;
}


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

const int mod = (int) (1e9)+7;
using ll = long long;

int main()
{
    ll n;
    ll a[300000];
    ll q_sum[300000];
    scanf("%lld", &n);
    for(int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }
    q_sum[0] = a[0];
    for(int i = 1; i < n; i++){ 
        q_sum[i] = (q_sum[i-1] + a[i])%mod;
        q_sum[i] %= mod;
    }
    ll ans = 0;
    ll last = q_sum[n-1];
    for(int i = 0; i < n; i++) {
        ans += ((last - q_sum[i])*a[i])%mod;
        ans %= mod;
    }
    if(ans < 0) ans += mod;
    printf("%lld\n", ans); 
}


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

using namespace std;

int main(){
	unsigned long long a[3];

	cin >> a[0] >> a[1] >> a[2];
	
	sort(a,a+3);

	//cout << a[0] << " " << a[2]<<endl;

/*	unsigned long long s = a[0] * a[1] *2;
	unsigned long long t = a[2] * a[1] * a[0];

	while(s <= t){
		t -= s;
	}

	cout << t << endl;
*/
	cout<< a[2]%2 *a[1]*a[0] <<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
const int MOD = 1e9 + 7;
int main(){
    int K;
    cin >> K;
    string st = "ACL";
    string ans;
    for(int i = 0; i < K; i++){
        ans += st;
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    string c;
    int holder{0};
    cin >> c;
    int i=0;
    while(i<c.size())
    {
        switch(c[i]){
    case '0':
        break;
    case '1':
        holder+=1;
        break;
    case '2':
        holder+=2;
        break;
    case '3':
        holder+=3;
        break;
    case '4':
        holder+=4;
        break;
    case '5':
        holder+=5;
        break;
    case '6':
        holder+=6;
        break;
    case '7':
        holder+=7;
        break;
    case '8':
        holder+=8;
        break;
    case '9':
        holder+=9;
        break;
    default:
        break;
        }
        i++;
    }
    if(holder%9==0)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 3448
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
  int n;
  cin>>n;
  string s[n];
  for(int i=0;i<n;i++)cin>>s[i];
  int used[n];
  queue<int> k,k2;
  int ans=-1,ans2;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)used[j]=0;
    k.push(i);
    used[i]=1;
    ans2=0;
    while(!k.empty()){
    while(!k.empty()){
      for(int j=0;j<n;j++){
        if(s[k.front()][j]=='1'){
          if(used[j]==0){
             used[j]=-1*used[k.front()];
          k2.push(j);
          }else{
            if(used[j]==used[k.front()]){
              cout<<-1;
              return 0;
            }
          }
         
        }
      }
      k.pop();
   
    }
    swap(k,k2);
    ans2++;
    }
  //  cerr<<ans2<<' '<<k2.size()<<endl;
    ans=max(ans,ans2);
  }
  cout<<ans;

  


  return 0;
}


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

int main() {
    int n, p;
    cin >> n >> p;
    ll cnt[2] = {1, 0};
    

    for (int i=0; i<n; i++) {
        int t;
        cin >> t;
        if (t%2 == 0) {
            cnt[0] += cnt[0];
            cnt[1] += cnt[1];
        } else {
            ll pc = cnt[0];
            cnt[0] += cnt[1];
            cnt[1] += pc;
        }
    }
    
    cout << cnt[p] << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,W;
    cin >> N >> W;
    ll mini = INF;
    vector<ll> A(N),B(N);
    rep(i,0,N){
        cin >> A[i] >> B[i];
        mini = min(mini, A[i]);
    }
    vector<ll> V[4],accum[4];
    rep(i,0,N){
        V[A[i] - mini].push_back(B[i]);
    }
    rep(i,0,4)sort(V[i].rbegin(), V[i].rend());
    rep(i,0,4)accum[i].resize(V[i].size() + 1);
    rep(i,0,4){
        rep(j,0,V[i].size()){
            accum[i][j+1] = accum[i][j] + V[i][j];
        }
    }
    /*
    rep(i,0,4){
        for(auto j:V[i])cout << j << " ";
        cout << endl;
    }
    */
    ll maxi = 0;
    ll sum[4] = {};
    rep(i,0,V[0].size()+1){
        sum[0] = mini * i;
        if(sum[0] > W)break;
        rep(j,0,V[1].size()+1){
            sum[1] = sum[0] + (mini+1) * j;
            if(sum[1] > W)break;
            rep(k,0,V[2].size()+1){
                sum[2] = sum[1] + (mini+2) * k;
                if(sum[2] > W)break;
                rep(l,0,V[3].size()+1){
                    sum[3] = sum[2] + (mini+3) * l;
                    if(sum[3] > W)break;
                    maxi = max(maxi, accum[0][i] + accum[1][j] + accum[2][k] + accum[3][l] );
                }
            }
        }
    }
    cout << maxi << endl;
}

Measured memory_bytes: 256
import numpy as np

N,*A = map(int,open(0).read().split())
a = sorted(A,reverse=True)

arr = np.array(a)
bai = arr * 2
ruisekiwa = np.cumsum(bai[1:])
if N == 2:
    print(a[0])
    exit()
if N % 2 == 0:
    print(ruisekiwa[(N-1)//2 - 1] + a[0])
else:
    print(ruisekiwa[(N-1)//2 - 2] + a[(N-1)//2] + a[0])


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

typedef long long ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    int N;
    cin >> N;
    vector<int> A;
    vector<int> B;
    vector<int> C;
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        int a;
        cin >> a;
        A.push_back(a);
    }
    for (int i = 0; i < N; ++i)
    {
        int b;
        cin >> b;
        B.push_back(b);
    }
    for (int i = 0; i < N - 1; ++i)
    {
        int c;
        cin >> c;
        C.push_back(c);
    }
    int pre = 0;
    for (int i = 0; i < N; ++i)
    {

        ans += B[A[i] - 1];
        if (i + 1 < N && A[i + 1] == A[i] + 1)
        {
            ans += C[A[i] - 1];
        }
        pre = A[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int main()
    {
        ios::sync_with_stdio(0);
        cin.tie(0);
        ll n,cnt;
        string s;
        cin >>n;
	    cin >> s;
        ll r=count(s.begin(),s.end(),'R');
        ll  g=count(s.begin(),s.end(),'G');
        ll  b=count(s.begin(),s.end(),'B');
        cnt=r*g*b;
        for(ll i=0;i<n;i++){
            for(ll j=i+1;j<n;j++){
                if(j*2-i>=n)break;
                set<char>st;
                st.insert(s[i]);
                st.insert(s[j]);
                st.insert(s[j*2-i]);
                if(st.size()==3)cnt--;
            }
        }
 
        cout << cnt << endl;
        return 0;
    }

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

#include <atcoder/all>
typedef long long ll;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (ll i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (ll i = ((ll)(n)-1); i >= 0; --i)
#define rreps(i, n) for (ll i = ((ll)(n)); i > 0; --i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repc2(i, s, n) for (ll i = (s); i <= (ll)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
using namespace atcoder;

int n, m;
bool M[100][100];
char ans[100][100];

int vert(int y, int x) {
    return y * m + x + 1;
}
pair<int, int> yx(int v) {
    v--;
    return make_pair(v / m, v % m);
}
int s, t;
int main() {
    cin >> n >> m;
    s = 0, t = n * m + 1;
    rep(y, n) rep(x, m) {
        cin >> ans[y][x];
        if (ans[y][x] == '#') {
            M[y][x] = true;
        }
    }
    mf_graph<int> graph(n * m + 2);
    rep(y, n) rep(x, m) {
        if ((y + x) % 2 == 0) {
            graph.add_edge(s, vert(y, x), 1);
        } else {
            graph.add_edge(vert(y, x), t, 1);
        }
    }
    rep(y, n) rep(x, m) {
        if (!M[y][x]) {
            if (y + 1 < n && !M[y + 1][x]) {
                if ((y + x) % 2 == 0) {
                    graph.add_edge(vert(y, x), vert(y + 1, x), 1);
                } else {
                    graph.add_edge(vert(y + 1, x), vert(y, x), 1);
                }
            }
            if (x + 1 < m && !M[y][x + 1]) {
                if ((y + x) % 2 == 0) {
                    graph.add_edge(vert(y, x), vert(y, x + 1), 1);
                } else {
                    graph.add_edge(vert(y, x + 1), vert(y, x), 1);
                }
            }
        }
    }
    int flow = graph.flow(s, t);
    auto edges = graph.edges();
    for (const auto &e : edges) {
        if (e.from != s && e.to != t && e.flow > 0) {
            auto u = yx(e.from);
            auto v = yx(e.to);
            if (u > v)
                swap(u, v);
            if (u.first == v.first) {
                ans[u.first][u.second] = '>';
                ans[v.first][v.second] = '<';
            } else {
                ans[u.first][u.second] = 'v';
                ans[v.first][v.second] = '^';
            }
        }
    }

    printf("%d\n", flow);
    rep(y, n) {
        rep(x, m) { printf("%c", ans[y][x]); }
        puts("");
    }
    return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll x,y;cin>>x>>y;
  if(x%y!=0)cout<<x<<endl;
  else if(x*2%y!=0)cout<<x*2<<endl;
  else cout<<-1<<endl;
  return 0;
}

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

int main(void){
	int n;
	double h,w;
	char tmp;
	while(cin >> n >> tmp >> w >> tmp >> h){
		if(cin.eof()) break;
		double bmi=w/h/h;
		if(bmi >= 25.0) cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
import java.util.*;
import java.io.*;

public class Main {
		public static void main(String[] args) throws IOException {
		
		// 入出力高速化 java.io.* とthrows IOExceptionを忘れずに
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
		String[] in1 = br.readLine().split(" ");
		int[] in2 = new int[in1.length];
		for(int i=0; i<in1.length; i++){
		in2[i] = Integer.parseInt(in1[i]);
		}
		Arrays.sort(in2);
		
		// BとCをなるべくAに近づける
		int ans = (in2[2]-in2[1])/2+(in2[2]-in2[0])/2;
		// Aとの差を確認する
		int ab = (in2[2]-in2[1])%2;
		int ac = (in2[2]-in2[0])%2;
		
		if(ab == 0){
		    if(ac == 0){
		    //ABCの差が無いので追加操作不要
		    }else{
		        //差が(0,0,-1)のため、AとBに+1、Cに+2で操作は2回
		        ans += 2;
		    }
		
		}else{
		    if(ac == 0){
		    //差が(0,-1,0)のため、AとCに+1、Bに+2で操作は2回
		        ans += 2;
		    }else{
		        //差が(0,-1,-1)のため、BとCに+1で操作は1回
		        ans += 1;
		    }
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 32728
#include<cstdio>
using namespace std;
int a[100100];
int main(){
//	freopen("A.in","r",stdin);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	int zt=0,ans=1;
	for(int i=2;i<=n;i++)
	{
		if(zt==0)
		{
			if(a[i]>a[i-1])
				zt=1;
			else if(a[i]<a[i-1])
				zt=-1;
			else
				zt=0;
		}
		else
		{
			if(zt==1){
				if(a[i]<a[i-1]){
					ans++;
					zt=0;
				}
			}
			else{
				if(a[i]>a[i-1]){
					ans++;
					zt=0;
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 512
using Microsoft.VisualBasic;
using System;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = int.Parse(Console.ReadLine());
            var sp = Console.ReadLine().Split(' ');
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = long.Parse(sp[i]);
                if (a[i] == 0)
                {
                    Console.WriteLine(0);
                    Console.Out.Flush();
                    return;
                }
            }

            const long m = 1000000000000000000;
            long ans = 1;
            for (int i = 0; i < n; i++)
            {
                if ((m)/ans < a[i] || ans*a[i] > m)
                {
                    Console.WriteLine(-1);
                    Console.Out.Flush();
                    return;
                }
                ans *= a[i];
            }

            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 40548
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

vector<vector<ll>> comb(int n, int r) {
  vector<vector<ll>> v(n + 1,vector<ll>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() {
    int n, p;
    cin >> n >> p;
    int even, odd;
    even = 0;
    odd = 0;

    for (int i=0; i<n; i++){
        int ai;
        cin >> ai;
        if (ai%2)odd++;
        else even++;
    }
    if (even == n){
      if (p==1) cout << 0 << endl;
      else printf("%lld\n",(ll)pow(2,even));
    }
    else {
      printf("%lld\n", (ll)pow(2,n-1));
    }
}

Measured memory_bytes: 256
import Data.List
import qualified Data.IntMap.Lazy as IM
 
main = do
  getLine
  as <- map read . words <$> getLine
  print . h . sortBy (flip compare) $ f IM.empty as
 
f :: IM.IntMap Int -> [Int] -> [Int]
f im [] = j $ IM.toList im
f im (y:ys) = f (IM.insertWith g y 1 im) ys
 
g x y = y + 1
 
h (x:y:zs) = x * y
h _ = 0

j [] = []
j ((k, v):xs)
  | v >= 4 = [k, k] ++ j xs
  | v >= 2 = k : j xs
  | otherwise = j xs

Measured memory_bytes: 52604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++) cin >> A[i];
    ll a = 0;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += A[i];
        if (i % 2 == 0 && sum <= 0) {
            a += 1 - sum;
            sum = 1;
        }
        if (i % 2 == 1 && sum >= 0) {
            a += sum + 1;
            sum = -1;
        }
    }
    ll b = 0;
    sum = 0;
    for (int i = 0; i < n; i++) {
        sum += A[i];
        if (i % 2 == 0 && sum >= 0) {
            b += sum + 1;
            sum = -1;
        }
        if (i % 2 == 1 && sum <= 0) {
            b += 1 - sum;
            sum = 1;
        }
    }
    cout << min(a, b) << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int fib(unsigned int n);

int main(void){
    unsigned int n;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cout << fib(n) << endl;
}

int fib(unsigned int n) {
    vector<int> ary(n+1);
    ary[0] = 1;
    ary[1] = 1;
    for(int i = 2; i <= n; ++i) ary[i] = ary[i-1] + ary[i-2];
    return ary[n];
}


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

#define fs first
#define sc second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair

const int N = 2e5+10;
const ll MAX = ll(1e18) + 111;
const ll MOD = 1e9+7;

string ask(ll p){
    string s;
    cout << p << endl;
    cin >> s;
    if(s == "Vacant")
        exit(0);
    return s;
}

int main()
{
    int n;
    cin >> n;
    ll l = 0, r = n-1;
    string sl = ask(l);
    string sr = ask(r);
    for(;;){
        ll m = (l+r)/2;
        string sm = ask(m);
        if(l%2 == m%2 && sm != sl)
            r = m, sr = sm;
        else if(l%2 != m%2 && sm == sl)
            r = m, sr = sm;
        else if(r%2 == m%2 && sm != sr)
            l = m, sl = sm;
        else if(r%2 != m%2 && sm == sr)
            l = m, sl = sm;
        else
            r = m, sr = sm;
        //cout << "Turn: " << l << ' ' << r << ' ' << sl << ' ' << sr << endl;
    }

	return 0;
}


Measured memory_bytes: 852
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
typedef long long ll;
const ll MAXN=1e5+5,MAXM=2e5+5,P=1e9+7;
 
ll N,M,S,T;
 
struct E{ll next,to,val;} e[MAXM<<1];ll ecnt,G[MAXN];
void addEdge(ll u,ll v,ll w){e[++ecnt]=(E){G[u],v,w};G[u]=ecnt;}
void addEdge2(ll u,ll v,ll w){addEdge(u,v,w);addEdge(v,u,w);}
 
ll fS[MAXN],dS[MAXN],fT[MAXN],dT[MAXN];
 
struct HN{ll id,v;};
bool operator <(const HN &a,const HN &b){return a.v>b.v;}
std::priority_queue<HN> heap;
bool inS[MAXN];
void dijkstra(ll v0,ll *f,ll *d)
{
	memset(inS,0,sizeof inS);
	memset(d,0x3f,sizeof dS);
	d[v0]=0,f[v0]=1;heap.push((HN){v0,0});
	while(!heap.empty())
	{
		ll u=heap.top().id;heap.pop();
		if(inS[u]) continue;inS[u]=true;
		for(ll i=G[u];i;i=e[i].next)
		{
			ll v=e[i].to;
			if(inS[v]) continue;
			if(d[v]>d[u]+e[i].val)
			{
				f[v]=f[u];
				d[v]=d[u]+e[i].val;
				heap.push((HN){v,d[v]});
			}
			else if(d[v]==d[u]+e[i].val) f[v]=(f[v]+f[u])%P;
		}
	}
}
 
struct A{ll u,v,w;} a[MAXM];
int main()
{
	ll i;scanf("%d%d%d%d",&N,&M,&S,&T);
	for(i=1;i<=M;i++)
	{
		ll u,v,w;scanf("%d%d%d",&u,&v,&w);
		addEdge2(u,v,w);a[i]=(A){u,v,w};
	}
	dijkstra(S,fS,dS);
	dijkstra(T,fT,dT);
	ll ans=(ll)fS[T]*fS[T]%P;
	for(i=1;i<=N;i++)
		if(dS[i]==dT[i]&&dS[i]+dT[i]==dS[T])
			ans=((ll)ans+P-(ll)fS[i]*fS[i]%P*fT[i]%P*fT[i]%P)%P;
	for(i=1;i<=M;i++)
	{
		ll u=a[i].u,v=a[i].v,w=a[i].w;
		if(dS[u]>dS[v]) std::swap(u,v);
		if(dS[u]<dS[T]>>1&&dT[v]<dT[S]>>1&&dS[u]+dT[v]+w==dS[T])
		//if(dS[u]+dT[v]+w==dS[T]&&std::max(dS[u],dT[v])<std::min(dS[u],dT[v])+w)
			ans=((ll)ans+P-(ll)fS[u]*fS[u]%P*fT[v]%P*fT[v]%P)%P;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 20468
package main

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

func main() {
	S := nextInt()

	// dp[i] は 合計iになる数列の数
	dp := make([]mint, S+10)
	for i := 3; i <= S; i++ {
		dp[i] = dp[i].add(mint(1))
		for j := 3; j <= S-i; j++ {
			// debug(i, j, dp[i], dp[i+j])
			dp[i+j] = dp[i+j].add(dp[i])
		}
	}

	fmt.Println(dp[S])
}

type mint int64

var mod = mint(1e9 + 7)

// add は a + bを返します
func (a mint) add(b mint) mint {
	return (a + b) % mod
}

// sub は a - bを返します
func (a mint) sub(b mint) mint {
	return (a - b + mod) % mod
}

// mul は a * bを返します
func (a mint) mul(b mint) mint {
	return (a * (b % mod)) % mod
}

// div は a/bを返します
func (a mint) div(b mint) mint {
	return a.mul(b.inv())
}

// inv は aの逆元を返します
func (a mint) inv() mint {
	// 拡張ユークリッドの互除法
	b := mod
	u := mint(1)
	v := mint(0)
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	return (u + mod) % mod
}

// pow は a ^ bを返します
func (a mint) pow(b mint) mint {
	ans := mint(1)

	for b != 0 {
		if b&1 == 1 {
			ans = ans.mul(a)
		}
		a = a.mul(a)
		b = b >> 1
	}
	return ans
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args...)
}


Measured memory_bytes: 1860
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		int half = list.size() / 2;
		int ans = list.get(half) - list.get(half - 1);
		System.out.println(ans);
	}

}


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

int main()
{
	int N;
	int F[101][11] = {};
	int P[100][12] = {};
	long long int sum, ans;
	int n, m, k, a, b, c, i, j, l;
	ans = -1000000000;
	sum = 0;
	cin >> N;
	for (i = 0; i < N; i++) {
		for (j = 0; j < 10; j++) {
			cin >> F[i][j];
		}
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j <= 10; j++) {
			cin >> P[i][j];
		}
	}
	for (i = 1; i < 1024; i++) {
		sum = 0;
		for (k = 0; k < N; k++) {
			c = 0;
			for (j = 0; j < 10; j++) {
				if (((i >> j) & 1)&&F[k][j]) {
					c++;
				}
			}
			sum += P[k][c];
		}
		if (sum > ans)
			ans = sum;


	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String in = br.readLine();
		br.close();
		int x = Integer.parseInt(in);
		int y = cube(x);
		System.out.println(y);
	}
	/**
	 * x を3乗する
	 * 
	 * @param x
	 * @return
	 */
	public static int cube(int x) { 
		return x*x*x;
	}
}

Measured memory_bytes: 16864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
vector<ll> dic;
inline int S(ll x){
	int sum=0;
	while(x){
		sum+=x%10;
		x/=10;
	}
	return sum;
}
int main(){
	int K;
	scanf("%d",&K);
	dic.push_back(999999999999999ll);
	int idx=0;
	while(idx<(int)dic.size()){
		ll cur=dic[idx++];
		bool found=false;
		for(ll i=1;i<=1000000000000000ll && !found;i*=10){
			for(int digit=1;digit<=9 && !found;digit++){
				ll tmp=cur-digit*i;
				if(tmp>0 && tmp*S(cur)<=cur*S(tmp)){
					dic.push_back(tmp);
					found=true;
				}
			}
		}
	}
	sort(dic.begin(),dic.end());
	for(int i=0;i<K;i++)
		printf("%lld\n",dic[i]);
	return 0;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())
V = sum(v)

#dp[i][j]...i番目までの品物で価値j以上を達成するのに必要な重さの最小値(達成できないときはinf)
dp = [[float("inf")]*(V+1) for _ in range(N+1)]

"""
for j in range(V+1):
    if j<=v[0]:
        dp[1][j] = w[0]
"""
dp[0][0]=0
for i in range(1,N+1):
    for j in range(V+1):
        if j<v[i-1]:
            dp[i][j] = min(dp[i-1][j],w[i-1])
        else:
            dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1])

ans=0
#print(dp[-1])
for j in range(V+1):
    for i in range(N+1):
        if dp[i][j] <= W:
            ans = max(ans,j)
            break

print(ans)




Measured memory_bytes: 311960
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = Array.IndexOf(n, 0) + 1;


        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 28300
#include <stdio.h>
#include <math.h>


int main(void){
	int n, m, x, a;
	int leftSum = 0;
	int rightSum = 0;
	scanf("%d %d %d", &n, &m, &x);
	for (int i = 0; i < m; ++i) {
		scanf("%d", &a);
		if (a < x) {
			leftSum += 1;
		}
		else if(x<a){
			rightSum += 1;
		}
	}

	printf("%d", (int)fmin(leftSum, rightSum));

	return 0;
}

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

#define V vector

const double INF = 1e11;

struct state {
    int pos;
    double time;
    int vel;
    int prev;

    state () {}
    ~state () {}

    state(int a, double b, int c, int d):
        pos(a), time(b), vel(c), prev(d) {}

    bool operator < (const state& o) const {
        return time > o.time;
    }
};

struct edge {
    int to;
    int time;
    int lim;

    edge () {}
    ~edge () {}

    edge(int a, int b, int c):
        to(a), time(b), lim(c) {}
};

bool solve() {
    int n, m, s, g;
    cin >> n >> m;

    if (n == 0 && m == 0) return false;

    cin >> s >> g;
--s; --g;

    V<V<edge>> graph(n, V<edge>(0));

    for (int j = 0; j < m; ++j) {
        int x, y, d, c;
        cin >> x >> y >> d >> c;
        --x; --y;
        graph[x].push_back(edge(y, d, c));
        graph[y].push_back(edge(x, d, c));
    }

    V<V<V<double>>> min_time(n, V<V<double>>(n, V<double>(31, INF)));
    priority_queue<state> que;

    que.push(state(s, 0.0, 0, s));
    min_time[s][s][0] = 0;

    while (!que.empty()) {
        state st = que.top(); que.pop();

        if (st.time > min_time[st.pos][st.prev][st.vel]) {
            continue;
        }

        if (st.pos == g && st.vel == 1) {
            break;
        }

        for (edge& e : graph[st.pos]) {
            if (e.to == st.prev) continue;

            for (int a = -1; a <= 1; ++a) {
                int nv = st.vel + a;
                if (nv <= 0) continue;

                double t = st.time + (double)e.time / nv;

                if (nv <= e.lim && t < min_time[e.to][st.pos][nv]) {
                    min_time[e.to][st.pos][nv] = t;
                    que.push(state(e.to, t, nv, st.pos));
                }
            }
        }
    }

    double ret = INF;
    for (int j = 0; j < n; ++j) {
        ret = min(ret, min_time[g][j][1]);
    }
    
    if (ret == INF) {
        printf("unreachable\n");
    } else {
        printf("%.12f\n", ret);
    }

    return true;
}

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

Measured memory_bytes: 2072
import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)
  def main(args: Array[String]): Unit = {
    val n   = sc.nextLong
    val tl  = List.fill(5)(sc.nextLong)
    val min = tl.min

    val res = (n + min - 1L) / min + 4L

    println(res)

  }
}

Measured memory_bytes: 25664
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();

    let mut a = vec![0; n];

    for i in 0..n {
        a[i] = read::<i64>();
    }

    let mut ans = 0;
    for i in 0..n {
        ans += a[i]-1;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007

int main(){
  FIO;
  // ifstream cin("input");
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  ll ans=0;
  ans+=min(a,k);
  k-=a;
  if(k<0){
    cout<<ans<<endl;
    return 0;
  }
  k-=b;
  if(k<0){
    cout<<ans<<endl;
    return 0;
  }
  ans-=min(c,k);
  cout<<ans<<endl;
  return 0;  
}

Measured memory_bytes: 3652
'use strict'
const main = (input: string) => {
    // DP法苦手すぎて解説読んだ
    const std: string[] = input.split('\n')
    const [n, m] = std.shift().split(' ').map(Number)
    const holes: number[] = std.map(Number)
    let dp: number[] = []
    dp[0] = 1
    dp[1] = 1
    holes.forEach(v => dp[v] = 0)
    for (let i = 2; i <= n; i++) {
        if (dp[i] === 0) continue
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007
    }
    console.log(dp[n])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())

Measured memory_bytes: 27748
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

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

  long double n, x, t;
  cin >> n >> x >> t;

  long hun = ceil(n / x)*t;

 // cout << t <<endl;


  printf("%ld",hun);

  return 0;
}

Measured memory_bytes: 3800
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,k;
ll s[50];
int main(){
	scanf("%lld%lld",&n,&k);
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		rep(j,0,50)if(bit(t,j))s[j]++;
	}
	ll temp=0;
	for(int j=45;j>=0;j--)if((temp^(1LL<<j))<=k){
		if(s[j]*2<n)temp^=1LL<<j;
	}
	ll ans=0;
	rep(i,0,50){
		if(!bit(temp,i))ans+=s[i]<<i;
		else ans+=(n-s[i])<<i;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static long ans[];
	public static boolean ok[];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int sLen = s.length();
		int tLen = t.length();

		s = repeat(new StringBuilder(s), (int)Math.max(2, Math.ceil(tLen * 2.0 / sLen))).toString();

		ans = new long[sLen];
		Arrays.fill(ans, -1);
		ok = new boolean[sLen];
		Arrays.fill(ok, false);

		ArrayList<Integer> matchIndex = kmp(s, t);
		for(int i = 0; i < matchIndex.size(); i ++) {
			ok[matchIndex.get(i) % sLen] = true;
		}
		long max = 0;
		for(int i = 0; i < sLen; i ++) {
			max = Math.max(max, solve(i, sLen, tLen));
		}
		System.out.println(max);
	}

	static StringBuilder repeat(StringBuilder s, long y) {
		if (y == 0) {
			return new StringBuilder();
		} else if (y == 1) {
			return new StringBuilder(s);
		} else if (y % 2 == 0) {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			return tmp;
		} else {
			StringBuilder tmp = repeat(s, y / 2);
			tmp.append(tmp);
			tmp.append(s);
			return tmp;
		}
	}

	static long solve(int i, int sLen, int tLen) {
		i %= sLen;
		if(ans[i] == -2) {
			System.out.println(-1);
			System.exit(0);
		}else if(ans[i] == -1) {
			ans[i] = -2;
			ans[i] = (ok[i] ? (solve(i + tLen, sLen, tLen) + 1) : 0);
		}
		return ans[i];
	}

	static ArrayList<Integer> kmp(String s, String p) {

		int sLen = s.length();
		int sInt[] = new int[sLen];
		for(int i = 0; i < sLen; i ++) {
			sInt[i] = s.charAt(i) - 'a';
		}
		int pLen = p.length();
		int pInt[] = new int[pLen];
		for(int i = 0; i < pLen; i ++) {
			pInt[i] = p.charAt(i) - 'a';
		}

		int sIndex = 1;
		int pIndex = 0;

		int skip[] = new int[pLen + 1];
		Arrays.fill(skip, 0);
		while(sIndex < pLen) {
			if(pInt[sIndex] == pInt[pIndex]) {
				sIndex ++;
				pIndex ++;
				skip[sIndex] = pIndex;
			}else if(pIndex == 0) {
				sIndex ++;
				skip[sIndex] = 0;
			}else {
				pIndex = skip[pIndex];
			}
		}

		ArrayList<Integer> matchIndex = new ArrayList<Integer>();
		sIndex = 0;
		pIndex = 0;
		end: while(true) {
			while(sIndex < sLen && pIndex < pLen && sInt[sIndex] == pInt[pIndex]) {
				sIndex ++;
				pIndex ++;
			}
			if(pIndex >= pLen) {
				matchIndex.add(sIndex - pLen);
				pIndex = skip[pIndex];
			}else if(pIndex == 0){
				sIndex ++;
			}else {
				pIndex = skip[pIndex];
			}
			if(sIndex >= sLen) { break end; }
		}
		return matchIndex;
	}
}

Measured memory_bytes: 134784
using System;
using System.IO;
 
class MainClass {
    static void Main() {
        var a = Console.Read();
        var b = Console.Read();
      	var c = Console.Read();
      int count = 0;
      if (a == '1') count++;
      if (b == '1') count++;
      if (c == '1') count++;
        Console.WriteLine(count);
    }
}


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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    if (h1 > h2) h2 += 24;
    int dfh = h2 - h1;
    if (m1 > m2) {
        m2 += 60;
        dfh--;
    }
    int dfm = m2 - m1;
    int res = dfh * 60 + dfm - k;
    out(res);
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  string s;
  while(cin >> s){
    if(s[2] == s[3] and s[4] == s[5]){
      pout("Yes");
    }else{
      pout("No");
    }
  }
  


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  unsigned long long int
#define pb push_back
#define sx 200007
int main()
{
    ll n,cnt=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; ; j++)
        {
            if(i*j<n)
                cnt++;
            else
                break;
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 3672
#include<cstdio>
int main(void)
{
    int a,b=0,c=0,mode[100]={0};
    while(scanf("%d",&a)!=EOF)
    {
        mode[a-1]++;
        c++;
    }
    for(int i=0;i<c;i++)if(mode[i]>b)b=mode[i];
    for(int i=0;i<c;i++)if(mode[i]==b)printf("%d\n",i+1);
    return 0;
}

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

ll GCD(ll a, ll b){
    if(b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    int k; cin>>k;
    ll ans=0;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans+=GCD(GCD(i,j),l);
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n;
	ll a, b;
	cin >> a >> b;
	if(b == 100){
		b ++;
	}
	cout << b;
	for(ll i = 1; i <= a; i ++){
		cout << "00";
	}
	return 0;
}

Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
public static void main(String[] args) throws IOException {

BufferedReader br =new BufferedReader (new InputStreamReader (System.in));

String line = br.readLine( );
String[] list = line.split(" ");
int a = Integer.parseInt(list[0]);
int b = Integer.parseInt(list[1]);
int c = Integer.parseInt(list[2]);

System. out.println(b-a==c-b?"YES":"NO");
}}

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

using namespace std;

ifstream fin("fisier.in");
ofstream fout("fisier.out");

int v[100005][5];
int dp[100005][5];

int main(){
    int i,j,n,k;

    cin>>n;

    for(i=1;i<=n;i++)
        for(j=1;j<=3;j++)
            cin>>v[i][j];

    for(i=1;i<=n;i++)
        for(j=1;j<=3;j++){
            int maxv=-1;

            for(k=1;k<=3;k++)
                if(dp[i-1][k]>maxv && k!=j){
                    dp[i][j]=v[i][j]+dp[i-1][k];
                    maxv=dp[i-1][k];
                }
        }

    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));

    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int x,y;
    cin >> x >> y;
    int money = 0;
    if(x == 1){
        money += 300000;
    }else if(x == 2){
        money += 200000;
    }else if(x == 3){
        money += 100000;
    }
    if(y == 1){
        money += 300000;
    }else if(y == 2){
        money += 200000;
    }else if(y == 3){
        money += 100000;
    }
    if(x == 1 && y == 1){
        money += 400000;
    }
    cout << money << endl;
    return 0;
}


Measured memory_bytes: 3552