akhauriyash/Code-Regression huggingface dataset:
a = raw_input()
print a.replace("a","A").replace("b","B").replace("c","C").replace("d","D").replace("e","E").replace("f","F").replace("g","G").replace("h","H").replace("i","I").replace("j","J").replace("k","K").replace("l","L").replace("n","N").replace("m","M").replace("o","O").replace("p","P").replace("q","Q").replace("r","R").replace("s","S").replace("t","T").replace("u","U").replace("v","V").replace("w","W").replace("x","X").replace("y","Y").replace("z","Z")

Measured memory_bytes: 4232
fn main() {
    let mut sc = Scanner::new();
    let k: usize = sc.read();
    let n = 50;
    let mut p = vec![0; n];
    for i in 0..n {
        p[i] = k / n;
    }
    for i in 0..(k % n) {
        p[i] += 1;
    }

    let mut a = vec![0; n];
    for i in 0..n {
        a[i] = n - 1 + (n + 1) * p[i] - k;
        assert!(a[i] <= 10_000_000_000_001_000);
    }

    println!("{}", n);
    for i in 0..n {
        print!("{} ", a[i]);
    }
    println!("");
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
typedef long long ll;

int xs[105];
int ys[105];
ll hs[105];

int main(void) {
  int n;
  cin >> n;
  REP(i, n) {
    cin >> xs[i] >> ys[i] >> hs[i];
  }
  for(int cx = 0; cx <= 100; ++cx) {
    for(int cy = 0; cy <= 100; ++cy) {
      ll h = -1;
      REP(i, n) {
        ll th = abs(xs[i] - cx) + abs(ys[i] - cy) + hs[i];
        if(hs[i] == 0) {
          continue;
        } else {
          if(h == -1) {
            h = th;
          } else if(h != th) {
            h = -2;
            break;
          }
        }
      }
      
      if(h >= 1) {
        bool ok = true;
        REP(i, n) {
          ll th = max(h - abs(xs[i] - cx) - abs(ys[i] - cy), 0LL);
          if(th != hs[i]) {
            ok = false;
            break;
          }
        }
        if(ok) {
          cout << cx << " " << cy << " " << h << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import Control.Arrow (second)
import Data.List (foldl')
import qualified Data.Set as S
import qualified Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as B

solve :: B.ByteString -> Int -> B.ByteString
solve s k = S.toAscList go !! (k-1) where
  go = foldl' go' S.empty [1..k]
  go' arg p = foldl' go'' arg [0..max (B.length s - p) 0] where
    go'' substrs i
      | S.size substrs < k || sub < (S.toAscList substrs) !! (k-1) = S.insert sub substrs
      | otherwise = substrs
      where
        sub = B.take p $ B.drop i s

main = do
  s <- B.getLine
  k <- (fst . (\(Just x) -> x) . B.readInt) <$> B.getLine
  B.putStrLn $ solve s k



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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class DCrossing {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        bool flg = false;
        int x = sqrt(2*n);
        if(x*(x+1) / 2 == n) flg = true;
        if(!flg){
            out << "No" << endl;
            return;
        }
        out << "Yes" << endl;

        int k = x + 1;
        vector<int> s[100010];
        int num = 1;
        int ind = 0;
        rep(i, x){
            rep(j, i+1){
                s[ind].push_back(num);
                s[i+1].push_back(num);
                ind++;
                num++;
            }
            ind = 0;
        }

//        rep(i, 3){
//            cout << i << " ";
//            for(auto const& e : s[i]){
//                cout << e << " ";
//            }
//            cout << endl;
//        }

        out << k << endl;
        rep(i, k){
            out << x << " ";
            rep(j, x){
                out << s[i][j] << " ";
            }
            out << endl;
        }
	}
};


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


Measured memory_bytes: 4608
import Data.List

main :: IO ()
main = do
    [a,b,k] <- map read . words <$> getLine :: IO [Int]
    let g = gcd a b
        c = [ i | i <- [1..g], a `mod` i == 0 && b `mod` i == 0]
    print $ c !! (length c - k)

Measured memory_bytes: 508
#include <iostream>
int main ()
{
    int N,AC=0,WA=0,TLE=0,RE=0;
    std::string S;
    std::cin>>N;   

    for(int i=0;i<N;i++)
    {
        std::cin>>S;
        if(S =="AC")
        {
            AC+=1;
        }
        if(S =="WA")
        {
            WA+=1;
        }
        if(S =="TLE")
        {
            TLE+=1;
        }
        if(S =="RE")
        {
            RE+=1;
        }
    }
    std::cout<<"AC x "<<AC<<std::endl;
    std::cout<<"WA x "<<WA<<std::endl;
    std::cout<<"TLE x "<<TLE<<std::endl;
    std::cout<<"RE x "<<RE<<std::endl;
}

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

using namespace std;
using llong = long long int;

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    queue<pair<string, char> > Q;
    Q.push(make_pair("", 'a'));
    while (true) {
        pair<string, char> p = Q.front();
        if ((int)p.first.size() == n) break;
        Q.pop();
        for (char c = 'a'; c <= p.second; ++c) {
            Q.push(make_pair(p.first + c, (c == p.second) ? (char)(p.second + 1) : p.second));
        }
    }

    while (! Q.empty()) {
        cout << Q.front().first << endl;
        Q.pop();
    }

    return 0;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int n,m;
  cin>>n>>m;

  Int g=n;
  for(Int i=0;i<m;i++){
    Int x;
    cin>>x;
    g=__gcd(g,x);
  }
  
  cout<<(g==1?"Yes":"No")<<endl;
  return 0;
}



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


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

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s < t){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pll > 
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
//#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
set <pll> adj[200002];
set <lli> adj2[200002];
lli mod=1000000007;
lli decpl[100001];
string s;
lli n;
lli dp[100001][13];
lli rec(lli i,lli j){
	//if(i==0)cout<<s<<endl;
	//	for(lli j=0;j<5;j++)cout<<decpl[j]<< " ";
	//}
	//cout<<i<<" "<<j<<endl;
	if(i==n){if(j==0) return 1;else return 0;}
	if(dp[i][j]!=-1)return dp[i][j];
	if(s[i]!='?')return dp[i][j]=(rec(i+1,(j+((s[i]-'0')*(decpl[i]))%13)%13))%mod;
	lli ans=0;
	for(lli jt=0;jt<=9;jt++){ans=(ans%mod+rec(i+1,(j+(jt*decpl[i])%13)%13))%mod;}
	return dp[i][j]=(ans%mod); 
}


int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);
        //lli n;
        //cin>>n;
        //cout<<100%13<<" "<<1000%13;
        decpl[0]=1;
        for(lli i=1;i<100001;i++)decpl[i]=(10*decpl[i-1])%13;
        cin>>s;
        n=s.size();
        for(lli i=0;i<=n;i++)for(lli j=0;j<13;j++)dp[i][j]=-1;
        

    	
    	reverse(s.begin(),s.end());
		cout<<rec(0,8);
        return 0;
}

Measured memory_bytes: 36432
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){
//    cout << fixed << setprecision(10);
    int N, X, Y;
    cin >> N >> X >> Y;
    
    // 1 2 3 4 5 6 7 8 9 (N)
    // 1 1 1 x 2 2 2 y 3
    
    int count2BetweenXY = (Y - X) / 2; // 0, 1, 1, 2, 2, 3, 3, ...
    int isOddBetweenXY = (Y - X) % 2;
    
    vector<int> ans = vector<int>(N, 0);
    // group 1
    for (int i = X - 1; i > 0; i--) { // i is steps to X
        // inside group 1
        ans[X-i] += i - 1;
        
        // between group 2
        for (int j = 0; j <= count2BetweenXY; j++) {
            ans[i + j] += 2;
        }
        ans[i] --;
        ans[i + count2BetweenXY + 1] += isOddBetweenXY;

        // over group 3
        for (int j = 1; j <= N - Y; j++) {
            ans[i+j+1] ++;
        }
    }
    
//    for (int i = 1; i < N; i++) {
//        cout << ans[i] << endl;
//    }
    
    // group 2
    for (int i = 0; i < count2BetweenXY; i++) {
        // inside group 2
        ans[i + 1] += Y - X + 1;
    }
    ans[count2BetweenXY + 1] += isOddBetweenXY * (Y - X + 1) / 2;
    // group 2
    for (int i = X; i <= Y; i++) {
        // over group 3
        // steps to Y
        int stepToY = min(i - X + 1, Y - i);
        for (int j = 1; j <= N - Y; j++) {
            ans[j+stepToY] ++;
        }
    }

//    for (int i = 1; i < N; i++) {
//        cout << ans[i] << endl;
//    }

    // group 3
    X = N - Y + 1;
    for (int i = X - 1; i > 0; i--) { // i is steps to X
        // inside group 3
        ans[X-i] += i - 1;
    }
    
    for (int i = 1; i < N; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;


void solve(long long N, std::vector<long long> B){
    ll tot = 0;
    vector<ll> A(N);
    A[0] = B[0];
    rep(i,N-1){
        A[i] = min(A[i], B[i]);
        A[i+1] = B[i];
    }

    rep(i,N){
        tot += A[i];
    }
    cout<<tot<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> B(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(B));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int mod = (int)1e9 + 7;

signed main()
{
       int ans = 0;
       int n; cin>>n;
int ar[n];
int sum = 0;
for (int i=0; i<n; ++i)
cin>>ar[i],sum+=ar[i],sum%=mod;

for (int i=0; i<n; ++i)
{
sum-=ar[i];
sum+=mod;
sum%=mod;
ans+=(ar[i]*sum)%mod; 
ans%=mod;
}
cout<< ans <<endl;
}


Measured memory_bytes: 5196
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    # https://qiita.com/drken/items/dc53c683d6de8aeacf5a#dp-%E5%AE%9F%E8%A3%85%E3%81%AE%E9%A0%86%E5%BA%8F
    
    
    INF = 10**10  # INF+INFを計算してもオーバーフローしない範囲で大きく
    
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    # dpテーブル dp[i]:= iに辿りつく最小コスト
    dp = [INF]*N
    """
    初期化の値は，
        最小化問題：INF, 
        最大化問題：-INF（0以上の値しか取らないなら-1, あるいは0でもいいかも)
        数え上げ問題：0
        確率問題：0
        Yes/No判定問題:False
    """
    
    # 初期条件
    dp[0] = 0
    
    # ループ
    for i in range(1,N):
    
        """
        dp[from] の値の更新が完了していればノード from からノード to への緩和を行っていい．貰うdpであれ配るdpであれ．
        両者の違いを意識すべきケースはcf. 
        https://qiita.com/drken/items/ace3142967c4f01d42e9#%E8%B2%B0%E3%81%86-dp-%E3%81%A8%E9%85%8D%E3%82%8B-dp-%E3%81%AE%E6%AF%94%E8%BC%83
    
        # 遷移式がたくさんある場合この中でさらにforループを回したりする cf. https://atcoder.jp/contests/dp/tasks/dp_b
        """
        for j in range(1,K+1):
            if i-j>=0:
                dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]))

        
    
    # 出力
    print(dp[N - 1])
    
    
resolve()

Measured memory_bytes: 52448
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

X = ii()
'''
lim = 10**3

for a in range((-1)*lim, lim+1):
    for b in range((-1)*lim, lim+1):
        if a**5 - b**5 == X:
            print(a, b)
            exit()
'''
i = 0
while True:
    for j in range((-1)*i, i):
        if i**5 - j**5 == X:
            print(i, j)
            exit()
    i += 1

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0)
#define go_t int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define trace2(x, y)         cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)      cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)   cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf = 0x3f3f3f3f3f3f3f3fll;//4x10e18
const int N = 300000 , mod = 1000000007;
vector<int>divs;
void divisors(int n)
{
    for(int i=1;i<=sqrt(n);i++)
    {
        if((n%i)==0)
        {
            divs.push_back(i);
            if((n/i)!=i)
                divs.push_back(n/i);
        }
    }
}
int main()
{
    fastio;
    int n;
    cin>>n;
    int a[n];
    map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mp[a[i]]++;
    }
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        divs.clear();
        divisors(a[i]);
        bool f = true;
        sort(all(divs));
        if(mp[a[i]]>1)
            f = false;
        for(int j=0;j<(divs.size()-1);j++)
        {
            if(mp.count(divs[j]))f = false;
        }
        if(f)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

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

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    if (a > 0) {
        cout << b/x - (a-1)/x << endl;
    }
    else {
        cout << b/x + 1 << endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  int ans=0;
  for(i=1;i<=100000;i++){
    int tmp=upper_bound(all(a),i+1)-lower_bound(all(a),i-1);
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main() {
	int a, b,c;
	cin >> a >> b >> c;
	if (a != 2) {
		if ((b - c) % 2 == 0) {
			cout << "Alice";
		}
		else {
			cout << "Borys";
		}
		return 0;
	}
	cout << "Borys";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vll;
 
#define  ff     first
#define  ss     second
#define  pb     push_back
#define  all(x) (x).begin(), (x).end()
#define  rep(i,a,b) for(int i=a ; i<b ; ++i)
#define  deb(x) cout << #x << " - " << x << "\n";
#define  IOS    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  D2(x)  cout << "[" << #x << ": "; for(auto it:x) cout << it << " "; cout << "]\n"; 
#define  D2p(x)	cout << #x << " ~ [ "; for(auto n: x) cout << n.first << "-" << n.second << " / "; cout << "]" << "\n";
#define  ps(x,y) fixed<<setprecision(y)<<x
 
#define PI 3.141592653589793238462643383279502884L
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 1e5 + 2;

int prime[10000002];
void SieveOfEratosthenes(int n){ 
    memset(prime, -1, sizeof(prime)); 
    prime[1] = 1;
	for (int p=2; p<=n; p++) { 
		if (prime[p] == -1) {
		   for (int i=p; i<=n; i += p) 
			if(prime[i]==-1) prime[i] = p;    
		} 
	} 
} 

int main(){ 
    IOS;
    SieveOfEratosthenes(10000001);
    int n; cin >> n;
    ll sum = 0,pro,cnt,y;
    for(int i=1;i<=n;++i){
        int x = i;
        pro = 1;
        while(x!=1){
            y = prime[x];
            cnt = 0;
            while(x % y ==0){
                x /= y;
                ++cnt;
            }
            pro *= (cnt+1);
        }
        sum += (i*pro);
    }
    cout << sum ;
	return 0; 
} 


Measured memory_bytes: 42712
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

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

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

int gcd(int a, int b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

//-----------------------ここから-----------

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

    if(n == 1){
        cout << "Hello World" << endl;
    } else {
        cin >> a >> b;
        cout << a + b << endl;
    }



    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

vector<int> tsk[100010];

signed main(){
	int n,m,ans = 0;
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		int a,b;
		cin >> a >> b;
		tsk[a].pb(b);
	}
	priority_queue<int> que;
	for(int i = 1;i <= m;i++){
		for(int v : tsk[i]){
			que.push(v);
		}
		if(!que.empty()){
			ans += que.top();que.pop();
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5632
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int last = s.size() / 2;
    int ans = 0;
    rep(i,last) {
        if (s[i] != s[s.size()-1-i])  ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
#define F first
#define S second
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  if(s.at(1)=='R'){
    if(s.at(0)=='R'&&s.at(2)=='R'){
      cout << 3 << endl;
    }else if(s.at(0)=='R'||s.at(2)=='R'){
      cout << 2 << endl;
    }else{
      cout << 1 << endl;
    }
  }else{
    if(s.at(0)=='R'||s.at(2)=='R'){
      cout << 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }
}


Measured memory_bytes: 3616
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int res = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x >= k)
            ++res;
    }
    cout << res << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    int cn=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            cn+=1;
        }
    }
    cout<<cn;
    return 0;
}


Measured memory_bytes: 3896
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char a[21];
int main()
{
	char s,i=1,j;
	cin>>a;
	s=strlen(a);
	for(j=s-1;j>=0;j--)cout<<a[j];
    cout<<endl;
	return 0;
}

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

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

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


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int X;
  cin >> X;
  vector< int > dp(100001);
  dp[0] = true;
  for(int x : {100, 101, 102, 103, 104, 105}) {
    for(int i = 0; i + x < dp.size(); i++) {
      dp[i + x] |= dp[i];
    }
  }
  cout << dp[X] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

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

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

int main() {
	int n; cin>>n;
    vector<P> x(n);
  	for (int i=0; i<n; ++i) {
    	cin>>x[i].first>>x[i].second;
    }
  	string s; cin>>s;
  	int ans = 0;
  	bool sleep = false;
  	for (int i=0; i<n; ++i) {
      	if (sleep) ans += x[i].second;
    	if (x[i].first == s) sleep = true;
    }
  	cout<<ans<<endl;
  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

ll make(int d, int mask){
    string s = "";
    rep(i,d){
        if(mask>>i&1) s += '8';
        else s += '2';
    }
    return atoll(s.c_str());
}

const int INF = 19191919;
vector<ll> v;
int V;

const int N = 1<<10;
map<ll,int> dp[N];
int dfs(int d, ll n){
    if(d==V){
        if(n==1) return 0;
        return -INF;
    }

    int ret = -INF;
    if(n%v[d]==0) ret = max(ret, dfs(d, n/v[d])+1);
    ret = max(ret, dfs(d+1, n));

    return dp[d][n] = ret;
}

int main(){
    ll n;
    cin >>n;
    if(n==1){
        cout << -1 << endl;
        return 0;
    }

    for(int i=1; i<=9; ++i){
        rep(mask,1<<i) v.pb(make(i,mask));
    }
    V = v.size();

    int ans = -1;

    ans = max(ans, dfs(0,n));
    for(int i=10; i<=18; ++i){
        rep(mask,1<<i){
            ll val = make(i,mask);
            if(n%val==0){
                ans = max(ans, dfs(0, n/val)+1);
            }
        }
    }

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



Measured memory_bytes: 78712
#include <bits/stdc++.h>
    using namespace std;
    int main(){
    	string s;
      	cin>>s;
      	if(s[0]==s[1] && s[2]==s[3] && s[0]!=s[2]) cout<<"Yes"<<endl;
    	else if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) cout<<"Yes"<<endl;
      	else if(s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]) cout<<"Yes"<<endl;
      	else cout<<"No"<<endl;
     	return 0;
    }

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in",,"r",stdin);freopen(a".out","w",stdout)
#define int ll
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}
int n,x;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
signed main(){
	n=gi();x=gi();
	printf("%lld\n",3*(n-gcd(n,x)));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()	{
  string s;
  cin >> s;
  int n = s.length();
  int moves = 0;
  int tmp = 0;
  for (int i = 0; i < n - 1; i++)	{
  	if (s[i] != s[i + 1])	{
      tmp++;
    }
  }
  moves = tmp;
  for (int i = n - 1; i > 0; i--)	{
  	if (s[i] != s[i - 1])	{
      tmp++;
    }
  }
  moves = min(moves, tmp);
  cout << moves << endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{
	int n;
	int sum;
	int temp;
	int i;
	
	while (1){
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		
		sum = 0;
		for (i = 0; i < n / 4; i++){
			scanf("%d", &temp);
			sum += temp;
		}
		printf("%d\n", sum);
	}
	return (0);
}

Measured memory_bytes: 0
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
		String str = sc.next();
		String[] a = str.split(",",0);
		double[] b = new double[3];
		for(int i = 0; i < 3; i++)
			b[i] = Double.parseDouble(a[i]);
		
		if(b[1]/(b[2]*b[2]) >= 25)System.out.println((int)b[0]);
	}
}
}

Measured memory_bytes: 17144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9 + 7;
const int INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
#define REP(i, n) for(int i = 0; i <= n; i++)
#define rrep(i,n) for(int i=n;i>0;i--)
#define RREP(i,n) for(int i=n;i>=0;i--)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(d==1) cout<<"1"<<endl;
    else cout<<"0"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

constexpr ll MOD = 1'000'000'007LL;
constexpr int N = 112345;
ll fct[N] = {1}, fctinv[N];
ll a[N];
ll pw(ll a, ll b){
	ll c = 1;
	while(b){
		if(b&1) c = c*a %MOD;
		a = a*a % MOD;
		b /= 2;
	}
	return c;
}
ll inv(ll a){
	return pw(a, MOD-2);
}
ll cmb(ll a, ll b){
	return fct[a] * fctinv[b] % MOD * fctinv[a-b] % MOD;
}

int main(){
	FOR(i, 1, N) fct[i] = fct[i-1] * i % MOD;
	REP(i, N) fctinv[i] = inv(fct[i]);
	int n, k; scanf("%d%d", &n, &k);
	REP(i, n) scanf("%lld", a+i);
	sort(a, a+n);
	ll ans = 0;
	REP(ii, 2){
		ll tmp = 0;
		REP(i, n-k+1){
			DEBUG("%lld %lld\n", a[i], cmb(n-1-i, k-1));
			tmp += (a[i]%MOD+MOD)%MOD * cmb(n-1-i, k-1);
			tmp %= MOD;
		}
		tmp = tmp * (MOD + ii*2 - 1) % MOD;
		ans += tmp;
		reverse(a, a+n);
	}
	ans %= MOD;
	printf("%lld\n", ans);
}


Measured memory_bytes: 2816
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
	for j in range(W + 1):
		if j - w[i] >= 0:
			dp[i + 1][j] = dp[i][j - w[i]] + v[i]
		dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[N][W])


Measured memory_bytes: 120556
#include <stdio.h>
 
int main(void)
{
    int n;
    int i;
    int x;
     
    scanf("%d", &n);
     
    for (i = 3; i <= n; i++){
        if (i % 3 == 0){
            printf(" %d", i);
        }
        else {
            x = i;
            while (x != 0){
                if (x % 10 == 3){
                    printf(" %d", i);
                    break;
                }
                x /= 10;
            }
        }
    }
     
    printf("\n");
     
    return (0);
}

Measured memory_bytes: 600
import java.io.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
	
	public int[][] offset = new int[][]{
			{-1, 0}, {1, 0}, {0, 1}, {0, -1}
	};
	
	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = in.readLine();
		int size = Integer.parseInt(line);
		
		for(int n=0; n<size; n++){
			int[][] data = new int[10][10];
			for(int y=0; y<10; y++){
				line = in.readLine();
				String[] tmp = line.split(" ");
				for(int x=0; x<10; x++){
					data[y][x] = Integer.parseInt(tmp[x]);
				}
			}
			
			int[][] button = solve(data);
			
			for(int y=0; y<10; y++){
				for(int x=0; x<10; x++){
					System.out.print(button[y][x]);
					if(x!=9) System.out.print(" ");
				}
				System.out.println();
			}
		}
	}
	
	public int[][] solve(int[][] prob){
		int is_break = 0;
		int[][] button = null;
		for(int i=0; i<1024; i++){
			int[][] data = deepClone(prob);
			button = new int[10][10];
			int[] bin = num_to_bin(i);
			for(int x=0; x<10; x++){
				if(bin[x]==1){
					button[0][x]=1;
					data[0][x]^=1;
					for(int d=0; d<3; d++){
						int xx = x+offset[d][0];
						int yy = offset[d][1];
						if(xx>=0 && yy>=0 && xx<10 && yy<10){
							data[yy][xx]^=1;
						}
					}
				}
			}
			
			for(int y=1; y<10; y++){
				for(int x=0; x<10; x++){
					if(data[y-1][x]==1){
						button[y][x]^=1;
						data[y][x]^=1;
						for(int d=0; d<4; d++){
							int xx = x+offset[d][0];
							int yy = y+offset[d][1];
							if(xx>=0 && yy>=0 && xx<10 && yy<10){
								data[yy][xx]^=1;
							}
						}
					}
				}
			}
			
			is_break = 1;
			for(int x=0; x<10; x++){
				if(data[9][x]==1){
					is_break = 0;
					break;
				}
			}
			
			if(is_break==1){
				break;
			}
		}
		return button;
	}
	
	public int[][] deepClone(int[][] data){
		int[][] copy = new int[10][10];
		for(int y=0; y<10; y++){
			for(int x=0; x<10; x++){
				copy[y][x] = data[y][x];
			}
		}
		return copy;
	}
	
	public int[] num_to_bin(int n){
		int[] bin = new int[10];
		for(int i=0; i<10; i++){
			if(n%2 == 0){
				bin[i] = 0;
			}else{
				bin[i] = 1;
			}
			n = n/2;
		}
		
		return bin;
	}
}

Measured memory_bytes: 10000
n, l = [int(elem) for elem in input().split()]

apples = []
abss = []
for i in range(0, n):
    apples.append(l + i)
    abss.append(abs(l + i))

tmp = zip(abss, apples)
tmp = sorted(tmp)
abss, apples = zip(*tmp)

after = sum(apples[1:])
print(after)

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

int main() {
    string a, b;
    int i;
    cin >> a;
    cin >> b;
    if(a.size() > b.size()){
        cout << "GREATER" << endl;
        return 0;
    } else if(a.size() < b.size()) {
        cout << "LESS" << endl;
        return 0;
    } else {
        for(i=0; i<a.size(); i++){
            if((int)a[i] > (int)b[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if((int)a[i] < (int)b[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}

Measured memory_bytes: 256
n,l,t = gets.split.map(&:to_i)
x = Array.new(n)
y = Array.new(n)
w = Array.new(n)
n.times do |i|
    x[i],w[i] = gets.split.map(&:to_i)
end
u = 0
a = 0
n.times do |i|
    next if w[i] == 2
    n.times do |j|
        next if w[j] == 1
        u += (2*t-(x[j]-x[i])%l+l-1)/l
    end
    a = i
    break
end
n.times do |i|
    if w[i] == 1
        y[i] = (x[i]+t)%l
    else
        y[i] = (x[i]-t)%l
    end
end
b = y[a]
y.sort!
m = y.bsearch_index{|num|num >= b}
u %= n
n.times do |i|
    puts y[(m+i-u-a)%n]
end

Measured memory_bytes: 6300
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll A, B;
  cin >> A >> B;
  ll ret = max(A, B);
  if (A >= B)
    A--;
  else
    B--;
  cout << ret + max(A, B) << endl;
  return 0;
}


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

int n;
int h[100005];

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &h[i]);
        if(h[i - 1] > h[i])
        {
            printf("No");
            return 0;
        }
        if(h[i - 1] < h[i]) h[i]--;
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return num
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

type inputs struct {
	a, b, c, d int
}

func getScore(in []inputs, as []int) int {
	total := 0
	for i := 0; i < len(in); i++ {
		if as[in[i].b]-as[in[i].a] == in[i].c {
			total += in[i].d
		}
	}
	return total
}

func df(in []inputs, as []int, n, m, q int) int {
	if len(as) == n {
		return getScore(in, as)
	}

	max := 0
	if len(as) == 0 {
		for i := 1; i <= m; i++ {
			as = append(as, i)
			tmp := df(in, as, n, m, q)
			if max < tmp {
				max = tmp
			}
			as = nil
		}
		return max
	}

	for i := as[len(as)-1]; i <= m; i++ {
		as = append(as, i)
		tmp := df(in, as, n, m, q)
		if max < tmp {
			max = tmp
		}
		as = as[:len(as)-1]
	}

	return max
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	as := make([]int, 0, n)
	m := nextInt()
	q := nextInt()
	in := []inputs{}

	for i := 0; i < q; i++ {
		a := nextInt() - 1
		b := nextInt() - 1
		c := nextInt()
		d := nextInt()
		in = append(in, inputs{a, b, c, d})
	}

	ans := df(in, as, n, m, q)
	fmt.Println(ans)
}


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

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





int main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    
    int m; cin >> m;
    vector<int> t(m);
    rep(i,m) cin >> t[i];
    
    sort(d.begin(), d.end());
    sort(t.begin(), t.end());
    
    
    
    int j = 0;
    rep(i,m){
        
        while (1) {
            
            
            
            if(t[i] == d[j++]){
                break;
            }
            if(j >= n){
                cout << "NO"<< endl;
                return 0;
            }
            
        }
    }
    cout << "YES" << endl;
    return 0;
    
    
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		std::vector<int> num;
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (; x; x /= 10) {
			num.push_back(x % 10);
		}
		while (!num.empty()) {
			putchar(num.back() ^ '0');
			num.pop_back();
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

int n;
char s[200005];

void solve() {
	n = readStr(s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == '?') {
			putchar('D');
		} else {
			putchar(s[i]);
		}
	}
	putchar('\n');
}

int main() {
	int T = 1;
	// read(T);
	while (T--) {
		solve();
	}
}


Measured memory_bytes: 3632
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ans = b[a[0] - 1]
for i in range(1, n):
    ans += b[a[i] - 1]
    if a[i] == a[i - 1] + 1:
        ans += c[a[i - 1] - 1]
print(ans)


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

int main() {
	int T;
	cin >> T;
	for (int n = 0; n < T; ++n) {
		int N;
		cin >> N;
		vector<pair<int,long long>>L;
		vector<pair<int, long long>>R;
		long long ans = 0;
		for (int n = 0;n<N;++n) {
			int k;
			long long l, r;
			cin >> k >> l >> r;
			if (k != N) {
				if (l > r) {
					L.push_back(make_pair(k, l - r));
				}
				else if (r > l) {
					R.push_back(make_pair(N - k, r - l));
				}
				else {
					//non
				}
				ans += min(l, r);
			}
			else{
				ans += l;
			}
		}
		sort(L.begin(),L.end()); 
		sort(R.begin(), R.end());
		//左詰め
		{
			priority_queue<long long, vector<long long>, greater<long long> > que;
			for (int n = 0;n<L.size();++n) {
				if (que.size() < L[n].first) {
					que.push(L[n].second);
					ans += L[n].second;
				}
				else {
					if (que.top() < L[n].second) {
						ans -= que.top();
						ans += L[n].second;
						que.pop(); 
						que.push(L[n].second);
					}
				}
			}
		}
		//右詰め
		{	
			priority_queue<int, vector<int>, greater<int> > que;
			for (int n = 0; n < R.size(); ++n) {
				if (que.size() < R[n].first) {
					que.push(R[n].second);
					ans += R[n].second;
				}
				else {
					if (que.top() < R[n].second) {
						ans -= que.top();
						ans += R[n].second;
						que.pop();
						que.push(R[n].second);
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 8244
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main
{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String args[])
    {
        FastReader obj = new FastReader();
        int r = obj.nextInt();
        System.out.println(2*Math.PI*r);
    }
}


Measured memory_bytes: 33296