akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int ans,n,s;

void dfs(int nowsum,int k,int x)
{
	if (k == n)
	{
		if (nowsum == s)
		{
			ans++;
		}
		return;
	}

	if (x <= 9)
	{
		dfs(nowsum+x,k+1,x+1);
		dfs(nowsum,k,x+1);
	}
	return;
}

int main()
{
	while(1)
	{
		cin >> n >> s;
		if (n == 0 && s == 0) return 0;
		ans = 0;
		dfs(0,0,0);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;
void yn(bool b){
  if(b) cout << "Yes" << endl;
  else cout << "No" << endl;
  return;
}
int main(){
  string s, t;
  cin >> s >> t;
  bool b = 1;
  rep(i, s.size()){
    if(s[i] != t[i]){
      b = 0;
      break;
    }
  }
  yn(b);
  return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();            
            var n = cin.nextInt();
            var m = cin.nextInt();
            var bucket = new int[m+1];
            for (int i = 0; i < n; i++)
            {
                var k = cin.nextInt();
                for (int j = 0; j < k; j++)
                {
                    var ii = cin.nextInt();
                    bucket[ii]++;
                }
            }

            var ans = 0;
            foreach (var item in bucket)
            {
                if (item == n) ans++;
            }

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
K, N = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
res = 0
for i in range(N-1):
    res = max(res, A[i+1] - A[i])
else:
    res = max(res, K - A[-1] + A[0])
print(K - res)

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

int n;
ll a[200200], s, mod = 1e9 + 7, ans;

ll pw(ll n, ll k){
    if(!k) return 1;
    ll re = pw(n, k/2) % mod;
    return re * re % mod * (k % 2 ? n : 1) % mod;
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i], s = (s + a[i]) % mod;

	ans = s * s % mod;
	for(int i=1;i<=n;i++) ans = (ans - a[i] * a[i] + mod * mod) % mod;

	cout << ans * pw(2, mod - 2) % mod;
}

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e16;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
	int n;
	cin >> n;
	set<string> st;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		st.insert(s);
	}
	cout << st.size();
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	//srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int answer = 0;

    for(int r = 0; r < int(N/R)+1; r++){
        for(int g = 0;g < int(N/G)+1;g++){
            if(r*R + g*G > N){
                break;
            }
            if((N - r*R - g*G)%B == 0){
                answer++;
            }
        }
    }
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 256
def comp_order(a: int, b: int, c: int) -> bool:
    if (a < b < c):
        return True
    else:
        return False


if __name__ == "__main__":
    a, b, c = map(lambda x: int(x), input().split())
    if (comp_order(a, b, c)):
        print("Yes")
    else:
        print("No")



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

constexpr int MOD = 1000000007;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  explicit operator int() { return n; }
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};
mint operator "" _m(unsigned long long n) { return n; }

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, M; cin >> N >> M;
  string S; cin >> S;
  vector<pair<int, int>> I(M); rep(i, M) {
    cin >> I[i].first >> I[i].second, I[i].first--;
  }
  sort(I.begin(), I.end());
  vector<pair<int, int>> J;
  for (auto i : I) {
    if (J.empty() || (J.back().second < i.second)) {
      J.push_back(i);
    }
  }
  vector<int> sum(N+1);
  rep(i, N) sum[i+1] = sum[i] + (S[i] == '1');
  vector<mint> dp0(N+1), dp1(N+1);
  dp0[0] = 1;
  J.insert(J.begin(), make_pair(-1, -1));
  J.emplace_back(N, N);
  for (int i=1; i+1<J.size(); i++) {
    int l = J[i].first;
    int r = min(J[i].second, J[i+1].first);
    int c = sum[J[i].second] - sum[max(J[i].first, J[i-1].second)];
    int d = max(0, J[i-1].second - J[i].first);
    for (int j=d+1; j<=N; j++) dp0[j]=0;
    fill(dp1.begin(), dp1.end(), 0);
    for (int j=0; j+c<=N; j++) {
      dp1[j + c] += dp0[j];
    }
    swap(dp0, dp1);
    for (int j=l; j<r; j++) {
      fill(dp1.begin(), dp1.end(), 0);
      for (int k=0; k<=N; k++) {
        if (k>0) dp1[k-1] += dp0[k];
        dp1[k] += dp0[k];
      }
      swap(dp0, dp1);
    }
  }
  cout << dp0[0] << endl;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
)

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

	tmp_odd := 0
	tmp_even := 0
	for i := 0; i < len(s); i++ {
		if i%2 == 0 {
			if s[i] == '0' {
				tmp_odd++
			} else {
				tmp_even++
			}
		} else {
			if s[i] == '1' {
				tmp_odd++
			} else {
				tmp_even++
			}
		}
	}
	if tmp_odd > tmp_even {
		fmt.Println(tmp_even)
	} else {
		fmt.Println(tmp_odd)
	}
}


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

int main(void)
{
  string s;
  cin >> s;
  int count = 0;
  for(int i=0; i<s.size(); ++i)
  {
      if(s[i] == '1')
      {
          ++count;
      }

  }
  cout << count << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	pair<int, int> vp[n];
	for (int i = 0; i < n; i++) {
		cin >> vp[i].first >> vp[i].second;
	}

	sort(vp, vp + n);

	for (int i = 0; i < n; i++) {
		cout << vp[i].first << " " << vp[i].second << endl;

	}
	return 0;
}


Measured memory_bytes: 3884
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,d,x;
  cin >> n >> d >> x;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  int sum = 0;
  for(int i=0;i<n;i++){
    int s = 1;
    sum++;
    while(s+a[i] <= d){
      s += a[i];
      sum++;
    }
  }

  cout << sum+x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int INF = 1e9;
vector<ll> h;
ll N,A,B;

bool check(ll X){
    auto h2 = h;
    //まとめて爆風を処理
    rep(i,N){
        h2[i] = max(0LL, h[i]-X*B);
    }
    //個々にA-Bずつ減らしていく
    ll cnt = 0;
    rep(i,N){
        cnt += h2[i]/(A-B) + bool(h2[i]%(A-B));
    }
    //cerr<<X<<" "<<(cnt<=X)<<endl;
    return cnt<=X;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cin>>N>>A>>B;
    h.resize(N);
    rep(i,N)cin>>h[i];
    ll ng = 0, ok = INF;
    while(ok - ng > 1){
        ll mid = (ok+ng)/2;
        if(check(mid)){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    cout<<ok<<endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String S = in.readLine();

		if(S.indexOf("AC") >= 0) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
int main(){
    int N, M, a, p=1000000007;
    std::cin >> N >> M;
    int k[++N]={},s[N]={1};
    while(M--)std::cin>>a,k[a] = 1;
    
    if(!k[1])s[1] = 1;
    for(a=2; a<N; a++)
        if(!k[a])s[a] = (s[a-1]%p + s[a-2]%p)%p;

    std::cout << s[N-1] << '\n';
}

Measured memory_bytes: 1024
from collections import deque
h,w = map(int,input().split())
s = "#"

print(s*(w+2))

for i in range(h):
    lst = deque(list(map(str,input().split())))
    lst.appendleft("#")
    lst.append("#")
    print("".join(lst))

print(s*(w+2)) 

Measured memory_bytes: 9320
#include <iostream>
#include <vector>

#define INF 2000000000000

using namespace std;

struct path_t {
  int to, cost;
};

int main() {
  int N, M;
  vector<vector<path_t> > path;
  
  cin >> N >> M;
  path.resize(N);
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    path[a].push_back((path_t){b, c});
  }

  vector<long long> dist(N, INF);
  dist[0] = 0;
  bool update = true;
  int counter = 0;
  while (update) {
    update = false;
    for (int i = 0; i < N; i++) {
      if (dist[i] == INF) continue;
      for (int j = 0; j < path[i].size(); j++) {
        int to, cost;
        to = path[i][j].to;
        cost = - path[i][j].cost;
        if (dist[to] > dist[i] + cost) {
          dist[to] = dist[i] + cost;
          update = true;
        }
      }
    }
    counter++;
    if (counter >= N - 1) break;
  }

  vector<bool> negative(N, false);
  counter = 0;
  while (counter < N) {
    update = false;
    for (int i = 0; i < N; i++) {
      if (dist[i] == INF) continue;
      for (int j = 0; j < path[i].size(); j++) {
        int to, cost;
        to = path[i][j].to;
        cost = - path[i][j].cost;
        if (dist[to] > dist[i] + cost) {
          dist[to] = dist[i] + cost;
          negative[to] = true;
        }
        if (negative[i]) {
          negative[to] = true;
        }
      }
    }
    counter++;
  }

  if (negative[N-1]) {
    cout << "inf\n";
  } else {
    cout << - dist[N-1] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

using namespace std;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}
 
const int mod = (int)1e9 + 7;
 
long long Rec(long long a, long long b)
{
	if(b % a == 0) return b / a * (2 * a) - a;
	else
	{
		return b / a * (2 * a) + Rec(b % a, a);
	}
}

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();
	long long n, x;
	cin >> n >> x;
	cout << Rec(x, n - x) + x + n - x;
}


Measured memory_bytes: 256
//0321 部活動調査
//UF木
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
LL bol[200010],r1[200010],r2[200010],club[100010],node[100010],size[100010];
int root(int x){
	if(x!=node[x]){
		node[x]=root(node[x]);
		return node[x];
	}
	else return x;
}
int main(void)
{
	LL i,j,n,m,k;
	cin>>n>>m>>k;
	for(i=0;i<k;i++) cin>>bol[i]>>r1[i]>>r2[i];
	for(i=0;i<n;i++) club[i]=0,node[i]=i,size[i]=1;
	for(i=0;i<k;i++) {
		int x,y,c,s;
		if(bol[i]==1) {
			x=r1[i],y=r2[i];
			x=root(x);
			y=root(y);
			if(club[x]!=0&&club[y]!=0&&club[x]!=club[y]) {
				cout<<i+1<<endl;
				break;
			}
			else if(club[x]!=0&&club[y]==0) club[y]=club[x];
			else if(club[x]==0&&club[y]!=0) club[x]=club[y];
			if(x!=y) {
				if(size[x]>size[y]) node[y]=x;
				else if(size[y]>size[x]) node[x]=y;
				else node[y]=x,size[x]++;
			}
		}
		else {
			s=r1[i],c=r2[i];
			s=root(s);
			if(club[s]==0) club[s]=c;
			else if(club[s]!=c) {
				cout<<i+1<<endl;
				break;
			}
		}
	}
	if(i==k) cout<<"0"<<endl;
}

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


int main(){

    long X;
    cin >> X;
    
    long i=0,tmp=100;
    while(1){
        i++;
        tmp = tmp + (long)((double)tmp * 0.01);
        if(tmp>=X){
            cout << i << endl;
            return 0;
        }
    }
    

    return 0;
}


Measured memory_bytes: 3632
icase=0
if icase==0:
    n,m,c=map(int,input().split())
    b=list(map(int,input().split()))
    icnt=0
    for i in range(n):
        ai=list(map(int,input().split()))
        ab=0
        for ii in range(m):
            ab+=ai[ii]*b[ii]
        if 0<ab+c:
            icnt+=1
    print(icnt)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() { cerr << "--------------" << endl; }
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) cin >> a[i];
   map<int, int> mp;
   ll ans = 0;
   rep(i, 0, n){
      int diff = i-a[i];
      ans += mp[diff];
      int plus = a[i]+i;
      mp[plus]++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 21092
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x = sc.nextInt();
        int ans = 1;
        int d = 0;

        for (int i = 2; i <= n + 1; i++) {
            int l = sc.nextInt();
            int value = d + l;
            if (value > x) {
                break;
            } else {
                ans++;
            }
            d = value;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int n,k,x,y,money=0;
  cin >> n >> k >> x >> y;

  rep(i,0,n){
    if(i<k){
      money+= x;
    }else{
      money+= y;
    }
  }
  cout << money;
}


Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 200050;
int N;
int64_t X[MAX_N];

int64_t Y[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> X[i];
        Y[i] = X[i];
    }
    std::sort(Y + 1, Y + N + 1);

    int64_t left = Y[N/2];
    int64_t right = Y[N/2 + 1];
    //std::cout << left << " " << right << std::endl;

    for (int i = 1; i <= N; i++) {
        if (X[i] <= left) {
            std::cout << right << std::endl;
        } else {
            std::cout << left << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<>();
		while(n-->0) set.add(br.readLine());
		System.out.println(set.size());
	}
}


Measured memory_bytes: 59088
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define do long double
using namespace std;
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; }
 
//桁
int kt(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a,b;
  cin>>a>>b;
  int w[110],v[110];
  rep(i,a){
  cin>>w[i]>>v[i];
  }
  int dp[110][100010];
  dp[0][0]=0;
  rep1(i,a){
    for(int j=0;j<=b;j++){
      if(j-w[i-1]>=0)
  chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
    chmax(dp[i][j],dp[i-1][j]);
    }
    }
  cout<<dp[a][b]<<endl;
}  

Measured memory_bytes: 80128
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2e5+100,M=34;
vector <int> b;
vector <pii> a;
bool CMP(pii a, pii b){
	return (a.S) * (b.F) < a.F * (b.S);
}
ll dp[N][M];
int32_t main(){
    sync;
    ll n,t;
    cin >> n >> t;
    for (int i=0;i<n;i++){
        ll x,y;
        cin >> x >> y;
        y+=x+1;
        if (x==0) b.pb(y);
        else a.pb({x,y});
    }
    sort(b.begin(),b.end());
    sort(a.begin(),a.end(),CMP);
    for (int i=0;i<N;i++){
        for (int j=0;j<M;j++) dp[i][j]=1e9+10;
    }
    dp[0][0]=0;
    for (int i=1;i<=a.size();i++){
        for (int j=0;j<M;j++){
            dp[i][j]=dp[i-1][j];
            if (j==0) continue;
            ll z=dp[i-1][j-1];
            z*=a[i-1].F+1;
            z+=a[i-1].S;
            if (z<=t){
                dp[i][j]=min(dp[i][j],z);
            }
        }
    }
    ll w=a.size();
    ll ans=0;
    for (int j=0;j<M;j++){
       // cout << dp[w][j] << " " << j << endl;
        if (dp[w][j]<=t){
            ll p=j,k=dp[w][j];
            for (auto u : b){
                if (k+u<=t){
                    k+=u;
                    p++;
                }
                else break;
            }
            ans=max(ans,p);
        }
    }
    cout << ans << endl;

}























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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int a,b;cin>>a>>b;
  string s;cin>>s;
  bool flag=true;
  if(a+b+1!=s.size()||s[a]!='-')flag=false;
  for (int i = 0; i < s.size() && flag==true; ++i)
  {
  	// cout<<i<<endl;
  	if(i==a)continue;
  	if(!(s[i]>='0' && s[i]<='9'))flag=false;
  }
  // cout<<flag<<endl;
  flag2func(flag);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  double R;
  cin>>R;
  R*=2;
  cout<<setprecision(9)<<R*PI<<endl;
}

Measured memory_bytes: 3792
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    /* 変数宣言 */
    final String C;

    AtCoder(FastScanner sc) {
        C = sc.next();
    }

    void solve(PrintWriter out) {
        char[] c=C.toCharArray();
        c[0]++;
        System.out.println(c[0]);
    }
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

int main() {
    double n, k;
    cin >> n >> k;
    double p = 0;
    if (k <= n) p += (n-k+1)/n;
    for (int i = 1; i <= min(k-1,n); i++) {
        int x = 0;
        while ((i * pow(2,x)) < k) {
            x++;
        }
        p += (double)pow(1.0/2.0,x) * 1/n;
    }
    printf("%.10f",p);
}

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

int main(int argc, const char * argv[]) {
    int S;
    bool flag = true;
    
    cin >> S;
    
    
    if(S / 1000 == (S % 1000) / 100) flag = false;
    if((S % 1000) / 100 == (S % 100) / 10) flag = false;
    if((S % 100) / 10 == S % 10) flag = false;
    
    if(flag) cout << "Good" << endl;
    else cout << "Bad" << endl;
    
    return 0;
}


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

int main()
{
  int A,B,ans=0;
  cin >> A >> B;
  rep(i,A,B)
  {
    int x[5]={};
      x[0] = i/10000;
      x[1] = i/1000 % 10;
      x[2] = i/100 % 10;
      x[3] = i/10%10;
      x[4] = i%10;
    
    if(x[0] == x[4] && x[1]==x[3])
      ans++;
    }
    cout << ans << endl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
 
signed main(){
    vector<int>A(3);
    REP(i,3)cin>>A[i];
    sort(A.begin(),A.end());
    cout<<(A[0]+A[1]==A[2]?"Yes":"No")<<endl;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
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;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  char c;cin>>c;
  ans(c=='a'||c=='e'||c=='o'||c=='i'||c=='u',"vowel","consonant");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)
 
using namespace std;
typedef long long int ll;
 
double R;
int main(void){
    cin >> R;
    cout << 2*R*3.141592 << endl;
    return 0;
}

Measured memory_bytes: 3812
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

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

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=(int)l;i<=(int)r;++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod1 = 998244353; 
const int mod2 = 1e9 + 7;
const int inf = 9e18;
const int N = 1005;

void solve(){
    int s,w;
    cin>>s>>w;
    if(s>w)
        cout<<"safe";
    else
        cout<<"unsafe";
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
n = int(input())
S1 = input()
S = [list(input()) for _ in range(n-1)]
ans = ''

for s in S1:
    flag = 1
    for i in range(n-1):
        if s in S[i]:
            S[i].remove(s)
        else:
            flag = 0
    if flag == 1:
        ans += s

ans = list(ans)
ans.sort()
print(''.join(ans))


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

int main () {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> A(n, vector<int>(m));
    vector<int> b(m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    
    for (int i = 0; i < n; i++) {
        int c = 0;
        for (int j = 0; j < m; j++) {
            c += A[i][j]*b[j];
        }
        cout << c << endl;
    }
}


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

string s;
int cur = 0;

int dfs() {
    if (isdigit(s[cur])) {
        int res = 0;
        while (isdigit(s[cur])) res = res * 10 + s[cur++] - '0';
        return (res + 1) / 2;
    } else {
        vector<int> res;
        int ans = 0;
        while (s[cur] == '[') {
            cur++;
            res.push_back(dfs());
            cur++;
        }
        sort(res.begin(), res.end());
        for (int i = 0; i < (res.size() + 1) / 2; i++) ans += res[i];
        return ans;
    }
}

int main() {
    int n;
    cin >> n;
    while (n--) {
        cin >> s;
        cur = 0;
        cout << dfs() << endl;
    }
    return 0;
}


Measured memory_bytes: 3280
H,W=map(int, input().split())
S=[list(input()) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j]=='.': continue
        if 0<i and S[i-1][j]=='#': continue
        if i<H-1 and S[i+1][j]=='#': continue
        if 0<j and S[i][j-1]=='#': continue
        if j<W-1 and S[i][j+1]=='#': continue
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 39152
#include <iostream>

typedef unsigned long long ull;
typedef long long ll;

constexpr size_t MAXV = 1e5;
constexpr size_t MAXW = 1e9;
constexpr size_t INF = MAXW + 1;

void solve() {
  double D, T, S;
  std::cin >> D >> T >> S;
  double time_shell_be_spend = D / S;
  const char* answer = time_shell_be_spend <= T ? "Yes" : "No";
  std::cout << answer << "\n";
}

void warp() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
}

int main() {
  warp();
  solve();
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

string t,s;
int ss,ts;

bool solve(int a){
  bool f=1;
  rep(i,ts){
    if((s[i+a]!='?')&&(s[i+a]!=t[i]))
    f=0;
  }
  if(f) return 1;
  else return 0;
}

int main(){
  cin>>s>>t;
  ss=s.size();
  ts=t.size();

  if(ts>ss) puts("UNRESTORABLE");
  else{
    int id;
    bool f=0;
    for(int i=0;i+ts-1<ss;i++){
      if(solve(i)){
        f=1;id=i;
        // cout<<"id "<<id<<endl;
      }
    }
    if(f){
      rep(i,ss){
        if(i==id){
          cout<<t;i+=ts-1;
        }else{
          if(s[i]=='?') cout<<"a";
          else cout<<s[i];
        }
      }
      cout<<endl;
    }else puts("UNRESTORABLE");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n, s, mx=-1e9, d, f[105][15], p[105][15];
int main() {
	int i, j, k;
	cin>>n;
	for(i=1; i<=n; i++) for(j=1; j<=10; j++) cin>>f[i][j];
	for(i=1; i<=n; i++) for(j=0; j<=10; j++) cin>>p[i][j];
	for(k=1; k<1024; k++) {
		for(j=0; j<10; j++) f[0][j+1] = k & (1<<j);
		s = 0;
		for(i=1; i<=n; i++) {
			for(j=1, d=0; j<=10; j++) d += f[0][j] && f[i][j];
			s += p[i][d];
		}
		mx = max(mx, s);
	}
	cout<<mx;
	return 0;
}

Measured memory_bytes: 256
#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;

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, k;
    cin >> n >> k;
    ll h[n], dp[n];
    
    for (int i = 0; i < n; i++) 
        cin >> h[i];
    
    dp[0] = 0;

    for (ll i = 1; i < n ; i++)
    {
        ll ans = (ll)(1e10 + 10);
        for (ll j = 1; j <= min(i, k); j++)
            ans = min(ans, dp[i - j] + llabs(h[i] - h[i - j]));
        dp[i] = ans;
    }

    cout << dp[n - 1] << "\n";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
    ll res=0;
    rep(i,n){
        ll a; cin>>a;
        while(a%2==0){a/=2; res++;}
    }
    cout<<res<<endl;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	priority_queue<ll> q;
	for (int ii = 0; ii < N; ++ii){
		ll A;
		cin >> A;
		q.push(A);
	}

	for (int ii = 0; ii < M; ++ii){
		ll val = q.top();
		q.pop();
		q.push(val/2);	
	}

	ll ans = 0;
	while(!q.empty()){
		ll val = q.top();
		q.pop();
		ans += val;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1400
// 2016-11-25
#include <iostream>

int main() {
	int n, m, p;
	int x[100];
	int s;
	float a;
	std::cin >> n >> m >> p;
	while (n || m || p) {
		s = 0;
		for (int i = 0; i < n; i++) {
			std::cin >> x[i];
			s += x[i];
		}
		if (x[m - 1] == 0) {
			std::cout << 0 << std::endl;
		} else {
			a = 100 * s;
			a *= (1.0 - 0.01 * p);
			a /= x[m - 1];
			std::cout << (int)a << std::endl;
		}
		std::cin >> n >> m >> p;
	}
	return 0;
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
const int _ = 100007;
char s[_];int n;
int main()
{
	scanf("%s",s+1),n=strlen(s+1);
	puts((n&1)^(s[1]==s[n])?"First":"Second");
	return 0;
}


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

using namespace std;

long long x = 1;

vector < long long > a(3);

int main() {
    for (int i = 0; i < 3; ++i) {
        cin >> a[i];
        x = min(x, a[i] % 2);
    }
    sort(a.begin(), a.end());
    cout << (x * a[0] * a[1]);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n;
int ans[11];
bool vis[30];
void dfs(int x) {
	if (x == n) {
		for (int i = 1; i <= n; i++) {
			cout << (char)(ans[i] + 'a');
		}
		puts("");
		return;
	}
	for (int i = 0; i <= 26; i++) {
		if (vis[i]) {
			ans[x + 1] = i;
			dfs(x + 1);
		} else {
			vis[i] = 1;
			ans[x + 1] = i;
			dfs(x + 1);
			vis[i] = 0;
			break;
		}
		
	}
}
int main() {
	cin >> n;
	dfs(0);
	return 0;
}

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

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

  vector<vector<char>> C(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) cin >> C.at(i).at(j);
    for (int k = 0; k < 2; k++) {
      for (int j = 0; j < W; j++) cout << C.at(i).at(j);
      cout << "\n";  
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n;
    int a;
    int min=11111111,max=-1111111;
    long long sum=0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&a);
        sum+=a;
        
        if(min>a){
            min=a;
        }
        
         if(max<a){
            max=a;
        }
    }
    printf("%d %d %lld\n",min,max,sum);
       
        
       
        
    return 0;
}


Measured memory_bytes: 2132
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; ++i)
cin>>arr[i];
int dp[n];
dp[0]=0;
dp[1]=abs(arr[1]-arr[0]);
for(int i=2; i<n; ++i)
dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
cout<<dp[n-1];
}


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<setprecision(20);
    //good luck kittu!
    long double l; cin>>l;
    l /= 3;
    l = l*l*l;

    cout<<l<<"\n";
    return 0;
}

Measured memory_bytes: 256
import bisect

def cumsum(inlist):
    s = 0
    outlist = [0]
    for i in inlist:
        s += i
        outlist.append(s)
    return outlist

def bis(inlist, l, r):
    ok = r
    ng = l
    while ok - ng > 1:
        mid = (ok+ng)//2
        if inlist[r] - 2*inlist[mid] + inlist[l] > 0:
            ng = mid
        else:
            ok = mid
    upper = inlist[r] - 2*inlist[ok] + inlist[l]
    lower = inlist[r] - 2*inlist[ng] + inlist[l]
    if abs(upper) > abs(lower):
        return inlist[r] - inlist[ng], inlist[ng] - inlist[l]
    else:
        return inlist[r] - inlist[ok], inlist[ok] - inlist[l]



n = int(input())
num = [ int(v) for v in input().split() ]
accum_num = cumsum(num)
ans_list = []

for i in range(2,n+1-2):
    a, b = bis(accum_num, 0, i)
    c, d = bis(accum_num, i, n)
    ans_list2 = sorted([a, b, c, d])
    ans_list.append(ans_list2[-1] - ans_list2[0])
print(min(ans_list))

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

#define ll long long int
#define ld long double
#define u128 __int128 
#define ff first
#define ss second
#define pb push_back
#define PI 3.141592653589793

#define MOD 1000000007
#define N 100100
#define M 1000010

int n, m;
int a[N];

int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(10);
	
	cin >> n;
	int k = 0;
	int n1 = n;

	while(n1)
	{
		n1 /= 10;
		k++;
	}

	int i = 1;
	int ans = 0;
	while(i < k)
	{
		ans += pow(10, i - 1);
		i += 2;
	}
	ans *= 9;
	if(k % 2)
	{
		ans += n - pow(10, k - 1) + 1;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 384
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

n = inp()
if n >= 30:
    print('Yes')
else:
    print('No')

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)


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

int main()
{
	ll n;
	cin >> n;
	ll sum = n / 10;
	ll x = 50;
	while(x <= n){
		sum += n / x;
		x *= 5;
	}
	if(n % 2 == 1)
		cout << 0 << endl;
	else
		cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(s[0]==s[1]&&s[1]==s[2])System.out.println("No");
		else System.out.println("Yes");
		sc.close();
	}
}

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

int main(){
	
    int N, Q;
    long K;
    cin >> N >> K >> Q;
    vector<int> A(Q);
    vector<int> P(N);

    for (int i = 0 ; i < N; i++){
        P[i] = 0;
    }
    for (int i = 0 ; i < Q; i++){
        cin >> A[i];
        P[A[i]-1]++;
    }

    for (int i = 0 ; i < N; i++){
        //cout << P[i] << endl;
        if (K-Q+P[i]>=1){
            cout << "Yes" <<endl;
        }else{
            cout << "No" << endl;
        }
    }



	return 0;
}



Measured memory_bytes: 1408
import copy

N = int(input())
X = list(map(int, input().split()))

sort_X = copy.copy(X)
sort_X.sort()
small_median_X = sort_X[N//2 - 1]
big_median_X = sort_X[N//2]

for i in range(N):
    if X[i] <= small_median_X:
        print(big_median_X)
    else:
        print(small_median_X)

Measured memory_bytes: 25656
package main

import "fmt"

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func f(x, c, d int) int {
	v := c * d / gcd(c, d)
	return x - x/c - x/d + x/v
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	fmt.Println(f(b, c, d) - f(a-1, c, d))
}


Measured memory_bytes: 512