akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
//const int mod = 1000000007;
const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) --a[i];
  int ans = 0;
  vector<bool> used(n, false);
  int now = 0;
  while(true) {
    if(used[now]) break;
    used[now] = true;
    if(now == 1) {
      cout << ans << endl;
      return 0;
    }
    ++ans;
    now = a[now];
  }
  cout << -1 << endl;
}

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

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 ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main() {
    string S;
    cin>>S;
    int t = S.size();
    if(S[0]==S[t-1]){
        if(t%2==1) cout<<"Second"<<endl;
        else cout<<"First"<<endl;
    }
    else {
        if(t%2==0) cout<<"Second"<<endl;
        else cout<<"First"<<endl;
    }
}

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

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

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<string> S(H);
    rep(y, H) cin >> S[y];

    int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
    rep(y, H)rep(x, W) {
        if (S[y][x] != '#') continue;

        bool res = false;
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if (0 <= ny && ny < H && 0 <= nx && nx < W && S[ny][nx] == '#') {
                res = true;
            }
        }
        if (!res) {
            puts("No");
            return 0;
        }
    }

    puts("Yes");
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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



int main() {
	int x,y,z,e;
	IL{
		cin>>e;
		if(e==0)break;
		int res=INF;
		for(z=0;z*z*z<=e;++z){
			for(y=0;y*y+z*z*z<=e;++y){
				x=e-z*z*z-y*y;
				chmin(res,x+y+z);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

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

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n,m,r := scanInt(), scanInt(), scanInt()
	rs := scanInts(r)
	for i := 0; i < r; i++ {
		rs[i]--
	}

	g := make(graph, n)
	g.init()
	
	for i := 0; i < m; i++ {
		a,b,c := scanInt()-1, scanInt()-1, scanInt()
		g[a][b],g[b][a] = c,c
	}

	g.warshallfloyd()

	ans := 1<<31-1
	permutationSearch(r, func(a []int) {
		sum := 0
		for i := 0; i < r-1; i++ {
			sum += g[rs[a[i]]][rs[a[i+1]]]
		}
		ans = min(ans, sum)
	})

	fmt.Fprintln(wr, ans)
}

type graph [][]int

func (g *graph) init() {
	for i := 0; i < len(*g); i++ {
		(*g)[i] = make([]int, len(*g))
		for j := 0; j < len(*g); j++ {
			(*g)[i][j] = 1<<31-1
		}
	}
}

func (g *graph) warshallfloyd() {
	min := func(a,b int) int { if a<b { return a }; return b }
	for k := 0; k < len(*g); k++ {
		for i := 0; i < len(*g); i++ {
			for j := 0; j < len(*g); j++ {
				(*g)[i][j] = min((*g)[i][j], (*g)[i][k]+(*g)[k][j])
			}
		}
	}
}


func permutationSearch(n int, fn func(a []int)) {
	a := make([]int, n)
	for i := 0; i < n; i++ { a[i] = i }
	swap := func(i,j int) { a[i],a[j] = a[j],a[i] }

	fn(a)
	for i := n-2; i >= 0; i-- {
		if a[i] > a[i+1] { continue }
		for j := n-1; j >= 0; j-- {
			if a[i] > a[j] { continue }
			swap(i,j)
			for k := i+1; k < (n+i+1)/2; k++ { swap(k,n-(k-i)) }
			fn(a)
			i = n-1
			break
		}
	}
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

int main(void){
    // char ;
    ll n,m;
    scanf("%lld%lld",&n,&m);
    if(n*m%2){
        printf("Odd\n");
    }else{
        printf("Even\n");
    }

    
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n % 2 == 0) {
            System.out.println(0.5000000000);
        } else {
            double result = (double)(n + 1) / (2 * n);
            System.out.println(result);
        }
        sc.close();
    }
}

Measured memory_bytes: 22096
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto S = new string[](N);
    auto P = new long[](N);
    foreach (i; 0 .. N)
        scan(S[i], P[i]);
    P[] *= -1;
    auto I = iota(N).map!"a+1"().array();
    zip(S, P, I).sort();
    foreach (i; I)
        writeln(i);
}


Measured memory_bytes: 256
//cod2017_qualB_b.cpp
//Sat Nov 10 21:07:59 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	unordered_map<int, int> hash;
	for (int i=0;i<n;i++){
		int temp;
		cin >> temp;
//		auto itr = hash.find(temp);
//		if (itr != hash.end()){
			hash[temp]++;
//		}else {
//			hash[temp] = 1;
//		}
	}

	int m;
	cin >> m;

	int flag = 0;
	for (int i=0;i<m;i++){
		int temp;
		cin >> temp;
		auto itr = hash.find(temp);
		if (itr != hash.end()){
			if (hash[temp]==0){
				cout << "NO" << endl;
				return 0;
			}else {
				hash[temp]--;
			}
		}else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;
}

Measured memory_bytes: 8520
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll r,d,x;
	rl3(r,d,x);
	ll tmp=0;
	fr(i,0,10)
	{
		tmp=r*x-d;
		wl(tmp);
		NL;
		x=tmp;
	}
	return;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    map<int, int> m;
    int mi = 1000, ma = 0;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        m[a] += 1;
        mi = min(mi, a);
        ma = max(ma, a);
    }

    bool ok = (m[mi] >= 2 && ma & 1) || (m[mi] == 1 && ma % 2 == 0);
    ok &= (ma + 1) / 2 == mi && ma <= N - 1 && m[mi] <= 2 && m[ma] >= 2;
    int prev = mi - 1;
    for(auto& p : m) {
        if(p.first != prev + 1) {
            ok = false;
        }
        prev = p.first;
        if(p.first == mi) {
            continue;
        }
        ok &= p.second >= 2;
    }

    if(ok) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 256
def read_input():
    n, m = map(int, input().split())

    ships = []
    for i in range(m):
        a, b = map(int, input().split())
        ships.append((a, b))

    return n, m, ships


def submit():
    n, m, ships = read_input()

    links = {i: [] for i in range(1, n+1)}

    for ship in ships:
        links[ship[0]].append(ship[1])
        links[ship[1]].append(ship[0])

    set1 = set(links[1])
    set2 = set(links[n])

    if set1.intersection(set2):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')



if __name__ == '__main__':
    submit()

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

int main()
{
    int n;
    cin >> n;
    long a[n];

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

    int cnt = 0;
    bool flg = true;
    while (flg) {
        for (int i = 0; i < n; i++) {
            if ((a[i] & 1) == 1) {
                flg = false;
                break;
            } else {
                a[i] >>= 1;
            }
        }
        if (flg)
            cnt++;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
/*
ID: arthurc4
TASK: test
LANG: C++11
*/

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<bool> vb;
typedef vector<vb> vvb;

typedef map<string,int> msi;
typedef map<int,int> mii;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll; // note 'single' ls

typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++)

#define REPb(j, d, c) \
for (int j = int(d); j >= int(c); j--)

#define pb \
push_back

#define ff \
first

#define ss \
second

// LL OR INT ???
// DELETED IFSTREAM ???
int main()
{
	//ifstream cin("input.txt");
	//ifstream cin("test.in");
	//ofstream cout("test.out");

	ll N, P;
	cin >> N >> P;

	if(N==1)
	{
		cout << P << endl;
		return 0;
	}

	ll max_gcd = 1;

	for(ll d=2; d*d <=P; d++)
	{
		if(P%d == 0)
		{
			ll v_d = 0;

			while(P%d == 0)
			{
				P /= d;
				v_d += 1;
			}

			max_gcd *= pow(d, v_d/N);
		}
	}

	cout << max_gcd << endl;

	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> t, std::vector<long long> x, std::vector<long long> y){
    vector<pair<LL, pair<LL, LL> > > memo;
    REP(i, N) memo.PB(MP(t[i], MP(x[i], y[i])));

    sort(ALL(memo));
    LL nx = 0, ny = 0, nt = 0;
    REP(i, N) {
        LL cost = abs(memo[i].second.first - nx) + abs(memo[i].second.second - ny);
        if(memo[i].first - nt < cost || (memo[i].first - nt) % 2 != cost % 2) {
            cout << NO << endl;
            return;
        }
        nx = memo[i].second.first;
        ny = memo[i].second.second;
        nt = memo[i].first;
    }

    cout << YES << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> t(N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&t[i]);
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(t), std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 6644
from sys import stdin
import numpy as np
# import math
# import random
# import fractions
# import sys
# sys.setrecursionlimit(100000)
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

N, X = [int(x) for x in stdin.readline().rstrip().split()]
L = [int(x) for x in stdin.readline().rstrip().split()]
cnt = 1
n = 0
for l in L:
  n += l
  if n>X:
    break
  cnt += 1
print(cnt)

Measured memory_bytes: 21528
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long  
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define vvi vector <vi>
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define M_PI 3.14159265358979323846 

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
///*X.find_by_order("index")
///X.order_of_key("key")

///----------------------------------------------------------------------------------

int DP[2001];
int fun(int rem) {
	if (rem == 0)
		return 1;
	if (rem < 0) return 0;
	if (DP[rem] != -1) return DP[rem];
	int res = 0;
	rep(i,3,rem+1) res = (res + fun(rem - i)) % MOD;
	return DP[rem] = res;
}
void solve()
{
	int s;
	cin >> s;
	memset(DP, -1, sizeof DP);
	cout << fun(s) << "\n";
}
	
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	
	#ifdef local
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	clock_t TIMER = clock();
	#endif
	
	int t = 1;
	//cin >> t;
	rep(a,0,t)
	{
		//cout<<"Case #"<<a+1<<": ";
		solve();
		#ifdef local
		cout << "\n";
		#endif

	}
	
	#ifdef local
	{TIMER = clock() - TIMER;double time_taken = ((double)TIMER)/CLOCKS_PER_SEC;cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "<<time_taken<<" seconds\n";}
	#endif
}

Measured memory_bytes: 3688
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,m,k[15]={},s[15][15]={},p[15]={},ans=0,cnt1=0,cnt2;
  cin >> n >> m;
  for(int i=0; i<m; i++) {
    cin >> k[i];
    for(int j=0; j<k[i]; j++) {
      cin >> s[i][j];
    }
  }
  for(int i=0; i<m; i++) {
    cin >> p[i];
  }
  for(int i=0; i<(1<<n); i++) {
    cnt2=0;
    for(int j=0; j<m; j++) {
      cnt1=0;
      for(int l=0; l<k[j]; l++) {
        if(i&(1<<s[j][l]-1)) {
          cnt1++;
        }
      }
      if(cnt1%2==p[j]) {
        cnt2++;
      }
    }
    if(cnt2==m) {
      ans++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
using System;
using System.IO;

namespace MinPro2019D
{
    public class Program
    {
        void Solve(SimpleScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var L = int.Parse(ss.Next());
            var dp = new long[5];

            for (var i = 0; i < L; i++)
            {
                var A = long.Parse(ss.Next());
                var x = A == 0 ? 2 : A & 1;

                dp[0] += A;
                dp[1] += x;
                dp[2] += (x & 1) ^ 1;
                dp[3] += x;
                dp[4] += A;

                for (var t = 1; t < 5; t++)
                {
                    dp[t] = Math.Min(dp[t], dp[t - 1]);
                }
            }

            sw.WriteLine(dp[4]);
            //---------------------------------
        }

        static void Main()
        {
            var ss = new SimpleScanner(Console.OpenStandardInput());
            var sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }

    //ref: https://qiita.com/Camypaper/items/de6d576fe5513743a50e#%E5%85%A5%E5%8A%9B%E3%81%AE%E9%AB%98%E9%80%9F%E5%8C%96
    //by Camypaperさん 
    public class SimpleScanner
    {
        const int DefaultCapacity = 1024;

        readonly Stream stream;
        readonly int capacity;
        readonly byte[] buffer;
        readonly char[] chars;

        int index = 0;
        int length = 0;
        bool isEof = false;

        public SimpleScanner(Stream stream, int capacity = DefaultCapacity)
        {
            this.stream = stream;
            this.capacity = capacity;
            this.buffer = new byte[capacity];
            this.chars = new char[capacity];
        }

        void Reload()
        {
            index = 0;
            length = stream.Read(buffer, 0, capacity);
            isEof = length <= 0;
        }

        void CheckBuffer()
        {
            if (index < length) return;
            if (isEof) throw new EndOfStreamException();
            Reload();
            CheckBuffer();
        }

        byte Peek()
        {
            CheckBuffer();
            return buffer[index];
        }

        byte Read()
        {
            CheckBuffer();
            return buffer[index++];
        }

        bool CanInput(int b)
        {
            return 33 <= b && b <= 126;
        }

        public string Next()
        {
            var ptr = 0;
            while (!CanInput(Peek())) Read();
            while (CanInput(Peek())) chars[ptr++] = (char)Read();
            return new string(chars, 0, ptr);
        }
    }
}


Measured memory_bytes: 17232
def solve(xy):
    xy_diff = [] # x-yを追加(右上と左下でソートしたい)
    xy_dist = [] # x+yを追加(原典からの距離でソートしたい)
    for x,y in xy:
        xy_diff.append([x,y,x-y])
        xy_dist.append([x,y,x+y])
    xy_diff.sort(key = lambda x:x[2])
    xy_dist.sort(key = lambda x:x[2])

    return max(xy_diff[-1][2] - xy_diff[0][2], xy_dist[-1][2] - xy_dist[0][2])

def main():
    N = int(input())
    xy = [list(map(int,input().split())) for _ in range(N)]
    print(solve(xy))

if __name__ == "__main__":
    main()


Measured memory_bytes: 102584
from operator import itemgetter
import sys
input = sys.stdin.readline

# 二部探索木の代わり
# max_Xが大きい場合、0を含む場合は座標圧縮する

class BITbisect():
    def __init__(self, max_X):
        self.max_X = max_X + 1
        self.bit = [0]*(self.max_X+1)

    # x番目にaを加える
    def add(self, x, a):
        while x <= self.max_X:
            self.bit[x] += a
            x += x & -x

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    # xまでに出現している個数
    def query_sum(self, x):
        s = 0
        while x > 0:
            s += self.bit[x]
            x -= x & -x
        return s

    def exist(self, x):
        if self.query_sum(x) - self.query_sum(x-1) > 0:
            return True
        return False
    
    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)

    # xより大きくてbitに入ってるもののうち最小のもの
    # O((logN)^2)
    def upper(self, x):
        qx = self.query_sum(x) + 1
        if qx > self.query_sum(self.max_X):
            return False
        l = 0
        r = self.max_X
        while l < r:
            m = (l+r)//2
            if self.query_sum(m) < qx:
                if l == m:
                    return r
                l = m
            else:
                r = m
        if m == self.max_X:
            return False
        return m

    # x以下でbitに入っているもののうち最大のもの
    # O((logN)^2)
    def lower(self, x):
        qx = self.query_sum(x)
        if qx == 0:
            return False
        l = 0
        r = self.max_X
        while l < r:
            m = (l+r)//2
            if self.query_sum(m) < qx:
                if l == m:
                    return r
                l = m
            else:
                r = m
        return m

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max_X):
            if bit.exist(x):
                c = bit.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print()


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

B = []
for i, a in enumerate(A):
    B.append((i+1, a))
B.sort(key=itemgetter(1))

bit = BITbisect(N)

ans = 0
for i, a in B:
    l = bit.lower(i)
    r = bit.upper(i)
    if l is False:
        l = 0
    if r is False:
        r = N+1
    ans += (i-l)*(r-i)*a
    bit.insert(i)
print(ans)

Measured memory_bytes: 89980
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e6 + 10;
const ll mod = 1e9 + 7;
int n, m, k;
ll a[3010][3010];
ll dp[3010][3010][4];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		scanf("%lld", &a[x][y]);
	}
	dp[1][1][0] = 0; dp[1][1][1] = a[1][1];
	ll ans = -inf;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j][0] = 0;
			if (i == 1 && j == 1)continue;
			dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][0]);
			for (int x = 0; x <= 3; x++)dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][x]), dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][x] + a[i][j]);
			for (int x = 1; x <= min(j, 3); x++) {
				dp[i][j][x] = max(dp[i][j][x], max(dp[i][j - 1][x], dp[i][j - 1][x - 1] + a[i][j]));
			}
		}
	}
	for (int i = 0; i <= 3; i++)ans = max(ans, dp[n][m][i]);
	if (ans < 0)while (1);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 356336
package main
  
import (
    "fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    ps := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&ps[i])
    }
    var cnt int
    for i := 1; i < n-1; i++ {
        if ps[i] < ps[i-1] && ps[i] > ps[i+1] ||
            ps[i] > ps[i-1] && ps[i] < ps[i+1] {
            cnt++
        }
    }
    fmt.Println(cnt)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
    using namespace std;
    void dfs(int n, vector<vector<int> > &g, bool vis[],int dp[]){
    	vis[n] = true;
    //	cout<<"lol"<<endl;
    	for(int i =0; i<g[n].size();i++){
    	//		cout<<i<<endl;
     
    		if(!vis[g[n][i]])
    			dfs(g[n][i],g,vis,dp);
    		dp[n] = max(dp[n], 1 + dp[g[n][i]]);
     
    	}
    }
    int main(){
    	int v,e,v1,e1;
    	cin>>v>>e;
    	vector<vector<int> > g(v);
    	for(int i=0;i<e;i++){
    		cin>>v1>>e1;v1--;e1--;
    		g[v1].push_back(e1);
    	}
    	int dp[v+1];
    	bool vis[v+1];
    	memset(dp,0,sizeof dp);
    	memset(vis, false , sizeof vis);
    	for(int i = 0;i<v;i++){
    		if(!vis[i])
    		dfs(i,g,vis,dp);
    	}
    	int ans=0;
    //	cout<<"3"<<endl;
     
    	for(int i = 0; i<v;i++)
    		ans = max(ans,dp[i]);
    	cout<<ans<<endl;
    	return 0;
    }

Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
    int main(){
      int c[3][3];
      rep(i,3){
       rep(j,3){
        cin >> c[i][j]; 
       }
      }
      bool flag=true;
      int d[2];
      int e[2];
      rep(i,2){
       d[i]=c[0][i+1]-c[0][i];
        e[i]=c[i+1][0]-c[i][0];
      }
      rep(i,3){
       rep(j,3){
        int check=c[0][0];
         rep(k,i)check+=e[k];
         rep(l,j)check+=d[l];
         if(check!=c[i][j])flag=false;
       }
      }
      if(flag)cout << "Yes" << endl;
      else cout << "No" << endl;
      return 0;}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
    char s[101];
    int count = 0;

    scanf("%s", s);
    int len = strlen(s);

    for (int i = 0; i < len/2; i++){
        if (s[i] != s[len-1-i])
            count++;
    }

    printf("%d", count);

    return 0;
}

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int p;
    rp(i,s.size()){
        if(s.at(i)=='A'){
            p=i;
            break;
        }
    }
    int q;
    rp(i,s.size()){
        if(s.at(i)=='Z'){
            q=i;
        }
    }
    cout << q-p+1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll N=100005;

int main(){
    ll x;cin>>x;
    vl d;
    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            if(x/i == i)d.pb(i);
            else{
                d.pb(i),d.pb(x/i);
            }
        }
    }
    sort(all(d));
    for(auto l:d){
        for(ll b=-l;b+l<1300;b++){
            ll p=powmod(b+l,5)-powmod(b,5);
            if(p==x){
                cout<<b+l<<" "<<b;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

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

    if((b-a)%2==0){
        cout << (b-a)/2 << endl;
    }else{
        ll c1 = (b-a-1)/2 + a;
        ll c2 = (n-(a+n-b+1))/2 + (n-b+1);
        cout << min(c1, c2) << endl;
    }

    return 0;
}


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

int judgeprime(int);

int main(){
  int n, num;
  int flg,cnt = 0;
  int i;

  cin >> n;

  for(i = 0 ; i < n ; i++){
    cin >> num;
    flg = judgeprime(num);
    if(flg == 1){
      cnt++;
    }
  }

  cout << cnt << endl;
  return 0;

  }

int judgeprime(int num){
  int n = 3;
  if(num == 2){
    return 1;
  }else if(num == 1 || num%2 == 0){
    return 0;
  }

  while(n <= sqrt(num)){
    if(num % n == 0){
      return 0;
    }
    n+=2;
  }
  return 1;
}

Measured memory_bytes: 1160
n=int(input())
a={tuple(map(int,input().split())):False for _ in range(n)}
b=sorted([tuple(map(int,input().split())) for _ in range(n)])

ak=sorted(a.keys(),key=lambda x:x[1])[::-1]

for i in b:
  for j in ak:
    if i[0]<j[0] or i[1]<j[1] or a[j]:continue
    else:
      a[j]=True
      break

print(sum(a.values()))

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/c.in", "r", stdin);
//  freopen("../IO/c.out", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}

vector<int> a, b, c, d;
int ans = 0;
vector<int> seq;

void dfs(int mn, int mx, int left) {
  if (left == 0) {
    int a1 = 0;
    for (int i = 0; i < (int) a.size(); ++i) {
      if (seq[b[i] - 1] - seq[a[i] - 1] == c[i]) {
        a1 += d[i];
      }
    }
    ans = max(a1, ans);
  } else {
    for (int i = mn; i <= mx; ++i) {
      seq.push_back(i);
      dfs(i, mx, left - 1);
      seq.pop_back();
    }
  }
}

void solve(std::istream &in, std::ostream &out) {
  int n, m, q;
  in >> n >> m >> q;
  a.resize(q), b.resize(q), c.resize(q), d.resize(q);
  for (int i = 0; i < q; ++i) {
    in >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(1, m, n);
  out << ans << '\n';
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long n,m;
  cin >> n >> m;
  vector<long> sum(n+1);
  sum.at(0) = 0;
  rep(i,n){
    long a;
    cin >> a;
    sum.at(i+1) = sum.at(i) + a;
  }
  map<long,long> mp;
  rep(i,n+1){
    long tmp = sum.at(i) % m;
    if(mp.count(tmp)) mp.at(tmp)++;
    else mp[tmp] = 1;
  }
  long ans = 0;
  rep(i,n+1){
    long tmp1 = sum.at(i) % m;
    if(mp.count(tmp1)){
      long tmp2 = mp.at(tmp1) * (mp.at(tmp1)-1) / 2;
      ans += tmp2;
      mp.erase(tmp1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
#define REP(i,b,e) for(int i=b;i<(int)e;i++)
typedef long long ll;
typedef map<ll,ll> mll;
typedef vector<ll> vll;
ll INF=1e18;
int inf=1e9+1000;

string alpha="abcdefghijklmnopqrstuwvxyz";

ll N;
ll a[10003];

ll divide2(ll n){
    int i=0;
    while(n%2==0){
        n/=2;
        i++;
    }
    return i;
}


int main(){
    cin>>N;
    Rep(i,N) cin>>a[i];
    ll ans=0;
    Rep(i,N){
        ans+=divide2(a[i]);

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

Measured memory_bytes: 384
from fractions import gcd


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

x.append(X)
x.sort()

last = x[0]
ans = abs(x[0] - x[1])
for i in x[1:]:
    ans = gcd(ans, abs(last - i))
    last = i

print(ans)


Measured memory_bytes: 16244
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define ld long double
#define rall(a) (a).rbegin(),(a).rend()

ll power(ll b,ll e,ll m)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}  
bool isPowerOfTwo(ll x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
} 

void solve()
{
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll x=0,y=0;
  ll a=0,b=0;
  rep(i,0,n)
  {
    if(s[i]=='R') 
    {
      a++;
      x=1;
    }
    else 
    {
      b++;
      y=1;
    }
  }
  if(x and y)
  {
    ll ans1=0,ans2=0;
    rep(i,0,a) if(s[i]=='W') ans1++;
    rep(i,a,b) if(s[i]=='R') ans2++;
    ll ans=max(ans1,ans2);
    cout<<min({ans,a,b});
  }
  else
  {
    cout<<0<<"\n";
  }
}


int main()       
{
  fastio
  ll tt=1;
  // cin>>tt;
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
  return 0;
}


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

int main()
{
    int a , b ;
    cin>>a>>b;
    string s1="" , s2="" ;
    for(int i=0;i<b;i++)
        s1+=(a+48);
    for(int i=0;i<a;i++)
        s2+=(b+48);
    if(s1<s2)
        cout<<s1;
    else
        cout<<s2;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = "";
        String[] str = {"dream","dreamer","erase","eraser"};

        
        S = S.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "");

        if( S.equals("")){
            System.out.println("YES"); 
        }else{
            System.out.println("NO");
        }
        
    }
}


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


int main()
{
    ll n,temp;
    cin>>n;
    deque<ll> dq;
    deque<ll>::iterator it;
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        if(i%2==0)
        {
            dq.push_back(temp);
        }
        else
        {
            dq.push_front(temp);
        }
    }
    if(n%2!=0)
    {
        reverse(dq.begin(),dq.end());
    }
    for(it=dq.begin();it!=dq.end();it++)
    {
        cout<<*it<<" ";
    }
    printf("\n");


    return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    int H, W;
    cin >> H >> W;
    vector<vector<int>> A(H, vector<int>(W));
    vector<vector<int>> B(H, vector<int>(W));
    REP(i, H)REP(j, W) cin >> A[i][j];
    REP(i, H)REP(j, W) cin >> B[i][j];
    int M = 80 * 80 * 5;
    vector<vector<vector<bool>>> C(H+1, vector<vector<bool>>(W+1, vector<bool>(M, false)));
    C[0][0][0] = true;
    REP(i, H)REP(j, W)REP(k, M){
        if (C[i][j][k]){
            int tmp0 = k + abs(A[i][j] - B[i][j]);
            int tmp1 = abs(k - abs(A[i][j] - B[i][j]));
            //cout << i << " " << j << " " << tmp0 << " " << tmp1 << endl;
            C[i+1][j][tmp0] = true;
            C[i+1][j][tmp1] = true;
            C[i][j+1][tmp0] = true;
            C[i][j+1][tmp1] = true;
        } 
    }
    int ans = M;
    REP(i, M) if(C[H][W-1][i]) ans = min(ans, i);
    cout << ans << endl;

    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)

using LL  = long long;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int a, b;cin >> a >> b;
    cout << (a+b)%24 << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

if N % 2 ==  1:
    for i in range(M):
        print (i + 1, N - 1 - i)
elif N == 4:
    print (1, 2)
else:
    lst = [True] * N

    #奇数の個数
    n = (M + 1) // 2
    for i in range(n):
        print (1 + i, 1 + i + 2 * n - 1 - 2 * i)
    
    #偶数の個数
    m = M // 2
    for i in range(m):
        print (2 * n + 1 + i, 2 * n + 1 + i + 2 * (m - i))


Measured memory_bytes: 10188
#include<bits/stdc++.h>
using namespace std;
//pallindrom function
int pallindrom(string s)
{
    string ss;
    ss=s;
    reverse(s.begin(),s.end());
    if(ss==s)
    {
        return 1;
    }
    else
        return -1;
}
// main part
int main()
{
    string ss;
    cin>>ss;
    int n=ss.size();
    int r=  pallindrom(ss);
    if(r==1)
    {
        int a=(n-1)/2;
        int b=(n+3)/2;
        string s1= ss.substr(0, a);

        string s2= ss.substr(b-1, n);
      
        int p1=  pallindrom(s1);
        int p2=  pallindrom(s2);
        if(p1==p2 && p1==1)
        {
            cout<<"Yes";
        }
        else
            cout<<"No";
    }
    else
        cout<<"No";





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int a,b;
    cin >> a >> b;
    if(a<=b*2){
        cout << 0;
        return 0;
    }else{
        cout << a-2*b;
        return 0;
    }



}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int A[100],i,j,v,N,k;
  
  scanf("%d",&N);
  for(i=0;i<=N-1;i++){
    scanf("%d",&A[i]);
  }

 for(k=0;k<=N-1;k++){
	printf("%d",A[k]);
	if(k<=N-2)printf(" ");
      }
      printf("\n");
  
  for(i=1;i<=N-1;i++){
    v=A[i];
    j=i-1;
    while(j >= 0 && A[j] > v){
      A[j+1]=A[j];
	j--;
	A[j+1]=v;
    }
      for(k=0;k<=N-1;k++){
	printf("%d",A[k]);
	if(k<=N-2)printf(" ");
      }
      printf("\n");
  }
  
    return 0;
}

Measured memory_bytes: 604
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

//long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
//long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
//void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long N; cin >> N;
	long x[1000] = {}, y[1000] = {}, h[1000] = {};
	for (int i = 1; i <= N; i++) cin >> x[i] >> y[i] >> h[i];

	long cx, cy, H; //ぜんたん
	long hmax = *max_element(h + 1, h + N + 1);//hの最大値は頂点と同じ高さかそれ以下

	for (cx = 0; cx <= 100; cx++) {
		for (cy = 0; cy <= 100; cy++) {
			for (H = hmax; H <= hmax + 200; H++) {
				for (int i = 1; i <= N; i++) if (max(H - abs(x[i] - cx) - abs(y[i] - cy), (long)0) != h[i]) goto skip;

				cout << cx << " " << cy << " " << H << endl; return 0;
			skip:;
			}
		}
	}
}

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

#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define f(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pc __builtin_popcount // counts number of 1's in bin(num)

const double pi = 2*acos(0.0);
//__gcd(n1, n2);
//cout << fixed;
//cout << setprecision(6); //fixes # of dp



int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
	
    int n, k;
    cin >> n >> k;
    vector<int> mh;
    f(i, 0, n){
        int temp;
        cin >> temp;
        mh.push_back(temp);
    }
    if( k >= n){
        cout << 0;
    } else{
        sort(all(mh));
        ll ans = 0;
        f(i, 0, n - k){
            ans += mh[i];
        }
        cout << ans;
    }
}








Measured memory_bytes: 1400
fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toLong() }
    val sum = aa.sum()

    var snuke = 0L
    var bear = sum
    var min = Long.MAX_VALUE

    for (i in 0..n-2) {
        snuke += aa[i]
        bear -= aa[i]
        min = Math.min(min, Math.abs(snuke-bear))
    }

    println(min)
}

Measured memory_bytes: 82896
// =====================================================================================
// 
//       Filename:  D.cpp
//        Created:  2017년 06월 03일 21시 07분 33초
//       Compiler:  g++ -O2 -std=c++14
//         Author:  baactree ,  bsj0206@naver.com
//        Company:  Chonnam National University
// 
// =====================================================================================

#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int h[100000];
typedef long long ll;
bool possi(ll x){
	ll diff=a-b;
	ll cnt=0;
	for(int i=0;i<n;i++){
		ll now=h[i]-x*b;
		if(now>0)
			cnt+=(now+diff-1)/diff;
	}
	return cnt<=x;	
}
int main(){
	scanf("%d%d%d", &n, &a, &b);
	for(int i=0;i<n;i++)
		scanf("%d", &h[i]);
	int le, ri, mid, ans;
	le=0;
	ri=1e9;
	ans=0;
	while(le<=ri){
		mid=(le+ri)/2;
		if(possi(mid)){
			ans=mid;
			ri=mid-1;
		}
		else
			le=mid+1;
	}
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 640