akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace abc152
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc152A();
        }

        public static void solve_abc152B()
        {
        }

        public static void solve_abc152A()
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(nm[0] == nm[1] ? "Yes" : "No");            
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>

using namespace std;

uint64_t N, A, B;

int main()
{
  cin >> N >> A >> B;

  uint64_t ret=0;

  for (uint64_t i=0; i<N; ++i) {
    uint64_t t;
    cin >> t;
    if (t<A || B<=t)
      ++ret;
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

inline long max(long* a, long n) {
    long max = -2000000000;
    long min = a[0];

    for (int i = 1; i < n; i ++) {
        if (a[i] - min > max) {
            max = a[i] - min;
        }
        if (min > a[i]) {
            min = a[i];
        }
    }
    return max;
}

int main() {
    int n;
    scanf("%d", &n);

    long* a = new long[n];
    for (long i = 0; i < n; i ++) {
        scanf("%ld", &a[i]);
    }
    long m = max(a, n);
    printf("%ld\n", m);
}


Measured memory_bytes: 4288
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DTeleporter {
public:

    vector<int> mod_pow(vector<int> a, ll x) {
      int n = a.size();
      vector<int> res(n);
      rep(i, n) res[i] = i;
      while(x > 0) {
        vector<int> tmp(n);
        if (x & 1) {
          rep(i, n) {
            tmp[i] = a[res[i]];
          }
          swap(tmp, res);
        }
        rep(i, n) {
          debug(i, a[i]);
          tmp[i] = a[a[i]];
        }
        swap(tmp, a);
        x >>= 1;
      }
      return res;
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, k; cin >> n >> k;
      vector<int> a(n);
      rep(i, n) {
        cin >> a[i];
        a[i]--;
      }

      auto ret = mod_pow(a, k);
      cout << ret[0]+1 << endl;

    }
};

signed main() {
  DTeleporter solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 6404
#include<iostream>
#include<algorithm>
#include<cstdint>

int64_t gcd(int64_t a, int64_t b) {
  int64_t r = a%b;
  while(r){ a=b; b=r; r=a%b; }
  return b;
}

int64_t floor_div(int64_t x, int64_t y) {
  int64_t res = x/y, rem = x%y; // res*y+rem == x and abs(rem)<abs(y) by spec
  if((rem < 0) != (y < 0)) --res;
  return res;
}

bool solve() {
  int64_t A, B, C, D; std::cin >> A >> B >> C >> D;
  if(A < B) return false;
  if(D < B) return false;
  if(C-B+1 >= 0) return true;
  int64_t q = gcd(D, B);
  int64_t r = A%q;
  // min next morning:
  int64_t x = floor_div(C-r, q) + 1;
  return q*x+r >= B;
}

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int T; std::cin >> T;
  for(int i = 0; i < T; ++i) std::cout << (solve()? "Yes\n": "No\n");
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define INF 100000000

int min(int a,int b){
  if(a<b){
    return a;
  }else{
    return b;
  }
}

int main(){
  int n,i,j,k,l;
  int chain[MAX][MAX],matrix[MAX];

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d",&matrix[i-1],&matrix[i]);
    chain[i][i] = 0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = i+l-1;
      chain[i][j] = INF;
      for(k=i;k<=j-1;k++){
	chain[i][j] = min(chain[i][j],chain[i][k]+chain[k+1][j]+matrix[i-1]*matrix[k]*matrix[j]);
      }
    }
  }
  printf("%d\n",chain[1][n]);

  return 0;
}



Measured memory_bytes: 2108
use text_io::*;
use std::process::exit;

fn main(){
    let mut a:isize = read!();
    let mut b:isize = read!();
    let mut c:isize = read!();
    let mut d:isize = read!();
    for i in 0..1000 {
        c -= b;
        if c <= 0 {
            println!("Yes");
            exit(0);
        }
        a -= d;
        if a <= 0 {
            println!("No");
            exit(0);
        }
    }
}

Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
int n,k;
 
int main() {
	// your code goes here
    cin>>n>>k;
    int h[n+1];
    int dp[n+1]={0};
    for(int i=1; i<=n;++i)
        cin>>h[i];
    dp[1]=0;
    dp[2]= abs(h[2]-h[1]);
    for(int i=3;i<=n;++i)
    {   dp[i]=1000000001; //highest value
        for(int j =1;i-j>=1 && j<=k;++j)
            {   
                dp[i]= min( abs(h[i]-h[i-j])+dp[i-j],  dp[i]);
                
            }
            
    }
    cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    
    int i_max, a_max, i_min, a_min;
    a_max = INT_MIN;
    a_min = INT_MAX;
    for ( int i = 0; i < N; i++ ) {
        int a;
        cin >> a;
        if ( a_max < a ) {
            a_max =  a;
            i_max = i;
        }
        if ( a_min > a ) {
            a_min =  a;
            i_min = i;
        }
    }
    cout << 2*N-1 << endl;
    
    int x = abs( a_min ) > abs( a_max ) ? i_min+1 : i_max+1;
    
    for ( int i = 0; i < N; i++ ) {
        cout << x << " " << i+1 << endl;
    }
    
    if ( abs( a_min ) > abs( a_max ) ) {
        for ( int i = N; i >= 2; i-- ) {
            cout << i << " " <<  i-1 << endl;
        }
    }
    else {
        for ( int i = 1; i <= N-1; i++ ) {
            cout << i << " " <<  i+1 << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define printArr(harry, tam) range(tam) cout << harry[i] << " \n"[i == tam -1];
#define range(n) for(int i = 0; i < n; i++)
#define maxn 100000
#define mod 1000000007
#define md(x) ((((x) % mod) + mod) % mod)
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EPS 1e-9
#define INF INT_MAX
#define INFd 1e9

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

//Trace dinamico
template<typename T>
void trace(T a) { cout << a << "\n"; }
template<typename T, typename... Args>
void trace(T a, Args... args) { cout << a << " "; trace(args...); }

//DP debug
int recNum = 0;
void prTabs() { range(recNum) cout << "    "; }
template<typename... Args>
void recInit(Args... args) { prTabs(); trace("rec(", args..., ")"); recNum++; }
template<typename T>
void recEnd(T a) { prTabs(); trace("->", a); recNum--;}
int n, m, a, b, c;

int main(){
	char ch = getchar();
	int n = 0;
	int res1 = 0;
	int res2 = 0;
	while(ch != '\n') {
		//trace(ch, res1, res2);
		if (n & 1) {
			if(ch == '0') res1++;
			else res2++;
		} else {
			if(ch == '0') res2++;
			else res1++;
		}
		//trace(ch, res1, res2);
		n++;
		ch = getchar();
	}
	pr("%d\n", min(res1, res2));
 	return 0;
}


Measured memory_bytes: 256
import bisect

n = int(input())
a_list = sorted(list(map(int, input().split())))

a_i = a_list.pop()

half = a_i / 2

if len(a_list) == 1:
  print(*[a_i, a_list[0]])
  exit()
  
left_index = bisect.bisect_left(a_list, half)

if left_index >= 1:
  if a_list[left_index] - half < half - a_list[left_index-1]:
    print(*[a_i, a_list[left_index]])
  else:
    print(*[a_i, a_list[left_index-1]])
if left_index == 0:
  print(*[a_i, a_list[left_index]])

      

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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod=1e9+7;
const ll INF=1e18;
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll n,ans=0; cin >>n;
	for (int i=1;i<=n;i++) {
		if (i%3 && i%5) ans+=i;
	}
	cout <<ans;
	return 0;
}
/******************************************************************************
1000000
266666333332

266666333332
******************************************************************************/


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

double EPS = 1e-10;
double PI = 3.141592653589793238462643383279;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
};

struct circle{
  point p;
  double r;
};

double vec_abs(point a){
  return sqrt(a.x*a.x+a.y*a.y);
}

double dist(point a,point b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

double distance_ls_p(point a, point b, point c) {
    if ( dot(b-a, c-a) < EPS ) return vec_abs(c-a);
    if ( dot(a-b, c-b) < EPS ) return vec_abs(c-b);
  return abs(cross(b-a, c-a)) / vec_abs(b-a);
}
int crossCS(point a, point b, circle c){
  double res=distance_ls_p(a,b,c.p);
  double ac=dist(a,c.p);
  double bc=dist(b,c.p);

  if(res>c.r || (ac<c.r && bc<c.r))return 0;
  else if(c.r-res<EPS ||(ac<c.r && bc>=c.r)||(ac>=c.r && bc<c.r))return 1;
  else return 2;
}

int main(void){
  int n,m;
  circle c[100];
  point t,s;

  while(cin >> n,n){
    for(int i=0;i<n;i++)
      cin >> c[i].p.x >> c[i].p.y >> c[i].r;
    
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> t.x >> t.y >> s.x >> s.y;

      int fg=0;
      for(int j=0;j<n;j++){
	fg+=crossCS(t,s,c[j]);
      }
      if(fg==0)cout << "Danger" << endl;
      else cout << "Safe" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
// typedef
typedef long long ll;
typedef long double ldbl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
 
// container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
// repetition
#define FOR(i,m,n) for (ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for (ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)
 
// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl
 
// constant
const double PI  = acos(-1.0);
const int    MOD = (int)(1e9 + 7);
// DO NOT set INFTY_XXXs constants. They may bring some BUG! Use MAX_XXXs in climit instead.
 
// clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
// debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

int main() {
    int n, k; cin >> n >> k;
    vector<int> snack(n);
    for(int i = 0; i < k; i++) {
        int d; cin >> d;
        for (int j = 0; j < d; j++) {
            int a; cin >> a;
            snack[a-1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (snack[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
// Garg's Code
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i,x,n) for(ll i = x; i >= x; i--) 
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const ll MAX = LLONG_MAX, mod = 1000000007, MODA = 1e9 - 1;
const ll MIN = LLONG_MIN;
const long double PI = 3.1415926535;
const ll N = 400009;

int main()
{
  fast();
  
  ll n;
  cin >> n;
  ll ans = 0, itr = 0;
  while(n != 0)
  {
    n /= 2;
    ans += pow(2, itr);
    itr++;
  }
  cout << ans;
  return 0;
}

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

const int N = 100010, mod = 1e9 + 7;

int sum[N << 2];

inline void Inc(int &x, int y) {
	x += y, x -= x >= mod ? mod : 0;
}

void update(int rt, int l, int r, int x, int y) {
	Inc(sum[rt], y);
	if (l == r) return;
	int mid = (l + r) >> 1;
	if (x <= mid) update(rt << 1, l, mid, x, y);
	else update(rt << 1 | 1, mid + 1, r, x, y);
} 

int query(int rt, int l, int r, int start, int end) {
	if (start <= l && r <= end) return sum[rt];
	int res = 0, mid = (l + r) >> 1;
	if (start <= mid) Inc(res, query(rt << 1, l, mid, start, end));
	if (end > mid) Inc(res, query(rt << 1 | 1, mid + 1, r, start, end));
	return res;
}

int x[N], y[N], val[N], tot;

struct Point {
	int x, y;
} p[N];

int main() {
	int n, m; scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
	for (int i = 1; i <= m; i++) scanf("%d", &y[i]);
	sort(y + 1, y + m + 1); int all = 0;
	for (int i = 1; i <= n; i++) {
		int a = lower_bound(y + 1, y + m + 1, x[i]) - y;
		if (a > m || a == 1) continue;
		p[++all] = (Point){x[i] - y[a - 1], y[a] - x[i]}, val[++tot] = y[a] - x[i];
	}
	sort(val + 1, val + tot + 1), tot = unique(val + 1, val + tot + 1) - val - 1; 
	sort(p + 1, p + all + 1, [](Point a, Point b){
		if (a.x == b.x) return a.y > b.y;
		return a.x < b.x;
	});
	update(1, 0, tot, 0, 1);
	for (int i = 1; i <= all; i++) {
		p[i].y = lower_bound(val + 1, val + tot + 1, p[i].y) - val;
		if (i && p[i].x == p[i - 1].x && p[i].y == p[i - 1].y) continue;
		update(1, 0, tot, p[i].y, query(1, 0, tot, 0, p[i].y - 1));
	}
	printf("%d\n", query(1, 0, tot, 0, tot));
}

Measured memory_bytes: 2816
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		FastScanner fs = new FastScanner();
		int A = fs.nextInt();
		int B = fs.nextInt();
		int C = fs.nextInt();
		int D = fs.nextInt();

		for(int i = 0; ; i++) {
			if(i % 2 != 0) {
				A = A - D;
				if(A <= 0 ) {
					System.out.println("No");
					break;
				}
			}else {
				C = C - B;
				if(C <= 0 ) {
					System.out.println("Yes");
					break;
				}
			}
		}
	}

}


Measured memory_bytes: 25348
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

string s;

string Replace( string s1, string s2, string s3 )
{
    string :: size_type  pos( s1.find( s2 ) );
    while( pos != string :: npos )
    {
        s1.replace( pos, s2.size(), s3 );
        pos = s1.find( s2, pos + s3.size() );
    }
    return s1;
}

signed main()
{
    int n = 0;
    scanf( "%d\n", &n );
    while( 0 < n )
    {
        getline( cin, s );
        s = Replace( s, "Hoshino", "Hoshina" );
        cout << s << endl;
        n--;
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }

    int num = 1;
    int ans = 0;
    for(int a : A){
        if(a == num){
            num++;
        }
        else{
            ans++;
        }
    }
    if(ans == A.size()){
        ans = -1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int a,b,c=0;
	scanf("%d%d",&a,&b);
	if(a>=3 && b>=3)
	{
	if(a>b)
	{
		c=c+a;
		if(a-1>=b)
		{
			c=c+(a-1);
		}
		if(b>a-1)
		{
			c=c+b;
		}
	}
	
	if(b>a)
	{
		c=c+b;
		if(b-1>=a)
		{
			c=c+(b-1);
		}
		if(a>b-1)
		{
			c=c+a;
		}
	}
	if(a==b)
	{
		c= 2*a;
	}
}
	printf("%d",c);
	return 0;
	
	
	
}

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

int main()
{
 	int N;
  	char S[100];
	std::cin >> N;
  	std::cin >> S;
  
  	if (N%2 != 0)
      	std::cout << "No" << std::endl;
    else {
  
  	bool flag = true;
  	for (int i=0;i<N/2;i++) {
     	if (S[i] != S[i+N/2]) {
          flag = false; 
          break;
        }
    }
  
    if (flag)
    	std::cout << "Yes" << std::endl;
    else
       	std::cout << "No" << std::endl;
    }
  
 	return 0;
}


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

int main(){
  int L , N ;
  cin >> N  >> L;
  string s[N];

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

  sort(s , s + N);

  for(int i = 0; i < N ; ++i){
    cout << s[i];
  }
  cout << "\n";
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,N,M,K,Q,x,ans;
  cin>>K>>Q;
  vec d(K),md(K+1),zsum(K+1);
  md[0]=zsum[0]=0;
  rep(i,K)cin>>d[i];
  while (Q--){
    cin>>N>>x>>M;
    x%=M;
    rep(i,K){
      md[i+1]=md[i]+d[i]%M;
      zsum[i+1]=zsum[i]+(d[i]%M==0);
    }
    ans=--N;
    x+=N/K*md[K]+md[N%K];
    ans-=x/M+N/K*zsum[K]+zsum[N%K];
    print(ans);
  }
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include<algorithm>

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

using namespace std;

int main()
{
    int x, y,a,b,c;
    cin >> x >> y >> a >>b >>c;

    int p[a],q[b],r[c];

    rep(i,0,a-1) cin >> p[i];
    rep(i,0,b-1) cin >> q[i];
    rep(i,0,c-1) cin >> r[i];
    
    sort(p,p+sizeof(p)/sizeof(int),greater<>());
    sort(q,q+sizeof(q)/sizeof(int),greater<>());
    sort(r,r+sizeof(r)/sizeof(int),greater<>());

    int ans[x+y];
    rep(i,0,x-1) ans[i]=p[i];
    rep(i,x,x+y-1) ans[i]=q[i-x];
    sort(ans,ans+sizeof(ans)/sizeof(int));

    int idx=0;
    rep(i,0,x+y-1)
    {
        if (ans[i]<r[idx])
        {
            ans[i] = r[idx];
            idx++;
        }

        if(idx>=c) break;
        
    }

    long long total = 0;
    rep(i,0,x+y-1) total+=ans[i];

    cout << total << endl;

    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long LL;
typedef unsigned long long ULL;
const LL LINF = 0x3f3f3f3f3f3f3f3f; 
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int mod = 1e9+7;
const ULL P = 131;
const int N = 2e5+7;

int a[N];

int main()
{
	ULL k;
	cin>>k;
	ULL ans = 100;
	for(int i=1;i<=1e6;i++){
		ans = ans * 1.01;
		if(ans>=k){
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;

    if (a == 0 || b == 0 || (a < 0 && b > 0)) {
        cout << "Zero" << endl;
        return 0;
    }

    if (a > 0) {
        cout << "Positive" << endl;
        return 0;
    }

    cout << ((b - a) % 2 == 0 ? "Negative" : "Positive") << endl;
}


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

int main() {
  ll n; cin >> n;
  for(ll i = n; i < 1000; i++){
    string S = to_string(i);
    if(S[0] == S[1] && S[1] == S[2]){
      cout << S;
      return 0;
    }
  }
}

Measured memory_bytes: 3696
dict = {}
q = int(input())
for i in range(q):
    a = list(input().split())
    if a[0] =="0":
        dict[a[1]] =int(a[2])
    elif a[0] =="1":
        print(dict[a[1]] if a[1] in dict else 0)
    else:
        if a[1] in dict: dict[a[1]] =0


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

using namespace std;

int main(){
  int A;
  int B;
  int C;
  int N;
  int M;
  cin >> A >> B;
  int sa = B- A;
  int i = 0;
  int sum = 0;
  for(i = 1 ; i < sa ; i++)
   sum += i;
  int ans = sum-A;
  cout << ans << endl;
}


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

using namespace std;

int main(int argc, char* argv[])
{
  int A, B; cin >> A >> B;

  int cnt = 0;
  for (int i = A; i <= B; i++) {
    if (i/1000 == (i%100)/10+((i%100)%10)*10) {
      cnt++;
    }
  }
  
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

// ll modexp(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;
// }

// ll mulmod(ll a, ll b)
// {
// return ((a % mod) * (b % mod)) % mod;
// }

// ll sub_mod(ll a, ll b, ll m){
//    if (a >= b)
//        return a - b;
//    else
//        return m - b + a;
// }

// ll add_mod(ll a, ll b){
//    if (0 == b)
//        return a;

//    b = mod - b;
//    if (a >= b)
//        return a - b;
//    else
//        return mod - b + a;
// }

// ll gcd(ll a, ll b)
// {
// if (a == 0)
// return b;
// else
// return gcd(b % a, a);
// }

// ll modInv(ll a)
// {
//     ll g = gcd(a, mod);
//     if (g != 1)
//         return -1;
//     else
//         return modexp(a, mod-2, mod);
// }


int main()
{
fastio;
//#ifndef ONLINE_JUDGE  
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
//#endif
ll n = 0;
cin >> n;
ll s = 0;
ll tn = n;
while (n)
{
s += n % 10;
n /= 10;
}

if (tn % s==0)
cout << "Yes\n";
else
cout << "No\n";


}


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

int main() {
    int N, S;
    while (cin >> N >> S, N || S) {
        vector<int> d(N);
        for (auto& i : d) cin >> i;
        sort(d.begin(), d.end());

        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sub = S - d[i] + 1;
            if (sub <= d[i]) ans += N - 1 - i;
            else {
                int c = lower_bound(d.begin(), d.end(), sub) - d.begin();
                ans += N - c;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

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

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a  
  
n = int(input())
A = list(map(int,input().split()))

p = A[0]
for a in A[1:]:
  p = gcd(a,p)

primes = [0]*(10**6+2)
primes[1] = 1

for a in A:
  B = set(prime_factorize(a))
  for b in B:
    primes[b]+=1
  
  
if p == 1:
  if max(primes)==1:
    print('pairwise coprime')
  else:
    print('setwise coprime')
else:
  print('not coprime')

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  string S;
  IN(S);
  if(S=="AAA" || S=="BBB"){
    OUT("No");
  }else{
    OUT("Yes");
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	cout << (a-1) * (b-1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 1000005
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef map<ll, ll> Map;

int main(void) {
    ll N;
    cin >> N;
    ll i;
    ll a[200001];
    ll order[200001];
    set<ll> st;
    st.insert(-1);
    st.insert(N);
    
    for(i=0; i<N; i++) {
        cin >> a[i];
        order[a[i]-1]=i;
    }
    
    ll left, right;
    ll ans=0;
    for(i=0; i<N; i++) {
        set<ll>::iterator itr=st.lower_bound(order[i]);
        left=order[i]-(*itr);
        itr--;
        right=(*itr)-order[i];
        ans+=(i+1)*left*right;
        
        st.insert(order[i]);
        
    }
    
    prin(ans);
}

Measured memory_bytes: 12800
// ABC095A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
using namespace std;
int main()
{
	string S;
	cin >> S;
	int amount=700;
	string o, x;
	if (S[0] == 'o') amount += 100;
	if (S[1] == 'o') amount += 100;
	if (S[2] == 'o') amount += 100;
	cout << amount << endl;
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

int main() {

  long long h, n;
  cin >> h >> n;
  vector<int> a(n);
  int tmp = 0;

  for (int i = 0; i < n; i++) { 
    cin >>a.at(i);
    tmp = tmp + a.at(i);
  }
  if(h - tmp <= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

  

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


int main() {
	string S,T;
	cin >> S;
	reverse(S.begin(),S.end());

	vector<string> str{ "maerd","remaerd","esare","resare" };

	for (int i = 0; i < S.length(); i++) {
		if (S[i] == 'm') {
			T+= str[0];
			i += 4;
		}
		else if (S[i] == 'e') {
			T += str[2];
			i += 4;
		}
		else if (S[i] == 'r' && (i+2)<=S.length()) {
			if (S[i + 2] == 'm') {
				T += str[1];
				i += 6;
			}
			else if (S[i + 2] == 's') {
				T += str[3];
				i += 5;
			}
		}
	}

	if (S == T) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

}

Measured memory_bytes: 640
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        int A = Integer.parseInt (arr[0]);
        int B = Integer.parseInt (arr[1]);
        int K = Integer.parseInt (arr[3]);
        if (K <= A)
            System.out.println (K);
        else if (K <= A + B)
            System.out.println (A);
        else
            System.out.println (A - (K - A - B));
        return;
    }
}

Measured memory_bytes: 32400
if __name__ == '__main__':
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort(reverse=True)
    ans = 0
    count = 0
    for i in a:
        if ans ==0:
            ans+=i
            count+=1
        else:
            if count == n-2:
                ans+=i
                break
            elif count == n-3:
                ans+=i*2
                break
            else:
                ans+=i*2
                count+=2

    if n ==2:
        ans= max(a)

    print(ans)



Measured memory_bytes: 31544
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][][] count = new int[4][3][10];

        for (int m=0; m<n; m++) {
            int b = scanner.nextInt();
            int f = scanner.nextInt();
            int r = scanner.nextInt();
            int v = scanner.nextInt();
            count[b-1][f-1][r-1] += v;
        }
        for (int b=0; b<4; b++){
            for (int f=0; f<3; f++){
                StringBuilder sb = new StringBuilder();
                for (int r=0; r<10; r++){
                    sb.append(" " + count[b][f][r]);
                }
                System.out.println(sb);
            }
            if (b != 3) System.out.println("####################");
        }
    }
}



Measured memory_bytes: 29316
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

namespace
{
	ll GCD(ll a, ll b)
	{
		return a == 0 ? b : GCD(b % a, a);
	}


	ll LCM(ll a, ll b)
	{
		return a * b / GCD(a, b);
	}
}

void AGC018A()
{
	int N, K;
	cin >> N >> K;
	int a;
	cin >> a;
	int gcd = a;
	int maxa = a;
	if (a == K)
	{
		cout << "POSSIBLE" << endl;
		return;
	}
	for (int i = 1; i < N; ++i)
	{
		cin >> a;
		gcd = GCD(gcd, a);
		maxa = max(a, maxa);
		if (K % gcd == 0 && K <= maxa)
		{
			cout << "POSSIBLE" << endl;
			return;
		}
	}
	cout << "IMPOSSIBLE" << endl;
}
int main()
{
	AGC018A();
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split(" "))
S = input()

alp = S[K-1]
if alp == "A":
  print(S[:K-1] + "a" + S[K:])
elif alp == "B":
  print(S[:K-1] + "b" + S[K:])
else:
  print(S[:K-1] + "c" + S[K:])
  

Measured memory_bytes: 3060
import * as fs from 'fs'

const input = (fs.readFileSync('/dev/stdin', 'utf8') as string).split('\n')
const k = +input[0]
const a = +input[1].split(' ')[0]
const b = +input[1].split(' ')[1]

let result = 'NG'

for (let i = 0; i < 1000; i++) {
  if (a <= i * k && i * k <= b && result === 'NG') {
    result = 'OK'
  }
}

console.log(result)


Measured memory_bytes: 29632
#include <bits/stdc++.h>
#include<set>
#define ll long long 
#include <string>
#define pb push_back
#define mp make_pair
# define pi 3.14159265358979323846
using namespace std;
int main()
{
	ll int n;
	cin>>n;
	ll int a[n],i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n,greater<ll int>());
	ll int s=0;
	s+=a[0];
	ll int d=n/2-1;
	for(i=1;i<=d;i++)
	s+=2*a[i];
	if (n%2!=0)
	s+=a[n/2];
	cout<<s<<endl;
	
	
}
	
		
	
	
	
	



Measured memory_bytes: 5192
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main() {
	ll n; cin >> n;
	// f: 値 a が
	// s: index i に存在する
	map<ll, ll> place;
	set<ll> used = {-1, 0, n+1, n+2};
	for( int i = 1; i <= n; ++i ){
		int a; cin >> a;
		place[a] = i;
	}
	ll ans = 0;
	for ( ll i = n; i >= 1; --i) {
        ll l, r, exl, exr;
        auto itr = used.lower_bound(place[i]);
        ++itr; exr = *itr;
		--itr; r = *itr;
        --itr; l = *itr;
		--itr; exl = *itr;
		ll a = l-exl;
		ll b = place[i]-l;
		ll c = r-place[i];
		ll d = exr-r;
		if( l == 0 ) a = 0;
		if( r == n+1 ) d = 0; 
		// cout << exl << ' ' << l << ' ' << r << ' ' << exr << endl;
		// cout << a << ' ' << b << ' ' << c << ' ' << d << endl;
		ans += i*(a*c+b*d);
		// cout << i*(a*c+b*d) << endl;
        used.insert(place[i]);
    }
	cout << ans << endl;
}

Measured memory_bytes: 11136
mod = 998244353
n=int(input())
d=[int(i) for i in input().split()]
ans=[0]*n
for i in d:
    ans[i]+=1
f=mod
for i in ans:
    if f==0 and i>0:
        print(0)
        exit()
    f=min(f,i)
if d.count(0)!=1 or d[0]!=0:
    print(0)
    exit()
cnt=1
for i in range(1,n):
    if ans[i-1]==0:
        break
    cnt=cnt*pow(ans[i-1],ans[i],mod)%mod

print(cnt%mod)

Measured memory_bytes: 53556
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

signed main() {
    int x;
    cin >> x;

    int a = x / 500;
    int y = x - a * 500;
    int b = y / 5;
    cout << a * 1000 + b * 5 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a, b, ans;
int main()
{
    cin >> a >> b;
    if (a > b)
    {
        ans += a;
        a--;
    }
    else
    {
        ans += b;
        b--;
    }
    cout << ans + max(a, b) << endl;
    return 0;
}

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


class Date {
  public:
    Date (int y, int m, int d) : y(y), m(m), d(d) {};
    int y, m, d;
    void next ();
};

void Date::next () {

  // ?????´????????¨???
  if (y % 3 == 0) {

    // ??????
    if (d == 20) {

      // ??´???
      if (m == 10) {
        y ++;
        m = 1;
        d = 1;
      }

      // ??´?????\???
      else {
        m ++;
        d = 1;
      }
    }

    // ????????\???
    else {
      d ++;
    }
  }

  // ?????´??\???
  else {

    // ??§??????
    if (m % 2 == 1) {
      // ??????
      if (d == 20) {
        m ++;
        d = 1;
      }
      else {
        d ++;
      }
    }
    // ?°???????
    else {
      // ??????
      if (d == 19) {
        // ??´???
        if (m == 10) {
          y ++;
          m = 1;
          d = 1;
        }
        // ??´?????\???
        else {
          m ++;
          d = 1;
        }
      }
      // ????????\???
      else {
        d ++;
      }
    }
  }
}

int main() {
  int n, y, m, d;
  cin >> n;

  rep (i, n) {
    cin >> y >> m >> d;
    Date date = Date(y, m, d);
    int ans = 0;
    while (!(date.y == 1000 && date.m == 1 && date.d == 1)) {
      date.next();
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3036
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n = 0;
	long long s = 0;
	int a[10001];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		s += a[i];
	}
	sort(a, a + n);
	cout << a[0] << " " << a[n - 1] << " " << s << endl;
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int  i,j,k,l,r,x,y; string s;
    bool exit = false;
    ll a,b;
    cin>>a>>b;
    int c = b - a;
    ll sum=0;
    FOR(i,c){
        sum += i;
    }
    cout<<sum-a<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef list<ll> listl;
typedef string str;

#define min(A, B) min(static_cast<ll>(A), static_cast<ll>(B))
#define max(A, B) max(static_cast<ll>(A), static_cast<ll>(B))

void in(ll& I)
{
	cin >> I;
}

void in(vl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(listl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(str& s)
{
	cin >> s;
}

void out(ll& O)
{
	cout << O;
}

void out(ll O)
{
	cout << O;
}

void out(vl& O)
{
	for (auto& o : O)
	{
		cout << o;
	}
}

struct LIST
{
	string s;
	ll	n;

	bool operator<(const LIST& r) const
	{
		return this->s < r.s;
	}
};

bool cmp(const LIST& a, const LIST& b)
{
	if (a.s < b.s)return true;
	else if (a.s == b.s)
	{
		return(a.n / 100 > b.n / 100);
	}
	return false;
}

int main()
{
	ll N;

	in(N);

	vector<string> S(N);
	vl P(N);

	for (int i = 0; i < N; i++)
	{
		in(S[i]);
		in(P[i]);
	}

	for (int i = 0; i < N; i++)
	{
		P[i] = P[i] * 100 + i;
	}

	list<LIST> L;

	for (int i = 0; i < N; i++)
	{
		LIST l;
		l.s = S[i];
		l.n = P[i];
		L.push_back(l);
	}

	L.sort(cmp);

	for (auto itr = L.begin(); itr != L.end();)
	{
		out(((*itr).n % 100)+1);
		itr++;
		if (itr == L.end())break;
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;

map<ll, vector<ll>> M;
map<ll, ll> arr;
set<ll> S;

void solve() {
	S = set<ll>();
	arr = map<ll, ll>();
	ll N, A, B, C, D, e, f;
	cin >> N >> A >> B >> C >> D;
	S.insert(0);
	S.insert(N);
	arr.insert({ 0,LLONG_MAX / 3 });
	arr.insert({ N, 0 });

	while (!arr.empty()) {
		auto al = S.end();
		al--;
		f = *al;
		e = arr[f];

		if (f % 2 == 0) {
			if (arr.count(f / 2)) {
				if (arr[f / 2] > e + A) {
					arr[f / 2] = e + A;
				}
			}
			else {
				arr.insert({ f / 2,e + A });
				S.insert(f / 2);
			}
		}
		else {
			if (arr.count(f / 2)) {
				if (arr[f / 2] > e + A + D) {
					arr[f / 2] = e + A + D;
				}
			}
			else {
				arr.insert({ f / 2,e + A + D });
				S.insert(f / 2);
			}

			if (arr.count(f / 2 + 1)) {
				if (arr[f / 2 + 1] > e + A + D) {
					arr[f / 2 + 1] = e + A + D;
				}
			}
			else {
				arr.insert({ f / 2 + 1,e + A + D });
				S.insert(f / 2 + 1);
			}
		}


		if (f % 3 == 0) {
			if (arr.count(f / 3)) {
				if (arr[f / 3] > e + B) {
					arr[f / 3] = e + B;
				}
			}
			else {
				arr.insert({ f / 3,e + B });
				S.insert(f / 3);
			}
		}
		else {
			if (arr.count(f / 3)) {
				if (arr[f / 3] > e + B + D * (f % 3)) {
					arr[f / 3] = e + B + D * (f % 3);
				}
			}
			else {
				arr.insert({ f / 3,e + B + D * (f % 3) });
				S.insert(f / 3);
			}

			if (arr.count(f / 3 + 1)) {
				if (arr[f / 3 + 1] > e + B + D * (3 - f % 3)) {
					arr[f / 3 + 1] = e + B + D * (3 - f % 3);
				}
			}
			else {
				arr.insert({ f / 3 + 1,e + B + D * (3 - f % 3) });
				S.insert(f / 3 + 1);
			}
		}
		
		if (f % 5 == 0) {
			if (arr.count(f / 5)) {
				if (arr[f / 5] > e + C) {
					arr[f / 5] = e + C;
				}
			}
			else {
				arr.insert({ f / 5,e + C });
				S.insert(f / 5);
			}
		}
		else {
			if (arr.count(f / 5)) {
				if (arr[f / 5] > e + C + D * (f % 5)) {
					arr[f / 5] = e + C + D * (f % 5);
				}
			}
			else {
				arr.insert({ f / 5,e + C + D * (f % 5) });
				S.insert(f / 5);
			}

			if (arr.count(f / 5 + 1)) {
				if (arr[f / 5 + 1] > e + C + D * (5 - f % 5)) {
					arr[f / 5 + 1] = e + C + D * (5 - f % 5);
				}
			}
			else {
				arr.insert({ f / 5 + 1,e + C + D * (5 - f % 5) });
				S.insert(f / 5 + 1);
			}
		}

		if (f < LLONG_MAX / 2 / D) {
			if (arr[0] > e + D * f)arr[0] = e + D * f;
		}

		S.erase(al);

		if (f == 1)break;
	}
	cout << arr[0] << endl;
}

int main() {
	ll T;
	cin >> T;
	for (int i = 0;i < T;i++) {
		solve();
	}
}

Measured memory_bytes: 4516
#include<bits/stdc++.h>
using namespace std;
typedef vector<int>V;
int main(void){
	int n;
	int i;
	V v;
	cin>>n;
	for(i=0;i<n;i++)	v.push_back(i+1);
	for(i=0;i<(int)v.size();i++){
		if(i)	cout<<" ";
		cout<<v[i];
	}
	cout<<endl;
	while(1){
		if(!next_permutation(v.begin(),v.end()))	break;
		for(i=0;i<(int)v.size();i++){
			if(i)	cout<<" ";
			cout<<v[i];
		}
		cout<<endl;
	}
	return 0;
}


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

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

    vector<vector<ll>> dp(3005, vector<ll>(3005));

    for(int l=n-1;l>=0;l--){
        for(int r=l;r<n;r++){
            if(l==r){
                dp[l][r]=a[l];
            }else{
                dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
            }
        }
    }

    cout << dp[0][n - 1] << endl;
}

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

    // while(n--)
    solve();

    return 0;
}

Measured memory_bytes: 71040