akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<endl
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

ll calc(ll k,ll d) {
  return k*(k+1)/2*d;
}

const ll n=26;
ll c[n],q[444];
ll a[444][n];
set<ll> s[n];

ll solve(ll x,ll y) {
  ll ans=0;
  {
    ans-=a[x][q[x]];
    iter(s[q[x]]) it2=s[q[x]].lower_bound(x);
    iter(s[q[x]]) it1=it2,it3=it2;it1--,it3++;
    ans+=calc(*it2-*it1-1,c[q[x]]);
    ans+=calc(*it3-*it2-1,c[q[x]]);
    ans-=calc(*it3-*it1-1,c[q[x]]);
    s[q[x]].erase(it2);
  }
  {
    q[x]=y;
    s[q[x]].in(x);
    ans+=a[x][q[x]];
    iter(s[q[x]]) it2=s[q[x]].lower_bound(x);
    iter(s[q[x]]) it1=it2,it3=it2;it1--,it3++;
    ans-=calc(*it2-*it1-1,c[q[x]]);
    ans-=calc(*it3-*it2-1,c[q[x]]);
    ans+=calc(*it3-*it1-1,c[q[x]]);
  }
  return ans;
}

         
void Main() {
  srand((unsigned)time(NULL));
  int T;
  R T;
  rep(i,n) R c[i];
  rep(i,T)rep(j,n) R a[i][j];
  rep(i,n) s[i].in(-1),s[i].in(T);
  ll ans[T];
  mem(ans);
  rep(k,T) {
    ll M=0,x=0;
    rep(i,n) {
      if(M<a[k][i]) {
        M=a[k][i];
        x=i;
      }
    }
    q[k]=x;
    s[x].in(k);
    ans[k]=x;
  }
  clock_t t2=clock();
  for(int tt=0;;tt++) {
    ll e[2][3],sum=0;
    rep(i,1) {
      ll x=rand()%T,y=rand()%n;
      e[i][0]=q[x],e[i][1]=x,e[i][2]=y;
      sum+=solve(x,y);
    }
    if(sum<0) {
      rrep(i,1) {
        int x=e[i][1];
        s[q[x]].erase(x);
        q[x]=e[i][0];
        s[q[x]].in(x);
      }
    } else {
      rep(i,1) ans[e[i][1]]=e[i][2];
    }
    clock_t t3=clock();
    double t4=(double)(t3-t2)/CLOCKS_PER_SEC;
    if(tt>=2&&(double)t3/CLOCKS_PER_SEC+t4*2>1.900) break;
    t2=t3;
  }
  rep(i,T) pr(ans[i]+1);
}

int main(){Main();return 0;}


Measured memory_bytes: 3736
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cout<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}


using int64 = long long;
using P = pair<int64,int64>;


int main() {
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		String x = "";
		try {
			while ((x = in.readLine()).equals("0") == false) {
				int n = Integer.parseInt(x);
				String[] data = in.readLine().split(" ");
			
				double sum = 0;
				
				int[] score = new int[n];
				for (int i = 0; i < n; i++) {
					score[i] = Integer.parseInt(data[i]);
					sum = sum + score[i];
				}
				
				double m = sum / n;
				sum = 0;
				for (int i = 0; i < n; i++) {
					sum = sum + (score[i] - m) * (score[i] - m);
				}
				System.out.println(Math.sqrt(sum / n));
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24948
/**
 *    author:  FromDihPout
 *    created: 2020-08-08
**/

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == n) {
                cout << "Yes" << '\n';
                return 0;
            }
        } 
    }
    cout << "No" << '\n';
    return 0;
}

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

const ULL M = 1000000007;

ULL powm(ULL a, ULL i) {
    if (!i) return 1;
    if (i & 1) return powm(a * a % M, i >> 1) * a % M;
    return powm(a * a % M, i >> 1);
}

ULL F[10001], I[10001], iF[10001];

ULL C(ULL n, ULL r) { return F[n] * iF[r] % M * iF[n - r] % M; }
ULL P(ULL n, ULL r) { return F[n] * iF[n - r] % M; }
ULL H(ULL n, ULL r) { return C(r + n - 1, n - 1); }

struct Problem {

    void Solve() {
        F[0] = 1; for (UL i = 1; i <= 10000; i++) F[i] = F[i - 1] * i % M;
        I[1] = 1; for (UL i = 2; i <= 10000; i++) I[i] = M - M / i * I[M % i] % M;
        iF[0] = 1; for (UL i = 1; i <= 10000; i++) iF[i] = iF[i - 1] * I[i] % M;
        ULL N, K; cin >> N >> K;
        if (N < K) { cout << 0 << endl; return; }
        ULL ans[1001]; ans[0] = 0;
        for (UL i = 1; i <= K; i++) {
            ans[i] = powm(i, N);
            rep(j, i) ans[i] += (M - ans[j]) * C(i, j) % M;
            ans[i] %= M;
        }
        cout << ans[K] << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    p->Solve();
    return 0;
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

std::map<ll, ll> prime_factor(ll n) {
	std::map<ll, ll> res;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

class mint {
private:
	long long x;

public:
	mint(long long 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*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(long long t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

	friend std::ostream& operator<<(std::ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

struct combination {
    vector<mint> fact, ifact;

    combination(int n)
        :fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
        {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
        {
            ifact[i - 1] = ifact[i] * i;
        }
    }

    mint nCk(int n, int k)
    {
        if (k < 0 || k > n)
        {
            return 0;
        }
        return fact[n] * ifact[k] * ifact[n - k];
    }

    mint nHk(int n, int k)
    {
        return nCk(n + k - 1, k);
    }
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, m;
	cin >> n >> m;

	combination comb(1000000);
	auto primefactor = prime_factor(m);

	mint ans = 1;
	for (auto pf : primefactor) {
		int k = pf.second;
		ans *= comb.nCk(k + n - 1, n - 1);
	}

	out(ans);

	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    ll z = 1;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        bool y = 0;
        for (int j = 2; j < i; j++) if (i % j == 0) y = 1;
        if (!y) {
            int c = 0;
            for (int k = i; k <= n; k += i) {
                int d = k;
                while (d % i == 0) d /= i, c++;
            }
            z = z * (c + 1) % mod;
        }
    }
    cout << z;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string debug_string(const string& s) {
	return '"' + s + '"';
}
string debug_string(bool b) {
	return (b ? "true" : "false");
}
string debug_string(const char* s) {
	return debug_string((string)s);
}
template<class T, class U>
string debug_string(const pair<T, U>& p);
template<class U>
struct can_be_string {
	template<typename...>
	static int f(...) {
		return 0;
	}
	template<typename T>
	static char f(decltype(to_string(T()), char())) { 
		return 'a';
	}
	static const bool value = sizeof(f<U>(char())) == sizeof(char);
};
template<class T> 
typename enable_if<can_be_string<T>::value, string>::type debug_string(const T& a) {
	string s = to_string(a);
	return s;
}
template<class T>
typename enable_if<!can_be_string<T>::value, string>::type debug_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += debug_string(x);
	}
	s += "}";
	return s;
}
template<class T, class U>
string debug_string(const pair<T, U>& p) {
	string s = "(";
	s += debug_string(p.first);
	s += ", ";
	s += debug_string(p.second);
	s += ")";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << debug_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 1e18l + 100;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	vector<int> b(n - 1);
	for (int i = 0;i < n - 1;++i) {
		cin >> b[i];
	}
	int answer = 0;
	for (int i = 0;i < n;++i) {
		if (i == 0) {
			answer += b[i];
		}
		else if (i == n - 1) {
			answer += b[i - 1];
		}
		else {
			answer += min(b[i], b[i - 1]);
		}
	}
	cout << answer << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
using namespace std;

typedef long long int ll;

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	string st;
	cin >> st;
	ll ans = 0;
	stack<char> stc;
	for(ll i=0; st[i]; i++){
		if(stc.empty())
			stc.push(st[i]);
		else if(stc.top() != st[i]){
			ans ++;
			stc.pop();
		}
		else
			stc.push(st[i]);
	}
	cout << ans*2;
	return 0;
}

Measured memory_bytes: 3764
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, M, C) = read!(usize, usize, i64);
    let B = read![[i64]];
    let T = read![[i64]; N];

    let mut count = 0;
    for y in 0..N {
        let mut sum = C;
        for x in 0..M {
            sum += T[y][x] * B[x];
        }

        if sum > 0 {
            count += 1;
        }
    }
    println!("{}", count)
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    string a, b;
    cin >> a >> b;
    if(a.size() > b.size()) cout << "GREATER" << endl;
    else if(a.size() < b.size()) cout << "LESS" << endl;
    else{
        REP(i, a.size()){
            if(a[i] > b[i]){
                cout << "GREATER" << endl;
                exit(0);
            }
            else if(b[i] > a[i]){
                cout << "LESS" << endl;
                exit(0);
            }
        }
        cout << "EQUAL" << endl;
    }

}

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    int c=-1;
    for(int i=0;i<s.size();i++){
        if(s[i]=='C'){
            c=i;
            break;
        }
    }
    if(c==-1){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=c;i<s.size();i++){
        if(s[i]=='F'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
from copy import deepcopy
def toCount(L):
    return [ 1 if i == "#" else 0 for i in L]
    
def resolve():
    H,W,K = map(int,input().split())
    C=[toCount(input()) for i in range(H)]
    count = 0

    rc = list(BitSeacher(H))

    for rows in rc:
        for cc in range(2**W):
            
            cols = bst(cc,W)

            TC = deepcopy(C)
            for i in rows:
                TC[i]=[0]*W
            for i in cols:
                for j in range(H):
                    TC[j][i]=0

            if K==sum(map(sum,TC)):
                count +=1

    print(count)

def bst(val,bitcount):
        ans =[]
        flg =1
        for i in range(bitcount):
            if flg & val != 0:
                ans.append(i)
            flg = flg.__lshift__(1)
        return ans


class BitSeacher:
    def __init__(self,bitcount):
        self.counter =0
        self.bitcount = bitcount
        self.mx = 2**bitcount-1
    
    def __next__(self):
        if self.counter > self.mx:
            raise StopIteration()
        ans =[]
        flg =1
        for i in range(self.bitcount):
            if flg & self.counter != 0:
                ans.append(i)
            flg = flg.__lshift__(1)
        self.counter+=1
        return ans

    def __iter__(self):
        return self

resolve()

Measured memory_bytes: 75128
n, k = map(int, input().split())
cnt = [0] * (n+1)

for _ in range(k):
    d = int(input())
    a = map(int, input().split())
    for a_i in a:
        cnt[a_i] += 1

ans = 0
for i in cnt:
    if i == 0:
        ans += 1

print(ans-1)

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

using namespace std;

int main(){
    long long int a, b, k;
    cin>>a>>b;
    if((a+b)%2==0){
        k=(a+b)/2;
        cout<<k<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  for (int i = 1; i <= b; i++) {
    if (a * i % b == c) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


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

int main(){
    int h,w;
    int start = 1;
    while(1){
        scanf("%d %d",&h,&w);
        if(start)start = 0;
        else putchar('\n');
        if(h==0 && w == 0)break;
        for(int i = 0 ; i <h ;i++){
            for(int j = 0; j < w;j++)
                putchar('#');
            putchar('\n');
        }
    }
    
    return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#define lli long long int
#include<climits>
#include<unordered_map>
#include<algorithm>
#include<bitset>
#include<map>
#define pb push_back
using namespace std;

int main()
{
    lli n,w;
    cin>>n>>w;
    vector<lli>val(n);
    vector<lli>wt(n);
    
    for(lli i=0;i<n;i++){
        cin>>wt[i];
        cin>>val[i];
    }
    
    vector<vector<lli>>dp(n,vector<lli>(w+1,0));
    
    lli i,j;
    for(i=n-1,j=0;j<=w;j++) if(j+wt[i]<=w) dp[i][j]=val[i];
    
    for(i=n-2;i>=0;i--)
    {
        for(j=0;j<=w;j++)
        {
            if(j+wt[i]<=w)
                dp[i][j] = max(val[i]+dp[i+1][j+wt[i]],dp[i+1][j]);
            else
                dp[i][j] = dp[i+1][j];
        }
    }
    
    
    cout<<dp[0][0]<<endl;
    
}




Measured memory_bytes: 82332
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main { 

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int numberCount = Integer.parseInt(sc.nextLine());
    	
    	Map<String,Long> map = new HashMap<>();
    	long result = 0;
    	for(int i = 1;i<=numberCount;i++) {
    		String eachLine = sc.nextLine();
    		char[] charLine = eachLine.toCharArray();
    		Arrays.sort(charLine);
    		String sortedLine = new String(charLine);
    		
    		if(map.containsKey(sortedLine)) {
    			long tmp = map.get(sortedLine)+1;
    			result = result + tmp;
    			map.put(sortedLine, tmp);
    		}else {
    			map.put(sortedLine, 0l);
    		}
    		
    		
    	}
    	System.out.println(result);
    	
	}
}

Measured memory_bytes: 103708
import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B

getNum :: IO Int
getNum = fst . fromJust . B.readInt <$> B.getLine

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

main :: IO ()
main = do
    [a,b] <- getNums
    print . length $ filter isParindrome [a..b]

isParindrome :: Int -> Bool
isParindrome n = let
    [a1,a2,_,a4,a5] = show n
    in a1 == a5 && a2 == a4

Measured memory_bytes: 892
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	// 全部のカード
	public static ArrayList<tramp> tramp_all = new ArrayList<tramp>();

	public static void main(String[] args) {

		//
		int taro_card_number = 0;
		String[] array_name = { "S", "H", "C", "D" };

		// トランプの各マークの配列を作る//
		for (String val : array_name) {
			tramp hoge = new tramp();
			hoge.setMark(val);
			tramp_all.add(hoge);
		}

		// テキスト入力
		Scanner sc = new Scanner(System.in);
		// タローが持っているカードの数
		while (sc.hasNext()) {
			taro_card_number = sc.nextInt();

			// ループ処理(カードの数だけ回す)
			for (int i = 0; i < taro_card_number; i++) {

				// マーク
				String design = sc.next();
				// 数
				int number = sc.nextInt();

				for (tramp val : tramp_all) {

					// マークの指定に従い、数字を配列に格納
					if (design.equals(val.getMark())) {
						//
						int[] hoge = val.getCard();
						hoge[number - 1] = 1;
					}
				}

			}
			// //配列に入力情報が格納されたので、入力情報にないものをピックアップして出力

			// スペードから順にないものを出力
			for (tramp val : tramp_all) {
				// ないものをピックアップ
				for (int i = 0; i < 13; i++) {
					if (val.getCard()[i] == 0) {
						System.out.println(val.getMark() + " " + (i + 1));
					}
				}
			}

		}
	}

}

// それぞれのマークについて扱う
class tramp {

	// マーク名
	private String mark = "";

	// 各マークのカードを作る
	private int[] card = new int[13];

	// セッター
	public void setMark(String m) {
		mark = m;
		// tramp_all.add(m);
	}

	// ゲッター
	public String getMark() {
		return mark;
	}

	public int[] getCard() {
		return card;
	}

}

Measured memory_bytes: 18240
#include "bits/stdc++.h"

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

using namespace std;

long long gcd(long long a, long long b){
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}


int main() {
	string S, T;
	cin >> S >> T;
	cout << T + S;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

dp = [0] * (n + 1)
dp[0] = 2
dp[1] = 1

def l(n):
    if dp[n] != 0:
        return dp[n]
    else:
        dp[n] = l(n-1) + l(n-2)
        return dp[n]

print(l(n))


Measured memory_bytes: 61884
{-# LANGUAGE BangPatterns #-}

main :: IO ()
main = do
    cs <- getLine
    print $ solve cs

solve :: String -> Int
solve = go 0
  where
    go !acc (x:y:z:xs)
        | x == y = go (acc + 2) xs
        | otherwise = go (acc + 1) (y:z:xs)
    go acc [x, y]
        | x == y = acc + 1
        | otherwise = acc + 2
    go acc [x] = acc + 1
    go acc [] = acc


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

int main() {
  int a, b;
  string op;
  cin >> a >> b;
  
  if (a * b % 2 == 1){
    cout << "Odd" << endl;
  }
  if (a * b % 2 == 0){
    cout << "Even" << endl;
  }
}
  


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

using namespace std; 

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef set <int> st;
typedef set <char> stc;
typedef vector<int>::iterator itr;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sq(a) a*a
#define cu(a) (sq(a)*a)


const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int inf = 1e9+9;
const ll INF = 1e18;

int main() 
{ 
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    
    int n;
    
    cin >> n;
    map < string , int > m;
    string s;
    string a[maxn];
    f0(n){
    	
    	cin >> a[i];
    	m[a[i]]++;
    	
	}
	
	//sort(m.cbegin(), m.cend());
    
    
    vector < string > v;
    
    int big = -1*inf;
    for (auto x : m) {
     
	 big = max ( big , x.ss);
	  
    }
    int p = 0;
	for (auto x : m) {
     
	if(x.ss == big) v.pb(x.ff), p++;
	  
    }
    string tem;
    sort(v.begin(),v.end());
 //   for(int i = 0; i < p-1; ++i)
    
  //     for(int j = i+1; j < p; ++j) {
       	
  //    if(v[i] > v[j]) {
      	
      	
    //     tem = v[i];
         
   //      v[i] = v[j];
   //      v[j] = tem;
         
  //    }
  // }
   
   f0(v.size()) cout << v[i] << endl;
		
    //	if(small < u.ss){
    		
    //		v.clear();
    //		small = u.ss;
    //		v.pb(u.ff);
    		
	//	}    	
//	}
    
    
    
    
    return 0; 
    
}






Measured memory_bytes: 27120
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt(), b = scanner.nextInt();
		String operator;

		if (a < b)
			operator = "<";
		else if (a > b)
			operator = ">";
		else
			operator = "==";

		System.out.println("a " + operator + " b");
	}
}

Measured memory_bytes: 26244
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
typedef long long ll;
using namespace std;
#define int long long
#define mod 1000000007

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}

//互除法
ll gcd(ll a, ll b) {
	if (a < b) {
		return gcd(b, a);
	}
	else if (a%b) {
		return gcd(b, a%b);
	}
	else {
		return b;
	}
}

//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow

}

//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor(int n) {
	map<int, int> res; // map[i]:=ｎを素因数分解したときiは何乗か。
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n] = 1;
	return res;
}

//Ｏ(√n)
//素因数分解
map<int, int> prime_factor_ver2(int n, map<int, int> res) {
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) {
				res[i]++;
				n /= i;
			}
		}
	}
	if (n != 1)
		res[n]++;
	return res;
}


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

	int N, A, B;
	int ans = 0;
	cin >> N >> A >> B;
	
	vector<int> X(N);
	for (int i = 0; i < N; i++)
	{
		cin >> X[i];
	}

	for (int i = 1; i < N; i++)
	{
		ans += min((X[i] - X[i - 1])*A, B);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
# coding: utf-8
a = list(map(int, input().split(" ")))
x = a[0] - 1
y = a[1] - x
z = x * 2 + 1
p = y

for i in range(z):
    if i > 0:
        print(" ", end="")
    print(p, end="")
    p = p + 1

Measured memory_bytes: 38256
N = int(input())
AB = []
for _ in range(N):
    AB.append(tuple(map(int, input().split())))

AB = sorted(AB, key = lambda el:sum(el), reverse = True)
#print(AB)

ans = 0
for i in range(0, N):
    if i % 2 == 0:
       ans += AB[i][0]
    else:
        ans -= AB[i][1]
print(ans)


Measured memory_bytes: 22160
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x * y / GCD(x, y);}

int main(){
  string s; cin>>s;
  ll x=0,y=0;
  rep(i,s.size()){
  if(i%2==0){
  if(s[i]!='0') x++;
  else if(s[i]!='1') y++;
  }
    else {
  if(s[i]!='1') x++;
  else if(s[i]!='0') y++;
  }
  }
  cout<<min(x,y)<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

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

    int ans = min(a, k);
    k -= a;
    k -= b;
    if (k > 0)
    {
        ans -= k;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		switch (sc.nextInt() % 10) {
		case 2:
		case 4:
		case 5:
		case 7:
		case 9:
			System.out.println("hon");
			break;
		case 0:
		case 1:
		case 6:
		case 8:
			System.out.println("pon");
			break;
		case 3:
			System.out.println("bon");
		}
	}

}


Measured memory_bytes: 35828
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

double n;
double k;

int main(){
    cin >> n >> k;
    double ans = 0;
    for(double i = 1; i <= n; i++){
        int pw = 0;
        while(i*pow(2 , pw) < k){
            pw++;
        }
        ans += 1/pow(2 , pw);
    }
    ans *= 1/n;
    cout << fixed << setprecision(9) << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
char = "".join(chr(97+i) for i in range(n))


def dfs(s, idx):
    if len(s) == n:
        print(s)
    else:
        for i in range(idx):
            if i+1 != idx:
                dfs(s+char[i], idx)
            else:
                dfs(s+char[i], idx+1)


dfs("a", 2)

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int,int> > pint;
    rep(i,n){
        int d,v;
        cin >> d >> v;
        pint.push_back(make_pair(d,v));
    }
    sort(pint.begin(),pint.end());
    priority_queue<int> q; 
    long long ans = 0;
    int j = 0;
    for(int i = 1; i <= m; i++){
        while(pint[j].first <= i){
            if(j < n){   
                q.push(pint[j].second);
                j++;
            }else{
                break;
            }
        }
        if(!q.empty()){
            ans+= q.top();q.pop();
        }
    }

    cout << ans << endl;   
}

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

int main() {
    int X,Y,Z;
    cin >> X >> Y >> Z;
    
    int T;
    T = X;
    X = Y;
    Y = T;

    T = X;
    X = Z;
    Z = T;
    cout << X << " " << Y << " " << Z << endl;
}


Measured memory_bytes: 256
from collections import deque
S = list(input())
Q = int(input())
ans = deque(S)
a = 1
for i in range(Q):
    q = input()
    if q == '1':
        a *= -1
    else:
        d, f, c = q.split()
        if f == '1':
            if a == 1:
                ans.appendleft(c)
            else:
                ans.append(c)
        else:
            if a == 1:
                ans.append(c)
            else:
                ans.appendleft(c)

ans = ''.join(list(ans))
if a == -1:
    ans = ans[::-1] 

print(ans)


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  int ans=0;
  REP(i,a+1)REP(j,b+1)REP(k,c+1){
    if(i*500+j*100+k*50==x)ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
main = do
  n <- readLn :: IO Int
  k <- readLn :: IO Int
  print $ solve n k 1

solve :: Int -> Int -> Int -> Int
solve 0 _ ans = ans
solve n k ans
  | ans > k   = solve (n-1) k $ ans + k
  | otherwise = solve (n-1) k $ ans * 2


Measured memory_bytes: 508
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
using namespace std;

#define INF 1e18
#define int long long
#define MAX 1000000010

signed main() {
    int x, y; cin >> x >> y;

    int tmp = x;
    int ans = 0;
    for(int i = 1; tmp <= y; i++) {
        tmp *= 2;
        ans++;
    }

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


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

Measured memory_bytes: 35864
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int main(){
	int a,b ;
	cin >> a >> b;
	if (a % 2 == 1 && b % 2 == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  m,d=LI()
  ans=0

  for i in range(1,m+1):
    for j in range(10,d+1):
      j=str(j)
      d1=int(j[1])
      d10=int(j[0])

      if d1<2:
        continue
      if d10<2:
        continue

      if d1*d10==i:
        # print(i,j)
        ans+=1
  return ans

# main()
print(main())


Measured memory_bytes: 6832
#include <bits/stdc++.h>
#define MAXN 105
#define N 100
using namespace std;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') f=-1;
        ch=getchar();
    }
    while (ch>='0'&&ch<='9'){
        x=(x<<3)+(x<<1)+(ch^'0');
        ch=getchar();
    }
    return x*f;
}
int d[MAXN][MAXN],f[MAXN][MAXN];
int main(){
	// freopen("AT3877.out","w",stdout);
	int A=read(),B=read();
	for (register int i=1;i<=A;++i){
		for (register int j=1;j<=B;++j){
			d[i][j]=read();
		}
	}
	for (register int i=0;i<=N;++i){
		for (register int j=0;j<=N;++j){
			//f[i][j]=0;//构造f[i][j]
			for (register int x=1;x<=A;++x){
				for (register int y=1;y<=B;++y){
					f[i][j]=max(f[i][j],d[x][y]-i*x-j*y);
				}
			}
			// printf("%d ",f[i][j]);
		}
		// puts("");
	}
	for (register int x=1;x<=A;++x){
		for (register int y=1;y<=B;++y){
			int ans=0x7fffffff;
			for (register int i=0;i<=N;++i){
				for (register int j=0;j<=N;++j){
					ans=min(ans,f[i][j]+i*x+j*y);
				}
			}
			//printf("%d %d\n",ans,d[x][y]);
			if (ans!=d[x][y]) {
				puts("Impossible");
				return 0;
			}
		}
	}
	puts("Possible");
	printf("%d %d\n",N*2+2,N+N+(N+1)*(N+1));
	for (register int i=1;i<=N;++i){
		printf("%d %d X\n",i,i+1);
	}
	for (register int i=N+2;i<(N+1)*2;++i){//反着搞
		printf("%d %d Y\n",i,i+1);
	}
	for (register int i=0;i<=N;++i){
		for (register int j=0;j<=N;++j){
			printf("%d %d %d\n",i+1,202-j,f[i][j]);
		}
	}
	printf("%d %d\n",1,(N+1)*2);
}

Measured memory_bytes: 384
fun main(){
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }

    val bukaArray = Array(n){0}
    for (i in 0 until n-1){
        bukaArray[a[i]]++
    }
    bukaArray.drop(1).forEach { println(it) }
    println(0)
}

Measured memory_bytes: 72628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define repr(i,a,n) for (int i=a;i<n;i++)
#define rrep(i,a,n) for (int i=n-1;i>=a;i--)
#define all(cont) cont.begin(), cont.end()
#define unique(a)  sort(all(a)) , (a).erase(unique((a).begin(), (a).end()),(a).end())
#define rall(cont) cont.rbegin(), cont.rend()
#define sz(x) (int)(x).size()
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define fi first
#define se second
#define mod 1000000007
const int N = 2e5 + 5;
#define PI acos(-1.0)
typedef long long ll;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpii;
#define pqll_max priority_queue<ll> // max heap. push(),pop(),top(),size(),empty()
#define pqll_min priority_queue<ll,vector<ll>,greater<ll> >
#define lb(v,val)   lower_bound(v.begin(),v.end(),val) //first equal to or lower than [------------
#define ub(v,val)   upper_bound(v.begin(),v.end(),val) //first greater than ------------)
#define bs(v,x) binary_search(v.begin(),v.end(),x)
inline ll add(ll x, ll y) { x += y; if (x >= mod) x -= mod; return x; }
inline ll sub(ll a, ll b) { if (a < b)swap(a, b); return (((a%mod) - (b%mod) + mod) % mod); }
inline ll mul(ll x, ll y) { return (x%mod * 1ll * y%mod) % mod; }
inline ll pwr(ll a, ll b) { ll x = 1 % mod; while (b) { if (b & 1) x = mul(x, a); a = mul(a, a); b >>= 1; }return x % mod; }
inline ll inv(ll a) { return pwr(a, mod - 2) % mod; }
ll gcd(ll a, ll b) { if (!a)return b % mod; return gcd(b%a, a) % mod; }
#define debug(x) cout << #x << " = " << x << endl;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#define in(container) for (auto &it : container) cin>>it;
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
void solve() {

	return;
}

signed main()
{
	fastio;
	int n, x;
	cin >> n >> x;
	vi v(n);
	in(v);
	int sum = 0;
	rep(i, n) {
		sum += v[i];
		if (sum > x) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << n + 1 << endl;
	
}

Measured memory_bytes: 256
n,k = map(int, input().split())
dp = list(map(int, input().split()))

imos = [0]*n
for i in range(k):
    imos = [0]*(n+1)
    for j in range(n):
        mn = max(j-dp[j],0)
        mx = min(j+dp[j]+1,n)
        imos[mn]+=1
        imos[mx]-=1
    flag = True
    for j in range(n):
        dp[j]=imos[j]
        if(j>0):
            dp[j]+=dp[j-1]
        if dp[j]!=n:
            flag=False
    if flag:
        break
        
print(*dp)

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

int main(){
    int alpha[26];
    for(int a=0;a<26;a++)alpha[a]=0;

    char ch;
    while(cin>>ch){

        for(int i=0;i<26;i++){
            if(ch-'a'==i)alpha[i]++;
            else if(ch+32-'a'==i)alpha[i]++;
        }
    }

    for(int i=0;i<26;i++){
        cout<<(char)(i+'a')<<" : "<<alpha[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 3076
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}else if(a>b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
    return 0;
}

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

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long int i,j,n;
	cin>>n;
	long long int sum[n];
	long long int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sum[0]=a[0];
	for(i=1;i<n;i++)
		sum[i]=sum[i-1]+a[i];
	long long int dp[n][n];
	memset(dp,0,sizeof(dp));
	for(i=0;i<n;i++)
		dp[i][i]=a[i];
	int l;
	for(l=2;l<=n;l++)
	{
		for(i=0;i<n-l+1;i++)
		{
			j=l-1+i;
			long long int pp=sum[j];
			if(i)
				pp-=sum[i-1];
			dp[i][j]=max(pp-dp[i+1][j],pp-dp[i][j-1]);
		}
	}
	
	long long int pp=dp[0][n-1]-sum[n-1];
	pp+=dp[0][n-1];
	cout<<pp<<endl;
	return 0;
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  int n;
  while (cin >> n, n){
    int ans = 0;
    int state = 1; // up -> 1, down -> 0
    bool right_ok = 0, left_ok = 0;
    for (int i = 0; i < n; i++) {
      string s; cin >> s;
      if (s == "lu") {
        if (state == 1) left_ok = 1;
        else left_ok = 0;
      } else if (s == "ru") {
        if (state == 1) right_ok = 1;
        else right_ok = 0;
      } else if (s == "ld") {
        if (state == 0) left_ok = 1;
        else left_ok = 0;
      } else {
        if (state == 0) right_ok = 1;
        else right_ok = 0;
      }
      if (state == 1) {
        if (right_ok && left_ok) {
          state = 0;
          right_ok = 0;
          left_ok = 0;
          ans++;
        }
      } else {
        if (right_ok && left_ok) {
          state = 1;
          right_ok = 0;
          left_ok = 0;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false)

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

signed main(void){
  Accepted_MAGIC;
  
  int x, y, z; cin >> x >> y >> z;
  swap(x, y); swap(x, z);
  cout << x << ' ' << y << ' ' << z << endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if(a % 2 && b % 2) cout << "Odd" << endl;
    else cout << "Even" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int answer = 0;
		String[] input = sc.next().split("");
		for(int i =0; i < 3; i++) {
			if(input[i].equals("1")) {
				answer++;
			}
		}
		System.out.println(answer);


	}
}

Measured memory_bytes: 23764
import java.math.BigInteger;
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0055
public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (sc.hasNextDouble()) {
			double a = sc.nextDouble(), res = 0.0;
			res = a;
			for (int i = 2; i <= 10; i++) {
				if (i % 2 == 0) {
					a *= 2;
				} else {
					a /= 3;
				}
				res += a;
			}
			System.out.printf("%.9f", res);
			System.out.println();
		}
	}	
}

Measured memory_bytes: 0
nmax,abmax=40,10
n,ma,mb=map(int,input().split())
a,b,c=[None]*n,[None]*n,[None]*n
inf=float("inf")
for i in range(n):
  a[i],b[i],c[i]=map(int, input().split())
dp = [[[inf for _ in range(nmax*abmax+1)] for _ in range(nmax*abmax+1)] for _ in range(nmax+1)]
dp[0][0][0]=0
for i in range(n):
  for ca in range(nmax*abmax+1):
    for cb in range(nmax*abmax+1):
      if dp[i][ca][cb]==inf:continue
      dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb])
      dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i])

ans=inf
for ca in range(1,nmax*abmax+1):
  for cb in range(1,nmax*abmax+1):
    if ca*mb==cb*ma:ans=min(ans,dp[n][ca][cb])
if ans==inf:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 141660
def solve():
    n = int(input())
    H = [int(i) for i in input().split()]
    for i in range(n-1)[::-1]:
        if H[i+1]<H[i]:
            H[i]=H[i]-1
        if H[i+1]<H[i]:
            return 'No'
    else:
        return 'Yes'

if __name__ == '__main__':
    print(solve())

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> B(N, 1);
  vector<bool> E(N, false);
  E.at(0) = true;
  for (int i = 0; i < M; i++) {
    int X, Y;
    cin >> X >> Y;
    X--;
    Y--;
    B.at(X)--;
    B.at(Y)++;
    if (E.at(X) == true) E.at(Y) = true;
    if (B.at(X) == 0) E.at(X) = false;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (E.at(i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640