akhauriyash/Code-Regression huggingface dataset:
package main

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

func solve() {
	s, t := getString(), getString()
	ans := t + s
	fmt.Fprintln(wr, ans)
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
int read()
{
    char ch = getchar();
	int x = 0, f = 1;
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}
struct node
{
	int u,d,l,r;
	node()
	{
		u=d=l=r=0;
	}
};
const int N=2e3+5;
char a[N][N]; 
node mp[N][N];
int main()
{
  int n=rr,m=rr;
  
  
  rep(i,0,n)
  {
  	rep(j,0,m)
  	{
	   cin>>a[i][j];
	   if(a[i][j]=='.')
	   {
	   	 	node t;
	       t.u=0;
	       t.l=0;
	   	if(a[i-1][j]=='.')
	   	{
	   	  t.u=mp[i-1][j].u+1;
		   }
		   if(a[i][j-1]=='.')
		   {
		   	 t.l=mp[i][j-1].l+1;
		   }
	      
	   	mp[i][j]=t;
	   }
	}
    
  }
  
 int ans=0;
  for(int i=n-1;i>=0;i--)
  {
  	for(int j=m-1;j>=0;j--)
  	{
	   
	   if(a[i][j]=='.')
	   {
	   	 	node t=mp[i][j];
	       t.d=0;
	       t.r=0;
	   	if(a[i+1][j]=='.')
	   	{
	   	  t.d=mp[i+1][j].d+1;
		   }
		   if(a[i][j+1]=='.')
		   {
		   	 t.r=mp[i][j+1].r+1;
		   }
	      
	   	mp[i][j]=t;
	   	ans=max(ans,t.l+t.u+t.r+t.d+1);
	   }
	   
	}
    
  }
 cout<<ans;
}




Measured memory_bytes: 66944
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define LLI long long int
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}

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

  int d; cin >> d;

  string s[4] = {"Christmas", "Christmas Eve", "Christmas Eve Eve", "Christmas Eve Eve Eve"};

  cout << s[25-d] << endl;
  
  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;

void main() {
    
    int[100] n;
    int line = 0;
    
    // input
    for(int i=0; ; ++i) {
        auto temp = readln().chomp;
        
        if(stdin.eof) {
            break;
        }
        
        ++line;
        n[i] = to!int(temp);
    }
    
    for(int i=0; i<line; ++i) {
        
        writefln("%d", 2 + (n[i] + 2) * (n[i] - 1) / 2);
        
    }
    
}

Measured memory_bytes: 2380
;;(declaim (optimize (speed 0) (safety 3) (debug 3)))
#+sbcl (declaim (sb-ext:unmuffle-conditions sb-ext:compiler-note))
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(declaim (type fixnum *day-n*))
(defvar *day-n* (read))

(defvar *total-day* (loop for i from 1 to (read) summing (read) fixnum))

(if (> *total-day* *day-n*)
    (princ "-1")
  (princ (- *day-n* *total-day*)))


Measured memory_bytes: 29892
#include<iostream>
#include<map>
#include<string>
#include<cstdio>
using namespace std;

string returnRate(int n){
  if(n < 400){
    return "gray";
  }
  else if (n < 800){
    return "brawn";
  }
  else if(n < 1200){
    return "green";
  }
  else if(n < 1600){
    return "water";
  }
  else if(n < 2000){
    return "blue";
  }
  else if(n < 2400){
    return "yellow";
  }
  else if(n < 2800){
    return "orange";
  }
  else if(n < 3200){
    return "red";
  }
  else{
    return "all";
  }
}

int main(void){
  int n;
  cin >> n;
  map<string, bool> existColor;
  int countAll = 0;
  for(int i=0;i<n;++i){
    int rate;
    cin >> rate;
    if(returnRate(rate) != "all"){
      existColor[returnRate(rate)] = true;
    }
    else{
      countAll++;
    }
  }
   printf("%d %d\n",(existColor.size()!=0) ? existColor.size() : 1,existColor.size()+countAll);
}


Measured memory_bytes: 256
data_list = [x for x in input()]
word_first = data_list[0]
word_second = data_list[1]
word_third = data_list[2]
if data_list.count(word_first) ==2 and data_list.count(word_second) == 2 and data_list.count(word_third) == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define fi first
#define se second
#define mp make_pair

void ib(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

LL n,m;

int main(){
	
	cin >> n >> m;
	LL r = n / 2, c = m / 2;
	if ( n == 1 || m == 1 ){
		cout << 1 << endl;
		return 0;
	}
	LL black = 0;
	if ( n % 2 == 0 ){
		if ( m & 1 ) black = r * (c) + r * (c+1);
		else black = n * (m/2);
	} else {
		if ( m & 1 ) black = (r+1) * (c+1) + r * c;
		else black = n * (m/2);
	}

	cout << black << endl;
	return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    input_list = list(map(int, input().split()))
    N = input_list[0]
    M = input_list[1]
    C = input_list[2]

    B = [0]*(M+1)

    B = list(map(int, input().split()))
    A=[list(map(int,input().split())) for i in range(N)]

    answer = 0

    for i in range(N):
        judge_value = 0
        for j in range(M):
            judge_value += A[i][j] * B[j]
        judge_value += C

        if judge_value > 0:
            answer += 1

    print(answer)

Measured memory_bytes: 3064
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    VV vec(3,V(3));
    rep(i,3)rep(j,3){
        cin>>vec[i][j];
    }
    ll n;
    cin>>n;
    rep(i,n){
        ll x;
        cin>>x;
        rep(j,3)rep(k,3){
            if(vec[j][k]==x){
                vec[j][k]=-1;
            }
        }
    }
    rep(i,3){
        bool h=true;
        rep(j,3){
            if(vec[i][j]!=-1){
                h=false;
                break;
            }
        }
        if(h){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    rep(j,3){
        bool h=true;
        rep(i,3){
            if(vec[i][j]!=-1){
                h=false;
                break;
            }
        }
        if(h){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    bool h=true;
    rep(i,3){
        if(vec[i][i]!=-1){
            h=false;
        }
    }
    if(h){
        cout<<"Yes"<<endl;
        return 0;
    }
    h=true;
    rep(i,3){
        if(vec[2-i][i]!=-1){
            h=false;
        }
    }
    if(h){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define num(a) a-'0'
#define charr(a) (a - 'A' + 1)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define maxs(a,b) if(b>a)a=b
#define mins(a,b) if(b<a)a=b
#define debug(x) cerr<<"["<<#x<<":"<<x<<"] "
#define debug2(a,b) debug(a);debug(b)
#define debug3(a,b,c) debug2(a,b);debug(c)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/(__gcd(a,b))
#define print(arr) for(auto it = arr.begin();it < arr.end();it ++){cout << *it << " ";}cout << ln;
#define all(a) (a).begin(), (a).end()
#define vi vector<long long>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"
typedef long double ld;
typedef double d;
using namespace std;
int modF=1e9+7;
int INF=1e11;

void solve(){
	int s;
	cin>>s;
	if(s<3){
		cout<<0<<ln;
		return;
	}
	int ans=0;
	v<vi> dp(s/3+1,vi(s+1,0));
	for(int i=1;i<=s/3;i++){
		for(int j=1;j<=s;j++){
			if(j<3){
				dp[i][j]=0;
			}
			else if(i==1){
				dp[i][j]=(1+dp[i][j-1])%modF;
			}
			else{
				dp[i][j]=(dp[i-1][j-3]-dp[i-1][0]+dp[i][j-1]+modF)%modF;
			}
			// debug(dp[i][j]);
		}
		// cout<<ln;
	}
	for(int i=1;i<=s/3;i++){
		ans=(ans+dp[i][s]-dp[i][s-1]+modF)%modF;
	}
	cout<<ans<<ln;
}

signed main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 13720
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
vector<ll> x;
pair <ll,ll> p[110000];
int main(){
  ll n;
  cin>>n;
  cout<<n*n*n;
}

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

int _fr[100002];
int *fr = _fr + 1;

int main() {
  int n, x, rez;
#ifdef DEBUG
  freopen("codeforces.in", "r", stdin);
  freopen("codeforces.out", "w", stdout);
#endif
  scanf("%d", &n);
  for(int i = 0; i < n; ++i) {
    scanf("%d", &x);
    fr[x - 1]++;
    fr[x]++;
    fr[x + 1]++;
  }
  rez = 0;
  for(int i = -1; i <= 100000; ++i)
    if(fr[i] > rez)
      rez = fr[i];
  printf("%d", rez);
  return 0;
}


Measured memory_bytes: 640
import sys
import numpy as np
import math  # gcdもあるよ
import collections
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化

def main():
    n = int(sys.stdin.readline())
    a = list(map(int,sys.stdin.readline().split()))
    q = int(sys.stdin.readline())
    queue = [list(map(int,sys.stdin.readline().split())) for _ in range(q)]
    count = collections.Counter(a)
    #print(count)
    #print(list(count))
    ans = 0
    for k in count:
        ans += k * count[k]
    for b, c in queue:
        if  b in count:
            if c in count:
                count[c] += count[b]
                ans += (c - b) * count[b]
                del count[b]
            else:
                count[c] = count[b]
                ans += (c - b) * count[b]

                del count[b]
        print(ans)
    
    
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 55036
#include <iostream>
#define MOD 1000000007
using namespace std;

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

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b && b==c)puts("No");
    else if(a!=b && b!= c && a != c)puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	int d[14][14]={0},x,y,t,m=0,z=0;
	while(scanf("%d,%d,%d",&x,&y,&t)!=EOF){
		switch(t){
			case 3:d[x][y+2]++;d[x+2][y]++;d[x+2][y+4]++;d[x+4][y+2]++;
			case 2:d[x+1][y+1]++;d[x+1][y+3]++;d[x+3][y+1]++;d[x+3][y+3]++;
			case 1:d[x+1][y+2]++;d[x+2][y+1]++;d[x+2][y+2]++;d[x+2][y+3]++;d[x+3][y+2]++;break;
		}
	}
	for(int i=0;i<100;i++){
		if(d[i/10+2][i%10+2]==0)z++;
		m=max(m,d[i/10+2][i%10+2]);
	}
	cout<<z<<endl<<m<<endl;
}

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

int main(){

int i,x;
  for(i=1;1<1000;i=i+1)
    
 {  
   
  cin >> x;
    if ( x == 0 ) break;
   
   else
   cout<<"Case "<<i<<": "<<x<<endl;
}
  return 0;

}


Measured memory_bytes: 3064
s = input()
n = len(s)

calc = False
ans = 0
left = 0
right = 0
for i in range(n):
    if i == n-1:
        if s[i] == '<':
            left += 1
            calc = True
        else:
            right += 1
            calc = True
    else:
        if s[i] == '<':
            left += 1
        else:
            right += 1
            if s[i+1] == '<':
                calc = True
    if calc:
        if left >= right:
            ans += left*(left+1)//2
            ans += right*(right-1)//2
            calc = False
            left = 0
            right = 0
        else:
            ans += right*(right+1)//2
            ans += left*(left-1)//2
            calc = False
            left = 0
            right = 0

print(ans)


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

const int Maxn = 2005, p = 924844033;
int n, k, ct, arr[Maxn];
long long ans, f[Maxn][Maxn][2][2], fac[Maxn];
int main()
{
	scanf("%d%d", &n, &k);
	fac[0] = 1;
	for (int i = 1; i <= n; i++)
		fac[i] = fac[i - 1] * i % p;
	for (int i = 1; i <= k; i++)
		for (int j = i; j <= n; j += k)
			arr[++ct] = j;
	arr[0] = -0x3f3f3f3f;
	f[0][0][0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		f[i][0][0][0] = 1; 
		for (int j = 1; j <= i; j++)
		{
			f[i][j][0][0] = (f[i - 1][j][0][0] + f[i - 1][j][1][0] + f[i - 1][j - 1][0][0] * (arr[i] - arr[i - 1] == k)) % p;
			f[i][j][0][1] = (arr[i + 1] - arr[i] == k) * (f[i - 1][j - 1][0][0] + f[i - 1][j - 1][1][0]) % p;
			f[i][j][1][0] = (f[i - 1][j][0][1] + f[i - 1][j][1][1] + (arr[i] - arr[i - 1] == k) * f[i - 1][j - 1][0][1]) % p;
			f[i][j][1][1] = (arr[i + 1] - arr[i] == k) * (f[i - 1][j - 1][0][1] + f[i - 1][j - 1][1][1]) % p;
		}
	}
	for (int i = 0; i <= n; i++)
		(ans += (i & 1 ? p - 1 : 1) * fac[n - i] % p * (f[n][i][0][0] + f[n][i][1][0])) %= p;
	printf("%lld", ans);
	return 0;
}

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

using namespace std;

int main(){
	
	int n;
	string s, ans = "";
	
	cin >> n;
	cin >> s;
	
	for (int i = 0; i < s.length(); i++){
		s[i] += n;
		if (s[i] > 'Z'){
			s[i] -= 26;
		}
	}
	
	cout << s;
	
}


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

int main() {
    string s1;
    int n = 0;
    int val1 = 0;
    while (true) {
        cin >> s1;
        if (s1 == "-") break;
        cin >> n;
        for (int i=n; n>0; --n) {
        cin >> val1;
            string sub1 = s1.substr(0,val1);
            string sub2 = s1.substr(val1,s1.size());
            s1 = sub2 + sub1;
        }
        cout << s1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,n) for(ll i=n-1;i>=0;i--)
#define rloop(i,a,b) for(ll i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll n,k;
  cin>>n>>k;
  ll a[n];
  fo(i,n)
  cin>>a[i];
  for(ll i=k;i<n;i++)
  {
      if(a[i]>a[i-k]) cout<<"Yes\n";
      else cout<<"No\n";
  }
  return 0;
}

Measured memory_bytes: 5200
// atcoder/abc178/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  lli a, b, c, d;
  while (cin >> a >> b >> c >> d) {
    cout << max({a*c, a*d, b*c, b*d}) << endl;
  }

  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 998244353;

template <class T>
T fexp(T x, long long e) {
	T ans(1);
	for(; e > 0; e /= 2) {
		if(e & 1) ans = ans * x;
		x = x * x;
	}
	return ans;
}

template <int mod = MOD>
struct modBase {
	modBase(int v = 0) : val(v) {}
	int val;

	modBase<mod> operator * (modBase<mod> o) { return (long long) val * o.val % mod; }
	modBase<mod> operator / (modBase<mod> o) { return *this * fexp(o, mod - 2); }
	modBase<mod> operator + (modBase<mod> o) { return val + o.val > mod ? val + o.val - mod : val + o.val; }
	modBase<mod> operator - (modBase<mod> o) { return val - o.val < 0 ? val - o.val + mod : val - o.val; }
};

const int ms = 1000100;
modBase<> a[ms], b[ms];

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	while(n--) {
		int v;
		std::cin >> v;
		b[v] = b[v] + a[v] * v;
		a[v] = a[v] + v;
	}
	modBase<> ans(0);
	for(int i = 1; i < ms; i++) {
		for(int j = i + i; j < ms; j += i) {
			b[i] = b[i] + a[j] * a[i] + b[j];
			a[i] = a[i] + a[j];
		}
	}
	for(int i = ms-1; i > 0; i--) {
		for(int j = i + i; j < ms; j += i) {
			b[i] = b[i] - b[j];
		}
	}
	for(int i = 1; i < ms; i++) {
		if(b[i].val) {
			ans = ans + b[i] / modBase<>(i);
			//std::cout << i << ": " << b[i].val << "\n";
		}
	}
	std::cout << ans.val << '\n';
}

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

typedef struct{
  char mark;
  int num;
}Elem;

int main(){
  int n;

  Elem bubble[37],select[37];
  
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>bubble[i].mark>>bubble[i].num;
    select[i].mark=bubble[i].mark;
    select[i].num=bubble[i].num;
  }
  for(int i=0;i<n-1;i++){
    for(int j=0;j<n-1-i;j++){
      if(bubble[j].num>bubble[j+1].num){
	Elem temp=bubble[j];
	bubble[j]=bubble[j+1];
	bubble[j+1]=temp;
      }
    }
  }
  for(int i=0;i<n-1;i++){
    int minj=i;
    for(int j=i;j<n;j++){
      if(select[j].num<select[minj].num){
	minj=j;
      }
    }
    Elem temp=select[i];
    select[i]=select[minj];
    select[minj]=temp;
  }
  int flag =0;
  for(int i=0;i<n;i++){
    if(bubble[i].mark != select[i].mark){
      flag=1;
      break;
    }
  }
  for(int i=0;i<n;i++){
    cout<<bubble[i].mark<<bubble[i].num;
    if(i==n-1)cout<<endl;
    else cout<<" ";
  }
  cout<<"Stable"<<endl;
  for(int i=0;i<n;i++){
    cout<<select[i].mark<<select[i].num;
    if(i==n-1)cout<<endl;
    else cout<<" ";
  }
  if(flag)cout<<"Not stable"<<endl;
  else cout<<"Stable"<<endl;
}

Measured memory_bytes: 1168
n=int(input())
cnt=[[0]*10 for i in range(10)]
for i in range(1,n+1):
  cnt[int(str(i)[0])][int(str(i)[-1])]+=1
ans=0
for i in range(1,10):
  for j in range(1,10):
    ans+=cnt[i][j]*cnt[j][i]
print(ans)    

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll k,a,b;
    cin >> k >> a >> b;
    if(a%k == 0 || b%k == 0){
        cout << "OK" << endl;
        return 0;
    }else if((b-a) >= k){
        cout << "OK" << endl;
    }else if((b/k-a/k) >= 1){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }


    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
#include<cstdio>
int main(){
  int hit,blow;
  int a[4],b[4];
  while(scanf("%d",&a[0])!=EOF){
    hit=0;
    blow=0;
    for(int i=1;i<4;i++){
      cin>>a[i];
    }
    for(int i=0;i<4;i++){
      cin>>b[i];
      if(a[i]==b[i]){
	hit++;
	b[i]=11;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(a[i]==b[j])blow++;
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }
}

Measured memory_bytes: 1244
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  	var one = nextIntArray();
	var N = one[0];
	var M = one[1];
	var hlist = nextIntArray();
	var maxs = new Set();
	for(var i = 0; i < N; i++){
		maxs.add(i);
	}

	for(var i = 0; i < M; i++){
		var tmp = nextIntArray();
		if(hlist[tmp[0] - 1] > hlist[tmp[1] - 1]){
			maxs.delete(tmp[1] - 1);
		}else if(hlist[tmp[1] - 1] > hlist[tmp[0] - 1]){
			maxs.delete(tmp[0] - 1);
		}else{
			maxs.delete(tmp[1] - 1);
			maxs.delete(tmp[0] - 1);
		}
	}
	
	myout(maxs.size);
	
}

Measured memory_bytes: 63452
a = []
n = int(input())

a = list(map(int, input().split()))

e = 0  
for i in range(n):
  if a[i] % 2 == 0:
    e += 1
f = 0
for i in range(n):
  if a[i] % 6 == 0 or a[i] % 10 == 0:
    f += 1

if e == f:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 38384
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let k: usize = sc.read();
    let s: String = sc.read();
    let ans = if s.len() <= k {
        s
    } else {
        (&s[..k]).to_string() + "..."
    };
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

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

    int n;
    cin>>n;

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

    vector<vector<ld>> dp(n+1, vector<ld>(n+1, 0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=0;j<=n;j++) {
            if(j==0) {
                dp[i][j]=dp[i-1][j]*(1-p[i-1]);
            }
            else {
                dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1]);
            }
        }   
    }

    ld ans = 0;
    for(int i=n/2+1;i<=n;i++) {
        ans+=dp[n][i];
    }

    cout<<setprecision(12)<<ans;

    return 0;
}

Measured memory_bytes: 141056
N = int(input())
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
dp[1] = abs(h[0] - h[1])
h_2 = h[0]
h_1 = h[1]

for i in range(2, N):
    x = h[i]
    dp[i] = min(
        dp[i - 1] + abs(x - h_1),
        dp[i - 2] + abs(x - h_2)
    )
    h_2 = h_1
    h_1 = x
print(dp[-1])


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<tuple<int, string, int>> record(N);
    for (int n = 0; n < N; n++) {
        string S;
        int P;
        cin >> S >> P;
        record[n] = make_tuple(n + 1, S, P);
    }

    stable_sort(record.begin(), record.end(), [](const auto & a, const auto & b) { return get<2>(a) > get<2>(b); });
    stable_sort(record.begin(), record.end(), [](const auto & a, const auto & b) { return get<1>(a) < get<1>(b); });

    for (int n = 0; n < N; n++) {
        cout << get<0>(record[n]) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int n,s;
int ans;
void solve(int w,int a,int sum){
	if(sum>s||a>10){
		return;
	}
	if(w==0){
		ans+=(sum==s);
		return;
	}
	solve(w-1,a+1,sum+a);
	solve(w,a+1,sum);
}
int main(void){
	while(1){
		scanf("%d %d",&n,&s);
		if(n==0&&s==0) break;
		ans=0;
		solve(n,0,0);
		printf("%d\n",ans);
	}
	return 0;
}	


Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>

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

int main() {
	int N;

	cin >> N;

	int temp;

	vector<int> B;
	int sum = 0;

	B.push_back(-1);

	for (int i = 1; i < N; i++) {
		cin >> temp;

		B.push_back(temp);
	}

	for (int i = 0; i < N; i++) {
		if (i == 0) {
			sum += B[1];
		} else if (i == N - 1) {
			sum += B[N-1];
		} else {
			temp = B[i];
			chmin(temp, B[i+1]);

			sum += temp;
		}
	}

	cout << sum << endl;

}


Measured memory_bytes: 256
using System;

namespace abc139_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string f = Console.ReadLine();
            string t = Console.ReadLine();

            int same = 0;
            if(f[0] == t[0])
            {
                same++;
            }

            if (f[1] == t[1])
            {
                same++;
            }

            if (f[2] == t[2])
            {
                same++;
            }
            Console.WriteLine(same);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(int N, int M, vector<vector<int>> &ab, bool &flg){

    queue<int> q;
    vector<int> cost(N+1, -1);

    q.push(1);
    cost.at(1) = 0;

    //  bfs
    while( !q.empty() ){
        int buf;
        buf = q.front();
        q.pop();
//        cout << "buf = "s << buf << endl;

        for( auto np: ab.at(buf) ){
           if( cost.at(np) != -1 ){
               continue;
           }
           cost.at(np) = cost.at(buf) + 1;
//           cout << np << " "s << cost.at(np) << " "s << cost.at(buf) << endl;
           q.push(np);
        }
    }
    if( cost.at(N) == 2){
        flg = true;
    }

//    for( int i = 0; i < N+1; ++i){
//        cout << "cost = "s << cost.at(i) << endl;
//    }

    return;
}

int main(){

    int N, M;
    cin >> N >> M;
    vector<vector<int>> ab(N+1);
    for( int i = 0; i < M; ++i){
        int a, b;
        cin >> a >> b;
        ab.at(a).push_back(b);
        ab.at(b).push_back(a);
    }

    bool flg = false;
    solver(N, M, ab, flg);

    if( flg ){
        cout << "POSSIBLE"s << endl;
    }
    else{
        cout << "IMPOSSIBLE"s << endl;
    }
    return 0;
}

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

int main() {
  int N;
  string S;
  string color = "Three";
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S == "Y"){
    color = "Four";
    break;
    }
  }
 cout << color << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int A, B;
int main () {
cin>>A>>B;
if (A==1)
 	A = 14;
if (B==1)
	B = 14 ;
if (A>B)
	cout<<"Alice"<<endl;
else if (A<B)
		cout<<"Bob"<<endl;
else
		cout<<"Draw"<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] NM = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[] roadCnt = new long[NM[0]];
            for (int j = 0; j < NM[1]; j++)
            {
                long[] ab = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
                roadCnt[ab[0] - 1] += 1;
                roadCnt[ab[1] - 1] += 1;
            }
            for(int z = 0; z < roadCnt.Count(); z++)
            {
                Console.WriteLine(roadCnt[z]);
            }
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();


//Console.WriteLine(ans);

Measured memory_bytes: 28100
s = input()

ans1 = ""
ans2 = ""

for i in range(len(s)):
    if i%2 == 0:
        ans1 += "1"
        ans2 += "0"
    else:
        ans1 += "0"
        ans2 += "1"

ans11 = 0
ans22 = 0
for i in range(len(s)):
    if s[i:i+1] != ans1[i:i+1]:
        ans11 += 1
    if s[i:i+1] != ans2[i:i+1]:
        ans22 += 1
print(min(ans11,ans22))

Measured memory_bytes: 3316
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    n = int(sys.stdin.readline())
    A = list(map(int,sys.stdin.readline().split()))
    num_dict = {}
    flag = True
    for x in A:
        if not x-1 in num_dict:
            num_dict[x-1] = x-1
        else:
            flag = False
            break
    print("YES") if flag else print("NO")
    return 0

if __name__ == "__main__":
    main()

Measured memory_bytes: 44036
n,c,k = list(map(int, input().split()))
ans = 0
t = []
for _ in range(n):
    t.append(int(input()))
t.sort()
p = t[0]
m = 1
for i in range(1,n):
    if t[i]-p>k or m>=c:
        ans += 1
        p = t[i]
        m = 1
    else:
        m += 1
print(ans+1)


Measured memory_bytes: 7384
h, w = map(int , input().split())
a = [list(map(int , input().split())) for _ in range(h)]

ans = []

for hi in range(h):
  for wi in range(w):
    y = hi
    if hi % 2:
      x = w - 1 - wi
    else:
      x = wi
    if a[y][x] % 2 and not (wi == w-1 and hi == h-1):
      a[y][x] -= 1
      if wi == w-1:
        a[y+1][x] += 1
        ans.append([y+1, x+1, y+1+1, x+1])
      elif hi % 2:
        a[y][x - 1] += 1
        ans.append([y+1, x+1, y+1, x-1+1])
      else:
        a[y][x + 1] += 1
        ans.append([y+1, x+1, y+1, x+1+1])
print(len(ans))
for an in ans:
  print(*an)
      

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

int main() {
	string str;
	int num[102],ans=0;
	while(cin>>str){
		ans=0;
		for(int i=0;i<str.size();++i){
			if(str[i]=='I')num[i]=1;
			else if(str[i]=='V')num[i]=5;
			else if(str[i]=='X')num[i]=10;
			else if(str[i]=='L')num[i]=50;
			else if(str[i]=='C')num[i]=100;
			else if(str[i]=='D')num[i]=500;
			else if(str[i]=='M')num[i]=1000;
		}
		for(int i=0;i<str.size();++i){
			if(num[i]<num[i+1]&&i!=str.size()-1){
			ans+=num[i+1]-num[i];
			i++;
			}
			else ans+=num[i];
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n; cin >> n;
    int sum = 0, maxL = 0;
    for(int i = 0; i < n; ++i){
        int L; cin >> L;
        sum += L;
        maxL = max(maxL,L);
    }

    if(maxL < sum - maxL){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
using namespace std;


typedef long long ll;

char buf[100];
char query(int x) {
  printf("%d\n", x);
  fflush(stdout);
  scanf("%s", buf);
  return buf[0];
}

void go(int left, int right, char chL, char chR) {
  int mid = (left + right) / 2;
  char chM = query(mid);
  if(chM == 'V') {
    return;
  }
  if(chM == chL) {
    if((mid - left) % 2 == 0) {
      go(mid, right, chM, chR);
    } else {
      go(left, mid, chL, chM);
    }
  } else {
    if((mid - left) % 2 == 0) {
      go(left, mid, chL, chM);
    } else {
      go(mid, right, chM, chR);
    }
  }
}

int main(void) {
  int n;
  scanf("%d", &n);
  char ch0 = query(0);
  if(ch0 == 'V') {
    return 0;
  }
  char chN2 = query(n / 2);
  if(ch0 == 'V') {
    return 0;
  }
  if(ch0 == chN2) {
    if(n/2%2 == 0) {
      go(n/2, n, chN2, ch0);
    } else {
      go(0, n/2, ch0, chN2);
    }
  } else {
    if(n/2%2 == 0) {
      go(0, n/2, ch0, chN2);
    } else {
      go(n/2, n, chN2, ch0);
    }
  }
  
  return 0;
}


Measured memory_bytes: 852
n=int(input())
t=n
c=1
while t>=10:
    t=t//10
    c=c+1
ans=0
for i in range(1,c):
    if i%2==1:
        ans+=10**(i)-10**(i-1)
if c%2==1:
    ans=ans+n+1-10**(c-1)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define forsn(i,x,y) for(long long i = (x) ; i <= (y) ; ++i)
typedef long long ll;
typedef long double ld;




void explore(vector<vector<int>> &adj, vector<bool> &visited, int s, vector<int> &disj, int root) {
  visited[s] = true;
  disj[s] = root;
  for(int a : adj[s]) {
    if(!visited[a]) {
      explore(adj, visited, a, disj, root);
    }
  }
}

void dsearch(vector<vector<int>> &adj, vector<int> &disj) {
  vector<bool> visited(adj.size(), false);
  forn(i,adj.size()) {
    if(!visited[i]) {
      explore(adj,visited,i,disj,i);
    }
  }
}



int main() {
  int n,k,l;
  cin >> n >> k >> l;
  vector<vector<int>> roads(n,vector<int>());
  vector<vector<int>> trains(n,vector<int>());
  forn(i,k) {
    int f, t;
    cin >> f >> t;
    roads[f-1].push_back(t-1);
    roads[t-1].push_back(f-1);
  }
  forn(i,l) {
    int f, t;
    cin >> f >> t;
    trains[f-1].push_back(t-1);
    trains[t-1].push_back(f-1);
  }
  
  vector<int> roaddisj(n,0);
  dsearch(roads,roaddisj);
  vector<int> traindisj(n,0);
  dsearch(trains, traindisj);
  vector<pair<pair<int,int>,int>> pairs;
  forn(i,n) {
    pairs.push_back(make_pair(make_pair(roaddisj[i],traindisj[i]),i));
  }
  sort(pairs.begin(), pairs.end());
  /*
  for(pair<pair<int,int>,int> p : pairs) {
    cout << p.first.first << " " << p.first.second <<  " " << p.second << endl;
  }
  cout << endl;
  */
  int cnt = 1;
  int ini = 0;
  vector<int> ans(n,0);
  for(int i = 1; i <= n; i++) {
    if(i < n && pairs[i].first == pairs[i-1].first) {
      cnt++;
    }
    else {
      for(int j = ini;j < ini+cnt;j++) {
        ans[pairs[j].second] = cnt;
      }
      ini = ini + cnt;
      cnt = 1;
    }
  }
  for(int a : ans) {
    cout << a << " " ;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 20464
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const long long INF = 1LL << 60;

string S,T;

int main()
{
  cin >> S >> T;
  int res = 0;
  rep(i,S.size())
  {
    if(S[i] != T[i]) res++;
  }
  cout << res << endl;
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/


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

	int n, x;
	cin >> n >> x;
	vector<int> l(n);
	rep(i, n) cin >> l[i];

	int ans = 1;
	int d = 0;
	rep(i, n) {
		d = d + l[i];
		if (d > x) break;
		ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;
//abc178e

ll mn(ll x,ll xx,ll y,ll yy){
    return abs(x-xx)+abs(y-yy);
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V<ll> x(n),y(n);
    V<P> xx(n),yy(n);
    map<ll,V<ll>> mp;
    rep(i,n){
        cin>>x[i]>>y[i];
        xx[i]=make_pair(x[i],i);
        yy[i]=make_pair(y[i],i);
        mp[x[i]].pb(y[i]);
        mp[y[i]].pb(x[i]);
    }
    ll ans=0;
    ll m1=-1000000000000,m2=1000000000000;
    rep(i,n){
        chmax(m1,x[i]-y[i]);
        chmin(m2,x[i]-y[i]);
    }
    chmax(ans,m1-m2);
    m1=-100000000000;m2=1000000000000;
    rep(i,n){
        chmax(m1,x[i]+y[i]);
        chmin(m2,x[i]+y[i]);
    }
    chmax(ans,m1-m2);
    /*sort(all(xx));
    sort(all(yy));
    ll ans=0;
    int p1=xx[0].sc,p2=xx[n-1].sc;
    int p3=yy[0].sc,p4=yy[n-1].sc;
    ll tmp1=abs(x[p1]-x[p2]);
    sort(all(mp[x[p1]]));
    sort(all(mp[x[p2]]));
    
    ll q1,q2,q3,q4;
    q1=mp[x[p1]][0];
    q2=mp[x[p1]].back();
    q3=mp[x[p2]][0];
    q4=mp[x[p2]].back();
    tmp1+=max(abs(q1-q4),abs(q2-q3));
    chmax(ans,tmp1);
    ll tmp2=abs(y[p3]-y[p4]);
    sort(all(mp[y[p3]]));
    sort(all(mp[y[p4]]));
    
    //ll q1,q2,q3,q4;
    q1=mp[y[p3]][0];
    q2=mp[y[p3]].back();
    q3=mp[y[p4]][0];
    q4=mp[y[p4]].back(); 
    tmp2+=max(abs(q1-q4),abs(q2-q3));
    chmax(ans,tmp2);*/
    out(ans);
    //out(max({mn(x[p1],x[p2],y[p1],y[p2]),mn(x[p3],x[p4],y[p3],y[p4])}));
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

int main() {
  int a,s; cin >>a>>s;
  if(a>s){
    cout << a-s;
  }
  else{
    cout << "0";
  }
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(void){
    char a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>> a[i][j];
        }
    }

   cout<<a[0][0]<<a[1][1]<<a[2][2];
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n, k, x, y;
    cin >> n >> k >> x >> y;

    if (k >= n) {
        MSG(n * x)
    } else {
        MSG(k * x + (n - k) * y)
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

void solve(){
    int N;
    cin>>N;
    map<string,int> mp;
    for(int i=0;i<N;i++){
        string s;
        cin>>s;
        mp[s]++;
    }
    out(mp.size());

}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 19148
n=int(input())
l=[int(i) for i in input().split()]
lst=[0]
for i in l:
    lst.append(lst[-1]+i)
sm=lst[-1]
ans=10**20
for i in range(1,n):
    x=lst[i]
    y=sm-x
    a=abs(x-y)
    ans=min(ans,a)
print(ans)

Measured memory_bytes: 24948
#include <stdio.h>

int main() {
    int N, X, L, cnt = 0;
    scanf("%d %d", &N, &X);
    int D[1000];
    D[1] = 0;
    for (int i = 2; i <= N+1; ++i) {
        scanf("%d", &L);
        D[i] = L + D[i-1];
    }
    for (int i = 1; i <= N+1; ++i) {
        if (D[i] <= X) ++cnt;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	S := sc.nextRuneSlice()
	ans := 0
	for i := 0; i < N-1; i++ {
		l := make(map[rune]bool)
		r := make(map[rune]bool)
		for j := 0; j <= i; j++ {
			l[S[j]] = true
		}
		for k := i + 1; k < N; k++ {
			r[S[k]] = true
		}
		count := 0
		for key, _ := range l {
			if r[key] {
				count++
			}
		}
		if ans < count {
			ans = count
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 640
n = int(input())
A = list(map(int, input().split()))
q = int(input())

for i in range(q):
    com, b, e = list(map(int, input().split()))

    # min
    if com == 0:
        print(min(A[b:e]))

    # max
    else:
        print(max(A[b:e]))


Measured memory_bytes: 5624