akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
	int a,b,n,m,i,j,x[101][101],v,w[101],o[101][101],f[101];
	scanf("%d %d",&n,&m);
	for(a=1;a<=n;a++){
		for(b=1;b<=m;b++){
			scanf("%d",&v);
			x[a][b]=v;
		}
	}
	for(b=1;b<=m;b++){
		scanf("%d",&w[b]);
	}
	for(a=1;a<=100;a++){
		f[a]=0;
	}
	for(a=1;a<=n;a++){
		for(b=1;b<=m;b++){
			f[a]=f[a]+x[a][b]*w[b];
		}
	}
	for(a=1;a<=n;a++){
		printf("%d\n",f[a]);
	}
	return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
#define ks ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pa;
const int maxn=1e6+177;
const ll mod=0x3f3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
template<class T>inline void read(T &res){
    char c;T flag=1;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
void wenjian(){freopen("concatenation.in","r",stdin);freopen("concatenation.out","w",stdout);}
void tempwj(){freopen("hash.in","r",stdin);freopen("hash.out","w",stdout);}
ll gcd(ll a,ll b){return b == 0 ? a : gcd(b,a % b);}
ll qpow(ll a,ll b,ll mod){a %= mod;ll ans = 1;while(b){if(b & 1)ans = ans * a % mod;a = a * a % mod;b >>= 1;}return ans;}

int main(){

    int l,r,d;
    scanf("%d%d%d",&l,&r,&d);


    int ll=l/d;
    int rr=r/d;
    if(l%d==0){
        printf("%d\n",rr-ll+1);

    }else{
        printf("%d\n",rr-ll);
    }
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please


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

	int N;
	cin >> N;

	int kotae = 1;
	rep(i, 8) {
		kotae *= 2;
		if (kotae > N) break;
	}
	kotae /= 2;
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#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(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  Vi X(n);
  VIN(X)
  int sum = 0;
  int ans = INF;
  FOR(i,1,101){
    sum = 0;
    REP(j,n){
      sum += pow(X[j]-i,2);
    }
    ans = min(ans,sum);
  }
  OUT(ans);
}

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

int main(){
  long long x;
  cin >> x;
  long long ans;
  if(x%11==0) ans=x/11*2;
  else if(x%11<=6) ans=x/11*2+1;
  else ans=x/11*2+2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
int transform(string str){
	int num=0;
	for(int j=0;j<str.length();j++){
		if(isdigit((int)str[j])){
			if(str[j+1]=='m') num += (str[j]-48)*1000;
			else if(str[j+1]=='c') num += (str[j]-48)*100;
			else if(str[j+1]=='x') num += (str[j]-48)*10;
			else if(str[j+1]=='i') num += (str[j]-48);
			j++;
		}else{
			if(str[j]=='m') num+=1000;
			else if(str[j]=='c') num+=100;
			else if(str[j]=='x') num+=10;
			else if(str[j]=='i') num++;
		}
	}
	return num;
}

int retrans(int num){
	vector<char> ans;
	int kurai[4];
	for(int k=0;k<4;k++){
		kurai[k]=num%10;
		num/=10;
	}
	for(int k=0;k<4;k++){
		if(kurai[3-k]==0) continue;
		else if(kurai[3-k]==1){
			if(k==0) ans.push_back('m');
			else if(k==1) ans.push_back('c');
			else if(k==2) ans.push_back('x');
			else if(k==3) ans.push_back('i');
		}else{
			ans.push_back(kurai[3-k]+48);
			if(k==0) ans.push_back('m');
			else if(k==1) ans.push_back('c');
			else if(k==2) ans.push_back('x');
			else if(k==3) ans.push_back('i');
		}
	}
	for(int k=0;k<ans.size();k++){
		cout<<ans[k];
	}
	cout<<endl;
	return 0;
}

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string mcxi1,mcxi2;
		cin>>mcxi1>>mcxi2;
		int a=transform(mcxi1);
		int b=transform(mcxi2);
		retrans(a+b);
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w, n;
    cin >> h >> w >> n;
    
    vector<int> col(n);
    
    for ( int i = 0; i < n; i++ )
        cin >> col[i];
    
    int lin[h * w];
    
    int pos = 0;
    for ( int i = 0 ; i < n ; i++ ){
        for ( int j = 0; j < col[i]; j++ ){
            lin[ pos + j ] = i + 1;
        }
        pos += col[i];
    }
    
    for ( int i = 0; i < h; i++ ){
        for ( int j = 0; j < w; j++ ){
            if ( i % 2 == 0 ){
                cout << lin[i * w + j];
                if ( j != w - 1 ) cout << " ";
                else cout << endl;
            }
            else if ( i % 2 ) {
                cout << lin[ ( i + 1 ) * w - 1 - j ];
                if ( j != w - 1 ) cout << " ";
                else cout << endl;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 384
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
//#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
//#include <ordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};                                                     
const int dy[] = {0, 1, 0, -1, 0};

int n, a, b;
vector <int> ans;

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> n >> a >> b;
   if (!(a + b - 1 <= n && n <= a * b)) cout << -1, exit (0);
   for (int i = a; i >= 1; i --) ans.pb (i);
   if (b != 1) {
      int len = (n - a) / (b - 1);
      int ost = (n - a) % (b - 1);
      int it = a + 1;
      for (int z = 1; z < b; z ++) {
         int kon = it + len - 1 + (ost > 0);
         it = kon + 1;
         for (int i = 1; i <= len + (ost > 0); i ++) ans.pb (kon --);
         ost --;
      }
   }
   reverse (all (ans));
   for (auto it : ans) cout << it << ' ';
}               
 
signed main () {                                       
  // #ifdef QWERTY
  //    freopen("input", "r", stdin);
   //#endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Measured memory_bytes: 7412
#include <stdio.h>
 
int main()
{
   int n, k, ans=1;
   
   scanf("%d %d", &n, &k);
   
   for(int i=0 ; i<n ; i++){
   	(ans+k > ans*2) ? ans*=2 : ans+=k;
   }
   
   printf("%d", ans);
   
   return 0;
}

Measured memory_bytes: 1736
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)

    def __iter__(self):
        psum = 0
        for i in range(self.size):
            csum = self.sum(i+1)
            yield csum - psum
            psum = csum
        raise StopIteration()

    def __str__(self):  # O(nlogn)
        return str(list(self))

    def sum(self, i):
        # [0, i) の要素の総和を返す
        if not (0 <= i <= self.size): raise ValueError("error!")
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        if not (0 <= i < self.size): raise ValueError("error!")
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def __getitem__(self, key):
        if not (0 <= key < self.size): raise IndexError("error!")
        return self.sum(key+1) - self.sum(key)

    def __setitem__(self, key, value):
        # 足し算と引き算にはaddを使うべき
        if not (0 <= key < self.size): raise IndexError("error!")
        self.add(key, value - self[key])



S = input()
N = len(S)
cnt = [0]*26
for c in S:
    cnt[ord(c)-97] += 1
odd = -1
for i, cn in enumerate(cnt):
    if cn%2 != 0:
        if odd == -1:
            odd = i
        else:
            print(-1)
            exit()
    cnt[i] //= 2
#cnt2 = [0]*26
L = [[] for _ in range(26)]
n = N//2 + 1
B = []
for c in S:
    c_int = ord(c)-97
    if cnt[c_int] == 0:
        if c_int == odd:
            B.append(1)
            odd = -1
        else:
            p = L[c_int].pop()
            B.append(p)
    else:
        L[c_int].append(n)
        B.append(0)
        n-=1
        cnt[c_int] -= 1

bit = Bit(N//2+2)
ans = 0
for i, b in enumerate(B):
    ans += i - bit.sum(b+1)
    bit.add(b, 1)
print(ans)


Measured memory_bytes: 9840
timeList = []
for i in range(5):
  timeList.append(int(input()))
  
timeAndRe = []

for j in range(5):
  if timeList[j] % 10 == 0:
    timeAndRe.append([0, timeList[j]])
  else:
  	timeAndRe.append([10 - timeList[j] % 10 ,timeList[j]])

timeAndRe.sort()

sumTime = 0

for k in range(5):
  if k != 4:
    sumTime += (timeAndRe[k][0] + timeAndRe[k][1])
  else:
    sumTime += timeAndRe[k][1]
    
print(sumTime)

Measured memory_bytes: 3064
using System;

namespace _20190629_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力値:r, D, x2000
            // すべてint
            var input = Console.ReadLine().Split(' ');
            var r = int.Parse(input[0]);
            var D = int.Parse(input[1]);
            var x2000 = int.Parse(input[2]);

            for (int i = 0; i < 10; i++)
            {
                int xWeight = r * x2000 - D;
                x2000 = xWeight;
                Console.WriteLine(xWeight);
            }
        }
    }
}

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T>
constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T, typename U> istream& operator>>(istream& in, pair<T, U>& a) { cin >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& in, vector<T>& a) { for (T& x : a) cin >> x; }

void LOG(const int& x) { cerr << x << "\n"; }
void LOG(const vector<int>& a) { for (int x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

int ceil(int a, int b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

class UnionFind { private: vector<int> par; vector<int> rnk; int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); } public: UnionFind(int size) { par.resize(size); rnk.resize(size); REP(i, size) par[i] = i, rnk[i] = 0; } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (rnk[x] < rnk[y]) { par[x] = y; } else { par[y] = x; if (rnk[x] == rnk[y]) rnk[x]++; } } bool same(int x, int y) { return find(x) == find(y); } };

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

signed main() {
  int n;
  cin >> n;
  vector<int> A(n);
  cin >> A;
  int ans = inf<int>;
  for (int y = -100; y <= 100; ++y) {
    int val = 0;
    for (int x : A) {
      val += (y - x) * (y - x);
    }
    ans = min(ans, val);
  }
  cout << ans << endl;
}

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

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template<typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	ll N, C, K;
	cin >> N >> C >> K;
	vll T(N);
	cin >> T;
	sortall(T);

	ll ans = 1;
	ll ride = 1;
	ll limit = T[0] + K;
	for (int i = 1; i < N; i++) {
		if (ride < C && T[i] <= limit) {
			ride++;
		}
		else {
			ans++;
			ride = 1;
			limit = T[i] + K;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 100;
int N, H[Nmax+1];

int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> H[i];
	int hmax = 0;
	for(int i=0; i<N; i++) hmax = max(hmax, H[i]);

	int ans=0;
	for(int i=1; i<=hmax; i++){
		for(int j=0; j<N; j++){
			if(H[j]>=i&&H[j+1]<i) ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
fn append(s: &mut String, c: char, k: i32) {
    for _ in 0..k {
        s.push(c);
    }
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let sx: i32 = it.next().unwrap().parse().unwrap();
    let sy: i32 = it.next().unwrap().parse().unwrap();
    let tx: i32 = it.next().unwrap().parse().unwrap();
    let ty: i32 = it.next().unwrap().parse().unwrap();
    let mut ans = String::new();
    append(&mut ans, 'R', tx - sx);
    append(&mut ans, 'U', ty - sy + 1);
    append(&mut ans, 'L', tx - sx + 1);
    append(&mut ans, 'D', ty - sy + 1);
    ans.push('R');
    ans.push('D');
    append(&mut ans, 'R', tx - sx + 1);
    append(&mut ans, 'U', ty - sy + 1);
    append(&mut ans, 'L', tx - sx + 1);
    append(&mut ans, 'D', ty - sy);
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100001][101],n,s,w[100001],v[100001];

ll solve(int W,int idx)
{
    if(idx>=n) return 0;
    
    if(dp[W][idx]!=-1) return dp[W][idx];
    dp[W][idx]=0;
    if(W>=w[idx])
    dp[W][idx]=v[idx]+solve(W-w[idx],idx+1);
    dp[W][idx]=max(dp[W][idx],solve(W,idx+1));
    
    return dp[W][idx];
}

int main()
{
   cin>>n>>s;
   for(int i=0;i<n;i++) cin>>w[i]>>v[i];
   memset(dp,-1,sizeof(dp));
   cout<<solve(s,0);
   return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;

//clang++ -std=c++11 -stdlib=libc++ 
int main() {
  int N,M; cin>>N>>M;
  vb accepted(N, false);
  vi wa(N);
  int good = 0;
  int wrong=0;
  rep(i, M) {
    int p; cin >> p; p--;
    string s; cin >> s;
    if (s=="AC") {
      if (!accepted[p]) {
        good++; accepted[p]=true;
        wrong+=wa[p];
      }
    } else {
      wa[p]++;
    }
  }
  printf("%d %d\n", good, wrong);
  return 0;
}

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

typedef long long s64;

const int MaxN = 100;
const int M = 998244353;
const int B = 31;

inline s64 calc_hash(string s, int n)
{
	s64 ret = 0;
	for (int i = 0; i < n; ++i)
		ret = ret * B + s[i] - '0' + 1;
	return ret;
}

map<s64, int> all;

int dfs(string s)
{
	if (s.size() == 0)
		return 1;

	int n = s.size();
	s64 h = calc_hash(s, n);
	if (all.count(h))
		return all[h];

	int res = dfs(s.substr(1, n - 1)) * (1 + s[0] - '0') % M;

	for (int i = 1; i <= n; ++i)
		for (int j = 2; i * j <= n; ++j)
		{
			int l = i * j;

			string r = "";
			for (int k = 0; k < i; ++k)
			{
				bool ok = true;
				for (int p = 0; p < j; ++p)
					if (s[k + p * i] == '0')
					{
						ok = false;
						break;
					}

				r += '0' + ok;
			}

			res = (res + (s64)dfs(r) * dfs(s.substr(l, n - l))) % M;
		}

	return all[h] = res;
}

int main()
{
	string s;
	cin >> s;

	cout << dfs(s) << endl;

	return 0;
}

Measured memory_bytes: 3072
#!/usr/bin/env python3
import string

S = input()
all_s_list = list(string.ascii_lowercase)
remain_s_list = [x for x in all_s_list if x not in S]

s_dict = {c: i + 1 for i, c in enumerate(all_s_list)}

if remain_s_list:
    ans = S + remain_s_list[0]
else:
    last_s = "".join(reversed(all_s_list))
    if S == last_s:
        ans = -1
    else:
        tail_list = []
        for i in range(1, len(all_s_list) + 1):
            char = S[-i]
            w_list = [x for x in tail_list if s_dict[char] < s_dict[x]]
            w_list = sorted(w_list)
            if w_list:
                if i != len(all_s_list):
                    ans = S[:-i] + w_list[0]
                else:
                    ans = w_list[0]
                break
            tail_list.append(char)

print(ans)


Measured memory_bytes: 3960
#include <stdio.h>
#include <stdlib.h>

int main() {
  long long int n,m,ans;
  scanf("%lld %lld",&n,&m);
  if(n==1) {
    if(m==1) {
      ans = 1;
    } else {
      ans = m-2;
    }
  } else {
    if(m==1) {
      ans = n-2;
    } else {
      ans = (n-2)*(m-2);
    }
  }
  printf("%lld\n",ans);
  return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = (a + d - 1) / d;
    int y = (c + b - 1) / b;
    if (x >= y) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3624
n=int(input())
l=list(map(int,input().split(" ")))
ans=0
j=0
while j==0:
    i=0
    while i <len(l):
        if l[i]%2!=0:
            j=1
        else:
            l[i]=int(l[i]/2)
        i+=1
    ans+=1
print(ans-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 2000005;
char en = '\n';
ll inf = 1e17;
ll mod = 1000000007;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

// 1 based indexing
ll lps[N];
void computeLps(ll *lps, char *text, ll textLen) {
  lps[1] = 0;
  ll i = 2;
  ll len1 = 0; // best longest proper prefix which is also a suffix upto prev
  // Val
  while (i <= textLen) {
    if (text[i] == text[len1 + 1]) {
      len1++;
      lps[i] = len1;
      i++;
    } else {
      if (len1 != 0) {
        len1 = lps[len1];
      } else {
        len1 = 0;
        lps[i] = len1;
        i++;
      }
    }
  }
}

bool starts[N];

ll kmp(char *text, char *pattern, ll textLen, ll patternLen) {
  ll i = 1, j = 1; // i is pointing to main,j is pointing to pattern
  computeLps(lps, pattern, patternLen);
  ll res = 0;
  while (i <= textLen) {
    if (text[i] == pattern[j]) {
      i++;
      j++;
      if (j == (patternLen + 1)) {
        starts[i - patternLen - 1] = true;
        j = lps[j - 1] + 1;
        res++;
      }
    } else {
      if (j != 1) {
        j = lps[j - 1] + 1;
      } else {
        i++;
        j = 1;
      }
    }
  }
  return res;
}

ll dp[N];
bool visited[N];
ll nt, ns;
ll recur(ll pos) {
  if (!starts[pos])
    return 0;
  if (visited[pos]) {
    return -inf;
  }

  ll &ans = dp[pos];
  if (ans != -1)
    return ans;

  visited[pos] = true;
  ans = 1 + recur((pos + nt) % ns);
  visited[pos] = false;
  return ans;
}

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

  string s, t;
  cin >> s >> t;

  memset(dp, -1, sizeof(dp));
  string curr = s;
  while (s.length() < t.length())
    s += curr;

  s += s;

  ns = s.length();
  nt = t.length();

  char text[ns + 5];
  char patt[nt + 5];
  for (ll i = 1; i <= ns; i++)
    text[i] = s[i - 1];
  for (ll i = 1; i <= nt; i++)
    patt[i] = t[i - 1];

  // cout << s << " " << t << en;

  memset(starts, false, sizeof(starts));
  kmp(text, patt, ns, nt);

  s = s.substr(0, ns / 2);
  ns /= 2;
  memset(visited, false, sizeof(visited));
  ll res = 0;

  // for (ll i = 0; i < ns; i++)
  // cout << starts[i] << " ";
  // cout << en;

  for (ll i = 0; i < ns; i++) {
    if (starts[i]) {
      ll curr = recur(i);
      if (curr < 0) {
        cout << -1 << en;
        return 0;
      }
      res = max(res, curr);
    }
  }
  cout << res << en;

  return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;


int main()
{
    int r;
    cin >> r;
    cout << r*r << endl;
    return 0;
}



Measured memory_bytes: 256
from collections import Counter

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

MAX = 10 ** 6
is_divisible = [True] * (MAX + 1)
is_divisible[0] = False
for i in S:
    if not is_divisible[i]:
        continue
    for j in range(i * 2, MAX + 1, i):
        is_divisible[j] = False

for k, v in Counter(A).items():
    if v > 1:
        is_divisible[k] = False

ans = len([a for a in A if is_divisible[a]])
print(ans)


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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = n - 1; i >= 0; i--) {
    cout << v[i];
    if (i > 0) cout << " ";
  }
  cout << endl;

  return 0;
}


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

#define ll long long
using namespace std;

ll pw(ll x,ll a){
	ll ans = 1;
	while(a){
		while(a%2==0){
			a /= 2;
			x = (x*x);
		}
		ans = (ans*x);
		--a;
	}
	return ans;
}

int main(){
	int l,i,n=0;
	vector<int> a,b,c;
	cin >> l;
	while(pw(2,n)-1<l){
		n++;
	}
	
	for(i=1;i<n;i++){
		a.push_back(i);
		b.push_back(i+1);
		c.push_back(pw(2,i-1));
	}
	
	for(i=1;i<n;i++){
		a.push_back(i);
		b.push_back(i+1);
		c.push_back(0);
	}
	
	ll x = pw(2,n-1);
	while(l-x>0){
		int k = 0;
		while(x+pw(2,k)-1<l){
			k++;
		}
		a.push_back(k);
		b.push_back(n);
		c.push_back(x);
		x += pw(2,k-1);
	}
	
	cout << n << " " << a.size() << endl;
	for(i=0;i<a.size();i++){
		cout << a[i] << " " << b[i] << " " << c[i] << endl;
	}
}


Measured memory_bytes: 256
import numpy as np

N,M = map(int,input().split())

#numAC = [0]*N
numWA = [0]*N
flgAC = [0]*N

#print(num)

for ii in range(M):
  pi,Si = input().split()
  pi = int(pi) - 1 #indexとして使うので-1する
  
  if flgAC[pi] == 0:
    if Si == "AC":
      #numAC[pi] = 1
      flgAC[pi] = 1
    elif Si == "WA":
      numWA[pi] += 1

countWA = 0
for ii in range(N):
  if flgAC[ii] == 1:
    countWA += numWA[ii]
print(np.sum(flgAC),countWA)


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int N; cin >> N;

    cout << N*800-(N/15*200);

}


Measured memory_bytes: 256
# coding: utf-8

nt = [int(s) for s in input().strip().split()]
num_of_root = nt[0]
time_limit = nt[1]
min_cost = 1001

for i in range(num_of_root):
    ct = [int(s) for s in input().strip().split()]
    cost = ct[0]
    time = ct[1]
    if time > time_limit:
        continue
    if cost < min_cost:
        min_cost = cost
    
if min_cost == 1001:
    print("TLE")
else:
    print(min_cost)

Measured memory_bytes: 3060
s=list(input())
flont=int(s[0]+s[1])
back=int(s[2]+s[3])

if 1<=flont<=12:
    if 1<=back<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1<=back<=12:
    if flont==0 or 13<=flont:
        print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int H, W, h, w;
    
    scanf("%d%d%d%d", &H, &W, &h, &w);
    
    printf("%d", (H-h)*(W-w));

    return 0;
}



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

int main()
{
    char c[6],tmp[6];
    for(int i = 0; i < 6; i++){
        cin >> c[i];
        tmp[5-i] = c[i];
    }
    int cnt=0;
    for(int i = 0; i < 6; i++)
        if(tmp[i] == c[i]) cnt++;

    cout << (cnt == 6 ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<cstring>
#include<vector>
#include<stack>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<functional>
#include<unordered_map>
#define io ios::sync_with_stdio(false)
#define inf 0x3f3f3f3f
#define ll long long
#define P pair<int,int>
#define lc rt*2
#define rc rt*2+1
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const double PI = 3.1415926536;

using namespace std;



int main()
{
	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB")
		cout << "No";
	else
		cout << "Yes";
	return 0;
}


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

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

int N, S;
vector<pii> P, Q;
vector<int> sol;

int main() {
    scanf("%d %d", &N, &S);

    for(int i = 0; i < N; i++) {
        int x, p; scanf("%d %d", &x, &p);
        if(x < S) P.push_back({x, p});
        else Q.push_back({x, p});
    }
    reverse(Q.begin(), Q.end());

    if(P.size() == 0) {
        printf("%d", Q[0].first - S);
        return 0;
    }
    if(Q.size() == 0) {
        printf("%d", S - P[0].first);
        return 0;
    }

    int pos1 = 1, pos2 = 1, dir = (P[0].second < Q[0].second);
    ll sum = 0;
    sol.push_back(P[0].first);
    sol.push_back(Q[0].first);
    sum += P[0].second + Q[0].second;
    if(P[0].second >= Q[0].second) swap(sol[0], sol[1]);
    while(1) {
        if(dir) {
            while(pos1 < P.size() && sum > P[pos1].second) {
                sum += P[pos1++].second;
            }
            if(pos1 < P.size() && sum <= P[pos1].second) {
                sol.push_back(P[pos1].first);
                sum += P[pos1].second;
                pos1++;
                dir ^= 1;
            }
            else break;
        }
        else {
            while(pos2 < Q.size() && sum >= Q[pos2].second) {
                sum += Q[pos2++].second;
            }
            if(pos2 < Q.size() && sum < Q[pos2].second) {
                sol.push_back(Q[pos2].first);
                sum += Q[pos2].second;
                pos2++;
                dir ^= 1;
            }
            else break;
        }
    }
    sol.push_back(S);

    ll ans = 0;
    for(int i = 0; i < (int)sol.size() - 1; i++) {
        ans += abs(sol[i] - sol[i + 1]);
    }
    printf("%lld", ans);
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
 
using namespace std;
const int mx=1000009;
typedef long long ll;
//int dp[100][100][300];
ll mod=1000000007;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
  
  
  string s,t;
  cin>>s>>t;ll ans=100000;
  ll k=t.size();
  k--;
  
  for(int i=0;i<s.size()-k;i++){
      ll temp=0;
      for(int j=0;j<(k+1);j++){
          temp+=(s[i+j]!=t[j]);
      }ans=min(ans,temp);
  }
    
    
    cout<<ans;
    
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <math.h>
int main(){
    int i,d,n,k,buf;
    scanf("%d%d",&n,&k);
    double ans=0,p=(1/(double)n);
    for(i=1;i<=n;i++){
    buf=i;
    d=0;
    while(buf<k){
        buf*=2;
        d++;
    }
    ans+=p*pow(0.5,(double)d);
    }
    printf("%.12lf",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }

// ll get_pow(ll x, ll y){
//   ll ret=0;
//   ll temp = y;
//   while(true){
//     if(x<=temp) break;
//     ret++;
//     temp *= 2;
//   }
//   return ret;
// }






int main() {
  cout<<fixed<<setprecision(10);


  ll N,M;cin>>N>>M;
  vint k(M);
  vvint s(M, vint(N,0));
  // vint cnts(M,0);

  rep(i,M){
    cin>>k[i];
    // s[i].resize(k[i]);
    rep(j,k[i]){
      ll temp;
      cin>>temp;
      temp--;
      s[i][temp] = 1;
    }
  }
  vint p(M);
  rep(i,M)cin>>p[i];

  // rep(i,M){
  //   rep(j,N){
  //     cout << s[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  //
  // rep(i,M)cout<< p[i] << " ";

  ll ans = 0;

  rep(i,1<<N){
    // ll temp = i;
    bool flag = true;
    // ll cnt=0;
    // ll sum = 0;

    rep(j,M){
      ll temp = i;
      ll sum = 0;
      ll cnt = 0;
      while(temp>0){
        if(temp&1){
          sum = (sum+s[j][cnt])%2;
        }
        cnt++;
        temp>>=1;
      }
      // cout << j << i << sum << p[j] << endl;;
      flag = flag && (sum==p[j]);

    }

    if(flag){
      // cout << i << endl;
      ans++;
    }
  }



  cout << ans << endl;

}

















//


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;
ll memo[105][10];
void init(){
    for (int yi = 0; yi < 105; ++yi) {
        for (int xi = 0; xi < 10; ++xi) {
            memo[yi][xi] = 0;
        }
    }
}
vector<bool> genbit(int a){
    vector<bool> r(16);
    for(int i = 0; i < 16; i++){
        r[i] = (a  & (1ll << i));
    }
    return r;
}

int main() {
    int H,W,K;
    cin >> H >> W >> K;
    init();
    memo[0][0] = 1;
    ll MOD = 1000000007;
    for (int hi = 1; hi <= H; ++hi) {
        for (unsigned int i = 0; i < (1 << W - 1); ++i) {
            auto bars = genbit(i);
            bool judge = false;
            for (int j = 1; j < W; ++j) {
                if(bars[j] && bars[j-1]){
                    judge = true;
                }
            }
            if(judge){
                continue;
            }
            for (int j = 0; j < W; ++j) {
                if(j == 0){
                    if(bars[j]){
                        memo[hi][j] += memo[hi - 1][j + 1];
                        memo[hi][j] %= MOD;
                    }else{
                        memo[hi][j] += memo[hi - 1][j];
                        memo[hi][j] %= MOD;
                    }
                }else if(j == W - 1){
                    if(bars[j-1]){
                        memo[hi][j] += memo[hi - 1][j - 1];
                        memo[hi][j] %= MOD;
                    }else{
                        memo[hi][j] += memo[hi - 1][j];
                        memo[hi][j] %= MOD;
                    }
                }else{
                    if(bars[j]){
                        memo[hi][j] += memo[hi - 1][j + 1];
                        memo[hi][j] %= MOD;
                    }else{
                        if(bars[j-1]){
                            memo[hi][j] += memo[hi - 1][j - 1];
                            memo[hi][j] %= MOD;
                        }else{
                            memo[hi][j] += memo[hi - 1][j];
                            memo[hi][j] %= MOD;
                        }
                    }

                }

            }
        }
    }
    for (int hi = 0; hi <= H; ++hi) {
        for(int wi = 0; wi < W; wi++){
            //cout << memo[hi][wi] << ",";
        }
        //cout << endl;
    }
    cout << memo[H][K-1] << endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort()
data=[0]*9
for i in range(n):
    if a[i]//400>=8:
        data[8]+=1
    else:
        data[a[i]//400]+=1
count=0
for i in range(8):
    if data[i]!=0:
        count+=1
if count==0:
    print("1"+" "+str(data[8]))
else:
    print(str(count)+" "+str(count+data[8]))

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

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

    int l[n];
    int i;
    for(i=0; i<n; i++){
        cin>>l[i];
    }
    int d=0;
    int kaisu = 1;
    for(i=0; i<n; i++){
        d = d + l[i];
        if(d<=x){
            kaisu++;
        }
    }

    cout<<kaisu<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
int ans;
int n,m,l;
int d,a,k,tin;
int t[5][9][9];
int daymax[9][5];
int repmemomap[9][9][5];
bool used[9][9][5];
int repmemoallmap[5][41];
bool usedall[5][41];
int repmemo(int apos,int llim,int day);
int repmemoall(int day,int llim);
int main() {
  cin >> n >> m >> l;
  rep(i,m){
    cin >> d >> a >> k >> tin;
    if(t[d][a][k] < tin)
      t[d][a][k] = tin;
  }
  //cout << 1 << endl;                                                                                                                                                             
  rep(i,5){
    daymax[0][i] = 0;
    daymax[1][i] = 0;
    REP(j,1,n+1)REP(k,1,n-j+2)if(daymax[1][i]<t[i][j][k])
      daymax[1][i] = t[i][j][k];
    REP(l,2,n+1){
      daymax[l][i] = repmemo(1,l,i);
    }
  }
  //cout << 2 << endl;                                                                                                                                                             
  //rep(i,9)rep(j,5){                                                                                                                                                              
  //cout << i << ',' << j << "->" << daymax[i][j] << endl;                                                                                                                         
  //}                                                                                                                                                                              
  ans = repmemoall(0,l);
  cout << ans << endl;
  return 0;
}

int repmemo(int apos,int llim,int day){
  if(used[apos][llim][day])
    return repmemomap[apos][llim][day];
  int tmax = 0;
  REP(j,apos,n+1)REP(k,1,n-j+2){
    if(t[day][j][k] > 0){
      if(llim == 1){
        if(tmax < t[day][j][k]){
          tmax = t[day][j][k];
        }
      }else{
        int current = repmemo(j+k,llim-1,day);
        if(t[day][j][k] + current > tmax){
          tmax = t[day][j][k] + current;
        }
      }
    }
  }
  if(apos < n){
    int noget = repmemo(apos+1,llim,day);
    if(noget > tmax)
      tmax = noget;
  }else if(llim>1 || tmax==0){
    return -100000;
  }
  used[apos][llim][day] = true;
  repmemomap[apos][llim][day] = tmax;
  return tmax;
}

int repmemoall(int day,int llim){
  if(usedall[day][llim])
    return repmemoallmap[day][llim];
  int amax = 0;
  int current;
  rep(i,n+1){
    //cout << i << ' ' << day << ' ' << llim << endl;                                                                                                                              
    if(i>llim) break;
    if(day == 4){
      current = daymax[i][day];
    }else{
      current = repmemoall(day+1,llim-i) + daymax[i][day];
    }
    if(amax < current)
      amax = current;
  }
  usedall[day][llim] = true;
  repmemoallmap[day][llim] = amax;
  return amax;
}

Measured memory_bytes: 1168
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using ld [[maybe_unused]] = long double;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    if ((A * B) % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

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

const int mod=1e9+7;
inline int add(int x,int y)
{
  x+=y;
  if (x>=mod)
    return x-mod;
  return x;
}
inline int sub(int x,int y)
{
  x-=y;
  if (x<0)
    return x+mod;
  return x;
}
inline int mul(int x,int y)
{
  return (x*1ll*y)%mod;
}
inline int power(int x,int y)
{
  int ans=1;
  while(y)
    {
      if (y&1) ans=mul(ans,x);
      x=mul(x,x);
      y>>=1;
    }
  return ans;
}
inline int inv(int x)
{
  return power(x,mod-2);
}
inline int gcd(int x, int y)
{
  return(y!=0)?gcd(y, x%y):x;
}
inline ll nPr(int n, int r)
{
  ll i,result=1;
  rep(i,r)
    {
      result*=(ll)(n-i);
    }
  return result;
}
inline ll nCr(int n,int r)
{
  ll i,result=1;
  rep(i,min(r,n-r))
    {
      result*=(ll)(n-i);
      result/=(ll)(i+1);
    }
  return result;
}
bool prime(int n)
{
  for (int i=2; i<n/2; i++)
    {
      if(n%i==0)
	return false;
    }
  return true;
}

/*------------CODE-----------*/

int main()
{
  IOS;
  int x;
  cin >> x;
  if (x==1)
    {
      cout << 0 << " " << -1 << endl;
      return 0 ;
    }
  for (int i=-1000; i<=1000; i++)
    {
      for (int j=-1000; j<=1000; j++)
	{
	  if (((i*i*i*i*i)-(j*j*j*j*j))==x)
	    {
	      cout << i << " " << j << endl;
	      return 0;
	    }
	}
    }
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
    #include <string>
    #include <set>
    using namespace std;
    int main(void){
    	set<string> st;
    	string s;
    	int k,len,i,j;
    	cin >> s;
    	cin >> k;
    	len = s.length();
    	for(i = 0; i <= len; i++){
    		for(j = 1; i+j <= len && j <= k; j++)
    			st.insert(s.substr(i,j));
    	}
    	i = 0;
    	for(auto itr = st.begin(); itr != st.end(); ++itr) {
    			i++;
    			if(i == k)
    				cout << *itr << endl;
       	 }
    	
    }

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<N; i++) A[i]--;
    set<int> st;
    for(int i=0; i<N; i++)
        st.insert(A[i]);
    int M = st.size();

    int a[100000];
    fill_n(a, 100000, 0);
    for(int i=0; i<N; i++)
        a[A[i]]++;

    /*
    vector<int> v;
    for(int i=0; i<N; i++)
        if(a[i] != 0 && a[i] % 2 == 0)
            v.push_back(i);
 
    if(v.size() % 2 == 1)
        M--;
    cout << M << endl;
    */

    if(M % 2)
        cout << M << endl;
    else
        cout << M - 1 << endl;


    return 0;
}


Measured memory_bytes: 5760