akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        String s = sc.next();
        int n = sc.nextInt();
        HashSet<String> hs = new HashSet<>();
        int k = s.length();
        for(int i = 0; i < k; i++){
            int jk = Math.min(k,i+n);
            for(int j = i+1; j <= jk; j++){
                hs.add(s.substring(i,j));
            }
        }
        ArrayList<String> li = new ArrayList<>(hs);
        Collections.sort(li);
        System.out.println(li.get(n-1));
    }
}


class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 23096
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main()
{
    int r,d,x,x1;
    cin>>r>>d>>x;
    x1=x;
    for(int i=0;i<10;i++)
    {
        x1=r*x1-d;
        cout<<x1<<endl;
    }
    return 0;
}


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

int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long sum1,sum2,sum3,sum4,sum;
	sum1=a*c;
	sum2=a*d;
	sum3=b*c;
	sum4=b*d;
	sum=max(max(sum1,sum2),max(sum3,sum4));
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> edge(N, vector<int>(N,0));
    rep(i,0,M) {
        int a,b;
        cin >> a >> b;
        edge[a-1][b-1] = edge[b-1][a-1] = 1;
    }

    int ans = 0;
    vector<int> route(N-1);
    rep(i, 0, N-1) route[i] = i+1;
    do {
        bool can = true;
        if (!edge[0][route[0]]) can = false;
        rep(i,0,N-2) {
            if (!edge[route[i]][route[i+1]]) can = false;
        }
        if (can) ans++;
    } while (next_permutation(all(route)));

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c;
    std::deque<int> deq;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a >> b >> c;
        if (a*a==b*b+c*c || b*b==a*a+c*c || c*c==a*a+b*b) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    
    
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n+1, 0);
  rep(i, n) {
    int t;
    cin >> t;
    v[t]++;
  }
  sort(v.begin(), v.end(), greater<int>());

  int c = 0;
  int sum = 0;
  rep(i, n+1) {
    if (c < k) { 
      sum += v[i];
      c++;
    }
  }
  cout << n - sum;
}


Measured memory_bytes: 1152
#include <cstdio>

using namespace std;

int main()
{
    int H, W, A, B;
    scanf("%d %d %d %d", &H, &W, &A, &B);

    for (int x = 0; x < H; ++x)
    {
        for (int y = 0; y < W; ++y)
        {
            const bool l = x < B;
            const bool u = y < A;
            printf("%d", (l ^ u) ? 0 : 1);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int n, a;

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

    cout << (n*n) - a;

}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define     pi        acos(-1)
#define     ll        long long int
#define     fopen     freopen("in.txt","r",stdin)
#define     fwrite    freopen("o.txt","w",stdout)
#define     f0(n)     for(int i=0;i<n;i++)
#define     mem(a)    memset(a,0,sizeof(a))
#define     mems(a)   memset(a,-1,sizeof(a))

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

    int a,b;
    cin>>a>>b;
    if((a*b)%2==0) cout<<"No";
    else cout<<"Yes";

    return 0;
}


Measured memory_bytes: 256
MOD = 10 ** 9 + 7
N = int(input())
C = list(sorted(map(int, input().split()), reverse=True))

ans = 0
pow_list = [1] * (N + 1)
for i in range(1, N + 1):
    pow_list[i] = (2 * pow_list[i - 1]) % MOD
base = pow_list[N]

# 基本戦略:コストが一番高いものを一番最後に変更する
for i, c in enumerate(C):
    now = pow_list[N - i - 1]
    tot = 0
    # コストがi番目に大きい値は、最後からi番目に変更を行うので
    # 左からi-bitまでに何個1が立ったかで加算回数が決まる
    if i >= 1:
        tot = pow_list[i] + i * pow_list[i - 1]
    else:
        tot = pow_list[i]
    ans += (tot * now * c) % MOD
    ans %= MOD
print(ans * base % MOD)

Measured memory_bytes: 31612
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli h, a;
    cin >> h >> a;
    lli ans = 0;
    ans = h / a;
    h %= a;
    if(h!=0){
        ans++;
    }
    out(ans);
}

Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

long long max(long long x, long long y){return (x > y ? x : y);}
long long min(long long x, long long y){return (x < y ? x : y);}

#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=3200;
const ll inf=1e9+800;
const ll mod=1e9+7;

pii a[maxn];
ll n,m;
ll ent[maxn][maxn];
ll dp[maxn][maxn];
ll par[maxn];

void comperess(){
	for(ll i=0;i<m;i++){
		a[i].S*=-1;
	}
	sort(a,a+m);
	for(ll i=0;i<m;i++){
		a[i].S*=-1;
	}

	vector<pii> vec;
	for(ll i=0;i<m;i++){
		if(vec.size()==0 || vec.back().S<a[i].S){
			vec.pb(a[i]);
		}
	}
	for(ll i=0;i<vec.size();i++){
		a[i]=vec[i];
	}
	m=vec.size();
}
bool f(char c){
	return c-'0';
}
ll find_par(ll l,ll r){
	if(l==0){
		return par[r];
	}	
	return par[r]-par[l-1];
}
ll find_par(ll l){
	return find_par(a[l].F,a[l].S);
}
ll tol(ll l,ll r){
	return r-l+1;
}
ll tol(ll i){
	return a[i].S-a[i].F+1;
}


int main(){
	ent[0][0]=1;
	for(ll i=1;i<maxn;i++){
		ent[i][0]=1;
		ent[i][i]=1;
		for(ll j=1;j<i;j++){
			ent[i][j]=(ent[i-1][j]+ent[i-1][j-1])%mod;
		}
	}


	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	cin>>n>>m;
	string s;
	cin>>s;
	par[0]=f(s[0]);
	for(ll i=1;i<n;i++){
		par[i]=(par[i-1]+f(s[i]));
	}
	for(ll i=0;i<m;i++){
		cin>>a[i].F>>a[i].S;
		a[i].F--;
		a[i].S--;
	}
	comperess();
	for(ll i=0;i<m;i++){
		//cout<<a[i].F<<'@'<<a[i].S<<endl;
	}
	for(ll i=0;i<=tol(m-1);i++){
		dp[m-1][i]=ent[tol(m-1)][i];
	}
	for(ll i=m-2;i>=0;i--){
		if(a[i].S<a[i+1].F){
			for(ll j=0;j<=tol(i);j++){
				dp[i][j]=(ent[tol(i)][j]*dp[i+1][find_par(i+1)])%mod;
			}
		}else{
			for(ll j=0;j<=tol(i);j++){
				ll CTE=find_par(a[i].S+1,a[i+1].S);
				ll TOL=tol(a[i].F,a[i+1].F-1);
				ll Tol=tol(a[i+1].F,a[i].S);
				for(ll k=max(0LL,j-Tol);k<=min(TOL,j);k++){
					dp[i][j]+=(ent[TOL][k]*dp[i+1][j-k+CTE])%mod;
				}
				dp[i][j]%=mod;
			}
		}
	}
	cout<<dp[0][find_par(0)];
}



















Measured memory_bytes: 111616
unittest
{
	assert( [ "erasedream" ].parse.expand.solve == "YES" );
	assert( [ "dreameraser" ].parse.expand.solve == "YES" );
	assert( [ "dreamerer" ].parse.expand.solve == "NO" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	LOOP: while( 0 < s.length )
	{
		foreach( w; [ "dream", "dreamer", "erase", "eraser" ] )
		{
			if( w.length <= s.length && s[ $ - w.length .. $ ] == w )
			{
				s.length -= w.length;
				continue LOOP;
			}
		}
		return "NO";
	}
	return "YES";
}


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

int A, B, H, M;

void rotate(double& x, double& y, double theta){
    double x_buf = x, y_buf = y;
    x = cos(theta)*x_buf - sin(theta)*y_buf;
    y = sin(theta)*x_buf + cos(theta)*y_buf;
}

int main(){
    cin >> A >> B >> H >> M;
    double ans;
    pair<double,double> ph = make_pair(0,A), pm = make_pair(0,B);
    double vh = 2*M_PI/12/60, vm = 2*M_PI/60; //角速度(毎分)
    double x_buf, ybuf;
    double theta_h, theta_m;
    theta_m = vm * M;
    theta_h = vh * (60*H + M);
    rotate(ph.first, ph.second, theta_h);
    rotate(pm.first, pm.second, theta_m);
    ans = sqrt(pow(ph.first-pm.first,2)+pow(ph.second-pm.second,2));
    cout << setprecision(20) << ans << endl;
    return 0;
}

/*
時針の位置
それぞれの針の角速度は？(単位を分速に合わせる)
2Pi/12/60
分針の位置
2Pi/60
*/

Measured memory_bytes: 4024
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(int arg_budget,int arg_diff){
		budget = arg_budget;
		diff = arg_diff;
	}
	int budget,diff;
};

int dp[101][10001],next_dp[101][10001];

int main(){

	int N,C,min_cost;
	scanf("%d %d",&N,&C);

	int max_diff[C+1],next_max_diff[C+1];

	for(int i = 0; i <= C; i++){
		for(int k = 0; k <= 10000;k++){
			dp[i][k] = -1;
			next_dp[i][k] = -1;
		}
		max_diff[i] = 0;
	}

	int high_score,low_score,next_high_score,next_low_score,next_diff;

	int add_A,add_B,cost;

	dp[C][0] = 0;

	vector<Info> Updated;

	min_cost = C;
	int next_min_cost;

	for(int loop = 0; loop < N; loop++){

		scanf("%d %d %d",&add_A,&add_B,&cost);

		next_min_cost = min_cost;
		for(int i = 0; i <= C; i++){
			next_max_diff[i] = max_diff[i];
		}

		for(int budget = C; budget >= max(min_cost,cost); budget--){

			for(int diff = 0; diff <= max_diff[budget]; diff++){
				if(dp[budget][diff] == -1)continue;

				low_score = dp[budget][diff];
				high_score = low_score+diff;

				next_high_score = high_score+add_A;
				next_low_score = low_score+add_B;
				next_diff = next_high_score-next_low_score;
				if(next_dp[budget-cost][next_diff] < next_low_score){
					next_dp[budget-cost][next_diff] = next_low_score;
					Updated.push_back(Info(budget-cost,next_diff));
					next_min_cost = min(next_min_cost,budget-cost);
					next_max_diff[budget-cost] = max(next_max_diff[budget-cost],next_diff);
				}

				next_high_score = high_score+add_B;
				next_low_score = low_score+add_A;
				next_diff = max(next_high_score,next_low_score)-min(next_high_score,next_low_score);
				if(next_dp[budget-cost][next_diff] < min(next_high_score,next_low_score)){
					next_dp[budget-cost][next_diff] = min(next_high_score,next_low_score);
					Updated.push_back(Info(budget-cost,next_diff));
					next_min_cost = min(next_min_cost,budget-cost);
					next_max_diff[budget-cost] = max(next_max_diff[budget-cost],next_diff);
				}
			}
		}

		min_cost = next_min_cost;

		for(int i = 0; i < Updated.size(); i++){
			dp[Updated[i].budget][Updated[i].diff] = next_dp[Updated[i].budget][Updated[i].diff];
		}
		Updated.clear();

		for(int i = 0; i <= C; i++){
			max_diff[i] = next_max_diff[i];
		}
	}

	int ans = 0;

	for(int i = 0; i <= C; i++){
		for(int k = 0; k <= 10000; k++){
			ans = max(ans,dp[i][k]);
		}
	}

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

	return 0;

}

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

int bottom(vector<int> &wt, vector<int> &val, int n, int w)
{
	int maxval = n * 1000;
	int dp[n + 1][maxval + 1];
	//base case
	for (int i = 0; i <= maxval; i++)
	{
		dp[1][i] = INT_MAX;
	}
	dp[1][0] = 0;
	dp[1][val[1]] = wt[1];
	for (int i = 2; i <= n; i++)
	{
		for (int j = 0; j <= maxval; j++)
		{
			dp[i][j] = dp[i - 1][j]; //exclusion
			if (val[i] <= j)
				dp[i][j] = min(dp[i][j], wt[i] + dp[i - 1][j - val[i]]); //minimise the wt
		}
	}
	int ans = 0;
	for (int i = 0; i <= maxval; i++)
	{
		if (dp[n][i] <= w)
			ans = i;
	}
	return ans;
}
int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n, w;
	cin >> n >> w;
	vector<int> wt(n + 1), val(n + 1);
	for (int i = 1; i <= n; i++)
	{
		cin >> wt[i] >> val[i];
	}
	cout << bottom(wt, val, n, w);
}
// 6 15
// 6 5
// 5 6
// 6 4
// 6 6
// 3 5
// 7 2

// 17


Measured memory_bytes: 78336
def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    hands = []
    for i in range(M):
        hands.append([int(n) for n in input().split()])
    
    A.sort()
    hands = sorted(hands, key = lambda x: -x[1])
    
    res = sum(A)
    ptr = 0
    for a in A:
        hand_str = hands[ptr][1]   
        hand_amt = hands[ptr][0]
        if hand_str > a:
            res += hand_str - a
            hands[ptr][0] -= 1
            if hands[ptr][0] == 0:
                ptr += 1
        if ptr >= M:
            break
    print(res)
main()

Measured memory_bytes: 30908
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     int n;
     cin>>n;
     cout<<n*(n+1)/2<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"A B"# => "<",
// r#"24"# => "No",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        x: bytes,
        y: bytes,
    }

    if x[0] < y[0] { "<" } else if x[0] > y[0] { ">" } else { "=" }.to_string()
}

Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int main(){
    string s;
    cin>>s;
        int ans = s.length();
       for(int i=0;i<26;i++){
        char c='a'+i;
        int tmp=0;
        int cnt=0;
            for(int j=0;j<s.size();j++){
                if(s[j]==c){
                    tmp=max(cnt,tmp);
                    cnt=0; 
                }
                else cnt++;
            }
            tmp=max(tmp,cnt);
            ans=min(ans,tmp);

       }
       cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9+7;
LL const MaxSize = 1e6 + 5;
//LL const MOD = 998244353;

/*

#https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
D - Lucky PIN

Easy problem, but python version gives TLE in the last two cases
 */


LL X, Y;
string S;

//NOTE WORKS ONLY WHEN MOD IS PRIME
LL f[MaxSize], invF[MaxSize], r[MaxSize];

void preCalc() {
        r[1] = 1;
        f[1] = 1;
        invF[1] = 1;
        LL m = MOD;

        for (LL i = 2; i < MaxSize; ++i) {
                r[i] = (m - (m / i) * r[m % i] % m) % m;

                f[i] = (i * f[i - 1]) % MOD;
                invF[i] = (r[i] * invF[i - 1]) % MOD;
        }
}

LL choose(LL top, LL bottom) {
        if (top < bottom || top < 0 || bottom < 0)
                return 0;
        if (top == bottom || bottom == 0)
                return 1;

        LL bfs = (invF[bottom] * invF[top - bottom]) % MOD;

        //      cout << "ftop:" << top << " " << f[top] << endl;

        return (f[top] * bfs) % MOD;
}

int main() {
        ios_base::sync_with_stdio(false);
        //freopen("/Users/georgeli/A_1.in", "r", stdin);

        cin >> X >> Y;

        if ((X + Y) % 3){
        	cout << 0;
        	return 0;
        }

        LL ts  = (X + Y) / 3;
        LL delta = abs(X - Y);
        LL upSteps = (ts + delta)/ 2;

        preCalc();
        cout << choose(ts, upSteps);


        return 0;
}


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

int main() {

	int a;
	int b;
	int c;
	int d;

	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;

	int train;

	if (a < b) {
		train = a;
	}
	else
	{
		train = b;
	}

	int bus;

	if (c < d) {
		bus = c;
	}
	else {
		bus = d;
	}

	cout << to_string(train + bus) << endl;

}

Measured memory_bytes: 256
N = int(input())
Ai = input()
Ai = Ai.split(' ')
ans = 'APPROVED'
for moji in Ai:
    moji = int(moji)
    if moji % 2 != 0:
        pass
    else:
        if (moji % 3 == 0) or (moji % 5 == 0):
            pass
        else:
            ans = 'DENIED'
            break
print(ans)


Measured memory_bytes: 2940
/* Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define debug(x) cout << #x << " " << x <<endl;
#define set_bits __builtin_popcount
typedef long long ll;
typedef unsigned long long ull;
/*---------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod)
{ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll combination(ll n, ll r, ll m, ll* fact) {ll val1 = fact[n]; ll val2 = mminvprime(fact[r], m); ll val3 = mminvprime(fact[n - r], m); return ((val1 * val2) % m * val3) % m;}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	ll n;
	cin >> n;
	ll x = n / 1000;
	if (n % 1000 != 0)
		x++;
	ll ans = x * 1000 - n;
	cout << ans << endl;
	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string s;
  cin >> N >> s;
  int red = 0;
  for(int i = 0; i < N; i++) {
    if(s[i] == 'R') red++;
  }
  if(red > N - red)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 1e5;

ll N;
bool s[MAX];
bool k[MAX];

void show() {
  string ans = "";
  REP (i, N) ans += (k[i] ? 'S' : 'W');
  cout << ans << endl;
}

int main() {
  cin >> N;
  string S;
  cin >> S;
  REP (i, N) s[i] = (S[i] == 'o');

  REP (x, 4) {
    k[0] = (x&1)==0;
    k[1] = (x&2)==0;

    FOR (i, 2, N) {
      k[i] = (s[i-1]^k[i-1]^k[i-2]);
    }

    bool res = true;
    REP (i, N) res &= (!k[i%N]^k[(i+1)%N]^k[(i+2)%N]^s[(i+1)%N]);
    if (res) {
      show();
      return 0;
    }
  }

  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int N;

    if (scanf("%d", &N) < 1) return 0;

    vector<int> L(2 * N, 0);

    for (int i = 0; i < 2 * N; i++)
    {
        if (scanf("%d", &L[i]) < 1) return 0;
    }

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

    int ans = 0;

    for (int i = 2 * N - 1; 0 <= i; i--)
    {
        if (i % 2 == 0) ans += L[i];
    }

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

    return 0;
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  vector<int> a(3);
  cin >> a;

  sort(a);

  int cnt = (a.back() - a[0]) + (a.back() - a[1]);
  int ans = cnt / 2;
  if (cnt & 1) {
    ans += 2;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, c;
	int cur;

	scanf("%d %d %d", &a, &b, &c);

	cur = 0;
	do {
		if (cur <= c && c <= cur + a) {
			printf("%d\n", c);
			return 0;
		}

		cur += a + b;
		while (c < cur)
			c += 60;
	} while (cur % 60);

	puts("-1");
	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>

int main(void){
  int i, sum, tom;
  int t[4];
  scanf("%d%d%d%d", &t[0], &t[1], &t[2], &t[3]);
  if(t[2] - t[1] > 0 || t[0] - t[3] > 0){
    printf("0\n");
  }
  else{
  sum = t[2] - t[0];
  if(sum > 0){
    tom = t[3] - t[1];
    if(tom > 0){
      printf("%d", t[1] - t[2]);//1
    }
    else{
      printf("%d", t[3] - t[2]);//2
    }
  }
  else{
    tom = t[3] - t[1];
    if(tom > 0){
      printf("%d", t[1] - t[0]);//4
    }
    else{
      printf("%d", t[3] - t[0]);//3
    }
  }
}
  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i, j;
        int[] count = new int[26];
        Arrays.fill(count, 0);
        char[] tgts = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
                'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
        while(sc.hasNextLine()) {
	        String str = sc.nextLine();
	        char[] strArray = str.toCharArray();
	        for(i = 0; i < strArray.length; i++){
	        	strArray[i] = Character.toLowerCase(strArray[i]);
	        	for(j = 0; j < tgts.length; j++){
	            	if(strArray[i] == tgts[j]) {
	            		count[j]+= 1;
	            		break;
	            	}
	            }
	        }
        }
        
        for(j = 0; j < tgts.length; j++) {
        	System.out.print(tgts[j] + " : " + count[j]);
        	if(j != tgts.length) {
        		System.out.println();
        	}
        }
        sc.close();
    }
}



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

int a[6];
int t[4];
int main()
{
  for ( int i = 0; i < 6; i++ ) cin >> a[i];
  for ( int i = 0; i < 6; i++ ) t[a[i]-1]++;
  bool ret = true;
  for ( int i = 0; i < 4; i++ )
  {
    if ( t[i] == 0 || t[i] == 3 ) { ret = false; break; }
  }
  
  if ( ret )
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long int ll;
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    int dp[100001][3];
    memset(dp,0,sizeof(dp));
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][2],dp[i-1][0])+b[i];
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
   // for(int i=0;i<n;i++)
    //    cout<<dp[i]<<endl;
    return 0;
}
 



Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace Atcoder
{
	class Program
	{
		//string s = Console.ReadLine();
		//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		//int H = intArray[0];
		//int W = intArray[1];
		//int N = int.Parse(Console.ReadLine());
		//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());
		//Boolean ok = false;

		//Console.WriteLine(ans);
		//Console.WriteLine("Yes");
		//Console.WriteLine("No");
		//Console.ReadKey();
		//Console.WriteLine(cnt);

		//string[] strArray = Console.ReadLine().Split(' ').ToArray();
		//string S = strArray[0];
		//string T = strArray[1];
		static void Main(string[] args)
		{
			string S = Console.ReadLine();
			int len = S.Length;

			string L = S.Substring(0, (len - 1) / 2);
			string R = S.Substring((len + 3) / 2 - 1);

			if (Palindrome(S, len) && Palindrome(L, L.Length) && Palindrome(R, R.Length))
				Console.WriteLine("Yes");
			else
				Console.WriteLine("No");
		}

		/// <summary>
		/// 回文
		/// </summary>
		/// <param name="Target"></param>
		/// <param name="len"></param>
		/// <returns></returns>
		static bool Palindrome(string Target , int len)
        {
			bool yes = true;

			for(int i = 0;i < len; i++)
            {
				if(Target[i] != Target[len - 1 - i])
                {
					yes = false;
					break;
                }
            }
			return yes;
        }

		/// <summary>
		/// アナグラム
		/// </summary>
		/// <param name="word1"></param>
		/// <param name="word2"></param>
		/// <returns></returns>
		static bool IsAnagramOf(string word1, string word2)
		{
			return word1.OrderBy(x => x).SequenceEqual(word2.OrderBy(x => x));
		}
		/// <summary>
		/// 最小公倍数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static long Lcm(long a, long b)
		{
			return a * b / Gcd(a, b);
		}

		/// <summary>
		/// 最大公約数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static long Gcd(long a, long b)
		{
			if (a < b)
				// 引数を入替えて自分を呼び出す
				return Gcd(b, a);
			while (b != 0)
			{
				var remainder = a % b;
				a = b;
				b = remainder;
			}
			return a;
		}
	}
}

Measured memory_bytes: 25832
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"


def solve():
    C = []
    for _ in range(3):
        C.append(list(map(int, input().split())))

    for a1 in range(0, 101):
        for a2 in range(0, 101):
            for a3 in range(0, 101):

                b1_ok = (C[0][0] - a1) == (C[1][0] - a2) == (C[2][0] - a3)
                b2_ok = (C[0][1] - a1) == (C[1][1] - a2) == (C[2][1] - a3)
                b3_ok = (C[0][2] - a1) == (C[1][2] - a2) == (C[2][2] - a3)

                if b1_ok and b2_ok and b3_ok:
                    return Yes

    return No


def main():
    print(solve())


if __name__ == '__main__':
    main()


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  
  cin >> S;
 
  int cnt = 0;
  for(int i = 0; i < 3; i++){
    if(S[i] == 'R') cnt++;
  }
  
  if(S == "RSR") cnt=1;
  
  cout << cnt << endl;
 
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            int iA = int.Parse(sS[1]);
            int iB = int.Parse(sS[2]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = iB;
            int iAA = iN * iA;
            if (iAA < iB) { iOut = iAA; }

            // 出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


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


class RangeSumQuery {
private:
  int* tree;
public:
  int size;
  RangeSumQuery(int n) {
    size = 1; while(size < n) size *= 2;
    tree = new int[2*size - 1];
    for (int i=0; i < 2*size - 1; i++) tree[i] = 0;
  }
  void add(int i, int x);
  long long int getSum(int s, int t, int i, int l, int r);
};

void RangeSumQuery::add(int i, int x) {
  i += size - 1;

  tree[i] += x;
  while (i > 0) {
    i = (i - 1) / 2;
    tree[i] = tree[2*i+1] + tree[2*i+2];
  }
}

long long int RangeSumQuery::getSum(int s, int t, int i, int l, int r) {
  if (r < s || t < l) return 0;
  if (s <= l && r <= t) return tree[i];

  int vl = getSum(s, t, 2*i+1, l, (l+r)/2);
  int vr = getSum(s, t, 2*i+2, (l+r)/2+1, r);
  return vl + vr;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);  
  int n, q;
  int com, x, y;
  cin >> n >> q;

  RangeSumQuery rsq(n);
  
  for (int i=0; i<q; i++) {
    cin >> com >> x >> y;
    if (com == 0) {
      rsq.add(x-1, y);
    } else {
      cout << rsq.getSum(x-1, y-1, 0, 0, rsq.size - 1) << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 4252
#include<bits/stdc++.h>
using namespace std;
int n,a[110];
int main()
{
	scanf("%d",&n);
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if (a[i]==a[i-1]) a[i]=0,ans++;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;

using namespace std;

int A[200][200];

int gcd(int a, int b){
  if(A[a-1][b-1]!=-1)return A[a-1][b-1];
  if (a%b == 0)
  {
      A[a-1][b-1]=b;
      return(b);
  }
  else
  {
      return(gcd(b, a%b));
  }

}

int main() {
  int k;
  ll sum=0;
  cin>>k;
  for(int i=0;i<200;i++){
    for(int j=0;j<200;j++){
      A[i][j]=-1;
    }
  }
  for(int i=1;i<k+1;i++){
    for(int j=1;j<k+1;j++){
      for(int l=1;l<k+1;l++){
        sum+=gcd(gcd(i,j),l);
      }
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 3788
#include <vector>
#include <iostream>
#include <string>
#include <set>
#include <map>

using namespace std;

int n, T;
int c[1000], t[1000];

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

	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		int j;
		for (j = i; j < s.length(); j++) {
			if (s[j] != 'A' && s[j] != 'C' && s[j] != 'G' && s[j] != 'T') {
				break;
			}
		}
		ans = max(ans, j - i);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;


vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;

    for (ll a = 2; a * a <= n; ++a) {
        if (n % a != 0) continue;

        ll ex = 0;
        while (n % a == 0) {
            ++ex;
            n /= a;
        }
        res.emplace_back(a, ex);
    }

    if (n != 1) res.emplace_back(n, 1ll);

    return res;
}


int n;
map<ll, int> sisuu;

ll rec(map<ll, int>::const_iterator p, ll mul) {
    if (p == sisuu.cend()) {
        if (mul == 1) return 1;
        else return 0;
    }

    ll res = 0;
    for (int i = 0; i < p->second + 1; ++i) {
        if (mul % (i + 1) != 0) continue;
        res += rec(++p, mul / (i + 1));
        --p;
    }

    return res;
}



int main() {
    cin >> n;
    for (int i = 2; i <= n; ++i) {
        auto ps = prime_factorize(i);
        for (auto it: ps) sisuu[it.first] += it.second;
    }

    cout << rec(sisuu.cbegin(), 75) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define out(a) cout<<a<<" "
#define all(a) (a).begin(), (a).end()
#define upper_index(v, a) (int)distance(v.begin(), upper_bound((v).begin(), (v).end(), a))
#define lower_index(v, a) (int)distance(v.begin(), lower_bound((v).begin(), (v).end(), a))
typedef long long ll;
const long long INF = 1e17;

int main() {
    ll n,a,b,cnt=0,x,y;
    cin>>n>>a>>b>>y;
    rep(i,n-1){
        x=y;
        cin>>y;
        cnt+=min(a*(y-x),b);
    }
    cout<<cnt<<endl;
}

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

int main(){
	int arr[5];
	for(int i=0;i<5;i++){
		cin>>arr[i];
	}
	for(int i=0;i<5;i++){
		if(arr[i]==0){
			cout<<i+1;
		}
	}
	return 0;
}


Measured memory_bytes: 3588
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();
    int mx = A;
    if(mx < B) {
      mx = B;
    }
    if(mx < C) {
      mx = C;
    }
    System.out.println(A + B + C + mx * ((1 << K) - 1));
  }
}

Measured memory_bytes: 20820
MOD = 10**9 + 7
N = int(input())
stones = [int(input()) for _ in range(N)]
dp = [0] * (N+1)
rightmost = [0] * (2 * 10**5 + 1)
dp[0] = 1
for i, c in enumerate(stones):
    dp[i+1] += dp[i]
    dp[i+1] %= MOD
    if rightmost[c] not in [0, i]:
        dp[i+1] += dp[rightmost[c]]
        dp[i+1] %= MOD
    rightmost[c] = i+1
print(dp[N])

Measured memory_bytes: 24468
#include<stdio.h>
#define NUMBER 100
int main(void){
    int i,c=0,a,b,x[NUMBER];
    char op;
    for(i=0;1;i++){
       scanf("%d %c %d",&a,&op,&b);
       if(op=='+')
         x[i]=a+b;
       else if(op=='-')
         x[i]=a-b;
       else if(op=='*')
         x[i]=a*b;
       else if(op=='/')
         x[i]=a/b;
       else
         break;
       c++;
    }
    for(i=0;i<c;i++){
       printf("%d\n",x[i]);
    }
    return 0;
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
const int INF=1e9;
string rs;
ll N,C,ans;
bool is_prime(ll n){
      for(int i=2;i*i<=n;i++){
            if(n%i==0)return false;
      }
      return n!=1;
}
ll to_i(string s){
      ll k=1,res=0;
      reverse(ALL(s));
      REP(i,s.size()){
            res+=(s[i]-'0')*k;
            k*=10;
      }
      return res;
}
void rec(string s){
      if(s.size()==N){
            if((s[0]-'0')%2==0)return;
            rs=s;reverse(ALL(rs));
            if(C>=0)s+=(char)(C+'0');
            s+=rs;
            ll t=to_i(s);
            if(is_prime(t))ans=max(ans,t);
            return;
      }
      REP(i,10)rec(s+(char)(i+'0'));
      return;
}
int main(){
      cin>>N>>C;
      ans=-1;
      if(C<0){
            REP(i,N*2)cout<<9;cout<<endl;
      }else{
            rec("");
            cout<<ans<<endl;
      }
}

Measured memory_bytes: 1208
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
#include <cstring>
int main() {
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	std::cout << c - (d - b) << " " << d + (c - a) << " " << c - (d - b) - (c - a) << " " << d + (c - a) - (d - b) << std::endl;
		return 0;
}

Measured memory_bytes: 256