akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
int iinf=1<<30;
double pi=3.141592653589793238462643383279L;
double eps=1e-8;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
//#define endl "\n"
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<int,int,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
ll n;
vector<ll> v[200010];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    
    ll ans=0;
    ll now=0;
    rep(i,1,n+1){
        now+=i;
        ans+=now;
    }
    rep(i,0,n-1){
        ll a,b;cin>>a>>b;
        if(a>b)swap(a,b);
        ans-=a*(n-b+1);
        
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 8324
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
  if b[i] > a[i]:
    c += (b[i] - a[i]) // 2
  else:
    d += a[i] - b[i]
print(['Yes', 'No'][c < d])

Measured memory_bytes: 4596
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define qwq(x) cerr<<" #"<<#x<<" = "<<x<<endl;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

int a,b;

int main(){
	read(a),read(b);
	if(a<=0&&b>=0)puts("Zero");
	else if(0<a)puts("Positive");
	else if((b-a+1)%2==0)puts("Positive");
	else puts("Negative");
	return 0;
}


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

int sumdigit(int n){
  int a = 0;
  while(n > 0){
    a += n % 10;
    n /= 10;
  }
  return a;
}

int main() {
  int n, m = 9999999999;
  cin >> n;
  rep(i, n-1) m = min(m, sumdigit(i+1) + sumdigit(n-i-1));
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dp[5100][5100];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	for(int i = n-1; i >= 0; --i){
		for(int j = n-1; j >= 0; --j){
			if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1] + 1;
		}
	}
	int ans = 0;
	rep(i,n)rep(j,n){
		if(i >= j) continue;
		int cur = min(dp[i][j], j-i);
		chmax(ans, cur);
	}
	cout << ans << endl;
}

Measured memory_bytes: 100608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

vector<int> ans[SIZE];

void even(int n){

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if((i+1) + (j+1) == n+1) continue;
      ans[i].push_back(j);
    }
  }

}

void odd(int n){

  for(int i=0;i<n-1;i++){
    ans[n-1].push_back(i);
  }

  even(n-1);
}

int main(){

  int n;

  cin >> n;

  if(n % 2) odd(n);
  else even(n);

  int m = 0;
  for(int i=0;i<n;i++) m += ans[i].size();

  cout << m << endl;

  for(int i=0;i<n;i++){
    for(int p : ans[i]) {
      cout << i+1 << " " << p+1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 5500
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> v(M);
    rep(i, M)
    {
        int k;
        cin >> k;
        vector<int> tmp(k);
        rep(j, k) cin >> tmp.at(j);
        v.at(i) = tmp;
    }
    vector<int> p(M);
    rep(i, M) cin >> p.at(i);

    int cnt = 0;
    int conb = pow(2,N);
    rep(i, conb)
    {
        bitset<10> bv(i);
        bool flag = true;
        rep(m, M)
        {
            int l_cnt = 0;
            rep(n, v.at(m).size())
            {
                if (bv.test(v.at(m).at(n)-1))
                {
                    l_cnt++;
                }
            }
            if (l_cnt % 2 != p.at(m))
            {
                flag = false;
                break;
            }
        }
        if (flag)
            cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

signed main(){
    int A,B; cin>>A>>B;
  int ans = -1;
  if(A<10&&B<10) ans =A*B;
  Out(ans);
}





Measured memory_bytes: 256
let () =
    let main () =
        let n, k = Scanf.sscanf (read_line ()) "%d %d" (fun n k -> n, k) in
        let log2 j k =
            let rec loop c i =
                if c >= k then i else loop (c * 2) (i + 1)
            in
            loop j 0
        in
        let rec loop i acc =
            if i = 0 then acc else loop (i - 1) (acc +. 0.5 ** float (log2 i k))
        in
        let ans = loop n 0.0 /. float n in
        Printf.printf "%.10f\n" ans
    in
    main ()

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

int main() {
  char c;
  cin >> c;
 string alphabet = "abcdefghijklmnopqrstuvwxyz";
  for(int i = 0; i < alphabet.size()-1; i++){
    if(alphabet.at(i) == c) {
      cout << alphabet.at(i+1) << endl;
      return 0;
    }
  }
}


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

int main(){
  ll n;
  cin >> n;
  vector<string>s(n);
  for(int i=0; i<n; i++) cin >> s[i];
  sort(s.begin(),s.end());
  
  ll count=1;
  for(int i=0; i<n-1; i++){
    if(s[i]!=s[i+1]) count++;
  }
  
  cout << count << endl;
  
  return 0;
    
}


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

int main() {
	int x, n, p[100];
	scanf("%d%d", &x, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}

	for (int i = 0; x+i<=100||x-i>=0 ; i++) {
		int flag = 0;
		for (int j = 0; j < n; j++) {
			if (x + i == p[j]) {
				flag ++;
			}
			if (x - i == p[j]) {
				flag+=2;
			}
		}
		if (flag == 0) {
			printf("%d", x - i);
			return 0;
		}
		if (flag == 1) {
			printf("%d", x - i);
			return 0;
		}
		if (flag == 2) {
			printf("%d", x + i);
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 2136
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let k: i32 = read();

    if b - a + 1 <= 2 * k {
        for i in a..b + 1 {
            println!("{}", i);
        }
    } else {
        for i in a..a + k {
            println!("{}", i);
        }
        for i in b - k + 1..b + 1 {
            println!("{}", i);
        }
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<59)

#define int ll

signed main(){
    int n;
    cin>>n;
    vector<pii> v(n);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        if(a>b)swap(a,b);
        v[i] = pii(a,b);
    }
    
    sort(all(v));
    int mini = v[0].first;
    int maxi = 0;
    rep(i,n)maxi = max<ll>(maxi,v[i].second);
    
    bool df = false;
    rep(i,n){
        if(v[i].first==mini && v[i].second!=maxi)df = true;
    }
    
    int ans = INF;
    
    multiset<int> ms1,ms2;
    rep(i,n){
        ms1.insert(v[i].first);
        ms2.insert(v[i].second);
    }
    
    int l1 = *(ms1.begin());
    int r1 = *(ms1.rbegin());
    
    int l2 = *(ms2.begin());
    int r2 = *(ms2.rbegin());
    
    ans = (r1-l1)*(r2-l2);
    
    
    rep(i,n-1){
        ms1.erase(ms1.find(v[i].first));
        ms1.insert(v[i].second);

        ms2.erase(ms2.find(v[i].second));
        ms2.insert(v[i].first);
        
        l1 = *(ms1.begin());
        r1 = *(ms1.rbegin());
        
        l2 = *(ms2.begin());
        r2 = *(ms2.rbegin());
        
        ans = min(ans,(r1-l1)*(r2-l2));
    }
    
    cout<<ans<<endl;
}

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

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

    vector<int> A(n);
    rep(i, n){
        cin >> A[i];
    }

    for(int k = 0; k < n; k++){
            if (k == n - 1){
                cout << A[n-1] << endl;
            } else {
                cout << A[k] << " ";
            }
    }

    for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j + 1] = A[j];
            j--;
            A[j + 1] = v;
        }

        for(int k = 0; k < n; k++){
            if (k == n - 1){
                cout << A[n-1] << endl;
            } else {
                cout << A[k] << " ";
            }
        }
    }
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

long long nCkmod(long long n, long long k) {
    long long denomi = 1;
    REP(i, n) {
        denomi *= (i + 1);
        denomi %= mod;
    }
    long long numera = 1;
    for (int i = n - k; i > 0; i--) {
        numera *= i;
        numera %= mod;
    }
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
array<int, 101> factoring(int x) {
    array<int, 101> ret{};
    for (int i = 2; x >= i * i; i++) {
        while (x % i == 0) {
            ret[i]++;
            x /= i;
        }
    }
    if (x > 1) ret[x]++;
    return ret;
}

signed main() {
    int n;
    cin >> n;
    vector<int> as(n);
    REP(i, n) { cin >> as[i]; }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int b, e, k;
        cin >> b >> e >> k;
        cout << count(as.begin() + b, as.begin() + e, k) << endl;
    }
}


Measured memory_bytes: 3212
import java.util.*;

public class Main {

	static final int INF = 1<<29;
	static final int[] dy = {0,1,0,-1};
	static final int[] dx = {1,0,-1,0};

	int W, H;
	int[][] board;
	int[] cost;
	
	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			W = in.nextInt(); H = in.nextInt();
			if(W==0) return ;
			board = new int[H][W];
			cost = new int[4];
			for(int i=0; i<H; i++)for(int j=0; j<W; j++){
				board[i][j] = in.nextInt();
			}
			for(int i=0; i<4; i++)
				cost[i] = in.nextInt();
			System.out.println(solve());
		}
	}

	class State{
		int dist,y,x,dir;
		State(int _d, int _y, int _x, int _dir){
			this.dist  = _d;
			this.y = _y;
			this.x = _x;
			this.dir = _dir;
		}
	}

	class Cmp implements Comparator<State>{
		public int compare(State a, State b){
			return a.dist>b.dist?1:a.dist<b.dist?-1:0;
		}
	}

	int solve(){
		int[][][] dist = new int[H][W][4];
		for(int i=0; i<H; i++)for(int j=0; j<W; j++)for(int k=0; k<4; k++){
			dist[i][j][k] = INF;
		}
		PriorityQueue<State> Q = new PriorityQueue<State>(11,new Cmp());
		Q.add(new State(0,0,0,0));
		while(!Q.isEmpty()){
			State tp = Q.poll();
			if(tp.y == H-1 && tp.x == W-1) return tp.dist;
			if(dist[tp.y][tp.x][tp.dir] != INF) continue;
			dist[tp.y][tp.x][tp.dir] = tp.dist;
			for(int k=0; k<4; k++){
				int ndir = (tp.dir + k)%4;
				int ny = tp.y + dy[ndir], nx = tp.x + dx[ndir];
				if(0<=ny && ny<H && 0<=nx && nx<W && dist[ny][nx][ndir] == INF){
					int ndist = tp.dist + (board[tp.y][tp.x]==k?0:cost[k]);
					Q.add(new State(ndist, ny, nx, ndir) );
				}
			}
		}
		
		return -1;
	}

	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 13000
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(In));
        }

        public long Min(params long[] a)
        {
            var min = a[0];
            for (int i = 1; i < a.Length; i++)
            {
                if (min > a[i]) min = a[i];
            }
            return min;
        }

        public void Solve(ConsoleInput input)
        {
            var l = input.ReadInt;
            var a = input.ReadLongArray(l);

            var dp = new long[l + 1, 5];
            dp[0, 0] = 0;
            dp[0, 1] = 0;
            dp[0, 2] = 0;
            dp[0, 3] = 0;
            dp[0, 4] = 0;
            for (var i = 0; i < l; i++)
            {
                long cost0 = a[i];
                dp[i + 1, 0] = dp[i, 0] + cost0;
                long cost1 = a[i] == 0 ? 2 : a[i] % 2;
                dp[i + 1, 1] = Min(dp[i, 0], dp[i, 1]) + cost1;
                long cost2 = a[i] == 0 ? 1 : (a[i] + 1) % 2;
                dp[i + 1, 2] = Min(dp[i, 0], dp[i, 1], dp[i, 2]) + cost2;
                long cost3 = a[i] == 0 ? 2 : a[i] % 2;
                dp[i + 1, 3] = Min(dp[i, 0], dp[i, 1], dp[i, 2], dp[i, 3]) + cost3;
                long cost4 = a[i];
                dp[i + 1, 4] = Min(dp[i, 0], dp[i, 1], dp[i, 2], dp[i, 3], dp[i, 4]) + cost4;
            }

            WriteLine($"{Min(dp[l, 0], dp[l, 1], dp[l, 2], dp[l, 3], dp[l, 4])}");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private readonly char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            _separator = separator;
            _stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 26648
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N : usize,
    }
    let MOD = 1_000_000_007;

    let mut dp = vec![vec![vec![vec![0; 5]; 5]; 5]; N + 1];
    dp[0][0][0][0] = 1;
    // 1:A 2:G 3:C 4:T
    for n in 0..N {
        for c0 in 0..5 {
            for c1 in 0..5 {
                for c2 in 0..5 {
                    for c3 in 1..5 {
                        if c0 == 1 && c1 == 2 && c3 == 3 {continue;}
                        if c0 == 1 && c2 == 2 && c3 == 3 {continue;}
                        if c1 == 1 && c2 == 2 && c3 == 3 {continue;}
                        if c1 == 2 && c2 == 1 && c3 == 3 {continue;}
                        if c1 == 1 && c2 == 3 && c3 == 2 {continue;}
                        dp[n + 1][c1][c2][c3] += dp[n][c0][c1][c2];
                        dp[n + 1][c1][c2][c3] %= MOD;
                    }
                }
            }
        }
    }
    let mut res = 0usize;
    for i in 1..5 {
        for j in 1..5 {
            for k in 1..5 {
                res += dp[N][i][j][k];
                res %= MOD;
            }
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main{
	public static void main(String[]args) {
		Scanner input=new Scanner(System.in);
		int A;
		int B;
		int C;
		int D;
		do {
			A=input.nextInt();
			B=input.nextInt();
			C=input.nextInt();
			D=input.nextInt();
		}while(A<1||A>10000||B<1||B>10000||C<1||C>10000||D<1||D>10000);
		System.out.println(Math.max(A*B, C*D));
	}
}

Measured memory_bytes: 27096
#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long  
using namespace std;
#define  inf 1e15+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=40000;
#define  pq priority_queue
#define  ff first
#define  ss second 
#define pb  push_back
#define lb lower_bound
ll dp[402][402];
ll a[403];
ll pre[401];
ll get(ll l,ll r)
{
	if(l==0)
		return pre[r];
	return pre[r]-pre[l-1];

}
ll solve(ll l,ll r)
{
	
	if(r-l==0)
	{
		return (0);
	}
	if(dp[l][r]!=-1)
		return dp[l][r];
	ll ans=inf;
	for(int i=l;i<r;i++)
	{
		ans=min(ans,solve(l,i)+solve(i+1,r)+get(l,i)+get(i+1,r));
	}
  dp[l][r]=ans;
  return ans;

}
int main()
{
	memset(dp,-1,sizeof(dp));
	ll i,j,n;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		if(i==0)
			pre[0]=a[0];
		else
			pre[i]=pre[i-1]+a[i];
	}
	cout<<solve(0,n-1);
	//cout<<l;
}

Measured memory_bytes: 4848
n=int(input())
a=[]
b=[]
for i in range(n):
      c=input()
      a.append(list(c))
      b.append(c)
      
if len(list(set(b))) != len(a):
      print('No')
      exit()

for i in range(1,n):
      if a[i-1][-1] != a[i][0]:
            print('No')
            exit()
else:
      print('Yes')
      

Measured memory_bytes: 3064
import scala.math._

// longでrangeの作り方

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val a, b, c = sc.nextInt
//  val list = List.fill(3)(sc.next)

  val ans = if (b - a == c - b) YES else NO

  println(ans)


  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 27456
import java.util.Scanner;
import java.util.Arrays;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
int m=scan.nextInt();
int[] a=new int[n];

int i=0;
int sum=0;
for(i=0;i<n;i++){
    a[i]=scan.nextInt();
    sum=sum+a[i];
}
  
int summ=0;
for(i=0;i<n;i++){
    if(4*m*a[i]>=sum){
        summ=summ+1;
    }
}

if(summ>=m){
System.out.println("Yes");
}else{
  System.out.println("No");
}

}
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    int a[60],b[60];
    int ans[60]={};
    
    cin >> n >> m;
    for(int i=0; i<m;i++){
        cin >> a[i] >> b[i];
    }
    
    for(int i=0; i<m; i++){
        ans[a[i]-1]++;
        ans[b[i]-1]++;
    }
    
    for(int i=0; i<n;i++){
        cout << ans[i] <<endl;
    }
    return 0;
}

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

namespace ConsoleApp11
{
    class Program
    {
        static void Main()
        {
            int r = int.Parse(Console.ReadLine());
            int ans = r * r;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n;
	cin>>n;
	cout<<((n+110)/111)*111;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var lrd = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
            var l = lrd[0];var r = lrd[1];var d = lrd[2];
            var result = 0;
            for (int i = l; i <= r;i++)
            {
                if((i%d)==0)result++;
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27528
#UnionFind木
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r,
self.members(r)) for r in self.roots())

      
N,M = map(int,input().split())
uf = UnionFind(N+1)
for i in range(M):
    x,y,z = map(int,input().split())
    uf.union(x,y)
a = uf.group_count() - 1
print(a)

Measured memory_bytes: 7856
import collections

mod=10**9+7
n=int(input())
arr=list(map(int,input().split()))
cnt=collections.Counter(arr)
for key in cnt.keys():
  if cnt[key]==2:
    K=key
pos1=-1
pos2=-1
for i in range(n+1):
  if arr[i]==K:
    if pos1==-1:
      pos1=i
    else:
      pos2=i
A=pos1
B=pos2-pos1-1
C=n-pos2
facts=[1]
for i in range(1,n+1):
  facts.append((facts[-1]*i)%mod)
revfacts=[1]
for i in range(1,n+1):
  revfacts.append(pow(facts[i],mod-2,mod))
ans=[]
for i in range(1,n+2):
  ways1=0
  if i<=A+B+C:
    ways1=(facts[A+B+C]*revfacts[i]*revfacts[A+B+C-i])%mod
  ways2=0
  if i>=2 and i-2<=A+B+C:
  	ways2=(facts[A+B+C]*revfacts[i-2]*revfacts[A+B+C-(i-2)])%mod
  ways3=0
  if i>=1 and i-1<=A+C:
    ways3=(facts[A+C]*revfacts[i-1]*revfacts[A+C-(i-1)])%mod
  ways4=0
  if i>=1 and i-1<=A+B+C:
    ways4=(2*facts[A+B+C]*revfacts[i-1]*revfacts[A+B+C-(i-1)]-2*ways3)%mod
  ans.append((ways1+ways2+ways3+ways4)%mod)
for val in ans:
  print(val)

Measured memory_bytes: 26996
#include<complex>
#include<iostream>
#include<algorithm>

using namespace std;

typedef complex<long double> P;

// ??§????????°INF
#define INF (1e16)
// ?¨±?????????????????
#define EPS (1e-16)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2??????????????????????????????????????????
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

// ?????? (dot product) : a???b = |a||b|cos??
long double dot(P a, P b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// ?????? (cross product) : a??b = |a||b|sin??
long double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

// ?????????????????????
int is_intersected_ls(P a1, P a2, P b1, P b2) {
	return (cross(a2 - a1, b1 - a1) * cross(a2 - a1, b2 - a1) < EPS) &&
		(cross(b2 - b1, a1 - b1) * cross(b2 - b1, a2 - b1) < EPS);
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
	return EQ(cross(a1 - a2, b1 - b2), 0.0);
}

// ???c?????????a,b????????????????????????(1)
int is_point_on_line(P a, P b, P c) {
	return EQ(cross(b - a, c - a), 0.0) &&
		(dot(b - a, c - a) > -EPS) &&
		(dot(a - b, c - b) > -EPS);
}

// a1,a2???????????¨??????????????¨b1,b2???????????¨??????????????????????¨????
P intersection_ls(P a1, P a2, P b1, P b2) {
	P b = b2 - b1;
	long double d1 = abs(cross(b, a1 - b1));
	long double d2 = abs(cross(b, a2 - b1));
	long double t = d1 / (d1 + d2);

	return a1 + (a2 - a1) * t;
}


// ???a,b???????????¨??????????????¨???c??¨????????¢
long double distance_ls_p(P a, P b, P c) {
	if (dot(b - a, c - a) < EPS) return abs(c - a);
	if (dot(a - b, c - b) < EPS) return abs(c - b);
	return abs(cross(b - a, c - a)) / abs(b - a);
}

int main() {
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		long double x0, y0, x1, y1, x2, y2, x3, y3;
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P p0(x0, y0), p1(x1, y1), p2(x2, y2), p3(x3, y3);
		if (is_parallel(p0, p1, p2, p3)) {
			long double d0 = min(distance_ls_p(p0, p1, p2), distance_ls_p(p0, p1, p3));
			long double d1 = min(distance_ls_p(p2, p3, p0), distance_ls_p(p2, p3, p1));
			long double ans = min(d0, d1);

			cout.precision(20);
			cout << showpoint << ans << endl;
			continue;
		}
		if (is_intersected_ls(p0, p1, p2, p3)) {
			cout.precision(20);
			cout << showpoint << 0.00000000000 << endl;
			continue;
		}
		long double d0 = min(distance_ls_p(p0, p1, p2), distance_ls_p(p0, p1, p3));
		long double d1 = min(distance_ls_p(p2, p3, p0), distance_ls_p(p2, p3, p1));
		long double ans =min(d0,d1);

		cout.precision(20);
		cout << showpoint << ans << endl;
	}
}

Measured memory_bytes: 1316
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char a,b;
    scanf("%c %c",&a,&b);
    if( (a=='H' && b=='H')  || (a=='D' && b =='D'))
        printf("H\n");
    else
        printf("D\n");

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int x,y;
	while(scanf("%d %d",&x,&y),x+y){
		if(x>=y){
			printf("%d %d\n",y,x);
		}
		else{
			printf("%d %d\n",x,y);
		}
	}
		
	return 0;
}


Measured memory_bytes: 2080
N,M=map(int,input().split())
A=[]
a=0
for i in range(N):
    B=list(map(int,input().split()))
    A.append(B[1:])
if N==1:
    print(B[0])
else:
    for j in range(len(A[0])):
        for k in range(N-1):
            if A[0][j] not in A[k+1]:
                break
        else:
            a+=1
    print(a)

Measured memory_bytes: 3064
n = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in range(len(L)-1):
    x = L[i+1:].index(min(L[i+1:])) + i + 1
    if L[i] > L[x]:
        L[i], L[x] = L[x], L[i]
        cnt += 1
print(' '.join(str(x) for x in L))
print(cnt)


Measured memory_bytes: 5604
// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
#define pll pair <ll, ll>
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define inf (1LL << 62)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define for1(i, stop) for(ll i = 1; i <= stop; ++i)
#define for0(i, stop) for(ll i = 0; i < stop; ++i)
#define rep1(i, start) for(ll i = start; i >= 1; --i)
#define rep0(i, start) for(ll i = (start-1); i >= 0; --i)
#define ms(n, i) memset(n, i, sizeof(n))
#define casep(n) printf("Case %lld:", ++n)
#define pn printf("\n")
#define pf printf
#define EL '\n'
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

ll x, k, d;

inline ll solve(ll mv)
{
    if(mv >= k)
        return abs(x - k*d);

    ll now = x - mv*d;
    ll rest = k - mv;

    if(rest % 2 == 0)
        return abs(now);

    return min(abs(now + d), abs(now-d));
}

int main()
{
    cin >> x >> k >> d;
    x = abs(x);

    ll mv = x / d;

    cout << min(solve(mv), solve(mv+1)) << endl;

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>

int main() {
  int N;
  std::cin >> N;

  int abc_in;
  if (N % 111 == 0)
    abc_in = N;
  else
    abc_in = ((N / 111) + 1) * 111;

  std::cout << abc_in << std::endl;
  return 0;
}


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

int main() {
  ll a, b;
  double db;
  cin >> a >> db;
  b = (ll)(db * 100.0 + 1e-5);

  cout << a * b / 100LL << endl;
  return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main()
{
    int n,c;
    cin >> n >> c;

    int v[n], w[n];

    for(int i = 0;i < n; i++) {
        cin >> w[i] >> v[i];
    }

    int dp[n+1][c+1];

    for(int i = 0; i <= n; i++) {
        for(int j = 0;j <=c;j++) {
            dp[i][j] = 0;
        }
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 0; j <= c; j++) {
            if(w[i-1] <= j) {
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]] + v[i-1]);
            }
            else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    int best = 0;

    for(int i = 0; i <= c; i++) best = max(best, dp[n][i]);

    cout << best;

    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
int n,ans=0;
string s;

cin>>n>>s;
VI z(n);
for (int i = 0; i < n; i++)
{
   if (s.at(i)=='I')
   {
       ans++;
   }
   else
   {
       ans--;
   }
   z.push_back(ans);
}
sort(	ALL(z));
cout<<z.back()<<endl;
    return 0;
}

Measured memory_bytes: 256
/*Anuranjan Srivastava (codersaty)*/
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define pinf INT_MIN
#define minf INT_MAX
#define loop(i,j) for(int i=1;i<=j;i++)
#define rep(i,j) for(int i=0;i<j;i++)
#define deb(x) cout<< #x << "=" << x<< endl
#define deb1(x,y) cout<< #x << "=" << x<<","<< #y << "=" << y<< endl
#define endl "\n"
#define F first
#define S second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define clr(x) memset(x,0,sizeof(x))
#define  sortall(x) sort(all(x))
#define  tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define  pii pair<int,int>
#define  pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pii>
#define vpl vector<pl>
#define  vvi vector<vi>
#define mi map<int,int>
#define ml map<ll,ll>
const double pi=3.141592653589793238;
using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
       int d,t,s;
       cin>>d>>t>>s;
       double a=double(d)/s;
       if(a>t)
        cout<<"No\n";
       else
        cout<<"Yes\n";
}




Measured memory_bytes: 3616
#!/usr/bin/env python3

import math

N = int(input())
d = {}
l = []
for i in range(N):
    s,p = list(input().split(" "))
    d[i+1] = s,p
#print(d[1][0])
d1 = sorted(d.items(),key = lambda x:x[1][0])
#print(d1)
for i in range(N-1):
    for j in range(N-1):
        if d1[j][1][0] == d1[j+1][1][0] and int(d1[j][1][1]) < int(d1[j+1][1][1]):
            #print(d1)
            d1[j],d1[j+1] = d1[j+1],d1[j]
#print(d1)
#print(d1)
for i in range(N):
    print(d1[i][0])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,sum = 0,tmp;
    cin>>a;
    tmp = a;
    while(tmp!=0)
    {
        sum+=tmp%10;
        tmp/=10;
    }
    if(a%sum==0)
        cout<<"Yes\n";
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

int main(void){
    ll n,m;
    cin>>n>>m;
    vector<ll>a(n),b(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
        b[i] = a[i]/2;
    }
    if(n == 1){
        if(m<a[0]){
            ll x = a[0]/2;
            if(x<=m)cout<<1<<endl;
            else cout<<0<<endl;
            return 0;
        }
        ll ans = m/a[0];
        ll r = m%a[0];
        if(r>=a[0]/2)ans++;
        cout<<ans<<endl;
        return 0;
    }

    ll ans =0,parity = 0;
    for(ll i=0;i<n;i++){
        parity += b[i]&1;
    }
    if(parity!=0 && parity!=n){
        cout<<0<<endl;
        return 0;
    }

    ll g_even = 1;
    if(parity == 0){
        set<ll>s;
        ll num = 1;
        for(ll i=0;i<n;i++){
            num = 1;
            ll x = b[i];
            while(x%2 == 0){
                num *= 2;
                x /= 2;
            }
            if(s.empty())s.insert(num);
            else{
                if(s.count(num)==0){
                    cout<<0<<endl;
                    return 0;
                }
            }
        }
        g_even = num;
        for(ll i=0;i<n;i++)b[i]=b[i]/g_even;
    }
    ll lcm = b[0];
    for(ll i=1;i<n;i++){
        ll x = b[i];
        ll y = gcd(lcm,x);
        lcm = (lcm*x)/y;
        if(lcm>m){
            cout<<0<<endl;
            return 0;
        }
    }
    lcm = g_even*lcm;
    ans = m/lcm;
    if(ans%2 == 1){
        ans =(ans+1)/2;
    }
    else ans =ans/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
# coding: utf-8


def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    A = [None] * M
    B = [None] * M
    for i in range(M):
        A[i], B[i] = map(int, input().split())
        A[i] -= 1
        B[i] -= 1
    
    paths = [[] for _ in range(N)]
    for i in range(M):
        if B[i] not in paths[A[i]]:
            paths[A[i]].append(B[i])
        if A[i] not in paths[B[i]]:
            paths[B[i]].append(A[i])
    
    good = [None] * N
    for i in range(N):
        if good[i] is not None:
            continue
        
        neighs = paths[i]
        for neigh in neighs:
            if H[i] <= H[neigh]:
                good[i] = False
            if H[i] >= H[neigh]:
                good[neigh] = False
        
        if good[i] is None:
            good[i] = True
    
    ans = 0
    for i in range(N):
        if good[i]:
            ans += 1
    
    return ans


print(main())


Measured memory_bytes: 97176
#include <iostream>
using namespace std;
int main()
{
    int n, a, approve = 1;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(a % 2 == 0 && a % 3 != 0 && a % 5 != 0) approve = 0;
    }
    cout << (approve ? "APPROVED" : "DENIED") << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.chomp.to_i
L = gets.chomp.split.map(&:to_i)
count = 0

(0...N).each do |i|
  (i+1...N).each do |j|
    (j+1...N).each do |k|
      list = []
      list.push(L[i], L[j], L[k])
      list.sort!
      if list[0] != list[1] && list[1] != list[2] && list[2] != list[0]
        if (list[0] + list[1]) > list[2] 
          count += 1
        end
      end
    end
  end
end

puts count

Measured memory_bytes: 14384
/**
 * @author torith
 * @date 2019-02-03
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

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

    int N; cin >> N;
    int M; cin >> M;

    vector<int> X;
    for (int i = 0; i < M; ++i) {
        int t; cin >> t;
        X.push_back(t);
    }

    sort(X.begin(), X.end());

    vector<int> range;
    int before = -1e9;
    for (auto & x : X) {
        if(before != -1e9){
            range.push_back(x - before);
        }
        before = x;
    }

    sort(range.begin(), range.end(), greater<int>());

    ll ans = 0;
    for (int i = 0; i < range.size(); ++i) {
        if(i >= N - 1) ans += range[i];
    }
    cout << ans << "\n";


    return 0;
}



Measured memory_bytes: 1400
N = int(input())
L = [input() for i in range(N)]

ans = 0

leftB = rightA = leftB_and_rightA = 0

for l in L :
    ans += l.count("AB")
    if (l[0] != "B") and (l[-1] != "A") :
        continue
    elif (l[0] == "B") and (l[-1] != "A") :
        leftB += 1
    elif (l[0] != "B") and (l[-1] == "A") :
        rightA += 1
    else :
        leftB_and_rightA += 1

if leftB_and_rightA :
    ans += (leftB_and_rightA - 1)
    
    if leftB :
        ans += 1
        leftB -= 1
    
    if rightA :
        ans += 1
        rightA -= 1

ans += min(leftB, rightA)

print(ans)


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

int main() {
  int N;
  string S;
  cin>>N>>S;
  int a=0;
  if(N%2==1){
    a++;
  }
  
  for(int i=0;i<N/2;i++){
    if(a==1){
      break;
    }
    if(S.at(i)!=S.at(i+N/2)){
      a++;
    }
  }
  if(a==1){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int x; cin >> x;
  if(x==3 || x==5 || x==7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            if (13 <= A) {
                out.println(B);
            } else if (6 <= A) {
                out.println(B / 2);
            } else {
                out.println(0);
            }
        }

    }
}



Measured memory_bytes: 20564
h,w=map(int,input().split())
s=[]
for _ in range(h):
    s.append(input())


for y in range(h):
    for x in range(w):
        ans=0
        if s[y][x]=='.':
            for dy in [-1,0,1]:
                for dx in [-1,0,1]:
                    if 0<=x+dx<w and 0<=y+dy<h and s[y+dy][x+dx]=='#':
                        ans+=1
        else:
            ans='#'
        print(ans,end="")
    print()

                        


Measured memory_bytes: 3444
n = int(input())
A = [int(input()) for _ in range(2 ** n)]
B = A[:]
while len(B) > 1:
  C = [0] * (len(B) // 2)
  for i in range(len(B) // 2):
    if B[i*2] == B[i*2+1]:
      C[i] = B[i*2]
    else:
      C[i] = abs(B[i*2] - B[i*2+1])
  B = C[:]
print(B[0])

Measured memory_bytes: 21792
s = list(input())
ac, bc, cc = 0, 0, 0
for i in range(len(s)):
    if s[i] == 'a':
        ac += 1
    elif s[i] == 'b':
        bc += 1
    else:
        cc += 1
if abs(ac-bc) > 1 or abs(ac-cc) > 1 or abs(bc-cc) > 1:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 3956