akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int M = int.Parse(str[1]);
        int[] L = new int[M];
        int[] R = new int[M];
        int[] X = new int[M];
        for(int i=0;i<M;i++){
            str = Console.ReadLine().Split(' ');
            L[i] = int.Parse(str[0]);
            R[i] = int.Parse(str[1]);
            X[i] = int.Parse(str[2]);
        }
        int[] Jmin = new int[N+1];
        int[] Jmax = new int[N+1];
        int[] Kmin = new int[N+1];
        int[] Kmax = new int[N+1];
        for(int i=0;i<=N;i++){
            Jmin[i] = 0;
            Jmax[i] = 500;
            Kmin[i] = 0;
            Kmax[i] = 500;
        }
        for(int i=0;i<M;i++){
            if(X[i] == 1){
                Jmax[R[i]] = Math.Min(Jmax[R[i]],L[i]-1);
            }
            else if(X[i] == 2){
                Kmax[R[i]] = Math.Min(Kmax[R[i]],L[i]-1);
                Jmin[R[i]] = Math.Max(Jmin[R[i]],L[i]);
            }
            else{
                Kmin[R[i]] = Math.Max(Kmin[R[i]],L[i]);
            }
        }
        long[,,] DP = new long[N+1,N+1,N+1];
        DP[1,0,0] = 3;
        for(int i=1;i<N;i++){
            for(int j=0;j<=i;j++){
                for(int k=0;k<=j;k++){
                    if(i != 0 && j == i){
                        DP[i,j,k] = 0;
                    }
                    if(j != 0 && j == k){
                        DP[i,j,k] = 0;
                    }
                    if(Jmin[i] > j || Jmax[i] < j){
                        DP[i,j,k] = 0;
                    }
                    if(Kmin[i] > k || Kmax[i] < k){
                        DP[i,j,k] = 0;
                    }
                    DP[i,j,k] %= Define.mod;
                    DP[i+1,j,k] += DP[i,j,k];
                    DP[i+1,i,j] += DP[i,j,k];
                    DP[i+1,i,k] += DP[i,j,k];
                }
            }
            
        }
        long count = 0;
        for(int j=0;j<N;j++){
            for(int k=0;k<=j;k++){
                if(j != 0 && j == k){
                    continue;
                }
                if(Jmin[N] > j || Jmax[N] < j){
                    continue;
                }
                if(Kmin[N] > k || Kmax[N] < k){
                    continue;
                }
                count += DP[N,j,k];
            }
        }
        count %= Define.mod;
        sb.Append(count+"\n");
    }
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 223840
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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 ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//----------------ここからだよ-------------------

int main(){
    ll A,B,K; cin>>A>>B>>K;
    if(A+B<K){
        cout<<0<<' '<<0<<endl;
    } else if(A<K){
        cout<<0<<' '<<B+A-K<<endl;
    } else{
        cout<<A-K<<' '<<B<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAXN=100010;
int a[MAXN],n,cnt,k;
inline int read(){
    int f=1,x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return f*x;
}
int main(){
    cin>>n>>k;
    cout<<n-k+1<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {

            string read = Console.ReadLine();
            int time = int.Parse(read);

            int hour, min, sec;

            hour = time / 3600;
            time -= hour * 3600;
            min = time / 60;
            time -= min * 60;
            sec = time;


            Console.WriteLine(hour+":"+min+":"+sec);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9152
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    ll dp[110][100100];
    rep(i, 110) rep(j, 100100) dp[i][j] = 1LL << 60; 
    dp[0][0] = 0;
    rep(i, N) {
        rep(sum_v, 100100) {
            if (sum_v - v[i] >= 0) chmin(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i]);
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }
    ll res = 0;
    rep(sum_v, 100100) if (dp[N][sum_v] <=W) res = sum_v;

    cout << res << endl;
}

Measured memory_bytes: 86272
N = int(input())
*A, = map(int, input().split())
B = []
C = 0
for i in A:
  if i % 2 == 0:
    B.append(i)
    if i % 5 == 0 or i % 3 == 0:
      C += 1
 
if C == len(B):
  print('APPROVED')
else:
  print('DENIED')



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

int main() {
    double P1[2], P2[2], x, y;

    cin >> P1[0] >> P1[1];
    cin >> P2[0] >> P2[1];
    x = P1[0]-P2[0];
    y = P1[1]-P2[1];
    cout << fixed;
    cout.precision(4);
    cout << sqrt(x*x + y*y) << endl;

    return 0;
}

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

using namespace std;
typedef unsigned long long ll;
ll n, m,ans;
inline int read() {
	char ch = getchar();
	int x = 0, f = 1;
	while (ch < '0' || ch > '9')
		f = (ch == '-' ? -1 : 1), ch = getchar();
	while (ch >= '0' && ch <= '9')
		x = x * 10 + ch - 48, ch = getchar();
	return x * f;
}
int main() {
	cin>>n>>m;
	if(n==1||m==1) ans=1;
	else {
		if(n%2==0) ans=n*m/2;
		else ans=(n-1)*m/2+(m%2==0? m/2:m/2+1);
	}
	cout<<ans;
	return 0;
}

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

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n;
    cin >> n;
    int sn = (n + 1) * n / 2;

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

    if(s % sn != 0){
        cout << "NO" << endl;
        return 0;
    }
    int k = s / sn;

    rep(i, n){
        int d = a[(i + 1 + n) % n] - a[i] - k;
        if(abs(d) % n != 0 || d > 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 1656
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;

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

int main()
{
    long long a,b;
    while(cin>>a>>b)
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 1156
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=100000+10;
int n,m,r[N],D[N],L,R,d;
bool flag;
int find(int now){
    if(r[now]==-1) return now;
    int root=find(r[now]);
    D[now]+=D[r[now]];
    r[now]=root;
    return root;
}
int main() {
    while(~scanf("%d%d",&n,&m)){
        flag=0;
        memset(r,-1,sizeof(r));
        memset(D,0,sizeof(D));
        for(int i=0;i<m;i++){
            scanf("%d%d%d",&L,&R,&d);
            if(flag) continue;
            int a=find(L),b=find(R);
            if(a==b){
                if(abs(D[R]-D[L])!=d) {flag=1;}
            }
            else {
                r[a]=b;
                D[a]=D[R]-D[L]+d;
            }
        }
        printf("%s\n",flag?"No":"Yes");

    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

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

vector <vector <int> > edge;
int n;
vector <int> get_v (int v, int x) {
    vector <int> d(n, INF), ans;
    d[v] = 0;
    queue <int> q;
    q.push(v);
    while (!q.empty()) {
        v = q.front();
        q.pop();
        for (int to : edge[v]) {
            if (d[to] == INF) {
                d[to] = d[v] + 1;
                q.push(to);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (d[i] <= x) ans.pb(i);
    }
    return ans;
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b;
    cin >> n >> a >> b;
    --a, --b;
    edge.resize(n);
    for (int i = 1, u, v; i < n; i++) {
        cin >> u >> v;
        --u, --v;
        edge[u].pb(v);
        edge[v].pb(u);
    }
    int l = 0, r = n;
    while (l < r) {
        int mid = (l + r) >> 1;
        vector <int> A = get_v(a, mid), B = get_v(b, mid);
        vector <int> used(n);
        for (auto &i : B) used[i] = 1;
        bool ok = true;
        for (auto &i : A) {
            if (!used[i]) {
                ok = false;
                break;
            }
        }
        if (ok) r = mid;
        else l = mid + 1;
    }
    cout << r - 1 << '\n';
}


Measured memory_bytes: 10772
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int r = scan.nextInt();
			if(n == 0 && r == 0){
				break;
			}
			int[] card = new int[n];
			for(int i = 0;i < n;i++){
				card[i] = n-i;
			}
			int p;
			int c;
			for(int i = 0;i < r;i++){
				p = scan.nextInt();
				c = scan.nextInt();
				card = shuffle(card,p,c);
			}
			System.out.println(card[0]);
		}
	}
	
	public static int[] shuffle(int[] a,int p,int c){
		int[] b = new int[a.length];
		int i = 0;
		for(int j = 0;j < c;j++){
			b[i++] = a[p-1+j];
		}			
		for(int j = 0;j < p-1;j++){
			b[i++] = a[j];
		}			
		for(int j = p+c-1;j < a.length;j++){
			b[i++] = a[j];
		}
		return b;
	}
}

Measured memory_bytes: 28260
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }

    ull operator"" _64u(unsigned long long x){ return ull(x); }

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N;
    is >> N;
    if(!is) return;
    vector<double> v(N);
    for (auto &&i : v) {
        is >> i;
    } // end i
    while(v.size() > 1){
        sort(ALL(v), greater<>());
        auto p1 = v.back();
        auto p2 = v[v.size()-2];
        v.pop_back(); v.pop_back();
        v.push_back((p1+p2) / 2);
    }
    cout << v[0] << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_C.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

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

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

const int64_t N_MAX = 1e5 + 5;
const int64_t MOD = 1e9 + 7;
int64_t fac[N_MAX] = {1, 1};
int64_t inv[N_MAX] = {1, 1};
int64_t finv[N_MAX] = {1, 1};

// combinationを計算
int64_t comb(int n, int r)
{
  if (n < r) return 0;
  return fac[n] * finv[n - r] % MOD * finv[r] % MOD;
}

// combinationを求めるためのテーブル初期化
void comb_init()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < N_MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

const int UNDEFINED = 10;

int A[3][3];

int main()
{
  int N, M;
  vector<pair<int, int>> sc;

  cin >> N >> M;

  sc.resize(M);
  for (int i = 0; i < M; i++) {
    cin >> sc[i].first >> sc[i].second;
  }

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

  bool invalid_falg = false;
  vector<int> x_vector;
  x_vector.resize(N + 1, UNDEFINED);

  for (auto &&i : sc) {
    if (x_vector[i.first] == UNDEFINED) {
      x_vector[i.first] = i.second;
    }
    else if (x_vector[i.first] != i.second) {
      invalid_falg = true;
      break;
    }
  }

  if (N != 1) {
    if (x_vector[1] == 0) {
      invalid_falg = true;
    }
    else if (x_vector[1] == UNDEFINED) {
      x_vector[1] = 1;
    }
  }

  for (auto &i : x_vector) {
    if (i == UNDEFINED) {
      i = 0;
    }
  }
  if (invalid_falg == true) {
    cout << -1 << endl;
  }
  else {
    int x = 0;
    for (int i = 1; i <= N; i++) {
      x += x_vector[i] * pow(10, N - i);
    }
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n;
int h[100000];
int a, b;

bool ok(int64_t m) {
	int64_t x = 0;
	rep(i,n) {
		auto c = a - b;
		if (h[i] > b*m)x += (h[i] - b*m + c - 1) / c;
	}
	return x <= m;
}


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

	cin >> n>>a>>b;
	rep(i, n)cin >> h[i];
	int64_t lb = 0, ub = (1LL << 60) / b;
	while (ub-lb>1) {
		auto mid = (lb + ub) / 2;
		if (ok(mid))ub = mid;
		else lb = mid;
	}
	cout << ub << endl;

	return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
 
int main(){
 int N;
 int K;
 int height[100001];
 cin >> N;
 cin >> K;
 for(int i=0; i<N; ++i){
      cin >> height[i]; 
 }
 int cnt  = 0;
 for(int i = 0; i < N; ++i){
   if(height[i] >= K) cnt++; 
 }
 cout << cnt << endl;
}

Measured memory_bytes: 640
N = int(input())
T_list = list(map(int, input().split()))
M = int(input())
PX_list = []
for _ in range(M):
    PX_list.append(tuple(map(int, input().split())))
    
for i in PX_list:
    print(sum(T_list) + i[1] - T_list[i[0]-1])

Measured memory_bytes: 3060
a=int(input())
A=[]
for i in range(a):
  A.append(input())
m=int(input())
B=[]
for j in range(m):
  B.append(input())
ans=[]
for i in A:
  ans.append(A.count(i)-B.count(i))
print(max(0,max(ans)))
  


Measured memory_bytes: 3060
// https://atcoder.jp/contests/agc019/tasks/agc019_b
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

ll mp[26];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for (auto &x : s) {
        mp[x - 'a']++;
    }
    ll ans = 1;
    REP(i, 26) {
        FOR(j, i + 1, 26) { ans += mp[i] * mp[j]; }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
public class Main {
	public static void main(String[] args) {
		String input = new java.util.Scanner(System.in).nextLine();
		//??????????????????
		String str1 = new String(input);
		String[] str1Ary = str1.split(" ");
		//?????????input?????????????????§??????????????????str1Ary?????£??\
		int a = Integer.parseInt(str1Ary[0]);
		int b = Integer.parseInt(str1Ary[1]);
		//str1Ary[0],[1]?????°????????????
		System.out.println(a * b + " " + (2 * a + 2 * b));
	}
}

Measured memory_bytes: 25788
use std::io;
#[allow(unused_macros)]
macro_rules! read {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            input.trim().parse::<$t>().unwrap()
        };
    };
    ($($t: ty),*) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let mut iter = input.trim().split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()), *)
        };
    }
}
#[allow(unused_macros)]
macro_rules! read_vec {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let iter = input.trim().split_whitespace();
            iter.map(|x| x.parse::<$t>().unwrap()).collect::<Vec<$t>>()
        };
    }
}
#[allow(unused_macros)]
macro_rules! read_chars {
    () => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            input.trim().chars().collect::<Vec<char>>()
        };
    }
}

fn main() {
    let (a, b) = read!(i32, i32);

    if a * b % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    ll N,K;cin>>N>>K;
    ll ans=K;
    for(ll i=0;i<N-1;i++){
        ans*=K-1;
    }
    cout<<ans<<endl;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){
  Node x;
  x=u;

  while(x!=NIL && k!=x->key){
    if(k < x->key)x=x->left;
    else x=x->right;
  }

  return x;

}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->p=y;

  if(y==NIL)root=z;
  else if(z->key < y->key)y->left=z;
  else y->right=z;

}

void inorder(Node u){
  if (u==NIL)return;

  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);

}
void preorder(Node u){
if (u==NIL)return;

 printf(" %d",u->key);
 preorder(u->left);
 preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  Node t;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
       t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

string S;
signed main() {
    cin>>S;
    if(S[0]!='A'){
        cout<<"WA"<<endl;
        return 0;
    }
    int idx=-1;
    for(int i=2;i<S.length()-1;i++){
        if(S[i]=='C'){
            idx=i;
        }
    }
    if(idx==-1){
        cout<<"WA"<<endl;
        return 0;
    }
    for(int i=0;i<S.length();i++){
        if(i!=0&&i!=idx&&(S[i]<'a'||S[i]>'z')){
            cout<<"WA"<<endl;
            return 0;
        }
    }
    cout<<"AC"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl '\n'
 
int calculate(int x,int y,int z){
    return x*x + y*y + z*z + x*y + y*z + z*x;
}


void solve(){
    int n;
    cin>>n;
    map<int,int> mp;
        for(int x = 1;x*x<=n;x++){
            for(int y = 1;y*y<=n;y++){
                for(int z = 1;z*z<=n;z++){
                    int a = calculate(x,y,z);
                    if(a <= 10000){
                        mp[a]++;
                    }
                }
            }
        }
        for(int i = 1;i<=n;i++){
            if(mp.find(i) != mp.end()){
                cout<<mp[i]<<endl;
            }else{
                cout<<0<<endl;
            }
        }
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
    while(t--){
        solve();
    }
	return 0;
}


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

#define si(v) v.size()
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (n); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  char op;
  int a, b;

  cin >> a >> op >> b;

  if (op == '-') cout << a - b << endl;
  else cout << a + b << endl;
  
  return (0);
}

Measured memory_bytes: 3516
#include<stdio.h>
int main(){
	int a,b,k,i;
	int flag;
	scanf("%d%d%d",&a,&b,&k);
	if(k%2==0){
		
	for(i=1;i<k;i++){
	
	if(a%2!=0)
		a--;
	flag=a/2;
	a=a/2;
	b=b+flag;
	if(b%2!=0)
		b--;
	flag=b/2;
	b=b/2;
	a=a+flag;
	}
	}
	else{
				
	for(i=1;i<k-1;i++){
	
	if(a%2!=0)
		a--;
	flag=a/2;
	a=a/2;
	b=b+flag;
	if(b%2!=0)
		b--;
	flag=b/2;
	b=b/2;
	a=a+flag;
	}
	if(a%2!=0)
		a--;
	flag=a/2;
	a=a/2;
	b=b+flag;
	}
	printf("%d %d",a,b);
}

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

void array_print(int *arr, int n) {
	for (int i = 0; i < n; i++) {
		cout << arr[i];

		if (i < n - 1) {
			cout << ' ';
		}
		else {
			cout << endl;
		}
	}
}

void insertionSort(int *arr, int n) {
	for (int i = 1; i < n; i++) {
		array_print(arr, n);
		int v = arr[i];
		int j = i - 1;

		while (j >= 0 && arr[j] > v) {
			arr[j + 1] = arr[j];
			j--;
		}
		arr[j + 1] = v;
	}
}

int main() {
	int n, arr[1000];

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

	insertionSort(arr, n);
	array_print(arr, n);

	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  vector<long long int> a(n);
  long long int ans=1;
  bool over=false;
  long long int last=0;
  for(long long int i=0; i<n; i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  for(long long int i=0; i<n; i++){
    ans*=a.at(i);
    if(ans>1000000000000000000){
      over=true;
      break;
    }
    if(ans<last){
      over=true;
      break;
    }else{
      last=ans;
    }
  }
  if(over){
    cout<<-1<<endl;
  }else{
    cout<<ans<<endl;
  }
}

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;

void f(vector<int> a, int i)
{
	if (i >= a.size()) return;
	ll p = 1;
	a[i] += 1;
	for (int j = 0; j < a.size(); ++j)
	{
		p *= a[j];
	}
	if (p % 2 == 0) cnt++;
	f(a, i + 1);
	a[i]--;

	f(a, i + 1);
	a[i]--;

	p = 1;
	for (int j = 0; j < a.size(); ++j)
	{
		p *= a[j];
	}
	if (p % 2 == 0)
		cnt++;
	f(a, i + 1);
}

void solve()
{
	int n; cin >> n;
	vector<int> a(n);
	forn(i, n) cin >> a[i];
	f(a, 0);
	ll p = 1;
	for (int j = 0; j < a.size(); ++j)
	{
		p *= a[j];
	}
	if (p % 2 == 0)
		cnt++;
	cout << cnt << endl;

}

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


Measured memory_bytes: 3624
#include <iostream>

using namespace std;


int WA(int n)
{
    int sum = 0;
    while ( n > 0 ) {
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main()
{
    int n;
    int a, b;
    int ans = 0;

    cin >> n >> a >> b;

    for (int i = 0; i <= n; i++) {
        int sum = WA(i);
        if ( a <= sum && sum <= b ) {
            ans += i;
        }
    }


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define hi cout<<"hi"<<endl;
typedef long long ll;
const int N = 105;
#define LL long long

int a[N], b[N];
int main()
{
    ios::sync_with_stdio(0);
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
    priority_queue<int, vector<int>, greater<int> > q;
    int k = 0;
    for (int i = 1; i <= 31; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (a[j] == i)
            {
                q.push(b[j]);
            }
        }
        if (!q.empty())
        {
            k++;
            q.pop();
        }
        while (!q.empty() && q.top() == i) q.pop();
    }
    cout << k * 100 + (31 - k) *50 << endl;
    return 0;
}
/*
4
9999992 9999992 9999998 9999998
*/


Measured memory_bytes: 3212
# coding:utf-8

import math

line_list = input().split(" ")

n = int(line_list[0])
m = int(line_list[1])

clear_case_ms = 100*(n-m)
re_export_times = 2**m
ans_ms = re_export_times*(1900*m+clear_case_ms)
print(ans_ms)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using AnsType = long long int;

AnsType dpn[3010], dpc[3010];
int main() {
  AnsType N, T, S; cin >> N >> T >> S;
  vector<AnsType> A(N), B(N);
  for(int i=0; i<N; i++) {
    cin >> A[i] >> B[i];
  }

  fill(dpc, dpc + T + 1, -1);
  fill(dpn, dpn + T + 1, -1);
  dpc[0] = 0; dpc[S] = 0;

  for(int i=0; i<N; i++) {
    for(int j=0; j<=T; j++) {
      dpn[j] = max(dpn[j], dpc[j]);
      if(dpc[j] < 0) continue;
      
      int nj = j + B[i];
      if(nj <= T and !(j < S and S < nj)) {
        {
          dpn[nj] = max(dpn[nj], dpc[j] + A[i]);
        }
        
        if(nj <= S) {
          dpn[S] = max(dpn[S], dpc[j] + A[i]);
        }
      }
      dpc[j] = -1;
    }
    fill(dpc, dpc + T + 1, -1);
    swap(dpc, dpn);
  }
  cout << *max_element(dpc, dpc + T + 1) << endl;
  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    ll h,c=0;
    cin>>h;
    while(h)
    {
        c++;
        h/=2;
    }
    ll p= pow(2,c);
    cout<<p-1<<e;
}



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

int main() {
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  if (std::abs(a - c) <= d || (std::abs(a - b) <= d && std::abs(b - c) <= d)) {
    printf("Yes");
  } else {
    printf("No");
  }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int index = -1;

    List<int[]> protList = new ArrayList<int[]>();
    for (int i = 0; i < n; i++) {
      int[] prot = new int[3];
      prot[0] = sc.nextInt();
      prot[1] = sc.nextInt();
      prot[2] = sc.nextInt();
      if (prot[2] > 0) {
        index = i;
      }
      protList.add(prot);
    }

    for (int x = 0; x <= 100; x++) {
      for (int y = 0; y <= 100; y++) {

        int aa = Math.abs(protList.get(index)[0] - x);
        int bb = Math.abs(protList.get(index)[1] - y);
        int hh = aa + bb + protList.get(index)[2];
        int tmpH = hh;

        boolean isCollect = true;

        for (int[] p : protList) {
          int a = Math.abs(p[0] - x);
          int b = Math.abs(p[1] - y);
          //int h = a + b + p[2];
          if (p[2] != Math.max(tmpH - a - b, 0)) {
            isCollect = false;
            break;
          }
        }

        if (isCollect) {
          System.out.println(x + " " + y + " " + tmpH);
          return;
        }
      }
    }
  }
}


Measured memory_bytes: 22100
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var abc = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
            Console.WriteLine(abc[0] * abc[1] / 2);
        }
    }
}


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

int main() {

	int  N;
	int A[99];
	int maxValue;
  	int minValue;
  
	cin >> N;
    
  	for (int i = 0; i < N; i++) { 
      cin >> A[i];     
    }
  
  	maxValue = A[0];
    minValue = A[0];
  
    for (int i = 1; i < N; i++) { 
      if (maxValue < A[i] ) maxValue = A[i];
      if (A[i] < minValue ) minValue = A[i];
    }
  	cout << maxValue - minValue << endl;
	return 0;
	
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long int n,i,min,max,sum;
    scanf("%ld",&n);
    long int a[n+1];
    for(i=0; i<n; i++)
    {
        scanf("%ld",&a[i]);
    }
    sum=0;
    min=max=a[0];
    for(i=0; i<n; i++)
    {
         if(min>a[i])
         {
             min=a[i];
         }
		  
		   if(max<a[i])
           {
                max=a[i];
           }
		   
		    sum=sum+a[i];
    }
     printf("%ld %ld %ld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
using namespace std;
int main() {
	int h, w,count;
	char s[55][55];
	cin >> h >> w;
	for (int i = 0; i < h+2;i++) {
		for (int j = 0; j < w+2;j++) {
			if (i == 0 || j == 0 || i == h+1 || j == w+1) {
				s[i][j] = '.';
			}
			else {
				cin >> s[i][j];
			}
		}
	}
	for (int i = 1; i < h + 1;i++) {
		for (int j = 1; j < w + 2;j++) {
			count = 0;
			if (j == w + 1) {
				cout << endl;
			}
			else if (s[i][j] == '.') {
				for (int x = i - 1; x < i + 2;x++) {
					for (int y = j - 1; y < j + 2;y++) {
						if (s[x][y] == '#') count++;
					}
				}
				cout << count;
			}
			else {
				cout << '#';
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
while True:

    n = int(input())
    if n == 0:
        break

    a = [int(i) for i in input().split()]

    stone = 32
    k = 0
    while True:
        stone = stone - (stone-1)%5
        if stone > 0:
            print(stone)
        else:
            print(0)
            break
        stone = stone - a[k]
        if stone > 0:
            print(stone)
        else:
            print(0)
            break
        k = (k + 1) % n



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

int main() {
    char ch, ans;
    cin >> ch;
    if(ch == 'A') ans = 'T';
    else if(ch == 'T') ans = 'A';
    else if(ch == 'C') ans = 'G';
    else ans = 'C';
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REP1(i,n) for(int i=1;i<=(int)(n);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)

int main(){
  int N, K,ans=0;
  cin >> N >> K;
  vector<int>price(N);
  REP(i,N)cin >> price.at(i);
  sort(price.begin(),price.end());
  REP(i,K)ans += price.at(i);
  cout << ans << endl;
}


Measured memory_bytes: 3580
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stack>
#include<vector>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<cstring>
#include<sstream>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<time.h>
typedef long long ll;
using namespace std;

int main() {
	//freopen("run.in", "r", stdin);
	//freopen("run.out", "w", stdout);

	char s[100];
	stack<long long> t;
	
	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			int a = 0;
			a += t.top();
			t.pop();
			a += t.top();
			//cout << a << endl;
			t.pop();
			t.push(a);
		}
		else if (s[0] == '-') {
			int b = t.top();
			t.pop();
			int a = t.top();
		//	cout << a-b << endl;
			t.pop();
			t.push(a-b);
		}
		else if (s[0] == '*') {
			int a = t.top();
			t.pop();
			a *= t.top();
			//cout << a << endl;
			t.pop();
			t.push(a);
		}
		else {
			t.push(atoi(s));
		}
	}

	printf("%lld\n", t.top());

	cin.get();
	return 0;

}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
// #define fore(i, b, e) for (int i = (int)(b); i <= (int)(e); ++i)
// #define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long i64;
typedef unsigned long long u64;
typedef long double ld;
typedef long long ll;

const int maxn = 4040;

int n, X;
int a[maxn];
i64 best = 1e18 + 100500;

int mn[maxn];

int main() {
#ifdef LOCAL
//     freopen("b.in", "r", stdin);
#endif

    cin >> n >> X;
    forn(i, n) cin >> a[i], mn[i] = a[i];

    forn(s, n) {
        i64 t = (i64)s * X;
        forn(i, n) t += mn[i];
        best = min(best, t);

        forn(i, n) mn[i] = min(mn[i], a[(i - s - 1 + n*2) % n]);
    }

    cout << best << endl;

#ifdef LOCAL
    cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
#endif
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = list(input())

# 部分文字列の和を算出
array = []
now_num = 1
count = 0
for i in s:
  if now_num == int(i):
    count += 1
  else:
    array.append(count)
    count = 1
    now_num = 1 - now_num

if count != 0:
  array.append(count)

if len(array) % 2 == 0:
  array.append(0)

res = 0
add = 2 * k + 1
ans = 0
left = 0
right = 0
tmp = 0

for i in range(len(array))[::2]:
    next_left = i
    next_right = min(i+add, len(array))
    # 尺取法
    while next_left > left:
        tmp -= array[left]
        left += 1
    while next_right > right:
        tmp += array[right]
        right += 1
    ans = max(tmp,ans)

print(ans)

Measured memory_bytes: 4780
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
	int ans = 1;
	for (; b; b >>= 1, a = a * a % mod)
		if (b & 1)
			ans = ans * a % mod;
	return ans;
}

signed main()
{
	io;
	string a,b;
	int A,B;string u;
	cin>>a>>b>>A>>B>>u;
	if(a==u)A--;
	if(b==u)B--;
	cout<<A<<" "<<B;

	getchar(); //
	getchar();
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, l, n, q;
  scanf("%lld%lld", &n, &q);
  vector<ll> vec[q + 1];
  ll s[n], t[n], x[n], d[q];
  for(i = 0; i < n; ++i) scanf("%lld%lld%lld", &s[i], &t[i], &x[i]);
  for(i = 0; i < q; ++i) scanf("%lld", &d[i]);
  for(i = 0; i < n; ++i) {
    vec[lower_bound(d, d + q, s[i] - x[i]) - d].push_back(x[i]);
    vec[lower_bound(d, d + q, t[i] - x[i]) - d].push_back(-x[i]);
  }
  multiset<ll> ans;
  for(i = 0; i < q; ++i) {
    for(j = 0; j < vec[i].size(); ++j) {
      if(vec[i][j] > 0) ans.insert(vec[i][j]);
      else ans.erase(ans.find(-vec[i][j]));
    }
    if(ans.size()) printf("%lld\n", (*ans.begin()));
    else printf("-1\n");
  }
  return 0;
}

Measured memory_bytes: 29416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  ll a;
  double b;
  cin>>a>>b;
  ll c=b*100+0.5;
  a*=c;
  cout<<a/100<<endl;
}

Measured memory_bytes: 3724
// Date: 2020-04-01

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define D(x) cout << #x << " = " << x << endl;
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 300 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int n, m;
vector<pii> rg[N];
LL dp[N][N][N];

void add(LL& x, LL y) {
    x = (x + y) % mod;
}

int main() {
    FIO;
    cin >> n >> m;
    while(m--) {
        int l, r, x;
        cin >> l >> r >> x;
        rg[r].pb(mk(l, x));
    }
    dp[0][0][0] = 1;
    rep(i, 0, n) rep(j, 0, n) rep(k, 0, n) {
        int p = max(max(i, j), k);
        int flag = 1;
        for(auto pa : rg[p]) {
            int l = pa.fi, x = pa.se;
            int cnt = 0;
            if(l <= i && i <= p) cnt++;
            if(l <= j && j <= p) cnt++;
            if(l <= k && k <= p) cnt++;
            if(cnt != x) {
                flag = 0;
                break;
            }
        }
        if(!flag) dp[i][j][k] = 0;
        add(dp[p+1][j][k], dp[i][j][k]);
        add(dp[i][p+1][k], dp[i][j][k]);
        add(dp[i][j][p+1], dp[i][j][k]);
    }
    LL ans = 0;
    rep(i, 0, n) rep(j, 0, n) {
        add(ans, dp[n][i][j]);
        add(ans, dp[i][n][j]);
        add(ans, dp[i][j][n]);
    }
    cout << ans;


    return 0;
}

Measured memory_bytes: 227712
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int a,b,c;
//=============================
void input()
{
    cin>>a>>b>>c;
}
//=============================
//=============================
void solve()
{
    int tasks[3] = {a,b,c};
    int ans = INF;
    rep(first,3){
        int ans_sub = 0;
        rep(second,3){
           if (first == second)continue;

            rep(third,3){
                if (first == third || second == third) continue;

                
                ans_sub = abs(tasks[second]-tasks[first]) + abs(tasks[third]-tasks[second]);
                ans = min(ans, ans_sub);
            }
        }
    }
    cout<<ans<<endl;
}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
  string s;
  cin>>s;
  ll k=s.length();
  bool p=true;
  rep(i,0,k/2){
    if(s[i]!=s[k-1-i])p=false;
  }
  ll k2=(k-1)/2;
  rep(i,0,k2){
    if(s[i]!=s[k2-1-i])p=false;
  }
  ll k3=(k+3)/2-1;
  rep(i,0,(k-k3)/2){
    if(s[k3+i]!=s[k-1-i])p=false;
  }
  if(p)cout<<"Yes";
  else cout<<"No";
  
}



Measured memory_bytes: 256
X = int(input())

A1 = X % 100
count = 0
while A1 >= 5:
    count += 1
    A1 -= 5
while A1 >= 4:
    count += 1
    A1 -= 4
while A1 >= 3:
    count += 1
    A1 -= 3
while A1 >= 2:
    count += 1
    A1 -= 2
while A1 >= 1:
    count += 1
    A1 -= 1
if count <= X // 100:
    print('1')
else:
    print('0')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;

int X[] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Y[] = {1, 1, 1, 0, -1, -1, -1, 0};

void solve() {
    int n, z[100005], res = 0;
    cin >> n;
    int a[n];
    REP(i, 100005) z[i] = 0;
    REP(i, n) cin >> a[i], z[a[i]]++;

    for(int i = 1; i < 100000; i++){
        res = max(res, z[i]+z[i+1]+z[i-1]);
    }
    cout << res << endl;
}

int main(){
    solve();
    return 0;
}

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

int main() {
  int n,a,b;
  cin >> n >> a >>b;
  if(n*a <= b) cout << n*a << endl;
  else cout << b << endl;
}

Measured memory_bytes: 3604