akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 998244353;

int main() {
    int A,B;
    cin >> A >> B;
    cout << (A-1) * (B-1) << endl;
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_162
{
    class F
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] array = ReadLongs();
            long[,] dp = new long[n, 3];
            for(int i = 0; i < n; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    dp[i, j] = long.MinValue;
                }
            }
            if (n % 2 == 0)
            {
                dp[0, 1] = array[0];
                dp[1, 0] = array[1];
            }
            else
            {
                dp[0, 2] = array[0];
                dp[1, 1] = array[1];
                dp[2, 0] = array[2];
            }

            for(int i = 0; i < n; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    if (dp[i, j] == long.MinValue)
                    {
                        continue;
                    }

                    for(int k = 0; k <= j; k++)
                    {
                        int to = i + 2 + k;
                        if (to >= n)
                        {
                            continue;
                        }

                        dp[to, j - k] = Max(dp[to, j], dp[i, j] + array[to]);
                    }
                }
            }

            long res = long.MinValue;
            if (n % 2 == 0)
            {
                res = Max(dp[n - 1, 0], dp[n - 2, 1]);
            }
            else
            {
                res = Max(dp[n - 1, 0], Max(dp[n - 2, 1], dp[n - 3, 2]));
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 51928
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <queue>

int main(void){
    Cin(int, n, m);
    vc<vc<int>> a(n, vc<int>()), b(n, vc<int>());
    Rep(m){
        Cin(int, u, v);
        u --, v --;
        a[u].push_back(v);
    }
    Cin(int, s, t); s --, t --;
    
    auto f = [&](vc<int> v){
        vc<int> r;
        vc<bool> e(n);
        for(int i : v) for(int j : a[i]){
            if(!e[j]) e[j] = true, r.push_back(j);
        }
        return r;
    };
    
    {
        b[s] = f(f(f({s})));
        if(Contains(b[s], t)){
            Cout(1);
            return 0;
        }
    }
    
    For(i, n) b[i] = f(f(f({i})));
    
    constexpr int Inf = 2e9;
    vc<int> d(n, Inf); d[s] = 0;
    
    using P = pair<int, int>;
    priority_queue<P, vector<P>, greater<P>> q; q.emplace(0, s);
    while(!q.empty()){
        auto e = q.top(); q.pop();
        if(e.second == t){
            Cout(e.first); return 0;
        }
        if(e.first > d[e.second]) continue;
        for(int i : b[e.second]){
            if(d[i] > d[e.second]+1){
                d[i] = d[e.second]+1;
                q.emplace(d[i], i);
            }
        }
    }
    Cout(-1);
    // Couts(d);
}




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

int main() {
   int L,R,d;
   cin >> L >> R >> d;
   if (L%d!=0){
     cout << R/d- L/d << endl;
   }else{
       cout << R/d- L/d +1<< endl;
   }
   return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

int main(){
	map<string, int> word;
	vector<string> w;
	string str;
	int max=0,length=0;

	while(cin >> str){
			
		w.push_back(str);
		
		//??\???????????????????????§??????????????¢???
		if(word.find(str) != word.end() ){
			word[str]++;
		}else{
			word.insert( pair<string, int>(str,1));
		}
	}
	
	map<string,int>::iterator p;
	for(p = word.begin() ; p != word.end() ; p++){
		if( max < p->second) max = p->second;
	}
	for(p = word.begin() ; p != word.end() ; p++){
		if( max == p->second){
			cout << p->first << " ";
			break;
		}
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length < w[i].size() ) length = w[i].size();
	}
	for(int i=0 ; i<w.size() ; i++){
		if( length==w[i].size() ){
			cout << w[i] << endl;
			break;
		}
	}
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, ans=1;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    bool out=false;
    rep(i,n){
        if(a[i] > INF/ans) out = true;
        else ans *= a[i];
    }
    if(out) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b) {
	return b ? gcd(b, a % b) : a;
}
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(nullptr);
	cout.tie(nullptr);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int d, t, s;
	cin >> d >> t >> s;
	if(d <= t * s) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int count = 0;

		for (int x = a; x <= b; x++) {
			if (c % x == 0) {
				count++;
			}

		}
		System.out.println(count);
	}

}



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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(a-x)>abs(b-x)) cout << "B" << endl;
    else cout << "A" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define vint vector<int>


int main(){
	string s;
	cin >> s;
	
	bool a[2]; // [前半 後半]
	
	int zen,kou;
	zen = 10*(int)(s[0]-'0') + (int)(s[1]-'0');
	kou = 10*(int)(s[2]-'0') + (int)(s[3]-'0');
	
	if(1 <= zen && zen <= 12) a[0] = true;
	else a[0] = false;
	if(1 <= kou && kou <= 12) a[1] = true;
	else a[1] = false;
	
	if(a[0] && a[1]) cout << "AMBIGUOUS\n";
	else if(a[0]) cout << "MMYY\n";
	else if(a[1]) cout << "YYMM\n";
	else cout << "NA\n";
	
	
	return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>

using namespace std;

const double PI = 3.14159265358979323846;

int main() {
  int n;

  cin >> n;

  cout << 2 * PI * n << endl;

  return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define int long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define re(x) cout<<(#x)<<" is "<<(x)<<"\n"; 
#define gif(a,b) ((a)/(b)+((a)%(b)?1:0))
using namespace std;

int Prime(int n)
{
	if(n < 2)
		return 0;
	if(n < 4)
		return 1;
	if(n % 2 == 0 or n % 3 == 0)
		return 0;
	for(int i = 5; i*i <= n; i += 6)
		if(n % i == 0 or n % (i+2) == 0)
			return 0;
	return 1;
}

int32_t main()
{
	IOS
	int T = 1; 
	//cin >> T;  
	for (int t = 0; t < T; ++t)
	{
		int k;
		cin >> k;
		int flag = 0;
		int val = 7;
		for (int i = 1; i <= k ; ++i)
		{
			if(val%k == 0)
			{
				cout << i;
				flag = 1;
				break;
			}
			val %= k;
			val = (val*10 + 7)%k;
		}
		if(!flag)
			cout << -1;
	}
	return 0;
}
//if not working? go ahead.


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N, A, B;
  std::cin >> N >> A >> B;
  std::cout << ((A-B)%2==0?"Alice":"Borys") << '\n';
  return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    int tmp = x - a;
    cout << tmp - (tmp / b) * b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;
 
void solve()
{
	int n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];

	ll ans=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]<a[i-1])
		{
			ans+=abs(a[i]-a[i-1]);
			a[i]=a[i-1];
		}
	}
	cout<<ans;
}
 
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 5200
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
mini = As.pop(0)
maxi = As.pop()

ans = []
for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a

print(maxi-mini)
for a in ans:
    print(*a)
print(maxi, mini)

Measured memory_bytes: 84380
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

#include <iostream>

using namespace std;

void scans(string & str) {
	char c;
	scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {

	int n;
	scanf("%d", &n);
	string s = "";
	char tmp;
	scanf("%*c%c", &tmp);
	s += tmp;
	rep(i, n - 1) {
		scanf("%c", &tmp);
		if (s.back() != tmp)s += tmp;
	}
	printf("%d\n", s.length());
 	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void) {
	int N, K;
	scanf("%d",&N);
	scanf("%d",&K);
	int a[K],i;
	
	if (K > 1) {
		for (i = 0; i < K; i++) {
			a[i] = 1;
		}

		a[0] = a[0] + N - K;

		printf("%d\n", a[0] - a[1]);
	}
	else {
		printf("%d\n",0);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
  map<int, int> group_1 = {
    {1, 1},
    {3, 1},
    {5, 1},
    {7, 1},
    {8, 1},
    {10, 1},
    {12, 1},
  };
  map<int, int> group_2 = {
    {4, 1},
    {6, 1},
    {9, 1},
    {11, 1},
  };
  map<int, int> group_3 = { {2, 1} };
  vector<map<int, int>> groups{group_1, group_2, group_3};
  int x, y;
  cin >> x >> y;
  for (auto group : groups) {
    if (group[x] == 1 && group[y] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h> 
int main(){ 
int W, H, x, y, r; 

scanf("%d %d %d %d %d", &W, &H, &x, &y, &r); 

if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H){ 
    printf("Yes\n"); 
  } 
  
  else{ 

    printf("No\n"); 
  } 
  return 0; 
} 


Measured memory_bytes: 2144
#include <stdio.h>
void checkSwap(int a, int *p){
    int count = 0;
    for(int i = 0; i < a; i++){
        if(p[i] != i + 1){
            count++;
        }
    }
    if(count <= 2)printf("YES");else printf("NO");
}

int main(){
    int a;
    scanf("%d", &a);
    int p[a];
    for(int i = 0; i < a; i++){
        scanf("%d", &p[i]);
    }
    checkSwap(a, p);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
char S[11111];
LL K;

void MAIN() {
    scanf("%s%lld", S, &K);
    N = strlen(S);

    LL ans;
    if (count(S, S+N, S[0]) == N) {
	ans = N*K/2;
    } else {
	VI v;
	for (int i=0; i<N; ) {
	    int j = i;
	    while (j < N && S[i] == S[j]) j++;
	    v.push_back(j-i);
	    i = j;
	}

	ans = 0;
	if (S[0] == S[N-1]) {
	    ans += v[0]/2;
	    ans += v.back()/2;
	    ans += (v[0] + v.back())/2 * (K-1);
	    v[0] = v.back() = 0;
	}
	EACH (e, v) ans += *e/2 * K;
    }

    printf("%lld\n", ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
int A, B, C, X;
using namespace std;
int solve(){
    int ans = 0;
    for(int i = 0; i <= A; ++i){
        for(int j = 0; j <= B; ++j){
            for(int k = 0; k <= C; ++k){
                int tmp = i * 500 + j * 100 + k * 50;
                if(tmp == X)
                    ans++;
            }
        }
    }
    return ans;
}

int main(){
    scanf("%d", &A);//500
    scanf("%d", &B);//100
    scanf("%d", &C);//50
    scanf("%d", &X);//money
    int ans = solve();
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#define MAX 20
#define INF 100000
#define ll long long
#define forall(i,a,b) for(int i = a; i < b; ++i)
#define sd(s) scanf("%d", &s);
#define ss(s) scanf("%s", )
#define sll(s) scanf("%lld", &s);

using namespace std;

int N, M;
ll Prev, New;
int D[1 << MAX];
int Cnt[1 << MAX];
int W[MAX][MAX];
int P;
int answer = INF;

string INIT;

ll Gcd(ll a, ll b) {
	while (a % b != 0) {
		ll temp;
		a %= b;
		temp = a;
		a = b;
		b = temp;
	}
	return b;
}

int main() {
	int l1, l2, r1, r2;
	sd(N);
	Prev = 1;

	forall(i, 0, N) {
		sll(New);
		Prev *= (New / Gcd(Prev, New));
	}

	cout << Prev << endl;
}

Measured memory_bytes: 256
a,b,c=gets.split.map(&:to_i);
p r1=(a*c-b);
p r2=a*(r1)-b;
p r3=a*(r2)-b;
p r4=a*(r3)-b;
p r5=a*(r4)-b;
p r6=a*(r5)-b;
p r7=a*(r6)-b;
p r8=a*(r7)-b;
p r9=a*(r8)-b;
p r10=a*(r9)-b;

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x;
  int y;
  int a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<long> r(a);
  vector<long> g(b);
  vector<long> n(c);
  for(int i = 0;i < a;i++){
    cin >> r.at(i);}
  for(int i = 0;i < b;i++){
    cin >> g.at(i);} 
  for(int i = 0;i < c;i++){
    cin >> n.at(i);}
  sort(r.begin(),r.end());
  sort(g.begin(),g.end());
  for (int i = 0;i < x;i++){
    n.push_back(r.at(a-i-1));}
  for (int i = 0;i < y;i++){
    n.push_back(g.at(b-i-1));}
  sort(n.begin(),n.end());
       int p = n.size();
       long long ans = 0;
   for (int i = 0;i < x+y;i++){
     ans += n.at(p-i-1);}
       cout << ans << endl;
    
}

Measured memory_bytes: 6512
M,D = list(map(int,input().split()))

ans = 0
for month in range(1,M+1):
    for day in range(1,D+1):
        d10 = day//10
        d1 = day%10
        if d1 >= 2 and d10 >= 2 and d1*d10 == month:
            ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=1000000007;
ll MOD=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n%2==1) cout << "No" << endl;
    else{
        bool t=true;
        rep(i,s.size()/2){
            if (s[i]!=s[i+n/2]) t=false;
        }
        if (t) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int N;
	vec(D);
	cin >> N;
	map<int, int> K;
	K[0]++;
	fx(N) {
		vecp(D);
		K[D[x]]++;
	}

	fx(13) {
		if (K[x]>2||(x==0&&K[x]==2)) {
			ce(0);
			return 0;
		}
	}
	int ans = 0;
	vec(A);
	vec(B);
	fx(13) {
		if (K[x]==2) {
			pb(A, x );
			pb(A, 24 - x);
		}
		else if (K[x]==1) {
			pb(B, x);
		}
	}

	fx(1<<(B.size())) {
		vector<int> C(A);
		fy(B.size()) {
			if ((x&(1<<y))==0) {
				pb(C, B[y]);
			}
			else {
				pb(C, 24 - B[y]);
			}
		}
		sorts(C);
		int mini = 100;
		fy((int)C.size()-1) {
			mini = min(mini, abs(C[y] - C[y + 1]));
		}
		ans = max(ans, min(mini,C[0]+24-C[C.size()-1]));
	}
	ce(ans)

    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main(){
string S;
  cin >> S;
  
int zg = 0;
int zk = 0;
int ig = 0;
int ik = 0;  
  
  for(int i = 0; i < S.size();i++){
    if((i % 2 == 0) && (S.at(i) == '0')) zg++;
    else if((i % 2 == 0) && (S.at(i) == '1')) ig++;
    else if((i % 2 == 1) && (S.at(i) == '0')) zk++;
    else if((i % 2 == 1) && (S.at(i) == '1')) ik++;  
  }
  
int ma = max(zg, max(ig, max(zk, ik)));
  
  if(ma == zk){
  cout << ik + zg << endl;
  }
  
  else if(ma == ik){
  cout << zk + ig << endl;
  }
  
  else if(ma == zg){
  cout << ig + zk << endl;
  }
  
  else cout << zg + ik << endl;
  
 
return 0;
  
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
//pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
const ll mod = 1e9 + 7;
const ll N = 2e5 + 7;


int main() {
	fastIO;
	ll n;
	cin >> n;
	cout << n*n*n;

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n;cin >> n;
    int v,c;
    vector<int> V,C;
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> v;
        V.push_back(v);
    }
    for(int i = 0; i < n; i++){
        cin >> c;
        C.push_back(c);
    }

    for(int i = 0; i < n; i++){
        if(V[i]>C[i])ans+=V[i]-C[i];
    }
    cout << ans <<endl;
}


Measured memory_bytes: 256
n=int(input())
def f(x):
  return x//400 if x<3200 else 8
l=list(map(f,list(map(int,input().split()))))
ds=l.count(8)
sl=set(l)
if ds==0:
  print(len(sl),len(sl))
elif len(sl)==1:print(1,ds)
else:
  print(len(sl)-1,len(sl)+ds-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main (){
    int a;
    int te=1;
    int co=0;
	cin>>a;
    int n[10];
    n[0]=a%10;
    for(int i=1;i<10;i++){
		te*=10;
		n[i]=a/te-(a/(te*10))*10;
	}
	for(int i=0;i<10;i++){
		co+=n[i];
	}
	if(a%co==0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}		
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int I=X;I<Y;I++)
#define REP(I,X,Y) for(int I=Y-1;I>=X;I--)
#define INF 1000000007
using namespace std;

int adj[10][10];

int main(){
  int N,M,ans=0,a,b;
  cin >> N >> M;
  FOR(i,0,M){
    cin >> a >> b;
    adj[a][b]=1;
    adj[b][a]=1;
  }
  vector<int> v(N);
  FOR(i,1,N+1)v[i-1] = i;
  do{
    bool flag = 1;
    FOR(i,0,N-1)if(!adj[v[i]][v[i+1]])flag = 0;
    if(flag)ans++;
  }while(next_permutation(v.begin()+1,v.end()));
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
long long a[100010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	int zero=0;

	for(int i=0;i<n;i++)if(a[i]==0)zero++;
	if(zero>0){
		// a[i] contains 0
		printf("0\n");
		return 0;
	}
	long long prod=1;
	for(int i=0;i<n;i++){
		if(a[i]<=1000000000000000000/prod){
			// This condition is equivalent to prod*a[i]<=10ˆ18
			prod*=a[i];
			}
      	else{
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld\n",prod);
}


Measured memory_bytes: 2488
// template version 1.11
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int dp[51][51][100];

int solve(){
  int n,k;cin>>n>>k;
  vector<int> v(n);
  rep(i, n) {
    cin>>v[i];
  }
  dump(v);

  int res=-INF;

  rep(bc, k){
    // get k-bc
    int d = k-bc;
    if (d>=n){
      vi dd = v;
      sort(all(dd));
      int r = bc;
      int ans=0;
      rep(i, sz(dd)){
        if (dd[i]<0 and r>0){ r--; }
        else{ ans += dd[i]; }
      }
      chmax(res, ans);
    }
    else{
      rep(l, 0, d+1){
        vi dd;
        rep(i, l){
          dd.pb(v[i]);
        }
        int R = d-l;
        rep(i, n-R, n){  // d-l
          dd.pb(v[i]);
        }
        sort(all(dd));
        int r = bc;
        int ans=0;
        rep(i, sz(dd)){
          if (dd[i]<0 and r>0){ r--; }
          else{ ans += dd[i]; }
        }
        chmax(res, ans);
      }
    }
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

namespace Contest_02_Valeo_P2
{

    class Program
    {
        public static void Main(string[] args)
        {
            //while (true)
            //{
            //    Console.WriteLine("start problem");
                string input = Console.ReadLine();
                int n = int.Parse(input);
                List<Point> points = new List<Point>();
                for (int i = 0; i < n; i++)
                {
                    input = Console.ReadLine();
                    int x = int.Parse(input.Split(' ')[0]);
                    int y = int.Parse(input.Split(' ')[1]);
                    points.Add(new Point(x, y));
                }

                double result = getAvg(points);
                Console.WriteLine(result);
            //    Console.Write("press y to exit : ");
            //    if (Console.ReadLine() == "y")
            //        return;
            //}
        }

        private static double getAvg(List<Point> points)
        {
            double avg = 0;
            List<List<double>> allDistances = new List<List<double>>();
            for (int i = 0; i < points.Count; i++)
            {
                List<double> subList = new List<double>();
                for (int j = 0; j < points.Count; j++)
                {
                    subList.Add(0);
                }
                allDistances.Add(subList);
            }
            for (int i = 0; i < points.Count; i++)
            {
                for (int j = 0; j < points.Count; j++)
                {
                    if (i == j)
                        continue;
                    allDistances[i][j] = getDistance(points[i], points[j]);
                }
            }
            long count = 0;
            foreach (var item in allDistances)
            {
                foreach (var subItem in item)
                {
                    if(subItem != 0)
                    {
                        count++;
                        avg += subItem;
                    }
                }
            }
            return avg*(points.Count-1)/count;
        }

        private static double getDistance(Point a , Point b)
        {
            double first = Math.Pow( b.X - a.X,2);
            double second = Math.Pow(b.Y - a.Y, 2);
            return Math.Sqrt(first + second);
        }
    }

    public struct Point
    {
        public int X;
        public int Y;

        public Point(int x, int y)
        {
            X = x;
            Y = y;
        }
    }
}


Measured memory_bytes: 13268
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

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

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    string S;cin >> S;
    int X = 0;
    for(int i = 0;i<S.size();i++){
        if(S.at(i) == 'x') X++;
    }
    if(X >= 8)cout << "NO" << endl;
    else cout << "YES" << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Integer A = sc.nextInt();
		Integer B = sc.nextInt();

		if ( A < 9 && B < 9 ) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");

		}


	}

}



Measured memory_bytes: 21844
fun upperBound(array: IntArray, target: Int): Int {
    var left = 0
    var right = array.size
    while(left < right) {
        val mid = (left + right) / 2
        if (array[mid] <= target) left = mid + 1
        else right = mid
    }
    return right
}

fun main(args: Array<String>?): Unit {
    val n = readLine()!!.toInt()
    val nums = readLine()!!.trim().split(' ').map(String::toInt)
    val memo = IntArray(n + 1){-1}
    memo[memo.lastIndex] = Int.MAX_VALUE
    val sum = LongArray(n + 1){-1}
    sum[sum.lastIndex] = 0
    for (i in nums.asReversed()) {
        val pos = upperBound(memo, i)
        memo[pos - 1] = i
        sum[pos - 1] = sum[pos] + i
    }
    println(sum.first { it >= 0 })
}


Measured memory_bytes: 62672
#include<bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define a11111124 mp[{a,b}]=t;
#define a11111119 for(int k=0;k<g[v].size();k++){
#define a11111143 DFS(1,0);
#define a11111145 int a=min(ed[k].x,ed[k].y),b=max(ed[k].x,ed[k].y);
#define a11111125 DFS(g[v][k],t);
#define a11111144 for(int k=0;k<ed.size();k++){
#define a11111133 int a,b;
#define a11111121 if(used[g[v][k]]==0){
#define a11111131 scanf("%d",&n);
#define a11111134 scanf("%d%d",&a,&b);
#define a11111116 void DFS(int v,int cl){
#define a11111122 if(cl==t)
#define a11111140 ans=max(ans,max(dg[a],dg[b]));
#define a11111130 int main(){
#define a11111118 int t=1;
#define a11111148 return 0;
#define a11111117 used[v]=1;
#define a11111127 }
#define a11111132 for(int k=1;k<n;k++){
#define a11111136 g[b].push_back(a);
#define a11111120 int a=min(v,g[v][k]),b=max(v,g[v][k]);
#define a11111112 int n,dg[100005],used[100005],ans=0;
#define a11111114 map <pii,int> mp;
#define a11111113 vector<int> g[100005];
#define a11111146 printf("%d\n",mp[{a,b}]);
#define a11111139 ed.push_back({a,b});
#define a11111111 using namespace std;
#define a11111142 printf("%d\n",ans);
#define a11111123 t++;
#define a11111115 vector<pii> ed;
#define a11111137 dg[a]++;
#define a11111135 g[a].push_back(b);
#define a11111138 dg[b]++;
a11111111
a11111112
a11111113
a11111114
a11111115
a11111116
a11111117
a11111118
a11111119
a11111120
a11111121
a11111122
a11111123
a11111124
a11111125
a11111123
a11111127
a11111127
a11111127
a11111130
a11111131
a11111132
a11111133
a11111134
a11111135
a11111136
a11111137
a11111138
a11111139
a11111140
a11111127
a11111142
a11111143
a11111144
a11111145
a11111146
a11111127
a11111148
a11111127


Measured memory_bytes: 16376
num=int(input().rstrip())
#print(num)
position_line = input().rstrip().split(" ")

#print(position_line)

position_line2 = [int(s) for s in position_line]


position_line2.sort()
#print(position_line2)

posiP=0
for i in range(num):
    posiP+=position_line2[i]

posiP=round(posiP/num) 

#posiP=(position_line2[0]+position_line2[num-1])//2
#print(posiP)

sum1=0

for i in range(num):
   a=(position_line2[i]-posiP)**2
   #print(a)
   sum1+=a

print(sum1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<double, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll L;
	cin >> n >> L;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	int pos = -1;
	rep(i, n - 1) {
		if (a[i] + a[i + 1] >= L) {
			pos = i;
			break;
		}
	}
	if (pos == -1) {
		cout << "Impossible" << endl;
		return 0;
	}
	vector<ll> ans;
	rep(i, pos) ans.push_back(i + 1);
	for (int i = n - 2; i >= pos; --i) ans.push_back(i + 1);
	cout << "Possible" << endl;
	for (int c : ans) cout << c << endl;
 	return 0;
}


Measured memory_bytes: 2548
#include <stdio.h>
int main(void){
    // Your code here!
    long long ans = 1,num[100000];
    int N;
    
    
    scanf("%d",&N);
    
    for(int i= 0; i < N; i++){
        scanf("%lld",&num[i]);
        if(num[i] == 0){
            printf("0\n");
            return 0;
        }
    }
    
    for(int i = 0; i < N; i++){
        if(num[i] <= 1000000000000000000 / ans){
            ans *= num[i];
        }
        else{
            printf("-1\n");
            return 0;
        }
    }
    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2516
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int main()
{
	int a = 0, b = 0, count=0;
	scanf("%d%d", &a, &b);

	for (int i = 0; i < 2; i++) {
		if (a < b) {
			count += b;
			b--;
		}
		else {
			count += a;
			a--;
		}
	}
	printf("%d", count);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n,x;
  cin >> n >> x;
  int l[n];
  int i;
  for(i=0;i<n;i++){
    cin >> l[i];
    if(i!=0){
      l[i] += l[i-1];
    }
    if(l[i]>x){
      break;
    }
  }
  cout << i+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
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() {
  ll k, a, b; cin >> k >> a >> b;

  if (b <= a || k <= a) outl(k + 1);
  else if ((k - a) % 2 == 1) {
    ll t = k - a;
    outl(max(k + 1, (t + 1) / 2 * b - ((t + 1) / 2 - 1) * a));
  } else {
    ll t = k - a - 1;
    outl(max(k + 1, (t + 1) / 2 * b - ((t + 1) / 2 - 1) * a + 1));
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int th,ts,xh,xs;
    cin>>th>>ts>>xh>>xs;
    while(1){
           xh-=ts; 
        
        if(xh<=0) break;
        th-=xs;
        if(th<=0)break;
    }
    if(th>=xh) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3636
n, m, *X = map(int, open(0).read().split())
X.sort()
if n >= m:
  print(0)
else:
  Y = [0] * m
  for i in range(m-1):
      Y[i] = X[i+1] - X[i]
  Y.sort()
  print(sum(Y[:m-n+1]))

Measured memory_bytes: 13964
import bisect


def LCS(S, T):
    N = len(S)
    M = len(T)
    dp = [[0] * (M + 1) for _ in range(N + 1)]

    for i, s in enumerate(S, start=1):
        for j, t in enumerate(T, start=1):
            if s == t:
                dp[i][j] = dp[i - 1][j - 1] + 1
            else:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
    return dp[N][M]


def LCS_HTKB(S, T):
    T = T[::-1]
    memo = []

    for s in S:
        i = T.find(s) + 1
        while i:
            j = bisect.bisect_left(memo, -i)
            if j >= len(memo):
                memo.append(-i)
            else:
                memo[j] = -i
            i = T.find(s, i) + 1
    return len(memo)


if __name__ == "__main__":
    Q = int(input())
    ans = []
    for _ in range(Q):
        ans.append(LCS_HTKB(input(), input()))
    print(*ans, sep="\n")


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

int n;
vector<double> x, y;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++) {
        double a, b; cin >> a >> b;
        x.emplace_back(a), y.emplace_back(b);
    }
    auto dist = [&](double a, double b, double c, double d) {
        return sqrt((a-c)*(a-c) + (d-b) * (d-b));
    };
    auto dist2 = [&](int i, int j) {
        return dist(x[i], y[i], x[j], y[j]);
    };
    auto midpoint = [&](int i, int j) {
        double u = (x[i] + x[j]) / 2, v = (y[i] + y[j]) / 2;
        double c = 0;
        for (int i = 0; i < n; i++) {
            c = max(c, dist(x[i], y[i], u, v));
        }
        return c;
    };
    auto circumcenter = [&](int i, int j, int k) {
        double a = dist2(j, k), b = dist2(i, k), c = dist2(i, j);
        a *= a, b *= b, c *= c;
        double p = a*(b+c-a), q = b*(c+a-b), r = c*(a+b-c);
        if (abs(p + q + r) < 1e-10) return 1e20;  
        double u = (p*x[i] + q*x[j] + r*x[k]) / (p+q+r);
        double v = (p*y[i] + q*y[j] + r*y[k]) / (p+q+r);
        c = 0;
        for (int i = 0; i < n; i++) {
            c = max(c, dist(x[i], y[i], u, v));
        }
        return c;
    };
    double ans = 1e20;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            ans = min(ans, midpoint(i, j));
            for (int k = j+1; k < n; k++) {
                ans = min(ans, circumcenter(i, j, k));
            }
        }
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != ',')
        {
            cout << s[i];
        }
        else
        {
            cout << ' ';
        }
    }
    cout << endl;
    return 0;
}

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

int main()
{
    int flg=0,sum=0;
    char d[1000];
    while(1){
        scanf("%s",d);
        sum =0;
        if(d[0] == '0')
            break;
        if(('0' <= d[0]) && (d[0] <= '9')){
            //数値の場合の処理
            for(int i=0;i<strlen(d);i++){
                //printf("%s\n",d);
                //printf("5確認用 %c\n\n",d[0]);
                if(('0' <= d[i]) && (d[i] <= '9')){
                    sum += d[i]-'0';
                }else {
                    //printf("%d\n",sum);
                    flg = 1;
                }
            }
        printf("%d\n",sum);
        }
    if(flg == 1){
        break;
    }
    }
    return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main() {
	map<string, vector<int> > book;
	string title;
	int page;
	while(cin >> title >> page) {
		book[title].push_back(page);
	}
	for(map<string, vector<int> >::iterator itr = book.begin(); itr != book.end(); itr++) {
		printf("%s\n", (*itr).first.c_str());
		sort((*itr).second.begin(), (*itr).second.end());
		vector<int>::iterator sc = (*itr).second.begin();
		printf("%d", *sc);
		sc++;
		for(; sc != (*itr).second.end(); sc++) {
			printf(" %d", *sc);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
INPUT_1 = input()
N, K = INPUT_1.split()
N = int(N)
K = int(K)

if 1 <= N <= 10**5 and 1 <= K <= 500:
    pass
else:
    INPUT_1 = input()
    N, K = INPUT_1.split()
    N = int(N)
    K = int(K)

INPUT_2 = list(map(int, input().split()))
if len(INPUT_2) == N:
    pass
else:
    INPUT_2 = list(map(int, input().split()))

count = 0
for i in range(len(INPUT_2)):
    if INPUT_2[i] >= K:
        count += 1
    else:
        pass
print(count)

Measured memory_bytes: 11908