akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll G[1005][1005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w,a,b; cin>>h>>w>>a>>b;
  rep(i,b){
    rep(j,a){
      G[i][j]=1;
    }
  }
  irep(i,b,h){
    irep(j,a,w){
      G[i][j]=1;
    }
  }
  rep(i,h){
    rep(j,w) cout<<G[i][j];
    cout<<endl;
  }
}

Measured memory_bytes: 9088
#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

void solve(int n, int k, vector<char> &cv) { cv[k-1] = cv[k-1] + 0x20; }

int main(int argc, char const *argv[]) {
  int a, b;

  cin >> a;
  cin >> b;

  if(a<6){
    cout << 0;
  } else
    if(6<=a && a < 13){
      cout << b /2;
    }   else {
      cout <<b;
    }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;

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

int H, W, N, SY, SX;
char board[MAX_W][MAX_W + 1];
int dist[MAX_W][MAX_W + 1];


void init() {
	scanf("%d%d%d ", &H, &W, &N);
	for (int i = 0; i < H; ++i) {
		scanf(" %s ", board[i]);
	}
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (board[i][j] == 'S') {
				SY = i;
				SX = j;
			}
		}
	}
}

int solve() {
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		char tar = '1' + i;
		memset(dist, -1, sizeof(dist));
		queue<pair<int,int> > que;
		que.push(make_pair(SY, SX));
		dist[SY][SX] = 0;
		for (;!que.empty();) {
			int y = que.front().first, x = que.front().second;
			if (board[y][x] == tar) {
				ans += dist[y][x];
				SY = y; SX = x;
				break;
			}
			que.pop();
			int nd = dist[y][x] + 1;
			for (int k = 0; k < 4; ++k) {
				const int ny = y + dy[k], nx = x + dx[k];
				if ( 0 <= ny && ny < H && 0 <= nx && nx < W && board[ny][nx] != 'X' && dist[ny][nx] == -1) {
					dist[ny][nx] = nd;
					que.push( make_pair(ny, nx) );
				}
			}
		}
	}
	return ans;
}

int main() {
	init();
	printf("%d\n", solve());

	return 0;
}

Measured memory_bytes: 5676
#include<cstdio>
#include<cstring>
#include<cassert>
#include<iostream>
#include<algorithm>

using namespace std;

#define Whats(x) cout<<#x<<" is "<<(x)<<endl
#define Divhim() cout<<">>>>>>>>>>>>>>>"<<endl
#define Divher() cout<<"<<<<<<<<<<<<<<<"<<endl
#define Oops() cout<<"!!!!!!!!!!!!!!!"<<endl

template<typename T> bool GetMin(T &a,T b)
{
	return ((a<=b)?false:(a=b,true));
}

template<typename T> bool GetMax(T &a,T b)
{
	return ((a>=b)?false:(a=b,true));
}

/*
	 -<Unlimited Blade Works>-
 */

#define LL long long
#define Pir pair<int,int>
#define fir first
#define sec second

const int N=3333;
const int MX=2e5+10;
const int MOD=1e9+7;

void SU(int &x,int y)
{
	((x+=y)>=MOD)&&(x-=MOD);
}

void SD(int &x,int y)
{
	((x-=y)<0)&&(x+=MOD);
}

int D(int x,int y)
{
	return ((x-=y)<0)?(x+MOD):x;
}

int Qpow(int x,int y=MOD-2)
{
	int res=1;
	for(;y;y>>=1,x=(LL)x*x%MOD)if(y&1)
		res=(LL)res*x%MOD;
	return res;
}

int h,w,n;
Pir p[N];
int dp[N];

int jc[MX],njc[MX];

int C(int n,int m)
{
	return (LL)jc[n]*njc[m]%MOD*njc[n-m]%MOD;
}

void Prework()
{
	int mx=h+w;
	jc[0]=1;
	for(int i=1;i<=mx;++i)
		jc[i]=(LL)jc[i-1]*i%MOD;
	njc[mx]=Qpow(jc[mx]);
	for(int i=mx-1;i>=0;--i)
		njc[i]=(LL)njc[i+1]*(i+1)%MOD;
}

int Calc(const Pir &a,const Pir &b)
{
	int x=b.fir-a.fir,y=b.sec-a.sec;
	return C(x+y,x);
}

int main()
{
	scanf("%d%d%d",&h,&w,&n);
	Prework();
	for(int i=1;i<=n;++i)
		scanf("%d%d",&p[i].fir,&p[i].sec);
	sort(p+1,p+n+1);
	int ans=C(h+w-2,h-1);
	for(int i=1;i<=n;++i)
	{
		dp[i]=MOD-(LL)Calc((Pir){1,1},p[i]);
		for(int j=1;j<i;++j)if(p[j].sec<=p[i].sec)
			SD(dp[i],(LL)dp[j]*Calc(p[j],p[i])%MOD);
		SU(ans,(LL)dp[i]*Calc(p[i],(Pir){h,w})%MOD);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1792
using System;

public class Hello{
    public static void Main(){
		int s = int.Parse(System.Console.ReadLine());
        var line =System.Console.ReadLine();
      
        var Ch= line.ToCharArray();
        var i=0;
        var count=0;
        for(i=0;i<s;i++){
            if (Ch[i]=='R'){ count++;}
        }
      int Bcou =0;
        Bcou = s - count;
        if(count > Bcou){
            System.Console.WriteLine("Yes");    
        }else{
            System.Console.WriteLine("No");
        }
        
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=3e5+10,inf=0x3f3f3f3f;
int n,sumw,sumb,a[maxn];
inline bool check(int x){
	int sum=a[1];
	for(int i=3;i<=n;i+=2)
		if(sum>=x) sum=max(sum+a[i]-a[i-1],a[i]);
		else sum+=a[i]-a[i-1];
	return sum>=x;
}
int main(){
	n=read();
	REP(i,1,n) a[i]=read();
	REP(i,1,n)
		if(i&1) sumb+=a[i];
		else sumw+=a[i];
	int ans;
	if(n%2==0) ans=max(sumw,sumb);
	else{
		int L=0,R=sumb;
		while(L<=R){
			int Mid=(L+R)>>1;
			if(check(Mid)) L=Mid+1;
			else R=Mid-1;
		}
		ans=max(sumw+L-1,sumb);
	}
	printf("%d %d\n",ans,sumw+sumb-ans);
	return 0;
}


Measured memory_bytes: 1408
print([0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())])

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;

const int INF = 1e9;
const ll num = 2000011;
ll n;
int k, x;

int main() {
  cin >> k >> x;
  for (int i= x-k+1; i < x+k; ++i) {
  cout << i << " ";
  }
  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
ls =[]

for _ in range(m):
  s,c = input().split()
  s = int(s)-1
  ls.append([s,c])

ans = -1
for i in range(pow(10,n)):
  s = str(i).zfill(n)
  p = True
  for a in ls:
    if not (s[a[0]] == a[1]):
      p = False
  if p and len(str(i))==n:
    ans = i
    break
print(ans)




Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <climits>
#include <sstream>
using namespace std;

const int INF = INT32_MAX;
int N;
int Q;
int n;
const int N_MAX = 100000;

vector<int> node;

void change(int i,int val)
{
	i = i + n - 1;
	node[i] = val;
	while(i > 0)
	{
		i = (i - 1)/2;
		node[i] = min(node[2 * i + 1],node[2 * i + 2]);

	}
	return;
}

int getmin(int a,int b,int k,int l,int r)
{
	if(r <= a || b <= l) return INF;

	if(a <= l && r <= b) return node[k];

	int vl = getmin(a,b,2 * k + 1,l,(l + r) / 2);
	int vr = getmin(a,b,2 * k + 2,(l + r) / 2,r);

	return min(vl , vr);
}


int main()
{
	cin >> N >> Q;

	n = 1;
	while(n < N) n *= 2;
	node.resize(2 * n - 1,INF);
	stringstream result;
	int com,x,y;
	for(int i = 0;i < Q;i++)
	{
		cin >> com >> x >> y;

		if(com == 0)
		{
			change(x,y); 
		}
		else
		{
			result << getmin(x,y + 1,0,0,n) << endl;
		}
	}
	cout << result.str();
	return 0;
}



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

int main() {
    int N;
    cin >> N;
    vector<int> dp(N);
    vector<int> h(N);
    for (int i=0;i<N;i++){
        cin >> h.at(i);
    }
    dp.at(1) = abs(h.at(0) - h.at(1));
    for (int i=2;i<N;i++){
        dp.at(i) = min(abs(h.at(i) - h.at(i-1)) + dp.at(i-1), abs(h.at(i) - h.at(i-2)) + dp.at(i-2));
    }
    cout << dp.at(N-1);
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
  int N;  cin >> N;
  vector<int>W(N);
  for(int i=0;i<N;i++){
    cin >> W.at(i);
  }
  int S1 = 0;
  int S2 = 0;
  for(int i=0;i<N;i++){
    S2 += W.at(i);
  }
  int min = 100000;
  for(int i=0;i<N-1;i++){
    S1 += W.at(i);
    S2 -= W.at(i);
    if(min > abs(S1-S2))  min = abs(S1-S2);
  }
  cout << min << endl;
}


Measured memory_bytes: 256
n = int(input())
a = []
maxi = [0, 0]
for _ in range(n):
    a.append(int(input()))
    if maxi[0] < a[-1]: 
        maxi[1] = maxi[0]
        maxi[0] = a[-1]
    elif maxi[1] < a[-1]:
        maxi[1] = a[-1]

for x in a:
    if x == maxi[0]: print(maxi[1])
    else: print(maxi[0])



Measured memory_bytes: 12512
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
typedef long long ll;
int main(){
   int N,K;
   cin>>N>>K;
   int a=K;
   int count=1;
   while(K<=N){
       K*=a;
       count++;
   }
   cout<<count<<endl;

    return 0;
}


Measured memory_bytes: 256
use std::io;

pub fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let line: Vec<i64> = buf.split_whitespace().into_iter().map(|s| s.parse().unwrap()).collect();
    let N = line[0];
    let mut x = 1;
    let mut y = N;
    let mut i = 1;
    loop {
        i += 1;
        if i * i > N {
            break
        }
        if N % i != 0 {
            continue
        }
        x = i;
        y = N / i;
    }
    println!("{}", x + y - 2)
}

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

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> x(N), y(M);
  for (int i = 0; i < N; i++) {
    cin >> x.at(i);
  }
  for (int i = 0; i < M; i++) {
    cin >> y.at(i);
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  if (min(Y, y.at(0)) - max(X, x.at(N - 1)) > 0) {
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A;
    cin >> A;
    for(ll N = 1; ; N++) {
        if(N * (N + 1) / 2 < A) continue;
        string S;
        ll l = N;
        ll r = N;
        for(ll i = 0; i < 2 * N; i++) {
            ll num = (l - 1) * l / 2;
            if(r < l) {
                ll d = (l - r - 1);
                num -= d * (d + 1) / 2;
            }
            //cerr << l << " " << r << " " << num << " " << A << endl;
            if(num < A) {
                S.push_back(')');
                r--;
                A -= max(0LL, l - r);
            } else {
                S.push_back('(');
                l--;
            }
        }
        cout << S << endl;
        return 0;
    }
    return 0;
}



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

typedef long long ll;

int K, N;
ll D[100010] = {1};
ll F[100010] = {1};
ll R[100010];
ll mod = 998244353;

ll con(int a, int b)
{
    if(a < 0 || b < 0 || a < b)return 0;
    return F[a] * R[b] % mod * R[a - b] % mod;
}

ll pow_mod(ll a, ll b)
{
    if(b == 0)return 1;
    ll res = pow_mod(a * a % mod, b / 2);
    if(b % 2)res = res * a % mod;
    return res;
}

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

    for(int i = 1; i < 100010; i++)D[i] = D[i - 1] * 2 % mod;
    for(int i = 1; i < 100010; i++)F[i] = F[i - 1] * i % mod;
    for(int i = 0; i < 100010; i++)R[i] = pow_mod(F[i], mod - 2);

    for(int i = 2; i <= 2 * K; i++)
    {
        ll ans = 0;
        int n = 0;
        for(int j = 1; j <= K; j++)if(i - j > j && i - j <= K)n++;
        //cout << "n : " << n << endl;

        if(i % 2)
        {
            for(int j = 0; j <= n; j++)
            {
                //cout << j << " ; " << con(n, j) * D[j] % mod * con(j + (K - 2 * n) + N - j - 1, N - j) % mod << endl;
                ans += con(n, j) * D[j] % mod * con(j + (K - 2 * n) + N - j - 1, N - j) % mod;
                ans %= mod;
            }
            cout << ans << endl;
        }
        else
        {
            for(int j = 0; j <= n; j++)
            {
                ans += con(n, j) * D[j] % mod * con(j + (K - 2 * n - 1) + N - j - 2 , N - j - 1);
                ans %= mod;
            }
            for(int j = 0; j <= n; j++)
            {
                ans += con(n, j) * D[j] % mod * con(j + (K - 2 * n - 1) + N - j - 1 , N - j);
                ans %= mod;
            }
            cout << ans << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;


ld s(ll x) {
    ll ret = 0;
    ll y = x;
    while (x) {
        ret += (x % 10);
        x /= 10;
    }
    return (ld)y / ret;
}

void Main()
{
    ll n;
    cin >> n;

    ll res = 0;
    ll base = 1;
    rep(i, n) {
        while(true) {
            if (s(res + base) > s(res + base * 10)) {
                base *= 10;
            }
            else {
                break;
            }
        }
        res += base;
        put(res);
    }
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3528
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        Magatro alice = new Magatro();
        alice.Scan();
        alice.Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';
    public Scanner()
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }
    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }
    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private long N;
    private long[] A;
    public void Scan()
    {
        Scanner sc = new Scanner();
        N = sc.NextLong();
        A = sc.LongArray();
    }

    public void Solve()
    {
        long k;
        long w = (N + 1) * N / 2;
        long sum = A.Sum();
        if (sum % w != 0)
        {
            Console.WriteLine("NO");
            return;
        }
        k = sum / w;
        long[] d = new long[N];
        for(int i = 0; i < N; i++)
        {
            d[i] = A[i] - A[(i+1)%N];
        }
        
        d = d.Select(i => i + k).ToArray();
        if (d.Any(i => i < 0))
        {
            Console.WriteLine("NO");
            return;
        }
            long cnt = 0;
        for (int i = 0; i < N; i++)
        {
            if (d[i] % N != 0)
            {
                Console.WriteLine("NO");
                return;
            }
            cnt += d[i] / N;
        }
        if (cnt != k)
        {
            Console.WriteLine("NO");
        }
        else
        {
            Console.WriteLine("YES");
        }
    }
}



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

int main(){
    string S;
    int a;
    string sun = "SUN";
    string mon = "MON";
    string tue = "TUE";
    string wed = "WED";
    string thu = "THU";
    string fri = "FRI";
    string sat = "SAT";

    cin >> S;
    if(S == sun){
        a = 7;
    }else if(S == mon){
        a = 6;
    }else if(S == tue){
        a = 5;
    }else if(S == wed){
        a = 4;
    }else if(S == thu){
        a = 3;
    }else if(S == fri){
        a = 2;
    }else if(S == sat){
        a = 1;
    }
    cout << a <<endl;
}


Measured memory_bytes: 256
//============================================================================
// Name        : arc84c.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;

int main() {
	long long N;
	cin >> N;
	vector<pair<long long, long long>> A;
	vector<pair<long long, long long>> B;
	vector<long long> C;

	for (long long i = 0; i < N; ++i) {
		long long a;
		scanf("%lld", &a);
		A.push_back(make_pair(a, 0));
	}

	for (long long i = 0; i < N; ++i) {
		long long b;
		scanf("%lld", &b);
		B.push_back(make_pair(b, 0));
	}
	for (long long i = 0; i < N; ++i) {
		long long c;
		scanf("%lld", &c);
		C.push_back(c);
	}
	sort(C.rbegin(), C.rend());
	sort(B.rbegin(), B.rend());
	sort(A.rbegin(), A.rend());

	for(long long i = 0; i < N; ++i){
		if(i != 0){
			B[i].second = B[i - 1].second;
		}
		for(long long j = B[i].second; j < N; ++j){
			if(B[i].first < C[j]){
				++B[i].second;
			}
			else{
				break;
			}
		}
	}

	long long count = 0;
	for(long long i = 0; i < N; ++i){
		if(i != 0){
			A[i].second = A[i - 1].second;
		}
		for(long long j = A[i].second; j < N; ++j){
			if(A[i].first < B[j].first){
				++A[i].second;
				count += (N - i) * B[j].second;
			}
			else{
				break;
			}
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 5232
#!/usr/bin/python
# coding: UTF-8


#import scipy.optimize
#import numpy as np

    
##################################################################

if __name__ == "__main__":
    Input = [input() for i in range(1)]
    #N,K = list(map(int,Input[0].split()))
    S = str(Input[0])
    N = len(S)
    S = [S[i]=='L' for i in range(N)]

    C = [0 for i in range(N)]
    R = 1
    L = 0
    for i in range(1,N):
        if R>0 and not S[i]:
            R += 1
            L = 0
        elif R>0 and S[i]:
            C[i-1] += R%2 + R//2
            C[i] += R//2
            R = 0
            L = 1
        elif R == 0 and S[i]:
            L += 1
        elif R == 0 and not S[i]:
            C[i-L-1] += L//2
            C[i-L] += L//2 + L%2
            L = 0
            R = 1
    i = N
    C[i-L-1] += L//2
    C[i-L] += L//2 + L%2
    
    print(' '.join(map(str,C)))


Measured memory_bytes: 11264
x,n = map(int,input().split())
if n==0:
    print(x)
else:
    p = list(map(int,input().split()))
    for i in range(101):
        if x-i==0:
            print(0)
            break
        if p.count(x-i)==0:
            print(x-i)
            break
        if x+i==101:
            print("101")
            break
        if p.count(x+i)==0:
            print(x+i)
            break

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string dectobin(int a){
	string tmp="";
	while(a) { tmp+=(a%2)+'0'; a>>=1;}
	while(tmp.size()<5) tmp+='0';
	reverse(tmp.begin(),tmp.end());
	return tmp;
}
char strtoch(string str){
	if(str.size()==3)
	{
		if(str=="101") return ' ';
		else if(str=="110") return 'E';
		else if(str=="111") return 'P';
	}
	else if(str.size()==4)
	{
		if(str=="0101") return 'C';
		else if(str=="0001") return 'D';
		else if(str=="0111") return 'I';
		else if(str=="0110") return 'K';
		else if(str=="1000") return 'R';
	}
	else if(str.size()==5)
	{
		if(str=="00100") return 'L';
		else if(str=="00101") return 'O';
		else if(str=="00110") return 'S';
		else if(str=="00111") return 'T';
		else if(str=="01001") return 'F';
	}
	else if(str.size()==6)
	{
		if(str=="000000") return '\'';
		else if(str=="000001") return '?';
		else if(str=="000010") return 'W';
		else if(str=="000011") return ',';
		else if(str=="010000") return 'H';
		else if(str=="010001") return '.';
		else if(str=="100101") return 'A';
	}
	else if(str.size()==8)
	{
		if(str=="10010001") return '-';
		else if(str=="10011010") return 'B';
		else if(str=="10011011") return 'G';
		else if(str=="10011000") return 'J';
		else if(str=="10011001") return 'M';
		else if(str=="10011110") return 'N';
		else if(str=="10011111") return 'Q';
		else if(str=="10011100") return 'U';
		else if(str=="10011101") return 'V';
		else if(str=="10010010") return 'X';
		else if(str=="10010011") return 'Y';
		else if(str=="10010000") return 'Z';
	}
	return 'a';
}
int main() {
	string str;
	while(getline(cin,str)){
		string tmp="";
		for(int i=0;i<str.size();i++){
			char ch; ch=str[i];
			if(ch-'A'>=0 && ch-'Z'<=0) tmp+=dectobin(ch-'A');
			else if(ch==' ') tmp+="11010";
			else if(ch=='.') tmp+="11011";
			else if(ch==',') tmp+="11100";			
			else if(ch=='-') tmp+="11101";
			else if(ch=='\'') tmp+="11110";
			else if(ch=='?') tmp+="11111";
		}
		string ans="";
		for(int i=0;i<tmp.size();i++){
			for(int j=3;i+j-1<=tmp.size()-1;j++){
				char ch=strtoch(tmp.substr(i,j));
				if(ch!='a' ) {ans+=ch;i+=j-1;break;}
			}
		}
		cout << ans << '\n' ;
	}
}

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

int main(void)
{
    int a, sum=0;
    int x=0;
    for(int i=0; i<4; i++) {
        cin >> a;
        sum += a;
    }
    while(sum >= 60) {
        sum -= 60;
        x++;
    }
    cout << x << endl << sum << endl;
    return 0;
}

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

using namespace std;

int main()
{
  int n,g,h,x,y;double d=0;
  cin>>n;
  vector<pair<int,int>> a;
  for(int i=0;i<n;i++)
  {
      cin>>g>>h;
      a.push_back(make_pair(g,h));
      for(int j=0;j<i;j++)
      {
          x=a[j].first; y=a[j].second;
          d+=sqrt(pow((x-g),2)+pow((y-h),2));
      }
  }
  cout<<setprecision(13)<<2*(d/n);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
}


Measured memory_bytes: 256
(let ((n (read))
      (k (read)))
  (format t "~F~%" (+ (* (/ 1.0d0 n) (if (<= k n) (- n k -1) 0))
                      (loop :for x :from 1 :to (min (1- k) n)
                            :for num := (ceiling (log (/ k x) 2.0d0))
                            :sum (* (/ 1.0d0 n) (expt (/ 1 2.0d0) num))))))


Measured memory_bytes: 27464
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    INT(S);
    INT(W);

    if(W >= S){
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
   
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 

 int main(){
  ll n ; cin>> n ;
  vector<string> A(n) ;
  rep(i,n) cin>>A[i] ;
  ll ans = 0 ;
  ll a=0 ;
  ll b=0 ;
  ll c=0 ;
  rep(i,n){
    ll k= A[i].size() ;
    rep(j,k-1){
     if(A[i][j]=='A'&&A[i][j+1]=='B') ans++ ;
    }
    if(A[i][0]=='B'&&A[i][k-1]=='A' ) a++ ;
    else if(A[i][0]=='B') b++ ;
    else if(A[i][k-1]=='A') c++ ;
  }
  if(a>0){
  ans+= a-1 ;
  if(b>0){
    ans++ ;
    b-- ;
  }
  if(c>0){
    ans++ ;
    c-- ;
  }
  ans+= min(b,c) ;
  }
  else ans+= min(b,c) ;
  cout<<ans<<endl ;
   return 0 ;
 }



Measured memory_bytes: 3712
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>


using namespace std;
#define modd 1000000007



typedef pair<long long, long long> pl;


typedef string::const_iterator State;
class ParseError {};




#define ll long long




class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};


class SegmentTree {
private:
	int n;
	vector <ll> node;

public:
	// 元の配列　v をセグメントツリーで表現する。
	SegmentTree(vector<ll> v) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪->これをnとおく。
		//セグ木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1; 
		while (n < sz)n *= 2;

	}

};




long long N, M, K, a, b, c, d, e, H, W, L;
ll A[300005] = {};
ll B[300005] = {};
ll C[300005] = {};
bool f, ff;
string S;
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset[50];
multiset<ll> llmset;


struct ST
{
	int kaisuu;
	int dan;
	int score;
	char situ[52][2][2];
	

	bool operator<(const ST& another) const
	{
		return dan < another.dan;//比較
	};

};



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


ll minn, maxx;
double ansa;

string SS;
char ca;

ll huka, owari,kaisuu;

double kakuritu,ab,ac,ad;


int main() {

	cin >> N;

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


	a = 0;
	for (int i = 1; i < N-1; i++) {
		llset[i].insert(A[i - 1]);
		llset[i].insert(A[i + 1]);
		llset[i].insert(A[i]);

		if (llset[i].size() >= 2) {
			auto au = llset[i].end();
			au--;
			au--;

			if (*au == A[i]) {
				a++;
			}

		}

	}
	

	cout << a << endl;

	//cout << fixed << setprecision(10) << ansa << endl;
	return 0;

}


Measured memory_bytes: 6528
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
void solve()
{
    ll a,b;
    cin>>a>>b;
    rep1(i,maxn){
        if(((i*8)/100)==a&&(i/10)==b){
            pr(i);
            return;
        }
    }
    pr(-1);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())
ans = 0

def check(x):
  tx = list(str(x))
  c = 1
  for i in range(len(tx)):
    if tx[i] != tx[-1 * i -1]:
      c = 0
  return c

for i in range(A, B+1):
  ans += check(i)

print(ans)
  

Measured memory_bytes: 3060
import numpy as P
M=10**9+7
m=lambda:map(int,input().split())
n,k=m()
a=P.matrix([list(m())for _ in[0]*n],dtype='O')
b=P.eye(n,dtype='O')
while k:b=[b,b*a%M][k&1];a=a*a%M;k>>=1
print(b.sum()%M)

Measured memory_bytes: 18616
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define chmin(x,y) x = min(x, y)
#define chmax(x,y) x = max(x, y)
#define V vector
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

int main () {
    int n; cin >> n;
    V<int> l(n);
    rep(i, n) cin >> l[i];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            for (int k = j+1; k < n; k++) {
                int a = l[i], b = l[j], c = l[k];
                if (a == b || b == c || c == a) continue;
                bool flag = (a+b>c) && (b+c>a) && (c+a>b);
                if (flag) ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <deque>
using namespace std;
 
int main() {
    //input
    int n;cin >> n;
    vector<long> a(n + 1); 
    for(int i = 1; i < n + 1;i++) cin >> a[i];
    deque<int> dq1,dq2;
    
    //compute
    vector<long> b(n + 1); 
    for(int i = 1; i < n + 1;i++){
        if(i % 2 == 1)dq1.push_back(a[i]);
        if(i % 2 == 0)dq2.push_back(a[i]);
        }

    if(n % 2 == 1){
        while( dq2.empty() != 1){
            dq1.push_front(dq2.front());
            dq2.pop_front();
        }
        for(int i = 1; i < n + 1;i++){
            b[i] = dq1.back(); 
            dq1.pop_back();
            }
    }

    if(n % 2 == 0){
        while( dq1.empty() != 1){
            dq2.push_front(dq1.front());
            dq1.pop_front();
        }
        for(int i = 1; i < n + 1;i++){
            b[i] = dq2.back(); 
            dq2.pop_back();
            }
    }


    //output
    for(int i = 1; i < n + 1; i++) cout << b[i] << " " ;
}


Measured memory_bytes: 7164
import collections
def main():

    N = int(input())

    d = collections.defaultdict(int)
    for i in range(1, N+1):
        s = str(i)
        d[(s[0], s[-1])] += 1

    ans = 0
    for a in d:
        b = (a[1], a[0])
        if b in d:
            ans += d[a] * d[b]
    return ans



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

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

using namespace std;

const int N = 2e5+5;

int n;
int k;
int len[N];

bool can(int x){
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        cnt += (len[i] - 1) / x;
    }
    return cnt <= k;
}

int main(){
    scanf("%d%d" , &n , &k);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &len[i]);
    }
    int l = 1 , r = 1e9;
    while(l < r){
        int mid = (l + r) >> 1;
        //cout << mid << "\n";
        if(can(mid)){
            r = mid;
        } else {
            l = mid + 1;
        }
    }
    /*for(int i = 1; i < 10; i++){
        cout << i << " " << can(i) << "\n";
    }*/
    printf("%d\n" , l);
}


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

using namespace std;

const int MAX_V = 205;
vector<int> G[MAX_V];
vector<int> match(MAX_V);
vector<bool> used(MAX_V);

void add_edge(const int &u, const int &v) {
	G[u].emplace_back(v);
	G[v].emplace_back(u);
}

bool dfs(const int &v) {
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i) {
		int u = G[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

//?????¨??????????????°????????§???????±?????????????
int bipartite_matching(const int &V) {
	int res = 0;
	fill(match.begin(), match.end(), -1);
	for (int v = 0; v < V; ++v) {
		if (match[v] < 0) {
			fill(used.begin(), used.end(), false);
			if (dfs(v))++res;
		}
	}
	return res;
}

int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int X, Y, E, s, t; cin >> X >> Y >> E;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t;
		add_edge(s, t + X);
	}
	int ans = bipartite_matching(X + Y);
	cout << ans << endl;
}

Measured memory_bytes: 1348
n,k=map(int,input().split())
a=list(map(int,input().split()))
v=[0]*n
v[0]=1
i=1
l=[1]
while True:
  i=a[i-1]
  l.append(i)
  if v[i-1]:
    t=i
    break
  else:
    v[i-1]=1
pre=l.index(t)
loop=len(l)-pre-1
if pre>=k:
  print(l[k])
else:
  k=k-pre
  mod=k%loop
  print(l[pre+mod])

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

int main() {
  int n; cin>>n;
  double m=1,c;
  vector<int> a(n);
  rep(i,n){
    cin>>a.at(i);
    m*=a.at(i);
  }
  rep(i,n){c+=m/a.at(i);}
  double  ans=m/c;

  cout<<ans<<setprecision(6);;
  
}



Measured memory_bytes: 256
# 25230590点
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0

for i in range(D):
  s.append(list(map(int,(input().split()))))
  for day in range(26):
    if(last[day]!=0):
      last[day]+=1

  for j in range(26):
    for k in range(26):
      s[i][j]-=c[k]*(1+last[k])*10
    s[i][j]+=c[j]*(1+last[j])*9

  sat+=max(s[i])
  last[s[i].index(max(s[i]))]=1
  ans=s[i].index(max(s[i]))+1
  print(ans)


Measured memory_bytes: 9376
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

N,T = li()

ans = 10**5
for i in range(N):
    c,t = li()
    if t <= T:
        ans = min(ans,c)
     
if ans == 10**5:
    print("TLE")
else:
    print(ans)

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

int main(){
  long a, b, c, d, n1, n2, n3, n4;
  cin >> a >> b >> c >> d;
  n1 = a*c;
  n2 = a*d;
  n3 = b*c;
  n4 = b*d;
  long max = n1;
  if(max<n2){ max=n2; }
  if(max<n3){ max=n3; }
  if(max<n4){ max=n4; }
  cout << max;
  return 0;
}
  

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;

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

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

    int vmax = *max_element(v.begin(),v.end());
    int sum = accumulate(v.begin(),v.end(), 0);

    if(vmax < sum - vmax){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


}



Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

class BIT(private val n: Int) {
    private val data = LongArray(n) { 0 }

    fun add(i: Int, x: Long) {
        var p = i + 1
        while (p <= n) {
            data[p - 1] += x
            p += p and -p
        }
    }

    fun sum(l: Int, r: Int): Long {
        return sum(r) - sum(l)
    }

    private fun sum(i: Int): Long {
        var r = i
        var s = 0L
        while(r > 0) {
            s += data[r - 1]
            r -= r and -r
        }
        return s
    }
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val q = sc.nextInt()
    val a = Array(n) { sc.nextLong() }
    val bit = BIT(n)
    for (i in 0 until n) {
        bit.add(i, a[i])
    }
    for (_i in 0 until q) {
        val t = sc.nextInt()
        if (t == 0) {
            val p = sc.nextInt()
            val x = sc.nextLong()
            bit.add(p, x)
        } else {
            val l = sc.nextInt()
            val r = sc.nextInt()
            println(bit.sum(l, r))
        }
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 88268
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 234567;
const int MOD = 998244353;
char s[MAXN];
int sdig[MAXN];
bool visit[8787];
int dp[MAXN][3][3];

int solveMin(int N) {
    if (N == 2) {
       if (s[1] == s[2]) return 1;
       return 2;
    }
    queue<int> qu;
    qu.push(sdig[1] * 100 + sdig[2] * 10 + sdig[3]);
    int ans = 0;
    while (!qu.empty()) {
          int tp = qu.front();
          qu.pop();
          if (visit[tp]) continue;
          visit[tp] = 1;
          ans++;
          int f1 = tp / 100, f2 = (tp / 10) % 10, f3 = (tp % 10);
          if (f1 != f2) {
             int tmp = ((f1 + f2) * 2) % 3;
             qu.push(tmp * 100 + tmp * 10 + f3);
          }
          if (f2 != f3) {
             int tmp = ((f2 + f3) * 2) % 3;
             qu.push(f1 * 100 + tmp * 10 + tmp);
          }
    }
    return ans;
}

int add(int a, int b) {
    int ans = a + b;
    if (ans >= MOD) ans -= MOD;
    return ans;
}

int mul(LL a, LL b) {
    return (a * b) % MOD;
}

int sub(int a, int b) {
    return (a - b + MOD) % MOD;
}

int main() {
    scanf("%s", s + 1);
    int N = strlen(s + 1);
    int sum = 0;
    for (int i = 1; i <= N; i++) {
        sdig[i] = s[i] - 'a';
        sum = (sum + sdig[i]) % 3;
    }
    if (N < 4) {
       return !printf("%d\n", solveMin(N));
    }
    bool allSame = true;
    for (int i = 2; i <= N; i++) {
        if (s[i] != s[i - 1]) allSame = false;
    }
    if (allSame) return !printf("1\n");
    for (int i = 0; i < 3; i++) dp[1][i][i] = 1;
    int ans = 1;
    for (int i = 1; i < N; i++) {
        for (int x = 0; x < 3; x++)
            for (int s = 0; s < 3; s++)
                for (int y = 0; y < 3; y++) {
                    if (x == y) continue;
                    int ns = (s + y) % 3;
                    dp[i + 1][ns][y] = add(dp[i + 1][ns][y], dp[i][s][x]);
                }
    }
    for (int i = 1; i < N; i++)
        ans = mul(ans, 3);
    for (int i = 0; i < 3; i++)
        ans = sub(ans, dp[N][sum][i]);
    bool noPair = true;
    for (int i = 2; i <= N; i++) {
        if (s[i] == s[i - 1]) noPair = false;
    }
    printf("%d\n", add(ans, noPair));
    return 0;
}


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

int main(){

  int a,b;
  
  cin >> a >> b;
  
  int n  = 0;
  float tmp = (float)(b - a )/( a - 1) ;
  
  if(b == 1){
    n = 0;
    cout << n;
    return 0;
  }
  
  if(tmp < 0){
    n ++;
    cout << n;
    return 0;
  }
 
  n += (int)tmp;
  
  if (tmp - (int)tmp != 0)n ++;

  
  n ++;
  
  cout << n;
    return 0;
}




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

string s,t;
int main(){
    cin >> s >> t;
    sort( s.begin(), s.end());
    sort( t.begin(), t.end());
    reverse( t.begin(), t.end());
    cout << ( s < t ? "Yes": "No") << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

void factorization(ll N, vector<ll> &fac) {
    for (ll i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            fac.push_back(i);
            if (i != N/i) 
                fac.push_back(N/i);
        }
    }
    if (N != 1)
        fac.push_back(N);
    sort(fac.begin(), fac.end());
}

int main() {
    ll N, ans;   cin >> N;
    vector<ll> fac, fac1;
    factorization(N, fac);
    factorization(N-1, fac1);
    ans = fac1.size();
    
    for (auto k: fac) {
        ll n = N;
        while (n%k == 0)
            n /= k;
        if (n%k == 1)
            ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    long long sum = 0;
    for (int i = 1; i < N+1; i++)
    {
        if (i % 3 != 0 && i % 5 !=0)
        {
            sum += (long long) i;
        }
        
    }
    cout << sum << "\n";
    
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> x(N);
    vector<ll> y(N);
    vector<ll> z(N);
    rep(i,N){
        cin >> x[i] >> y[i] >> z[i];
    }
    vector<ll> vec0(N);
    rep(i,N){
        vec0[i] = x[i] + y[i] + z[i];
    }
    vector<ll> vec1(N);
    rep(i,N){
        vec1[i] = x[i] + y[i] - z[i];
    }
    vector<ll> vec2(N);
    rep(i,N){
        vec2[i] = x[i] - y[i] + z[i];
    }
    vector<ll> vec3(N);
    rep(i,N){
        vec3[i] = x[i] - y[i] - z[i];
    }
    vector<ll> vec4(N);
    rep(i,N){
        vec4[i] = -1 * x[i] + y[i] + z[i];
    }
    vector<ll> vec5(N);
    rep(i,N){
        vec5[i] = -1 * x[i] + y[i] - z[i];
    }
    vector<ll> vec6(N);
    rep(i,N){
        vec6[i] = -1 * x[i] - y[i] + z[i];
    }
    vector<ll> vec7(N);
    rep(i,N){
        vec7[i] = -1 * x[i] - y[i] - z[i];
    }
    sort(all(vec0));
    sort(all(vec1));
    sort(all(vec2));
    sort(all(vec3));
    sort(all(vec4));
    sort(all(vec5));
    sort(all(vec6));
    sort(all(vec7));
    ll ans = 0;
    ll ans_sub0 = 0;
    ll ans_sub1 = 0;
    ll ans_sub2 = 0;
    ll ans_sub3 = 0;
    ll ans_sub4 = 0;
    ll ans_sub5 = 0;
    ll ans_sub6 = 0;
    ll ans_sub7 = 0;
    rep(i,M){
        ans_sub0 += vec0[N - i - 1];
        ans_sub1 += vec1[N - i - 1];
        ans_sub2 += vec2[N - i - 1];
        ans_sub3 += vec3[N - i - 1];
        ans_sub4 += vec4[N - i - 1];
        ans_sub5 += vec5[N - i - 1];
        ans_sub6 += vec6[N - i - 1];
        ans_sub7 += vec7[N - i - 1];
    }
    ans = max(ans_sub0, max(ans_sub1, max(ans_sub2, max(ans_sub3, max(ans_sub4, max(ans_sub5, max(ans_sub6, ans_sub7)))))));
    cout << ans << endl;
}


Measured memory_bytes: 3720