akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		long[] a = new long[n];
		// 偶数＋偶数＝偶数　奇数＋奇数＝偶数
		int odd = 0;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if (a[i] % 2 != 0) {
				odd++;
			}
		}
		if (odd % 2 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 50284
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

#define MOD 1000000007
ll self_square(ll a, ll b){
    if(b == 0) return 1;
    if(b%2 == 0){
        ll t = self_square(a, b/2);
        return t * t % MOD;
    }
    return a * self_square(a, b-1) % MOD;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n, k; cin >> n >> k;
  vector<ll> used(k+1, 0);
  ll ans = 0;
  for(ll i = k; i > 0; i--){
    used[i] = self_square(k/i, n);
    // cout << "s:" << self_square(k/i, n) << endl;
    for(ll j = 2; i * j <= k ; j++){
      used[i] += (MOD - used[i*j]) % MOD;
    }
    ans += (used[i] * i) % MOD;
    ans %= MOD;
  }
  // for(int i = k; i > 0; i--) cout << (used[i]*i)%MOD << endl;
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 4004
#include <stdio.h>
int main()
{
    char ch;
    scanf("%c", &ch);
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
    {
        printf("vowel\n");
        //printf("Since %c is a vowel, print vowel.\n", ch);
    }
    else{
        printf("consonant\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void) {

  int a, b, d, r;
  double f;

  scanf("%d %d", &a, &b);

  d = a / b;
  r = a % b;
  f = (double)a / b;

  printf("%d %d %lf\n", d, r, f);

  return 0;
}



Measured memory_bytes: 2076
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    string s, t; cin >> s >> t;
    ll k = 0;
    rep(i, s.size()) {
        if (s[i] != t[i]) ++k;
    }
    cout << k << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 3796
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
import collections
D=collections.defaultdict(int)
ans=0
for i in range(n):
  D[i - A[i]]+=1
for i in range(n):
  ans+=D[A[i]+i]
print(ans)


Measured memory_bytes: 61572
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <numeric>
using namespace std;
 
#define LOCAL  1
#define UPLOAD 2
 
#define ll long long
const long long INF = 1LL << 60;
 
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
#define REP(i,M) for(int i=0;i<M;i++)
 
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  ll a = input();
  ll b = input();

  string s1;
  for(int i=0;i<b;i++){
    s1 += std::to_string(a);
  }
  string s2;
  for(int i=0;i<a;i++){
    s2 += std::to_string(b);
  }

  output(min(s1, s2));
  
  return 0;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	n, m := scanInt(sc), scanInt(sc)
	lmax, rmin := 1, math.MaxInt32
	for i := 0; i < m; i++ {
		l, r := scanInt(sc), scanInt(sc)
		if lmax < l {
			lmax = l
		}
		if r < rmin {
			rmin = r
		}
	}
	return max(0, min(n, rmin)-lmax+1)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

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

    vector<vector<int> > v(n);
    vector<int> a(m);
    vector<int> b(m);
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;

        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }

    int ans = 0;
    for(int i = 0; i < m; i++){
        if(v[a[i]].size() == 1 || v[b[i]].size() == 1){
            ans++;
        }else{
            queue<int> q;
            int flag[n];
            int che = 0;
            for(int j = 0; j < n; j++){
                flag[j] = 0;
            }
            if(v[a[i]].size() < v[b[i]].size()){
                for(int j = 0; j < v[a[i]].size(); j++){
                    if(v[a[i]][j] != b[i]){
                        q.push(v[a[i]][j]);
                        flag[v[a[i]][j]] = 1;
                    }
                }

                flag[a[i]] = 1;

                while(!q.empty()){
                    int k = q.front();
                    q.pop();

                    if(k == b[i]){
                        che = 1;
                        break;
                    }

                    for(int j = 0; j < v[k].size(); j++){
                        if(flag[v[k][j]] == 0){
                            q.push(v[k][j]);
                            flag[v[k][j]] = 1;
                        }
                    }
                }

                if(che == 0){
                    ans++;
                }
            }else{
                for(int j = 0; j < v[b[i]].size(); j++){
                    if(v[b[i]][j] != a[i]){
                        q.push(v[b[i]][j]);
                        flag[v[b[i]][j]] = 1;
                    }
                }

                flag[b[i]] = 1;

                while(!q.empty()){
                    int k = q.front();
                    q.pop();

                    if(k == a[i]){
                        che = 1;
                        break;
                    }

                    for(int j = 0; j < v[k].size(); j++){
                        if(flag[v[k][j]] == 0){
                            q.push(v[k][j]);
                            flag[v[k][j]] = 1;
                        }
                    }
                }

                if(che == 0){
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  map<string, int> m;
  m["AC"] = 0;
  m["WA"] = 0;
  m["TLE"] = 0;
  m["RE"] = 0;

  int N; cin >> N;
  for(int i = 0; i < N; i++){
    string s; cin >> s;
    m[s]++;
  }

  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
  
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

void solve() {
	int n, k; cin >> n >> k;
	cout << fixed << setprecision(10);
	ld ans = 0;
	rep1(i, n) {
		ld p = 1 / (ld)n;
		int c = i;
		while (c < k) {
			c *= 2; p /= 2.0;
		}
		ans += p;
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//experi(4);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,d,j,i,c;
  int A[100][100]={};
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d%d",&b,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      A[b-1][c-1]=1;
    }
  }
  for(i=0;i<a;i++){
    for(j=0;j<a;j++){
      if(j==a-1)printf("%d",A[i][j]);
      else printf("%d ",A[i][j]);
    }
    printf("\n");
  }
}



Measured memory_bytes: 2796
import collections

n = int(input())
a = list(map(int, input().split()))
ac = collections.Counter(a)
ans = 0
for i in range(min(a) - 1, max(a) + 2):
    ans = max(ans, ac[i - 1] + ac[i] + ac[i + 1])
print(ans)

Measured memory_bytes: 14564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
fの別解

19
1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1
*/

long long modinv(long long a, long long mod) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a/b;
        a -= t*b; swap(a, b);
        u -= t*v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

template<typename T>
void polynomial_division(vector<T> a, const vector<T> &b, T mod, vector<T> &ans){
	int n = a.size(), m = b.size();
	ans.assign(n-m+1,0);
	for(int i=0; i+m-1<n; i++){
		if(a[n-1-i]==0)continue;
		T r = (a[n-1-i]/b[m-1]) % mod;
		ans[n-m-i]=r;
		for(int j=0; j<m; j++){
			a[n-1-i-j]=(a[n-1-i-j]+mod-(r*b[m-1-j])%mod) % mod;
		}
	}
}

template<typename T>
void polynomial_multiplication(const vector<T> a, const vector<T> &b, T mod, vector<T> &ans){
	int n = a.size(), m = b.size();
	ans.assign(n+m-1,0);
	for(int i=0; i<m; i++){
		if(b[i]==0)continue;
		for(int j=0; j<n; j++){
			ans[i+j]=(ans[i+j]+a[j]*b[i]) % mod;
		}
	}
}

// LIBRARY END

ll p,a[3001],b[3001],A[3010];
vector<ll> ans;

void init(){
	cin>>p;
	rep(i,p)cin>>a[i];
}

int main(void){
	init();
	A[0]=a[0];
	reg(i,1,p-1){
		ll tmp = (a[i]+p-A[0])%p, t=1;
		reg(j,1,i-1){
			t = (t*(i+1-j)) % p;
			// cerr<<i<<","<<j<<": "<<t<<endl;
			tmp = (tmp + p - (t*A[j])%p)%p;
		}
		// cerr<<t<<": "<<tmp<<endl;
		A[i] = (tmp*modinv(t,p)) % p;
	}
	// rep(i,p)cerr<<A[i]<<endl;
	ans.assign(1,A[p-1]);
	ireg(i,0,p-2){
		polynomial_multiplication(ans,{p-i,1},p,ans);
		ans[0] = (ans[0] + A[i]) % p;
	}
	// Verification
	bool ok=true;
	rep(i,p){
		ll x=1,tmp=0;
		rep(j,p){
			tmp = (tmp+x*ans[j])%p;
			x=(x*i)%p;
		}
		if(tmp!=a[i])ok=false;
	}
	cerr<<(ok?"大丈夫":"ダメ")<<endl;
	// print the answer
	rep(i,ans.size())cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 512
from collections import Counter,defaultdict
import sys,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n,m = inpl()
a = inpl()
sum_a = sum(a)
bc = []
for i in range(m):
    b,c = inpl()
    bc.append([b,c])
a.sort()
bc.sort(key=lambda x:x[1],reverse=True)

start = 0
flag = True
for i,q in enumerate(bc):
    end = start+q[0]
    if end >= n:
        flag = False
        end = n
    for j in range(start,end):
        if a[j] < q[1]:
            a[j] = q[1]
        else:
            flag = False
            break
    start += q[0]
    if not flag:
        break
print(sum(a))

Measured memory_bytes: 26904
#include<bits/stdc++.h>
using namespace std;
char a;
int main()
{
	  cin>>a;
	  if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
	  {
	  	cout<<"vowel"<<endl;
	  }
	  else
	  cout<<"consonant"<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

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

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
    
    int n;
    vector<int> v(5);
    cin >> n;
    rep(i,5)
        cin >> v[i];  

    int mm = ceil(1.0 * n / *min_element(all(v)));
    cout << 4 + mm << '\n';
}

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

if K >= 2 ** M:
    print(-1)
elif K == 0:
    ans = []
    x = range(0, 2 ** M)
    y = range(0, 2 ** M)
    for xx, yy in zip(x, y):
        ans.append(xx)
        ans.append(yy)
    print(*ans)
else:
    t = 0
    for i in range(1, 2 ** M):
        if i == K: continue
        t ^= i
    if t == K:
        x = [i for i in range(0, 2 ** M) if i != K]
        ans = [K] + x + [K] + list(reversed(x))
        print(*ans)
    else:
        print(-1)


Measured memory_bytes: 66928
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

int main() {
  string s;
  cin >> s;
  cout << s.substr(0, s.size() - 8) << endl;
  return 0;
}


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

int N;
int L[50], T[50], R[50], B[50];

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

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

	while (cin >> N)
	{
		if (N == 0) return 0;

		rep(i, 0, N) cin >> L[i] >> T[i] >> R[i] >> B[i];

		map<int, int> comp_x, comp_y;
		rep(i, 0, N)
		{
			comp_x[L[i]] = 0;
			comp_x[R[i]] = 0;
			comp_y[T[i]] = 0;
			comp_y[B[i]] = 0;
		}

		int idx = 0;
		for (auto p : comp_x)
		{
			comp_x[p.first] = idx;
			idx++;
		}

		idx = 0;
		for (auto p : comp_y)
		{
			comp_y[p.first] = idx;
			idx++;
		}

		ll G[105][105];
		rep(y, 0, 105) rep(x, 0, 105) G[y][x] = 0;

		rep(i, 0, N)
		{
			int l = comp_x[L[i]];
			int r = comp_x[R[i]];
			int t = comp_y[T[i]];
			int b = comp_y[B[i]];

			rep(y, b, t) rep(x, l, r)
			{
				G[y + 1][x + 1] |= 1LL << i;
			}
		}

		/*rep(y, 0, 10)
		{
			rep(x, 0, 10) cout << G[9 - y][x] << " ";
			cout << endl;
		}*/

		bool done[105][105];
		rep(i, 0, 105) rep(j, 0, 105) done[i][j] = false;
		int ans = 0;
		rep(y, 0, 105) rep(x, 0, 105) if (!done[y][x])
		{
			ll c = G[y][x];
			ans++;

			queue<int> que;
			que.push(y * 1000 + x);
			while (!que.empty())
			{
				int q = que.front(); que.pop();

				int y = q / 1000;
				int x = q % 1000;

				if (done[y][x]) continue;
				done[y][x] = true;

				rep(i, 0, 4)
				{
					int yy = y + dy[i];
					int xx = x + dx[i];
					if (yy < 0 || 105 <= yy) continue;
					if (xx < 0 || 105 <= xx) continue;
					if (G[yy][xx] != c) continue;
					if (done[yy][xx]) continue;

					que.push(yy * 1000 + xx);
				}
			}
		}

		cout << ans << endl;
	}
}

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

int main() {
    long long int N, A, B;
    cin >> N >> A >> B;
    long long int ans = 0;

    if ((A - B) % 2 == 0) {
        cout << (B - A) / 2 << endl;
    }
    else {
        if ((A - 1) < (N - B)) {
            ans += A - 1;
            ans++;
            ans += (B - A - 1) / 2;
        }
        else {
            ans += N - B;
            ans++;
            ans += (B - A - 1) / 2;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
n=int(input())
s=input()
a=[0]*n
a[0]=s[1:].count("E")

for i in range(1,n):
  if s[i-1]=="E" and s[i]=="E":
    a[i]=a[i-1]-1
  if s[i-1]=="W" and s[i]=="E":
    a[i]=a[i-1]
  if s[i-1]=="E" and s[i]=="W":
    a[i]=a[i-1]
  if s[i-1]=="W" and s[i]=="W":
    a[i]=a[i-1]+1
print(min(a))

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int l = 1;
    for(int i = n - 2; i >= 0; i--){
        if(s[i] != s[i + 1]) break;
        l++;
    }
    int ans = 1;
    if(l == n){
        if(l % 3 == 0) ans = l * 2 / 3;
        else if(l % 3 == 1) ans = l * 2 / 3 + 1;
        else ans = l * 2 / 3;
        cout << ans << endl;
        return 0;
    }
    bool f = false;
    int i;
    for(i = 1; i < n - l; i++){
        if(s[i] == s[i - 1] && !f){
            i++;
            f = true;
        }
        else f = false;
        ans++;
    }
    l = n - i;
    if(l % 3 == 0) ans += l * 2 / 3;
    else if(l % 3 == 1) ans += l * 2 / 3 + 1;
    else ans += l * 2 / 3;
    cout << ans << endl;
}

Measured memory_bytes: 640
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    set<ll> start;
    set<ll> end;

    //vector<vector<ll>> v(tate,vector<ll> (yoko));
    cin>>n>>m;
    rep(i,m){
        cin>>a>>b;
        if(a==1) start.insert(b);
        else if(b==n) end.insert(a); 
    }
    for(auto itr=start.begin();itr!=start.end();++itr){
        if(end.find(*itr)!=end.end()){
            cout<<"POSSIBLE"<<endl;
            return 0;

        }
    }
    cout<<"IMPOSSIBLE"<<endl;


    return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = (int)1e9+7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI v(n), c(n);
	rep(i, n) cin >>v[i];
	rep(i, n) cin >>c[i];
	
	ll ans = -(1LL<<60);
	rep(i, 1<<n){
		ll X=0, Y=0;
		rep(j, n) if(i>>j &1){
			X+=v[j]; Y+=c[j];
		}
		//dbg(X,Y);
		ans = max(ans, X - Y);
	}
	
	cout << ans <<"\n";
	
	return 0;
}

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

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

fn main() {
    let mut h = read::<i64>();
    let mut w = read::<i64>();
    let n = read::<usize>();
    let mut sy = read::<i64>() - 1;
    let mut sx = read::<i64>() - 1;
    let mut seqs = vec![vec![]; 2];
    seqs[0] = read::<String>().chars().collect::<Vec<char>>();
    seqs[1] = read::<String>().chars().collect::<Vec<char>>();
    for _iter in 0..2 {
        let mut r = w;
        let mut l = 0;
        for i in (0..n).rev() {
            if seqs[1][i] == 'L' {
                r += 1;
                r = std::cmp::min(r, w);
            } else if seqs[1][i] == 'R' {
                l -= 1;
                l = std::cmp::max(l, 0);
            }
            if seqs[0][i] == 'L' {
                l += 1;
            } else if seqs[0][i] == 'R' {
                r -= 1;
            }
            if r <= l {
                println!("NO");
                return;
            }
        }
        if sx < l || r <= sx {
            println!("NO");
            return;
        }
        std::mem::swap(&mut h, &mut w);
        std::mem::swap(&mut sx, &mut sy);
        for i in 0..2 {
            for j in 0..n {
                seqs[i][j] = match seqs[i][j] {
                    'L' => 'U',
                    'R' => 'D',
                    'U' => 'L',
                    'D' => 'R',
                    _ => unimplemented!(),
                }
            }
        }
    }
    println!("YES");
}


Measured memory_bytes: 6524
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int N;

int main() {
    cin >> N;

    int ans = 0, keta;
    for (int i = 1; i <= N; i++) {
        keta = to_string(i).length();
        if (keta % 2 == 1) ans++;
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
ll a[e5];
ll dp1[301][200000];
ll dp2[301][200000];



ll max_a;
const ll zero = 100000;

ll sna = 0;
ll ans;

ll powl(ll x,ll r,ll mod = mod){
  ll ret = 1;
  for(;r != 0;r >>= 1){
    if(r&1 != 0) ret *= x,ret %= mod;
    x *= x,x %= mod;
  }
  return ret;
}


int main(){
  cin >> n;
  for(ll i = 1;i <= n;i++){
    cin >> a[i];
  }
  dp1[0][zero] = 1;
  max_a = 0;
  for(ll i = 1;i <= n;i++){
    for(ll j = -max_a;j <= max_a;j++){
      dp1[i][zero+j+a[i]] += dp1[i-1][zero+j]*2;
      dp1[i][zero+j-a[i]] += dp1[i-1][zero+j];

    }
    max_a += a[i];
    for(ll j = -max_a;j <= max_a;j++){
      dp1[i][zero+j] %= mod;
    }

  }
  dp2[0][zero] = 1;
  max_a = 0;
  for(ll i = 1;i <= n;i++){
    for(ll j = -max_a;j <= max_a;j++){
      dp2[i][zero+j+a[i]] += dp2[i-1][zero+j];
      dp2[i][zero+j-a[i]] += dp2[i-1][zero+j];
    }
    max_a += a[i];
    for(ll j = -max_a;j <= max_a;j++){
      dp2[i][zero+j] %= mod;
    }
  }
  for(ll i = 0;i <= zero;i++){
    sna += dp1[n][i];
    sna %= mod;
  }
  sna %= mod;
  sna *= 3;
  sna %= mod;
  sna -= ((dp2[n][zero]*3)%mod);
  sna = (sna+mod)%mod;
  ans = ((powl(3,n)-sna+mod)%mod);
  cout << ans << endl;
}


Measured memory_bytes: 940288
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
int n,a,b;
string s;
int early[200005],late[200005];
signed main()
{
	cin>>n>>a>>b>>s;
	int y=0;
	for (int i=0;i<a;i++){
		for (int j=y;;j++){
			if (s[j]=='o'){
				early[i]=j;
				break;
			}
		}
		y=early[i]+b+1;
	}
	y=n-1;
	for (int i=a-1;i>=0;i--){
		for (int j=y;;j--){
			if (s[j]=='o'){
				late[i]=j;
				break;
			}
		}
		y=late[i]-b-1;
	}
	for (int i=0;i<a;i++){
		if (early[i]==late[i]){
			cout<<late[i]+1<<endl;
		}
	}
	re 0;
}

Measured memory_bytes: 4996
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	map<string, int> M;
	int q;
	cin >> q;
	int query, x;
	string key;
	map<string, int>::iterator itr;
	string L, R;

	for (int i = 0; i < q; i++) {
		cin >> query >> key;
		if (query == 0) {
			cin >> x;
			itr = M.find(key);

			if (itr == M.end())
				M.insert(make_pair(key, x));
			else
				M[key] = x;
		}
		else if(query == 1){
			cout << M[key] << endl;
			if (M[key] == 0)
				M.erase(key);
		}	
		else if(query == 2){
			M.erase(key);
		}
		else {
			L = key;
			cin >> R;
			
			for (auto it = M.lower_bound(L); it != M.upper_bound(R); it++)
				cout << it->first << " " << it->second << endl;
		}
	}
}


Measured memory_bytes: 27768
//c problem
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
ll n,m,a,b;
ll quick(ll a,ll b){
	ll res=1,t=a;
	while(b){
		if(b&1)res=(res*t)%mod;
		t=(t*t)%mod;
		b>>=1;
	}
	return res;
}
ll jie[N],inv[N];
void init(){
	jie[0]=inv[0]=1;
	for(int i=1;i<N;i++)jie[i]=(jie[i-1]*i)%mod,inv[i]=quick(jie[i],mod-2);
}
ll c(ll a,ll b){
	return ((jie[b]*inv[a])%mod*inv[b-a])%mod;
}
int main()
{
	init(); 
	ll a,b,n,m;
	cin>>n>>m>>a>>b; 
	ll ans=0;
	for(int i=1;i<=n-a;i++){
		ll ans1=c(b-1,b+i-2); 
		ll ans2=c(m-b-1,n-i+m-b-1);
		ans=(ans+ans1*ans2)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6728
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

result = 0
best = float('inf')
for i in range(N):
    t = T - H[i] * 0.006
    if abs(A - t) < best:
        best = abs(A - t)
        result = i + 1
print(result)


Measured memory_bytes: 3060
while 1:
    a,s,b=input().split()
    a=int(a)
    b=int(b)
    if s=="?":
        break
    if s=="+":
        print(a+b)
    elif s=="-":
        print(a-b)
    elif s=="*":
        print(a*b)
    else:
        print(a//b)


Measured memory_bytes: 5596
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main(){
	string line;
	getline(cin, line);
	int i = 0;
	while(line[i] != '\0'){
		if(isupper(line[i])) cout << (char)tolower(line[i]);
		else cout << (char)toupper(line[i]);
		i++;
	}
	cout << '\n';
}



Measured memory_bytes: 3064
from collections import defaultdict
from collections import deque

N = int(input())

neighbor = defaultdict(dict)

for i in range(N-1):
    a, b, c = map(int, input().split())
    neighbor[a-1][b-1] = c
    neighbor[b-1][a-1] = c

Q, K = map(int, input().split())
K -= 1

dp = [-1] * N

d = deque()
d.append((K, 0, -1))

while d:
    i, cost, parent = d.pop()

    dp[i] = cost

    for j, c in neighbor[i].items():
        if j != parent:
            d.append((j, cost+c, i))

for i in range(Q):
    x, y = map(int, input().split())
    print(dp[x-1] + dp[y-1])


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

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

if(a!=1&&b!=1){
	cout<<"1";}

if(a!=2&&b!=2){
		cout<<"2";}

if(a!=3&&b!=3){
			cout<<"3";

		}





	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <functional>
#include <string>
#include <iostream>
using namespace std;
using ll = long long;

int n, cnt[200010];
string s[200010];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		cin >> s[i];
	sort(s, s + n);

	int max_c = 1;
	for (int i = 0; i < n; i++) {
		if (i == 0 || s[i - 1] != s[i])
			cnt[i] = 1;
		else
			max_c = max(max_c, cnt[i] = cnt[i - 1] + 1);
	}
	for (int i = 0; i < n; i++)
		if (cnt[i] == max_c)
			cout << s[i] << endl;
}

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

using namespace std;

const int limit = 7369791;

int main()
{
  int M, N;
  bool dp[limit + 1];

  while(cin >> M >> N, M) {
    memset(dp, false, sizeof(dp));
    for(int i = M; i <= limit; i++) {
      if(!dp[i]) {
        if(--N < 0) {
          cout << i << endl;
          break;
        }
        for(int j = i + i; j <= limit; j += i) dp[j] = true;
      }
    }
  }
}

Measured memory_bytes: 10256
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define pb push_back
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef std::pair<int,int> P;
#define mk std::make_pair
#define fr first
#define sc second
inline int in()
{
	int k=0;char ch=gt;bool p=1;
	while(ch<'-')ch=gt;if(ch=='-')ch=gt,p=0;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return p?k:-k;
}
const int N=4e5+5;
ll ans=1e18;
int x[N],y[N],n,Mx,Mi,mx,mi,fz[N<<1],tot;
std::vector<int>G[N<<1];
inline void upd(int x,int i){if(x>Mx)Mx=x,mx=i;if(x<Mi)Mi=x,mi=i;}
inline void work1()
{
	int Lmx=-1e9,Rmx=-1e9,Lmi=1e9,Rmi=1e9;
	for(int i=1;i<=n;++i)
	{
		Lmx=std::max(Lmx,x[i]);
		Lmi=std::min(Lmi,x[i]);
		Rmx=std::max(Rmx,y[i]);
		Rmi=std::min(Rmi,y[i]);
	}
	ans=std::min(ans,(ll)(Lmx-Lmi)*(Rmx-Rmi));
}
inline void work2()
{
	if(mi==mx)return;
	for(int i=1;i<=n;++i)fz[++tot]=x[i],fz[++tot]=y[i];
	std::sort(fz+1,fz+tot+1);tot=std::unique(fz+1,fz+tot+1)-fz-1;
	int mmi=std::min(y[mx],x[mi]),mmx=y[mx]+x[mi]-mmi;
	for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)mmi=std::min(mmi,x[i]),mmx=std::max(mmx,y[i]);
	int l=std::lower_bound(fz+1,fz+tot+1,mmi)-fz;
	for(int i=1;i<=n;++i)if(i!=mx&&i!=mi)G[std::lower_bound(fz+1,fz+tot+1,y[i])-fz].pb(i);
	for(int j:G[1])mmx=std::max(mmx,x[j]);
	for(int i=2;i<=l;++i)
	{
		ans=std::min(ans,(ll)(Mx-Mi)*(mmx-fz[i]));
		for(int j:G[i])mmx=std::max(mmx,x[j]);
	}
}
int main()
{
	n=in();Mx=-2e9,Mi=2e9;
	for(int i=1;i<=n;++i)
	{
		upd(x[i]=in(),i),upd(y[i]=in(),i);
		if(x[i]<y[i])std::swap(x[i],y[i]);
	}
	work1(),work2();printf("%lld\n",ans);
	return 0;
}


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

int main(){
    int N;
    std::cin >> N;
    std::vector< int > A(N);
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    
    std::vector< bool > b(N, false);
    std::vector< bool > s(N, false);
    
    int best = 1e9;
    bool up = false;
    for(int i=0; i<N; i++){
        if(!up && best > A[i]){
            best = A[i];
        }else if(!up && best < A[i]){
            b[i-1] = true;
            up = true;
            best = A[i];
        }else if(up && best < A[i]){
            best = A[i];
        }else if(up && best > A[i]){
            s[i-1] = true;
            up = false;
            best = A[i];
        }
    }
    if(up){
        s[N-1] = true;
    }
    
    int buy;
    long long money = 1000;
    for(int i=0; i<N; i++){
        if(b[i]){
            buy = A[i];
        }else if(s[i]){
            money = (money / buy) * A[i] + (money % buy);
        }
    }
    
    std::cout << money << std::endl;
    
    
    return 0;
    
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

template <typename T> T gcd(T a, T b) { while (a) { b %= a; swap(a, b); } return b; }
template <typename T> T lcm(T a, T b) { return a / gcd(a,b) * b; }

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

    int A, B;
    cin >> A >> B;

    int ans = lcm(A, B);
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int main() {
  long int A, B, r, tmp, x;
  cin >> A >> B;
  x = A * B;
  if(A < B){
    tmp = A;
    A = B;
    B = tmp;
  }
    r = A % B;
    while(r != 0){
      A = B;
      B = r;
      r = A % B;
    }
  cout << x / B;
}

Measured memory_bytes: 256
#include <utility>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <numeric>
#include <limits>
#include <queue>
#include <cstdint>
#include<iomanip>
#define ll long long int
#define rep(i,rept) for (int (i) = 0; (i) < rept; (i)++)
#define Yes(b) std::cout<< (b ? "Yes" : "No")<<std::endl
#define YES(b) std::cout<< (b ? "YES" : "NO")<<std::endl
#define fr first
#define se second
#define lolo 92233720368547757
#define susu 1000000007
typedef std::pair<int, int> pp;
typedef std::pair<ll, ll> llpp;
using namespace std;
bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}
int main() {
	int n;
	cin >> n;
	rep(i,11111) {
		if (IsPrime(i * 5 + 1)) {
			cout << i * 5 + 1;
			n--;
			if (n > 0) {
				cout << " ";
			}
			else {
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,x,sum;
    int count = 0;
    
    while(1){
        cin >> n >> x;
        if(n==0 && x == 0)break;
        else{
            for(int i=1;i<=n;i++){
                for(int j=0;j<=n;j++){
                    for(int k=0;k<=n;k++){
                        sum = i+j+k;
                        if(i<j && j<k && sum == x){
                            count = count + 1;
                            sum = 0;
                        }else{
                            sum = 0;
                        }
                    }
                }
            }
        }
        
        cout << count << endl;
        count = 0;
    }
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int a,b;
  cin >> a >>b;
  int c,d;
  cin >> c >>d;
  cout << (a-c)*(b-d) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <algorithm>
#include <array>

int main() {
  std::array<std::int_fast32_t, 3> packs;
  std::cin >> packs[0] >> packs[1] >> packs[2];
  std::sort(packs.begin(), packs.end());
  std::cout << (packs[0] + packs[1] == packs[2] ? "Yes" : "No") << std::endl;
  return 0;
}

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

Measured memory_bytes: 256
# Your code here!

a,b,c,d=gets.split
a=a.to_i
b=b.to_i
c=c.to_i
d=d.to_i


w=c-a
h=d-b


array=[]

h.times{
    array<<"U"}
w.times{
   array<<"R" }

h.times{
    array<<"D"
    
}
w.times{
   array<<"L" 
    
}

array<<"L"

(h+1).times{
    
    array<<"U"
}
(w+1).times{
    
    array<<"R"
}
array<<"D"
array<<"R"

(h+1).times{
    
    array<<"D"
}
(w+1).times{
    array<<"L"
}

array<<"U"

puts array.join









Measured memory_bytes: 2428
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


signed main() {
  fio();
  int n, x;
  cin >> n >> x;
  vi l(n);
  rep (i, n) {
    cin >> l[i];
  }
  int ans = 1;
  int now = 0;
  rep (i, n) {
    now += l[i];
    if (now <= x) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#define R 1
#define U 0
using namespace std;
int w,h;
int c[60][60];

void rec(int x,int y){
  if( x<0 || x>=h ) return;
  if( y<0 || y>=w ) return;
  if( c[x][y]==U )  return;

  c[x][y]=U;
  for( int i=-1;i<=1;i++ ){
    for( int j=-1;j<=1;j++ ){
      if( i==j && i==0 ) continue;
      rec( x+i,y+j );
    }
  }
}

int main(){
  while( cin>>w>>h && (w|h) ){
    for( int i=0;i<h;i++ )
      for( int j=0;j<w;j++ )
	cin >> c[i][j];
    int ans=0;
    for( int i=0;i<h;i++ ){
      for( int j=0;j<w;j++ ){
	if( c[i][j]==R ){
	  ans++;
	  rec( i,j );
	}
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <map>
#include <list>
#include <math.h>

using namespace std;

int main() {
  long long N;
  cin >> N;

  int res;
  for(int i = 1; i <= sqrt(N); ++i){
    if(N % i == 0){
      if(N / i < i){
        res = i;
      }else{
        res = N / i;
      }
    }
  }
  string s = to_string(res);
  cout << s.size() << endl;
}



Measured memory_bytes: 3716
def judge_prime(x):
    is_prime=True
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            is_prime=False
    return is_prime

n=int(input())
ans=0
for i in range(n):
    x=int(input())
    if judge_prime(x):
        ans+=1
print(ans)


Measured memory_bytes: 5712
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 100010
vector<int> g[N];
int n, x;
bool ok;
int r = 0;
bool used[N];

int dfs(int u){
	used[u] = true;
	multiset<int> d;
	for(auto v: g[u]){
		if(used[v]) continue;
		int t = dfs(v)+1;
		d.insert(t);
		if(!ok) return INF;
	}
	if(d.size()%2==0) d.insert(0);

	while(d.size()>1){
		auto it = d.end(); --it;
		if(it!=d.begin() && *d.begin()+*it>x) --it;
		int k = *it;
		d.erase(it);
		auto it2 = d.upper_bound(x-k);
		if(it2==d.begin()){
			ok = false;
			break;
		}
		--it2;
		d.erase(it2);
	}
	if(*d.begin()>x) ok = false;
	used[u] = false;
	return *d.begin();
}

int main(){
	cin>>n;
	rep(i, n-1){
		int u, v;
		cin>>u>>v; u--; v--;
		g[u].push_back(v); g[v].push_back(u);
	}
	int resa = 0, resb = 0;
	rep(i, n){
		resa += (g[i].size()-1)/2;
		resb += g[i].size()%2;
		if(g[i].size()==1) r = i;
	}
	resa++; resb /= 2;
	if(resa!=resb) return -1;
	int lb = -1, ub = n;
	while(ub-lb>1){
		x = (lb+ub+1)/2;
		ok = true;
		mset(used, 0);
		dfs(r);
		(ok?ub:lb)=x;
	}
	cout<<resb<<" "<<ub<<endl;
	return 0;
}


Measured memory_bytes: 15232
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

main = do
  [n] <- readInt
  a <- readInt
  b <- readInt
  c <- readInt
  print $ solve a b c

solve a b c = ans
  where
    a' = V.fromList $ sort a
    b' = sort b
    c' = V.fromList $ sort c
    ans =
      sum $
      map
        (\bb -> fst (lowerBound a' (-1) (V.length a') bb) * (V.length c' - fst (upperBound c' (-1) (V.length c') bb)))
        b'

lowerBound xs s e key
  | e - s == 1 = (e, xs V.!? e)
  | xs V.! mid < key = lowerBound xs mid e key
  | otherwise = lowerBound xs s mid key
  where
    mid = (s + e) `div` 2

upperBound xs s e key
  | e - s == 1 = (e, xs V.!? e)
  | xs V.! mid <= key = upperBound xs mid e key
  | otherwise = upperBound xs s mid key
  where
    mid = (s + e) `div` 2


Measured memory_bytes: 39292
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#define nmax_def 110
using namespace std;
typedef long long ll;

int main() {
	int i, j;
	int N, D;
	int ans = 0;
	int X[nmax_def][nmax_def];
	cin >> N >> D;
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < D; j++)
		{
			cin >> X[i][j];
		}
	}
	for (i = 0; i < N; i++)
	{
		for (j = i + 1; j < N; j++)
		{
			int dist2 = 0;
			for (int d = 0; d < D; d++)
			{
				int disttmp = pow(X[i][d] - X[j][d], 2);
				dist2 += disttmp;
			}
			int dist = sqrt(dist2);
			if (dist * dist == dist2)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

easy = True
N = len(S)
for i in range(N):
    if (i+1)%2 == 1:
        if S[i] == "L":
            easy = False
            break
    else:
        if S[i] == "R":
            easy = False
            break
            
if easy:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int x;
    cin >> x;
    if (x < 600) cout << 8 << endl;
    else if (x < 800) cout << 7 << endl;
    else if (x < 1000) cout << 6 << endl;
    else if (x < 1200) cout << 5 << endl;
    else if (x < 1400) cout << 4 << endl;
    else if (x < 1600) cout << 3 << endl;
    else if (x < 1800) cout << 2 << endl;
    else if (x < 2000) cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  int N;
  cin >> N;
  int t[N+1], x[N+1], y[N+1];
  t[0] = x[0] = y[0] = 0;
  rep(i, 0, N) cin >> t[i+1] >> x[i+1] >> y[i+1];

  rep(i, 1, N+1) {
    int diff_t  = t[i] - t[i-1];
    int dist    = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
    if ((dist > diff_t) || (dist%2 != diff_t%2)) {
      cout << "No" << "\n";
      return;
    }
  }
  cout << "Yes" << "\n";
}

Measured memory_bytes: 1408