akhauriyash/Code-Regression huggingface dataset:
from functools import reduce

def gcd(m, n):
    # 入力を m, n (m ≧ n) とする。
    tmp = max(m,n)
    n = min(m,n)
    m = tmp
    # n = 0 なら、 m を出力してアルゴリズムを終了する。
    if n == 0:
        return m
    # m を n で割った余りを新たに n とし、更に 元のnを新たにm とし 2. に戻る。
    return gcd(n, m % n)

def gcda(arr, left, right):
    return reduce((lambda a,b:gcd(a,b)), arr[left:right+1], gcd(arr[left], arr[right]))

n = int(input())
nums = [ int(s) for s in input().split(" ")]

if n == 2:
    print(max(nums))
    exit()

left_n = [0 for _ in range(n)]
right_n = [0 for _ in range(n)]

left_n[0] = nums[0]
right_n[n-1] = nums[n-1]

for i in range(n-1):
    left_n[i+1] = gcd(left_n[i], nums[i+1])
    right_n[n-2-i] = gcd(right_n[n-1-i], nums[n-2-i])

# print(left_n)
# print(right_n)

maxgcd = 0
for i in range(n):
    if i == 0:
        maxgcd = max(maxgcd, right_n[1])
    if i == n-1:
        maxgcd = max(maxgcd, left_n[n-2])
    else:
        maxgcd = max(maxgcd, gcd(right_n[i+1], left_n[i-1]))

print(maxgcd)


Measured memory_bytes: 14652
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
    bool check[8] = {false};
    int n;
    cin >> n;
    int a;
    int more = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a >= 3200) {
            more++;
            continue;
        } else if (a < 3200 && check[a / 400] == false) {
            check[a / 400] = true;
        }
    }

    int color_num = 0;

    for (int i = 0; i < 8; i++) {
        if (check[i] == true) {
            color_num++;
        }
    }

    if (color_num == 0) {
        cout << 1 << " ";    
    } else {
        cout << color_num << " ";
    }

    cout << color_num + more << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  ll N; cin >> N;
  cout << N*(N-1)/2 << endl;
}

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

int main() {
int n; 
  cin>>n;
  int h[n];
  rep(i, n){
    cin>>h[i];}
  
  int maxh=0;
  int cnt=0;
  rep(i, n){
    if(maxh<=h[i]){
      cnt++;
      maxh=h[i];
    }
  }
  
  cout<<cnt<<endl;
  
  
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

n, a, b = map(int, input().split())

ans = 0

for i in range(n+1):
    s = str(i)
    sum = 0
    for j in s:
        sum += int(j)
    if a <= sum <= b:
        ans += i

print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
    int n,c,k;
    cin>>n>>c>>k;
    vector<ll> t(n+1,INF);
    REP(i, n) cin >> t[i];
    sort(t.begin(),t.end());

    int ans = 0;
    ll tt = t[0] + k;
    int jouin = 0;
    for(int i=0;i<=n;i++){
        if(t[i] <= tt && jouin < c){
            jouin++;
        }
        else{
            ans ++;
            jouin = 1;
            tt = t[i] + k;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int M, N, N_; 
long long seg[524300], lazy[524300]; 
long long D[200010], S[200010]; 
vector<pair<int, long long>> fi[200010], se[200010]; 
void init(int N_){
	N = 1; 
	while(N < N_) N *= 2; 
	for(int i = 0; i < N * 2 - 1; i++){
		seg[i] = 0; lazy[i] = 0;  
	}
}
void update(int k){
	if(lazy[k] == 0) return; 
	seg[k] += lazy[k]; 
	if(k * 2 + 2 < N * 2 - 1){
		lazy[k * 2 + 1] += lazy[k]; 
		lazy[k * 2 + 2] += lazy[k]; 
	}
	lazy[k] = 0; 
}
void add(int a, int b, int k, int l, int r, long long x){
	update(k); 	
	if(b <= l || r <= a) return; 
	if(a <= l && r <= b){
		lazy[k] += x; 
		update(k); 
	}else{
		add(a, b, k * 2 + 1, l, (l+r)/2, x);
		add(a, b, k * 2 + 2, (l+r)/2, r, x);
		seg[k] = max(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}
long long query(int a, int b, int k, int l, int r){
	if(b <= l || r <= a) return 0; 
	update(k); 
	if(a <= l && r <= b) return seg[k];
	long long vl = query(a, b, k * 2 + 1, l, (l+r)/2);
	long long vr = query(a, b, k * 2 + 2, (l+r)/2, r);
	return max(vl, vr); 
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N_ >> M;
	N_ ++; init(N_);
	for(int i = 0; i < M; i++){
		int l, r; long long a; 
		cin >> l >> r >> a; 
		fi[r].emplace_back(l, a); 
		se[l].emplace_back(r, a); 
		D[l] += a; D[r+1] -= a; 
	}
	for(int i = 1; i <= N_; i++){
		S[i] = S[i-1] + D[i]; 
	}
	for(int i = 1; i <= N_; i++){
		for(auto p : fi[i-1]){
			add(p.first, i, 0, 0, N, p.second); 
		}
		for(auto p : se[i]){
			add(i, p.first + 1, 0, 0, N, -p.second); 
		}
		long long mx = query(0, i, 0, 0, N); 
		add(i, i+1, 0, 0, N, S[i] + mx); 
	}
	for(auto p : fi[N_]){
		add(p.first, N_+1, 0, 0, N, p.second); 
	}
	cout << query(0, N, 0, 0, N) << "\n"; 
}

Measured memory_bytes: 36748
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <map>
#include <memory.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
const double EPS = 1e-12;
const int INF = 1 << 29;

const int SZ = 200010;
double dp[21][SZ];
int a[20];
 
int main(){
  int N;
  double res = INF;
  cin >> N;
  rep(i, N){
    cin >> a[i];
  }    
  fill(&dp[0][0], &dp[0][0] + (21 * SZ), INF);
  fill(dp[0], dp[0] + SZ, 0);
  rep(i, N){
    for(int j = 1; j < SZ; j++){
      for(int k = 1; k * k <= j; k++){
	if(j % k == 0){
	  dp[i+1][j] = min(dp[i+1][j],
			   max(dp[i][k],(double)abs(j - a[i]) / a[i]));
	  dp[i+1][j] = min(dp[i+1][j], 
			   max(dp[i][j/k], (double)abs(j - a[i]) / a[i]));
	}
      } 
    }
  }
  rep(i, SZ) res = min(res, dp[N][i]);
  cout << fixed << setprecision(12) << res << endl;
  return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();

        int N = sc.nextInt();
        int A[] = sc.nextIntArray(N);

        int X = 0;
        for (int i=0;i<N;i++) {
            if (i%2 == 0) {
                X += A[i];
            } else {
                X -= A[i];
            }
        }

        out.printf("%d", X);
        for (int i=1;i<N;i++) {
            int Y = (A[i-1] - X / 2) * 2;
            out.printf(" %d", Y);
            X = Y;
        }

        out.println();
        out.flush();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }

        int[] nextIntArray(int N) {
            int a[] = new int[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextInt();
            }

            return a;
        }

        long[] nextLongArray(int N) {
            long a[] = new long[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextLong();
            }

            return a;
        }

        double[] nextDoubleArray(int N) {
            double a[] = new double[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextDouble();
            }

            return a;
        }

        String[] nextTokenArray(int N) {
            String a[] = new String[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextToken();
            }

            return a;
        }
    }
}


Measured memory_bytes: 71780
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

S = input()

for s in atoz:
	if not s in S:
		print(s)
		sys.exit()

print('None')


Measured memory_bytes: 4456
n, m = map(int, input().split())
pair = []
ans = 0
x = 0

for i in range(m):
    a, b = map(int, input().split())
    pair.append([a, b])

pair = sorted(pair, key = lambda x: x[1])


for (i,j) in pair:
    if i > x:
        x = j - 1
        ans += 1

print(ans)


Measured memory_bytes: 22108
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N;
	int h[100010];
	int dp[100010];
	dp[0] = 0;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> h[i];
	}
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < N; ++i) {
		dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
	}
	cout << dp[N - 1] << endl;
	return 0;
}

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

int main(void){
    string s;
    cin >> s;
    string s0 = s;
    int tmp = s.size()-1;

    long long sum = 0;
    
    for(int i=0;i< (1 << tmp);i++){
        bitset<9> b(i);
        int k = 1;

        for(int j=0;j<9;j++){
            if(b.test(j)){
                s.insert(j+k,"+");
                k++;
            }
        }
        //cout << b << endl;
        //cout << s << endl;

        long long tmpsum = 0;
        for(int j=0;j<s.size();j++){
            if(s.at(j)=='+'){
                sum += tmpsum;
                tmpsum = 0;
            }else{
                tmpsum *= 10;
                tmpsum += (int)(s.at(j)-'0');
            }

            if(j==s.size()-1) sum+=tmpsum;

            //cout << tmpsum << endl;
        }
        s = s0;
    }


    cout << sum << endl;


}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int H,W;
	int i,j,k;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0) break;
		for(i=0; i<H; i++){
			for(j=0; j<W; j++){
				if( (i+j) % 2 == 0){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
/*input
5
0.42 0.01 0.42 0.99 0.42
*/
#include<bits/stdc++.h>
using namespace std;

#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test int t;cin>>t;while(t--)
#define X first
#define Y second
#define pb push_back
#define all(s) s.begin(),s.end()

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

const int MOD = 1e9+7;

int n;
long double prob[3000];
long double dp[3000][3000];


long double fun(int pos,int idx){
    // cout << pos << " " << idx << " " << dp[pos][idx] <<  "--\n";
    if(idx==n && pos==0) return 1.0;
    else if(idx==n) return 0;
    if(dp[pos][idx]!=2) return dp[pos][idx];

    dp[pos][idx] = 0;

    if(pos>0){
        dp[pos][idx] += fun(pos-1,idx+1)*prob[idx];
    }
    dp[pos][idx] += fun(pos,idx+1)*(1-prob[idx]);
    // cout << pos << " " << idx << " " << dp[pos][idx] <<  "\n";
    return dp[pos][idx];
}


void solve(){
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> prob[i];

    // memset(dp,2,sizeof(dp));
    for(int i=0;i<=n;i++)
        for(int j=0;j<=n;j++)
            dp[i][j] = 2;

    long double ans = 0;
    for(int i=n/2+1;i<=n;i++){
        ans += fun(i,0);
    }
    cout << fixed << setprecision(16);
    cout << ans;

}

int main(){
    FIN;   
    // test
    solve();
}

Measured memory_bytes: 141056
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int n, a;
	deque<int> deq;

	cin >> n;
	rep(i, n) {
		cin >> a;
		if (i % 2 == 0) deq.push_back(a);
		else deq.push_front(a);
	}

	if (n % 2 == 0) {
		cout << deq.front();
		deq.pop_front();
		while (!deq.empty()) {
			cout << ' ' << deq.front();
			deq.pop_front();
		}
	}
	else {
		cout << deq.back();
		deq.pop_back();
		while (!deq.empty()) {
			cout << ' ' << deq.back();
			deq.pop_back();
		}
	}

	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;

double shi(int i,int k){
  int ans=i;
  double j=1;
  while(ans<k){
    ans*=2;
    j*=(1.0/2.0);
  }
  return j;
}

int main(){
  int n,k; cin>>n>>k;
  double ans=0;
  double c=1/(double)(n);
  rep(i,n){
    ans+=c*shi(i+1,k);
    // cout<<shi(i+1,k)<<endl;
  }
  cout<<fixed<<setprecision(9)<<ans<<endl;

  return 0;
}


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

int map[5][5];

int all(int ax,int ay,int bx,int by){
  for( int i = ax ; i <= bx ; i++ ){
    for( int j = ay ; j <= by ; j++ ){

      if(! map[i][j]) return 0; 
   
    }
  }

  return 1;
}

int main(void){

  int m;
  int max;

  cin >> m;
  for( int o = 0 ; o < m ; o++ ){

    max = 0; 

    for( int i = 0 ; i < 5 ; i++ ){
      for( int j = 0 ; j < 5 ; j++ ){
	
	cin >> map[i][j];
	
      }
    }

    for( int i = 0 ; i < 5 ; i++ ){
      for( int j = 0 ; j < 5 ; j++ ){
	for( int k = i ; k < 5 ; k++ ){
	  for( int l = j ; l < 5 ; l++ ){

	    if( all( i , j , k , l ) ){
	      if( max < (k-i+1)*(l-j+1) ) max=(k-i+1)*(l-j+1);

	    }
	  }
	}
      }
    }

    cout << max << endl;

  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rep1(i,n) for(int i=1; (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
  int main(){
  int n; cin >> n;
  vector<int> d(n); rep(i,n) cin >> d[i];
  int ans=0;
  rep(i,n){
    for(int j=i+1; j<n; ++j){
      ans += d[i]*d[j];
    }
  }
  cout << ans;
 
  return 0;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

const ll C = 1000000007;

int main(){
    int N;
    cin >> N;
    vector<ll> M(N+1);

    for(int i=2; i<=N; i++) {
        ll num = i;
        for(int j=2; j<=i; j++) {
            while(num % j == 0) {
                M[j]++;
                num /= j;
            }
            if(num <= 1) {
                break;
            }
        }
    }

    ll ans = 1;
    for(int i=0; i<N+1; i++) {
        ans *= M[i]+1;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 500;
int field[N + 5][N + 5];

const int MULTI = 3000;

void hora(int tc) {
	int R, C, r, c;
	cin>>R>>C>>r>>c;
	ll total = 0;
	for(int i = 1;i <= R;i++) {
		for(int j = 1;j <= C;j++) {
			if(i % r == 0 && j % c == 0) field[i][j] = -(r * c - 1) * MULTI - 1;
			else field[i][j] = MULTI;
			total += field[i][j];
		}
	}
	if(total > 0) {
		cout<<"Yes"<<endl;
		for(int i = 1;i <= R;i++) {
			for(int j = 1;j <= C;j++) {
				if(j != 1) cout<<" ";
				cout<<field[i][j];
			}
			cout<<endl;
		}
	} else cout<<"No"<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n;
ll mi,ma;

int main(){
  cin >> n;
  mi = 1e10;
  ma = -1e10;
  REP(i,n){
    ll a;
    cin >> a;
    mi = min(mi,a);
    ma = max(ma,a);
  }
  cout << abs(ma-mi) <<endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
//#define all(x , n) x+1,x+n+1
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

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


using ll = long long;

//#define int ll

const int N = 1e7+54, mod = 1e9 + 7, mod1 = 998244353;
const int MAX = 1e5 + 11 , T = 2000;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const long double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const int LOG = 20;
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}
bool query = 0;
ll bp(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
///////////////////////////////////////////////////////////

void solve() {
    ll a , b , v , w , t;
    cin >> a >> v >> b >> w >> t;
    if(v < w) {
        cout << "NO";
        return;
    }
    if(a > b) {
        swap(a , b);
    }
    a += v*t;
    b += w*t;
    if(a >= b) {
        cout << "YES";
        return;
    }
    cout << "NO";
}

/*
8 1
1 10 1 1 1 2 8 2
1 1
*/

main() {
    ios;
    int tt = 1;
    if(query)
        cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


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

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

struct triple {
  int a, b, c;
  triple(){
    a = b = c = 0;
  }
};

struct broj {
  triple a, b, c;
  broj(){}
  broj(triple x, triple y, triple z) {
    a = x;
    b = y;
    c = z;
  }
};


broj t;

int main() {
  t.a.a = t.b.b = t.c.c = 1;
  REP(i, 20) {
    broj t1;
    t1.a.a = t.b.a + t.c.a;
    t1.a.b = t.b.b + t.c.b;
    t1.a.c = t.b.c + t.c.c;
    t1.b.a = t.a.a + t.c.a;
    t1.b.b = t.a.b + t.c.b;
    t1.b.c = t.a.c + t.c.c;
    t1.c.a = t.b.a + t.a.a;
    t1.c.b = t.b.b + t.a.b;
    t1.c.c = t.b.c + t.a.c;
 //   TRACE(t.a.a _ t.a.b _ t.a.c);
 //   TRACE(t.b.a _ t.b.b _ t.b.c);
 //   TRACE(t.c.a _ t.c.b _ t.c.c);
 //   TRACE("--------------------");
    t = t1;
  }
  int a, b, c;
  ll K;
  cin >> a >> b >> c >> K;
  if (K % 2) cout << b - a << endl;
  else cout << a - b << endl;

  return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input() for _ in range(N)]

ans = 0

for k in range(N):
    symmetry = True
    
    for i in range(N-1):
        for j in range(i+1,N):
            
            if S[(k+i)%N][j]!=S[(k+j)%N][i]:
                symmetry = False
                
    if symmetry:
        ans += N
        
print(ans)

Measured memory_bytes: 42476
N = int(input())
S = input()

def f(m):
    se = set()
    arr = [None]*N
    for i in range(0,N-m+1):
        if i >= m:
            se.add(arr[i-m])
        arr[i] = S[i:i+m]
        if arr[i] in se:
            return True
    return False

l = 0
r = N//2+1
while (r-l)>1:
    mid = (r+l)//2
    if f(mid):
        l = mid
    else:
        r = mid
print(l)


Measured memory_bytes: 9356
n, Y = map(int,input().split())
ans = 0
goukei = 0

flag = False
for x in range(n+1):
    for y in range(n+1):
            z = n - x - y
            goukei = 10000*x + 5000*y + 1000*z
            if 0 <= z <= 2000 and goukei == Y:
                print(x, y, z)
                flag = True
                break
            elif x == n:
                print(-1, -1, -1)
                flag = True
                break
    if flag:
        break


Measured memory_bytes: 40940
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    s =input()


    if len(s)>=4 and  "YAKI" == s[:4]:
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<array>
#include<algorithm>
#include <random>
std::random_device seed_gen;
std::mt19937 engine(seed_gen());
std::uniform_int_distribution<> dD {0, 364};
std::uniform_int_distribution<> dT {1, 26};

int const INF = 1e9;
int const M = 1e5;

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int D; std::cin >> D;
  int c[26];
  for(int& ci: c) std::cin >> ci;
  std::vector<std::array<int,26>> s(D);
  for(int d = 0; d < D; ++d) {
    for(int& si: s[d]) std::cin >> si;
  }
  
  // greedy
  std::vector<int> t(D);
  int ans = 0;
  int last[26];
  std::fill_n(last, 26, -1);
  for(int d = 0; d < D; ++d) {
    int ma = -INF;
    t[d] = 0;
    for(int T = 1; T <= 26; ++T) {
      int cur = s[d][T-1];
      int sv = last[T-1];
      last[T-1] = d;
      for(int cx = 0; cx < 26; ++cx) {
        cur -= (d-last[cx])*c[cx];
      }
      last[T-1] = sv;
      if(cur > ma) { ma = cur; t[d] = T; }
    }
    ans += ma;
    last[t[d]-1] = d;
  }
  
  auto score = [&]()->int {
    int ans = 0;
    int last[26];
    std::fill_n(last, 26, -1);
    for(int d = 0; d < D; ++d) {
      ans += s[d][t[d]-1];
      last[t[d]-1] = d;
      for(int cx = 0; cx < 26; ++cx) {
        ans -= (d-last[cx])*c[cx];
      }
    }
    return ans;
  };
  
  // modify
  for(int m = 0; m < M; ++m) {
    int d = dD(engine), T = dT(engine);
    int sv = t[d];
    t[d] = T;
    int new_ans = score();
    if(new_ans > ans) ans = new_ans;
    else t[d] = sv;
  }
  for(int ti: t) std::cout << ti << "\n";
  
  return 0;
}


Measured memory_bytes: 3720
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        if 2 not in a:
            a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f not in a:
                a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a = prime_factorize(N)

import math

lis = []
for n in range(1, int(math.sqrt(N)) + 1):
    if N % n == 0:
        lis.append(n)
t, u = N // max(lis) - 1, max(lis) - 1

i, j = N // max(a) - 1, max(a) - 1

ans = min(t + u, i + j)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define mem(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 7;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

int main()
{	
	string s,t;
	cin >> s >> t;
	int sum = 0;
	for(int i = 0;i < s.size();i++){
		if(s[i] != t[i]) sum++;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3852
n, m, q = map(int, input().split())
L = [1]
ans = 0

D = []
for i in range(q):
    a, b, c, d = map(int, input().split())
    D.append((a - 1, b - 1, c, d))


def gen(i):
    global ans
    if len(L) == n:
        cc = 0
        for a, b, c, d in D:
            if L[b] - L[a] == c:
                cc += d
        ans = max(ans, cc)
        return
    for x in range(L[-1], m + 1):
        L.append(x)
        gen(i + 1)
        L.pop()


gen(1)
print(ans)


Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int n,k;
  cin >>n >>k;
  int a[n];
  rep(i,n)cin >> a[i];
  ll dp[n+5];
  rep(i,n+5)dp[i]=1000000000;

  dp[0]=0;
  for(int i=1;i<n+2;i++){
    for(int e=1;e<=min(i,k);e++)chmin(dp[i],dp[i-e]+abs(a[i]-a[i-e]));
  }
  cout << dp[n-1] <<endl;
}

Measured memory_bytes: 1408
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	string s;
	cin >> s;
	int ans = 0;
	REP(i, s.length()) {
		if (s[i] == '2') ans++;
	}
	cout << ans << endl;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  int ret = 0;
  int concent = 1;
  while (concent < b) {
    concent += a - 1;
    ++ret;
  }
  cout << ret << "\n";
  return 0;
}


Measured memory_bytes: 256
class Combination:
    '''
    計算量：階乗・逆元テーブルの作成O(N)
            nCkを求めるO(1)
    '''

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD

q = int(input())
MOD = 10**6 + 3
comb = Combination(MOD, MOD)
for i in range(q):
    a1, d, n = map(int, input().split())
    if d == 0:
        print(pow(a1, n, MOD))
        continue
    syoko = a1 * (comb.inv_fact[d] * comb.fact[d-1])
    syoko %= MOD
    if syoko ==0 or syoko + (n-1) >= MOD:
        print(0)
    else:
        ans = pow(d, n, MOD) * comb.fact[syoko+(n-1)] * comb.inv_fact[syoko-1]
        print(ans % MOD)

Measured memory_bytes: 115996
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n,m = i_map()
    a = sum(i_list())
    if a > n:
        print(-1)
    else:
        print(n-a)




if __name__=="__main__":
    main()


Measured memory_bytes: 70388
#include <stdio.h>

int main(void)
{
    int     min = 0;
    int     max = 0;
    int     data = 0;
    int     count = 0;
    int     i = 0;

    scanf("%d %d %d", &min, &max, &data);

    for (i = min; i <= max; i++) {
        if ((i % data) == 0) {
            count++;
        }
    }

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

    return 0;
}

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

int main()
{
  	int w, a, b;
  	cin>>w>>a>>b;
  	int xa = a, ya = a+w, xb = b, yb = b+w;
  	if(xa < xb)
    {
      	int res = (xb - ya);
    	if(res < 0)
          	cout<<0;
      	else
          	cout<<res;
    }
  	else if(xa > xb)
    {
    	int res = (xa - yb);
    	if(res < 0)
          	cout<<0;
      	else
          	cout<<res;
    }
  	else
      	cout<<0;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	int N, i;
	cin >> N >> i;

	cout << N - i + 1 << endl;

	return 0;
}


Measured memory_bytes: 256
/*
BROKEN AF
CODING IS JOINING THE BODY PARTS AND THE SOUL
*/
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<numeric>
#include<vector>
#include<math.h>
using namespace std;
#define dude             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mesc(number,character)   char f[number];memset(f,character,number);
#define mesi(number,value)   int f[number];memset(f,value,number);
#define fr(i,start,end)  for(i=start;i<=end;i++)
#define rf(i,start,end)  for(i=start;i>=end;i--)
#define tst              int t;cin>>t;while(t--)
#define ai               ll n,i;cin>>n;ll a[n];
#define pi               3.14159265358979323846
#define ll               long long int
#define ld               long double
#define pb               push_back
#define r0               return 0;
#define pp               pop_back
#define vec              vector
#define S                string
#define D                double
#define len              length
#define br               break;
#define wh               while
#define F                float
#define gcd              __gcd
#define sz               size
#define endl             "\n"
#define sp              " "
const ll ifn=-1000000007;
ll power(ll x, ll y, ll p) { 
    ll res = 1;
    x = x % p;  
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p; 
    } 
    return res; 
} 
/*bool prim(ll n) { 
     int x=0;
    if (n<=1) {
        return false; 
    }
    for (ll i=2;i<=sqrt(n);i++) 
        if (n%i==0) {
            x=1;
            return false;
        }
        if(x==0) {
    return true;
        }
}*/
/*int fib(int n) {
    int i;
    int f[n];
    memset(f,n,int(-1));
    if(f[n]==-1) {
        if(n<=1) {
            f[n]=n;
        }
        else {
            f[n]=fib(n-1)+fib(n-2);
        }
    }
    else {
    return f[n];
    }
}
int prime(ll n) { 
    bool prim[n+1]; 
    memset(prime,true,sizeof(prim)); 
    for(int p=2;p*p<=n;p++) { 
        if(prime[p]==true) {
            for(inti=p*p;i<=n;i+=p) 
                prime[i]=false; 
        } 
    }
    return prim[n];
}*/
void swap(int x,int y) {
    int t=x;
    x=y;
    y=t;
}
bool vow(char c) {
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') {
        return true;
    }
    else {
        return false;
    }
}
/*int mmsed() {
    ll f[n];
    memset(f,1,n) {
        
    }
}*/
int fact(ll x) {
    ll i=1,cnt=1;
    fr(i,1,x) {
        cnt*=i;
    }
    return cnt;
}
bool isPrime(ll n) { 
    if (n<=1)  return false; 
    if (n<=3)  return true;
    if (n%2==0||n%3==0) return false; 
  
    for (ll i=5;i*i<=n;i=i+6) 
        if (n%i==0||n%(i+2)==0) 
           return false; 
  
    return true; 
} 
void solve() {
   ll s,w;
   cin>>s>>w;
   if(w>=s) {
       cout<<"unsafe"<<endl;
   }
   else {
       cout<<"safe"<<endl;
   }
}
int main() {
    dude
    solve();
    
   r0
}

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

char F[102][102];

void DFSapple(int X,int Y)
{
	if(F[X][Y]!='@')
		return;

	F[X][Y] = '.';
	
	DFSapple(X-1,Y  );
	DFSapple(X  ,Y+1);
	DFSapple(X+1,Y  );
	DFSapple(X  ,Y-1);
}	

void DFSpersimmon(int X,int Y)
{
	if(F[X][Y]!='#')
		return;

	F[X][Y] = '.';
	
	DFSpersimmon(X-1,Y  );
	DFSpersimmon(X  ,Y+1);
	DFSpersimmon(X+1,Y  );
	DFSpersimmon(X  ,Y-1);
}	

void DFSorange(int X,int Y)
{
	if(F[X][Y]!='*')
		return;

	F[X][Y] = '.';
	
	DFSorange(X-1,Y  );
	DFSorange(X  ,Y+1);
	DFSorange(X+1,Y  );
	DFSorange(X  ,Y-1);
}	

int main()
{
	while(true){
		int N,M;
		cin >> N >> M;
		if(N==0&&M==0)
			break;

		for(int x=1;x<=N;x++)
			for(int y=1;y<=M;y++)
				cin >> F[x][y];

		int cnt = 0;
		for(int x=1;x<=N;x++)
			for(int y=1;y<=M;y++)
				if(F[x][y]=='@'){
					cnt++;
					DFSapple(x,y);
				}

		for(int x=1;x<=N;x++)
			for(int y=1;y<=M;y++)
				if(F[x][y]=='#'){
					cnt++;
					DFSpersimmon(x,y);
				}

		for(int x=1;x<=N;x++)
			for(int y=1;y<=M;y++)
				if(F[x][y]=='*'){
					cnt++;
					DFSorange(x,y);
				}

		cout << cnt << endl;
	}

	return 0;
}


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

int main(){
    long long n,w;
    cin>>n>>w;
    
    long long profit[n],weight[n];
    
    for(long long i=0;i<n;i++){
        cin>>weight[i]>>profit[i];
    }
    
    long long  dp[n+1][w+1];
    
    memset(dp,0,sizeof(dp));
    
    
    
    for(long long  i=0;i<=n;i++){
        for(long  j=0;j<=w;j++){
            if(i==0||j==0)
                dp[i][j]=0;
            else if(weight[i-1]<=j){
                dp[i][j]=max(dp[i-1][j],profit[i-1]+dp[i-1][j-weight[i-1]]);
            }
            else if(weight[i-1]>j){
                dp[i][j]=dp[i-1][j];
            }
                
        }
    }
    cout<<dp[n][w];
}

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

int main(){
    int n;
    cin>>n;
    int arr[n+2];
    arr[0]=0;
    arr[n+1]=0;
    long total=0;
    for (int i=1; i<n+2; i++){
        if (i<n+1) cin>>arr[i];
        total+=abs(arr[i]-arr[i-1]);
    }
    for (int i=1; i<n+1; i++){
        //Removing A[i]
        cout<<total-abs(arr[i-1]-arr[i])-abs(arr[i]-arr[i+1])+abs(arr[i+1]-arr[i-1])<<"\n";
    }
    return 0;
    
    
}

Measured memory_bytes: 1664
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
  long n;
  cin >> n;
  string s[n];
  vector<long> c(5);
  for(long i = 0; i < n; i++){
    cin >> s[i];
    switch(s[i][0]){
      case 'M': c[0]++; break;
      case 'A': c[1]++; break;
      case 'R': c[2]++; break;
      case 'C': c[3]++; break;
      case 'H': c[4]++; break;
    }
  }
  long ans = 0;
  ans += c[0]*c[1]*c[2];
  ans += c[0]*c[1]*c[3];
  ans += c[0]*c[1]*c[4];
  ans += c[0]*c[2]*c[3];
  ans += c[0]*c[2]*c[4];
  ans += c[0]*c[3]*c[4];
  ans += c[1]*c[2]*c[3];
  ans += c[1]*c[2]*c[4];
  ans += c[1]*c[3]*c[4];
  ans += c[2]*c[3]*c[4];
  cout << ans << endl;
}


Measured memory_bytes: 6144
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll r, g;std::cin >> r >> g;
  std::cout << 2*g-r << '\n';
}


Measured memory_bytes: 256
/*
  Author: @yash_31
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#define ll long long int
#define eb emplace_back
#define fatafat ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define ft first
#define sd second
#define mkpr make_pair
#define deb(x) std::cout<<#x<<":"<<x<<endl;
#define whole(x) (x).begin(),(x).end()
#define revwhole(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key
#define init0(x) memset(x,0,sizeof(x));

using namespace std; 
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> gharKaSet;
 
const int maxlimit=2e5+2;
const ll inf=1e18;
//TTBDC

ll dp[401][401];
ll pref[401];

ll solve(int L,int R){
  if(dp[L][R]!=-1)return dp[L][R];
  else if(L==R)return dp[L][R] = 0;
  ll res = inf,cres;
  for(int i=0;i<R-L;i++){
    cres = solve(L,L+i) + solve(L+i+1,R) + pref[R];
    cres -= (L-1<0 ? 0 : pref[L-1]);
    res = min(res,cres);
  }
  return dp[L][R] = res;
}

int main()
{
  fatafat
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
    if(i==0)pref[i]=v[i];
    else pref[i]=pref[i-1]+v[i];
  }
  for(int i=0;i<n;i++){for(int j=0;j<n;j++){dp[i][j]=-1;}}
  cout<<solve(0,n-1);
  return 0;
}

Measured memory_bytes: 4876
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
 
 
#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979
#define MAXI 7500000

//.size()はunsigned int　0-1をするとオーバーフローする
 
using namespace std;
typedef long long int ll;
typedef pair< long long int , long long int> P;

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

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

struct edge{long long int to;
long long int cost;};

 
int main(void){

	int p,q,r;

	cin>>p>>q>>r;

	cout<<min(p+q,min(q+r,r+p))<<endl;

}



Measured memory_bytes: 256
package main

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

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

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	k := scanInt()

	arr := make([]int, 0, 1e5)
	for i := 1; i*i <= n; i++ {
		arr = append(arr, i, n/i)
	}
	sort.Ints(arr)
	// debug(arr)
	dp := make([]map[int]int, k+1)
	dp[0] = map[int]int{}
	dp[0][1] = 1
	for i := 0; i < k; i++ {
		dp[i+1] = map[int]int{}
		pre := 0
		sum := 0
		for _, e := range arr {
			num := e - pre
			sum += (dp[i][e] * num) % MOD
			sum %= MOD
			dp[i+1][n/e] = sum
			pre = e
		}
		// debug(dp[i+1])
	}
	ans := 0
	pre := 0
	for i := 0; i < len(arr); i++ {
		num := arr[i] - pre
		ans += dp[k][arr[i]] * num
		ans %= MOD
		pre = arr[i]
	}

	fmt.Fprintln(wr, ans)

}

// MOD constant
const MOD = 1000000007


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

int main(){
    int a,b;
    cin >> a >> b;
    int ans=0;
    if(a>b){
        ans+=a;
        a--;
    }else{
        ans+=b;
        b--;
    }
    if(a>b){
        ans+=a;
        a--;
    }else{
        ans+=b;
        b--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256