akhauriyash/Code-Regression huggingface dataset:
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//INT_MAXなど
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  int K, N;
  cin >> K >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];

  int sum = K - A[N - 1] + A[0];
  int max_dis = sum;
  for (int i = 0; i < N - 1; i++) {
    sum += A[i + 1] - A[i];
    max_dis = max(max_dis, A[i + 1] - A[i]);
  }

  cout << sum - max_dis << endl;

  return 0;
}

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

#define LEN_WORD 100

int main (void)
{
	/* variables for main process */
	char buffer_word[LEN_WORD];

	// STEP.01
	// read out the targe word
	scanf( "%s", buffer_word );

	// STEP.02
	// output the shortened word
	printf( "%c%d%c\n", buffer_word[0], strlen( buffer_word )-2, buffer_word[ strlen( buffer_word )-1 ] );

	// STEP.TRUE_END
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PI acos(-1.0)
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

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

  int ans = 0;

  rep(i,s.size()){
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3868
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long mod = (long) Math.pow(10, 9) + 7;

        long[] prime = new long[n + 1];
        for (int i = 2; i <= n; i++) {
            int num = i;
            for (int j = 2; j <= n; j++) {
                while (num % j == 0) {
                    prime[j] = (prime[j] + 1) % mod;
                    num /= j;
                }
            }
        }

        long count = 1;
        for (int i = 1; i < prime.length; i++) {
            count = (count * (prime[i] + 1)) % mod;
        }
        System.out.println(count);
    }

}


Measured memory_bytes: 21588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;

using Graph = vector<vector<int> >;


int main()
{
	int MAX_N = 1e5 + 1;
	int LMOD = 998244353;
	
	int N;

	cin >> N;

	vector<int> Ds(MAX_N,0);

	int max_d = 0;

	int d;
	for (int di = 0; di < N; di++) {
		cin >> d;
		if (di == 0 && d != 0) {
			cout << 0;
			return 0;
		}
		if (di != 0 && d == 0) {
			cout << 0;
			return 0;
		}
		max_d = max(max_d, d);
		Ds[d]++;
	}

	long long ans = 1;
	long long temp;
	for (int di = 1; di <= max_d; di++) {
		if (Ds[di] == 0) {
			cout << 0;
			return 0;
		}

		temp = 1;
		for (int ti = 0; ti < Ds[di]; ti++) {
			temp = (temp * Ds[di - 1]) % LMOD;
		}
		ans = ans * temp % LMOD ;
		//ans = (ans * pow(Ds[di - 1], Ds[di])) ;
	}

	cout << ans;


	return 0;
}



Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    auto b = a;

    sort(b.begin(), b.end());

    map<int, int> num2rank;
    for(int i=0; i<n; i++){
        num2rank[b[i]] = i;
    }

    int sum = 0;
    for(int i=0; i<n; i++){
        sum += (abs(num2rank[a[i]] - i) % 2);
    }

    int ans = sum / 2;
    cout << ans << endl;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int nm = 2e5;
int n, r[nm + 1], w[nm + 1], ans;
string s;

int main() {

	cin >> n >> s;
	ans = n;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'R')
			++r[i + 1];
		else
			++w[i + 1];
		r[i + 1] += r[i];
		w[i + 1] += w[i];
	}

	for (int i = 0; i < n + 1; ++i) {
		int t = max(w[i] - w[0], r[n] - r[i]);
		ans = min(ans, t);
	}

	cout << ans << endl;
}


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

#define ll long long
#define ull unsigned ll

#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define INFLL 9e18
#define INF 2e9
#define EPS 1e-9
#define pb push_back
#define emp emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0


int main ()

{
    #define int ll
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);

    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    
    int n;
    cin >> n;

    int low = 0;
    int high = n;
    int ans = -1;

    while (low <= high){
        int middle = (low + high)/2;
        if ((int)((double)middle*1.08) == n){
            ans = middle;
            break;
        }
        else if ((int)((double)middle*1.08) > n) high = middle - 1;
        else low = middle + 1;
    }
    if (ans != -1)
    cout << ans << endl;
    else cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
import Text.Printf
import Control.Applicative

main = do
  ss <- (map stoi . words) <$> getLine
  let [a, b] = ss
  putStrLn (if a < b then "a < b"
            else if a > b then "a > b"
            else "a == b")

stoi :: String -> Int
stoi str = read str :: Int

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

int main() {
int	n,i,c=0;
	cin>>n;
	int a[n],b[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(i=2;i<n;i++)
	{
		if(a[i]==b[i])
		{
			if(a[i-1]==b[i-1]&&a[i-2]==b[i-2])
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<int, lli> il;
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;}

#ifdef LOCAL
#define eprintf(...) printf(__VA_ARGS__)
#else 
#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

int main() {
	lli H, W, N;
	cin >> H >> W >> N;
	ii black[100009];
	vector<ii> As;
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		black[i] = ii(b,a);
		for (int j = b - 2; j <= b; j++) {
			for (int k = a - 2; k <= a; k++) {
				if (0 < j && j <= W - 2 && 0 < k && k <= H - 2) {
					As.push_back(ii(j, k));
				}
			}
		}
	}

	sort(As.begin(), As.end());
	As.erase(unique(As.begin(), As.end()), As.end());
	sort(black, black+N);

	lli ans[10]; SET_ZERO(ans);
	for (vector<ii>::iterator it = As.begin(); it != As.end(); ++it) {
		int tmp = 0;
		for (int x = it->first; x < it->first + 3; x++) {
			for (int y = it->second; y < it->second + 3; y++) {
				int q = lower_bound(black, black+N, ii(x,y)) - black;
				tmp += black[q].first == x && black[q].second == y;
			}
		}
		ans[tmp]++;
	}
	ans[0] = (H - 2) * (W - 2)  - As.size();
	for (int i = 0; i < 10; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 10732
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	String s = scan.next();

	for(int i = 0; i < s.length(); i++){
	    if(i % 2 == 0){
		System.out.print(s.charAt(i));
	    }
	}
	System.out.println();
    }
}


Measured memory_bytes: 31200
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
// static const int MOD = 998244353;
// static const int MAX = 100005;
// static const int ls = 101;
// static const int NMAX = 5005;
// static const lli INFTY = 1000000000000;

// typedef priority_queue<int, greater<int>> RevQ;
int n;
int x, y;
string s;
// lli l, r;
// lli gcd(lli a, lli b) {
//   return b ? gcd(b, a%b) : a;
// }



int main(){
  cin >> n;
  cin >> s;
  string alp;
  alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  // cout << alp[2] << endl;
  int l = s.size();
  string ans;
  rep(i, l) {
    int k = 0;
    rep(j, 26) {
      if (alp[j] == s[i]) {
        k = j;
        break;
      }
    }
    k = (k+n)%26;
    ans += alp[k];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
yen, num = list(map(int, input().split()))
dislike = list(map(int, input().split()))
dislike.sort()
a = [1]*10
ans = []
yenstr = list(str(yen))
for i in range(num):
  a[dislike[i]] = 0
for i in range(10):
  if a[i] != 0:
    ans.append(i)

for i in reversed(range(len(yenstr))):
  if ans[len(ans)-1]<int(yenstr[i]):
    if i==0:
      if ans[0]==0:
        yenstr.insert(i, ans[1])
      else:
        yenstr.insert(i, ans[0])
    else:
      yenstr[i] = ans[0]
      yenstr[i-1] = int(yenstr[i-1])+1
output=0
for i in range(len(yenstr)):
  for j in range(len(ans)):
      if yen < output:
        output += ans[0]*10**(len(yenstr)-(i+1))
        break
      elif int(yenstr[i]) <= ans[j]:
        output += ans[j]*10**(len(yenstr)-(i+1))
        break
      elif j == len(ans)-1:
        output += ans[0]*10**(len(yenstr)-(i+1))

print(output)


Measured memory_bytes: 3064
program main
implicit None
integer::d
	read *,d
	
	if (d == 22)then
		print 101,"Christmas Eve Eve Eve"
		else if(d == 23)then
			print 101,"Christmas Eve Eve"
		else if(d == 24)then
			print 101,"Christmas Eve"
		else
			print 101,"Christmas"
	endif

101 format(a)
end program main

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define vvsort(v) sort(v.begin(),v.end(),greater<int>());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int> > rpq;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//----------------------------------------------------------------------------------------------------------------------------------//
int n;
ll sum=0;
ll k;
ll k2;
ll a[100001],b[100001];
int main(){
        cin>>n;
        rep(i,0,n){
                cin>>a[i];
                sum+=a[i];
        }
        if(sum%((1LL+n)*n/2)==0) {
                k=2LL*sum/((1LL+n)*n);
        }else{
                cout<<"NO"<<endl;
                return 0;
        }
        k2=0;
        rep(i,0,n){
                if(k2>k) {
                        cout<<"NO"<<endl;
                        return 0;
                }
                if(i==n-1) {
                        if((a[0]-a[n-1]-k)%n!=0 || (a[0]-a[n-1]-k)>0) {
                                cout<<"NO"<<endl;
                                return 0;
                        }
                        if((a[0]-a[n-1]-k)!=0) {
                                k2+=(-1)*(a[0]-a[n-1]-k)/n;
                        }
                }else{
                        if((a[i+1]-a[i]-k)%n!=0 || (a[i+1]-a[i]-k)>0) {
                                cout<<"NO"<<endl;
                                return 0;
                        }
                        if((a[i+1]-a[i]-k)!=0) {
                                k2+=(-1)*(a[i+1]-a[i]-k)/n;
                        }
                }
        }
        if(k2==k) {
                cout<<"YES"<<endl;
                return 0;
        }else{
                cout<<"NO"<<endl;
        }
}


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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0; i<n; i++) cin >> d[i];
 
  sort(d.begin(), d.end());
  
  cout << d[(int)n/2] - d[((int)n/2)-1] << endl;
  
  
  return 0;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ignore ignore
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define YES printf("YES\n")
#define NO printf("NO\n")
#define yes printf("Yes\n")
#define no printf("No\n")
#define lin printf("\n")
// Iterator
#define rep(i,n) for(i=0;i<n;++i)
#define rrep(i,n) for(i=n-1;i>=0;--i)
#define lp(i,a,b) for(i=a;i<b;++i)
#define rlp(i,a,b) for(i=a;i>=b;--i)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// function
#define sz(x) x.size()
#define inrange(i,a,b) (i>=a && i<=b)
#define FLUSH fflush(stdout)
#define precision(x) cout << setprecision(x) << fixed
#define remax(a,b) a=max(a,b)
#define remin(a,b) a=min(a,b)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
// Constant
const double PI = acos(-1);
const double eps = (1e-9);
const ll INF = 2e9;
const int M = (1e9)+7;
const int N = (1e6)+3;  // check the limit, man
int main()
{
    stack<int> st;
    string str;
    llin(str);
    int i,n;
    n=sz(str);
    rep(i,n)
    {
        if(st.empty())
            st.push(str[i]);
        else
        {
            if(st.top()!=str[i])
                st.pop();
            else
                st.push(str[i]);
        }
    }
    i=st.size();
    out(n-i);
}



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

int main() {
    int N;
    cin >> N;
    int X = N;
    int fx = 0;
    while (X != 0) {
        fx += X % 10;
        X /= 10;
    }
    if (N % fx == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, d = map(int, input().split())
ans = 0
a = [list(map(int, input().split())) for i in range(n)]
import math
for i in range(n-1):
    for j in range(i+1, n):
        dist = math.sqrt(sum([(a[i][k]-a[j][k])**2 for k in range(d)]))
        if (int(dist) == dist):
            ans += 1
print(ans)

Measured memory_bytes: 9116
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // 文字を取得
        Scanner sc = new Scanner( System.in );
        String tapAll  = sc.next();
        String tap;
        String result = "Yes";

        for( int i = 0; i < tapAll.length(); i++ ) {
            tap = String.valueOf( tapAll.charAt( i ) );
            // 偶数
            if( ( i + 1 ) % 2 == 0 ) {
                if( !tap.equals( "L" ) && !tap.equals( "U" ) && !tap.equals( "D" ) ) {
                    result = "No";
                }
            }
            // 奇数
            else {
                if( !tap.equals( "R" ) && !tap.equals( "U" ) && !tap.equals( "D" ) ) {
                    result = "No";
                }
            }
        }
        System.out.println( result );
    }
}

Measured memory_bytes: 23124
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner ssc = new Scanner(System.in);
        int h = ssc.nextInt();
        int w = ssc.nextInt();
        int n = ssc.nextInt();
        int sr = ssc.nextInt();
        int sc = ssc.nextInt();
        
        String str = ssc.next();
        char[] sente = str.toCharArray();
        str = ssc.next();
        char[] gote = str.toCharArray();
        
        boolean win = false;
        // 左に落とせるか
        int max = w;
        int now = sc;
        for (int i = 0; i < n; i++) {
            if (sente[i] == 'L') now--;
            if (now == 0) win = true;
            if (gote[i] == 'R') now = Math.min(++now, max);
        }
        // 右に落とせるか
        int min = 1;
        now = sc;
        for (int i = 0; i < n; i++) {
            if (sente[i] == 'R') now++;
            if (now == w+1) win = true;
            if (gote[i] == 'L') now = Math.max(--now, min);
        }
        // 上に落とせるか
        max = h;
        now = sr;
        for (int i = 0; i < n; i++) {
            if (sente[i] == 'U') now--;
            if (now == 0) win = true;
            if (gote[i] == 'D') now = Math.min(++now, max);
        }
        // 下に落とせるか
        min = 1;
        now = sr;
        for (int i = 0; i < n; i++) {
            if (sente[i] == 'D') now++;
            if (now == h+1) win = true;
            if (gote[i] == 'U') now = Math.max(--now, min);
        }
        
        if (win) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}


Measured memory_bytes: 42132
<?php
$n=trim(fgets(STDIN));
if($n==1){
  echo 0;
}else{
  $h=explode(" ",trim(fgets(STDIN)));
  $i=0;
  $max=0;
  $r=0;
  while($i<$n-1){
    if($h[$i]>=$h[$i+1]){
      ++$r;
    }else{
      $max=max($max,$r);
      $r=0;
    }
    ++$i;
  }
  echo max($max,$r);
}

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

using namespace std;

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

int main(){
    int n, x;
    cin >> n >> x;
    int p = 0, ans = 0;
    for(int i = 0; i < n; i++){
        int l;
        cin >> l;
        if(p+l <= x)ans++;
        p+=l;
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Flag
 */
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int W, H;
		char c;

		W = sc.nextInt();
		H = sc.nextInt();
		c = sc.next().charAt(0);

		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if ((i == 0 || i == H - 1) && (j == 0 || j == W - 1)) {
					sb.append('+');
				} else if (i == 0 || i == H - 1) {
					sb.append('-');
				} else if (j == 0 || j == W - 1) {
					sb.append('|');
				} else if (i == H / 2 && j == W / 2) {
					sb.append(c);
				} else {
					sb.append('.');
				}
			}
			sb.append('\n');
		}

		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 26232
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>

const long long INF = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong x,t;
    cin >> x >> t;
    if(x-t<0){
        cout << 0 << endl;
        exit(0);
    }
    cout << x-t << endl;
    return 0;
}


Measured memory_bytes: 3148
#include<algorithm>
#include<iostream>
#include<stack>

using namespace std;

struct Node{
 Node *right;
 Node *left;
 Node *parent;
 int key;
public:
 Node(Node *r,Node *l,Node *p,int k) : right(r), left(l), parent(p), key(k){};
};

class Tree{
 Node *root;
 enum ORDER {PREORDER = 0, INORDER, POSTORDER};
public:
 Tree(){root = 0;}


 void insert(int v){
  Node *z = new Node(0,0,0,v);
  Node *y = 0;
  Node *x = root;
  while(x != 0){
   y = x;
   if(z->key < x->key){
    x = x->left;
   }else{
    x = x->right;
   }
  }
  z->parent = y;
  if( y == 0){
   root = z;
  }else if(z->key < y->key){
   y->left = z;
  }else{
   y->right = z;
  }
 } 

 void outputMain(Tree tree){
  outputOrder(tree, INORDER);
  outputOrder(tree, PREORDER);
 }

 void outputOrder(Tree tree, enum ORDER order = PREORDER){

  if(tree.root == 0) return ;

  Node* cur = tree.root;
  Node* prev = cur->parent;
  while(cur != 0){
   if(cur->parent == prev){

    if(order == PREORDER) cout << " " << cur->key;

    if(cur->left != 0){
     prev = cur;
     cur = cur->left;
     continue;
    }else{
     prev = cur->left;
    }
   }

   if(prev == cur->left){
    
    if(order == INORDER) cout << " " << cur->key;

    if(cur->right != 0){
     prev = cur;
     cur = cur->right;
     continue;
    }else{
     prev = cur->right;
    }
   }

   if(prev == cur->right){
    
    if(order == POSTORDER) cout << " " << cur->key;

    prev = cur;
    cur = cur->parent;
   }
  }
 cout << endl;
 }
};

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

 Tree tree;

 int n = 0;
 cin >> n;

 for(int i=0; i < n; i++){
  string str = "";
  int num = -1;
  cin >> str;
  if(str == "insert"){
   cin >> num;
   tree.insert(num); 
  }else if(str == "print"){
   tree.outputMain(tree); 
  }
 }

 
 return 0;
}

Measured memory_bytes: 24668
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000001
using namespace std;
typedef long long ll;

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

int main(){
  int N, X; cin >> N >> X;
  vector<int> x(N);
  rep(i, 0, N)  {
    cin >> x[i];
    x[i] = abs(x[i]-X);
  }
  sort(all(x));
  int ans = 0;
  rep(i, 0, N)  ans = gcd(ans, x[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		long N=sc.nextLong();
		
		long min=0;
		for(int i=0;i<5;i++) {
			
			if(i==0)min=sc.nextLong();
			else min=Math.min(min, sc.nextLong());
		}
		p((long)Math.ceil((double)N/min)+4);
		
		
		
		
		
	}
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;


int main() {
    while (true) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) return 0;
        rep(y, h) {
            rep(x, w) {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;

    }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  ll n;
  cin>>n;
  ll s[n+4];
  rep(i,n){
    cin>>s[i];
  }
  ll ans=0;
  rep(i,n){
    ans+=s[i];
  }
  if(ans%10==0){
    sort(s,s+n);
    rep(i,n){
     if(s[i]%10!=0){
       ans-=s[i];
       break;
     }
    }
  }
  if(ans%10==0){
    cout<<'0'<<endl;
  }
  else{
    cout<<ans<<endl;
  }
       }

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

using namespace std;

int main()
{
int a;
vector<int> array;
for(;cin >> a;)
{
if(a==0)
{
cout << array[array.size()-1] << endl;
array.pop_back();
}
else
array.push_back(a);
}
}

Measured memory_bytes: 1212
#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

const int INF = 2e9;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, t;
    cin >> n >> t;

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

    int best = 0;
    int maxVal = a[n - 1];
    for (int i = n - 2; i >= 0; --i) {
        best = max(best, maxVal - a[i]);
        maxVal = max(maxVal, a[i]);
    }

    int answer = 0;

    for (int r = n - 1, l = n - 1; r >= 0; r = l - 1) {
        l = r - 1;
        while (l >= 0 && a[l] <= a[r]) {
            --l;
        }
        ++l;

        if (l == r) {
            continue;
        }

        int minVal = INF;
        int minIdx = -1;

        for (int i = l; i <= r; ++i) {
            if (a[i] < minVal) {
                minVal = a[i];
                minIdx = i;
            }
        }

        if (a[r] - minVal < best) {
            continue;
        }

        int minCount = 0;
        for (int i = l; i <= r; ++i) {
            if (a[i] == minVal) {
                ++minCount;
            }
        }

        int maxCount = 0;
        for (int i = minIdx; i <= r; ++i) {
            if (a[i] == a[r]) {
                ++maxCount;
            }
        }

        answer += min(minCount, maxCount);
    }

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int mod=1e9+7;
const int maxn=2e5+7;
ll qpow(ll a,ll b)
{
  ll ans=1;
  while(b)
  {
    if(b&1)
      ans=ans*a%mod;
    a=a*a%mod;
    b>>=1;
  }
  return ans;
}
ll C(ll a,ll b)
{
  ll ans=1;
  for(int i=1;i<=a;i++)
  {
    ans=ans*i%mod;
  }
  ll res=1;
  for(int i=1;i<=b;i++)
    res=res*i%mod;
    ll ant=1;
  for(int i=1;i<=a-b;i++)
  {
    ant=ant*i%mod;
  }
  ans=ans*qpow(res,mod-2)%mod*qpow(ant,mod-2)%mod;
    return ans;
}
int a[2005];
int main()
{
   ios::sync_with_stdio(0); cin.tie(0);
    ll ans=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
      cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
    {
      for(int j=i+1;j<=n;j++)
        for(int k=j+1;k<=n;k++)
      {
        if(a[k]>=a[i]+a[j])
          break;
        else ans++;
       // cout<<k<<endl;
      }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long a, b;
    scan(a, b);
    if (13 <= a)
    {
        writeln(b);
    }
    else if (6 <= a)
    {
        writeln(b / 2);
    }
    else
    {
        writeln(0);
    }
}


Measured memory_bytes: 256
import Foundation

extension String {
    
    func toStrList() -> [String] {
        return self.map{String($0)}
    }
    
    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }
    
    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }
    
    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }
    
    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]
        
        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }
    
    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }
    
    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

extension Array {
    func dump(){
        for x in 0..<self.count-1{
            print(self[x], terminator: " ")
        }
        print(self.last!)
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])
    
}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]
    
    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y
    
    return [rx, ry]
}





func abc131d() -> String {
    let N = Int(readLine()!)!
    var AB = [[Int]](repeating: [], count: N)
    var now = 0
    for i in 0..<N{ AB[i].append(contentsOf: readLine()!.toSepIntList()) }
    AB.sort { (a, b) -> Bool in
        return a[1] < b[1]
    }
    for ab in AB {
        now += ab[0]
        if now > ab[1] {
            return "No"
        }
    }
    return "Yes"
}

print(abc131d())

Measured memory_bytes: 28000
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = (int)3e5 + 5;
const int mod = (int)1e9 + 7;
using namespace std;

char s[maxn];
int a[maxn], b[maxn];

int main()
{
	int n; scanf("%d", &n);
	scanf("%s", s);
	int cnt1 = 0, cnt2 = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'W'){
			cnt1++;
			a[i] = cnt1;
		} else{
			if(i != 0){
				a[i] = a[i-1];
			}
		}
	}
	for(int i = n - 1; i >= 0; i--){
		if(s[i] == 'E'){
			cnt2++;
			b[i] = cnt2;
		} else{
			b[i] = b[i+1];
		}
	}
	int Min = inf;
	int ans;
	for(int i = 0; i < n; i++){
		ans = a[i] + b[i];
		Min = min(Min, ans);
	}
	Min--;
	printf("%d\n", Min);
	return 0;
}

Measured memory_bytes: 2944
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define ll long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ppi>
#define vll vector<ll>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  fastio();
  int n,k,c,i;
   cin>>n>>k>>c;
   string inp;
   cin>>inp;
   vi dpl(n+2,0);
   vi dpr(n+2, 0);
   int prev=-10000000;
   for(i=1;i<=n;i++){
       if(inp[i-1]=='x') 
       	dpl[i]=dpl[i-1];
       else if(prev+c<i){
       	  prev=i;
          dpl[i]=dpl[i-1]+1;
       }
       else{
           dpl[i]=dpl[i-1];
       }
 
   }
   prev=-10000000;
   for(i=1;i<=n;i++){
       if (inp[n-i] == 'x')
           dpr[i] = dpr[i - 1];
       else if (prev + c < i){
           prev = i;
           dpr[i] = dpr[i - 1] + 1;
       }
       else{
           dpr[i] = dpr[i - 1];
       }
   }
   vi ans;
   for(int i=1;i<=n;i++){
       if(dpl[i-1]+dpr[n-i]==k-1 && inp[i-1]=='o'){
           ans.pb(i);
       }
   }
   
  for(int i:ans){
  	cout<<i<<"\n";
  }
  return 0;
}

Measured memory_bytes: 4236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  ll a,b;
  cin >> a >> b;
  
  if(a==1||b==1){
    cout << 1 << endl;
  }
  else if(a*b%2==0){
    cout << a*b/2 << endl;
  }
  else if(a*b%2!=0){
    cout << a*b/2+1 << endl;
  }
}

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

using namespace std;

int main(){
  int q,t,ix;
  bitset<64> a;

  cin >> q;

  for (int i = 0; i < q; i++){
    cin >> t;
    if (t == 0){
      cin >> ix;
      if (a.test(ix)){
        cout << "1" << endl;
      }else{
        cout << "0" << endl;
      }
    }else if(t == 1){
      cin >> ix;
      a.set(ix);
    }else if(t == 2){
      cin >> ix;
      a.reset(ix);
    }else if(t == 3){
      cin >> ix;
      a.flip(ix);
    }else if(t == 4){
      if (a.all()){
        cout << "1" << endl;
      }else{
        cout << "0" << endl;
      }
    }else if(t == 5){
      if (a.any()){
        cout << "1" << endl;
      }else{
        cout << "0" << endl;
      }
    }else if(t == 6){
      if (a.none()){
        cout << "1" << endl;
      }else{
        cout << "0" << endl;
      }
    }else if(t == 7){
      cout << a.count() << endl;
    }else if(t == 8){
      cout << a.to_ullong() << endl;
    }

  }

  return 0;
}



Measured memory_bytes: 3092
H,W,K=map(int,input().split())
S=[input()for _ in range(H)]
ans=[['0']*W for _ in range(H)]

i=U=L=0
now=0
now2=0
while i<H:
    j=0
    ok=0
    while j<W:
        if S[i][j]=='#':
            ok+=1
            now+=1
        if ok:
            ans[i][j]=now
        if ok==1:
            for k in range(j):
                ans[i][k]=now
        j+=1
    if ok>0 and now2==0:
        now2=ans[i]
    i+=1

i=0
while i<H:
    if '0' in ans[i]:
        ans[i]=now2
    else:
        now2=ans[i]
    i+=1

for a in ans:
    print(*a)

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;


/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
// const int MOD = 998244353;
const int MAX = 2'000'005;

ll addM(ll a, ll b){
	return ((a % MOD) + (b % MOD)) % MOD;
}

ll mulM(ll a, ll b){
	return ((a % MOD) * (b % MOD)) % MOD;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
  	else if(b == 1) return a % MOD;
  	else if(b%2==0) return mulM(powM(a, b/2), powM(a, b/2));
  	else return mulM(a, mulM(powM(a, (b-1)/2), powM(a, (b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
  	return mulM(a, powM(b, MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    rep3(i,2,MAX-1){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*** MOD CALCULATION ここまで ***/

void Main(){
    int n; cin >> n;
    vi a(n); rep(i, n) cin >> a[i];
    int tot = 0;
    rep(i, n){
        tot = addM(tot, a[i]);
    }    
    tot = mulM(tot, tot);
    int tot2 = 0;
    rep(i, n){
        tot2 = addM(tot2, mulM(a[i], a[i]));
    }
    tot = addM(tot, MOD - tot2);
    tot = divM(tot, 2);
    cout << tot << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,x;
    cin >>n>>x;

    int sum=0,answer=n;

    vector<int>m(n);
    for(int i=0;i<n;i++){
        cin>>m[i];
        sum+=m[i];
    }

    sort(m.begin(),m.end());
    int xx=x-sum;

    while(xx>m[0]){
        answer+=xx/m[0];
        xx = xx % m[0];
    }

    cout<<answer<<endl;

}


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

int main(){
  int x,y,b,p,n;

  cin >> n;
  while(n--){
    cin >> x >> y >> b >> p;
    if(b >= 5 && p >= 2){
      cout << (x*b+y*p)*0.8 << endl;
    }
    else if(b >= 5 && p < 2){
      double tmp = (x*b+y*p);
      p = 2;
      cout << min(tmp,(x*b+y*p)*0.8) << endl;
    }
    else if(b < 5 && p >= 2){
      double tmp = (x*b+y*p);
      b = 5;
      cout << min(tmp,(x*b+y*p)*0.8) << endl;
    }
    else cout << x*b+y*p << endl;
  }

  return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 40;
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int N;
int t = 0;
int f[105];
int s[105];
int used[105];


void dfs(int x,vector<vector<int>> &g){
    used[x] = 1;
    t ++;
    f[x] = t;
    for(auto y:g[x]){
        if(!used[y]) dfs(y,g);
    }
    t++;
    s[x] = t;
}

int main(){
    cin>>N;
    FOR(i,0,N) used[i]=0;
    vector<vector<int>> G(N);
    FOR(i,0,N){
        int u,k,v;
        cin >> u >> k; u--;
        FOR(j,0,k){
            cin >> v; v--;
            G[u].push_back(v);
        }
    }
    FOR(i,0,N){
        if(!used[i]) dfs(i,G);
    }
    FOR(i,0,N){
        cout << i+1 << " " << f[i] << " " << s[i] << endl;
    } 
    return 0;
}




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

int a, b, c, d;
int main() {
	cin >> a >> b >> c >> d;
	while(1) {
		c -= b;
		if(c<=0) return puts("Yes")*0;
		a -= d;
		if(a<=0) return puts("No")*0;
	}
	return 0;
}


Measured memory_bytes: 3636
# include <bits/stdc++.h>
using namespace std;
# define lli long long int
# define INF 100000000000000

lli sum[401][401];
lli dp[401][401];


lli findMin(lli i, lli j){
    if(i == j){
        return 0;
    }

    if(dp[i][j] != -1){
        return dp[i][j];
    }

    lli minVal = INF;
    for(lli k = i; k < j; k++){
        minVal = min(minVal, sum[i][j] + findMin(i, k) + findMin(k + 1, j));
    }

    return dp[i][j] = minVal;

}


void solve(){
    lli n;
    cin >> n;

    lli arr[n];
    for(lli i = 0; i < n; i++){
        cin >> arr[i];
    }

    for(lli i = 0; i < n; i++){
        for(lli j = i; j < n; j++){
            if(i == j)
                sum[i][j] = arr[j];
            else
                sum[i][j] = arr[j] + sum[i][j - 1];
        }
    }

    cout << findMin(0, n - 1);

}


int main(){

    memset(dp, -1, sizeof(dp));
    solve();

}


Measured memory_bytes: 6132
import java.util.*;

public class Main{
  
  public static void main (String[] args){
    
    Main main = new Main();
    main.solve();
  }
  
  private void solve (){
    
    Scanner scanner = new Scanner(System.in);
    int age = scanner.nextInt();
    
    if (age==1){
      System.out.println("Hello World");
    } else {
      int A = scanner.nextInt();
      int B = scanner.nextInt();
      System.out.println(A+B);
    }
  }
}

Measured memory_bytes: 23764
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        s:i64,
    }
    let x2 = 1e9 as i64;
    let y2 = 1;
    let x3 = (x2 - s % x2)%x2;
    let y3 = (s + x3) / x2;
    println!("{} {} {} {} {} {}", 0, 0, x2, y2, x3, y3);
}


Measured memory_bytes: 2140
//Placing Marbles

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
 
int main(){
    int ans = 0;
    string s;
    cin >> s;
    if(s[0]=='1')ans++;
    if(s[1]=='1')ans++;
    if(s[2]=='1')ans++;
    cout << ans <<endl;
    return 0;
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

int main() {
    FAST;

    int n, i, j, mask, o;
    cin >> n;

    vector<int> v(n), ans(n);
    for (i = 0; i < n; ++i) cin >> v[i];

    for (i = 0; i <= 30; ++i) {
        mask = (1 << i);
        o = 0;

        for (j = 0; j < n; ++j) {
            if (v[j] & mask) ++o;
        }
        if (!o) continue;

        if (o & 1) {
            for (j = 0; j < n; ++j) {
                if (v[j] & mask) continue;
                ans[j] |= mask;
            }
        } else {
            for (j = 0; j < n; ++j) {
                if (v[j] & mask) ans[j] |= mask;
            }
        }
    }

    for (int x : ans) cout << x << " ";

    return 0;
}


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

const ll MOD = 998244353;

ll mod_mul(ll a, ll b){
    return ((a % MOD) * (b % MOD)) % MOD;
}

ll mod_pow(ll x, ll r){
    if (r == 0) return 1;

    else if (r == 1) return x % MOD;

    else if (r % 2 == 0){
        ll t = mod_pow(x, r/2) % MOD;
        return mod_mul(t, t);
    }

    else{
        ll t = mod_pow(x, r/2) % MOD;
        ll k = mod_mul(t, t);
        return ((k % MOD) * (x % MOD)) % MOD;
    }
}

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

    int n;
    cin >> n;

    vector<ll> cnt(n, 0);
    rep(i, n){
        ll d;
        cin >> d;
        if(i==0 && d!=0){
            cout << 0 << endl;
            return 0;
        }
        ++cnt[d];
    }

    if(cnt[0] != 1){
        cout << 0 << endl;
        return 0;
    }

    ll res = 1;
    bool isend = false;
    for(int i = 1; i < n; ++i){
        if(cnt[i] == 0) isend = true;
        if(isend && cnt[i]!=0){
            cout << 0 << endl;
            return 0;
        }
        if(!isend) res = mod_mul(res, mod_pow(cnt[i-1], cnt[i]));
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3992