akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    while(sc.hasNext()){
      int n=sc.nextInt(); //N個のりんご
      int l=sc.nextInt();
      int arr[]=new int[n]; //りんごの味
      for(int s=0;s<n;s++){
        arr[s]=l+s;
      }
      int total=0;
      for(int s=0;s<n;s++){
        total+=arr[s];
      }
      int newa[]=new int[n];
      for(int s=0;s<n;s++){
        newa[s]=Math.abs(arr[s]);
      }
      int min=300;
      int ans=0;
      for(int s=0;s<n;s++){
        if(min>newa[s]){
          min=newa[s];
          ans=s;
        }
      }
      System.out.println(total-arr[ans]);


    }
  }
}


Measured memory_bytes: 23252
def same_numbers(ary, result = [])
  return result.sort if ary.empty?
  a = ary.first
  co = ary.count(a)
  result << co if co > 1
  same_numbers(ary - [a], result)
end

$<.readlines.map {|l| l.split(",").map(&:to_i)}.each do |hand|
  puts case same_numbers(hand)
       when [4]    then "four card"
       when [2, 3] then "full house"
       when [3]    then "three card"
       when [2, 2] then "two pair"
       when [2]    then "one pair"
       else
         hand.sort!
         if hand.sum == (hand.first + 2) * 5 or hand == [1, 10, 11, 12, 13]
           "straight"
         else
           "null"
         end
       end
end


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

const int maxn = 100010;
int n, col[maxn], dep[maxn];
vector<int> G[maxn];
struct node1 { int id; };
bool operator < (node1 a, node1 b) { return dep[a.id] < dep[b.id]; }
struct node2 { int id; };
bool operator < (node2 a, node2 b) { return dep[a.id] > dep[b.id]; }

void dfs(int v, int fa) {
    dep[v] = dep[fa] + 1;
    for (int u : G[v]) if (u ^ fa) dfs(u, v);
}

int main() {
    memset(col, -1, sizeof(col));
    scanf("%d", &n);
    col[1] = 0, col[n] = 1;
    for (int i = 1, u, v; i < n; i++) {
        scanf("%d %d", &u, &v);
        G[u].push_back(v), G[v].push_back(u);
    }
    dfs(1, 0);
    priority_queue<node1> q1;
    priority_queue<node2> q2;
    q1.push((node1){1}), q2.push((node2){n});
    while (1) {
        if (q1.empty()) printf("Snuke\n"), exit(0);
        int v = q1.top().id; q1.pop();
        for (int u : G[v]) {
            if (!~col[u]) col[u] = 0, q1.push((node1){u});
        }
        if (q2.empty()) printf("Fennec\n"), exit(0);
        v = q2.top().id; q2.pop();
        for (int u : G[v]) {
            if (!~col[u]) col[u] = 1, q2.push((node2){u});
        }
    }
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
#include <map>
#include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>

using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define sz(a) (int)(a.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);

ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

bool vowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    else return false;
}

// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
class UnionFind {                                              // OOP style
private:
    vi p, rank, setSize;                       // remember: vi is vector<int>
    int numSets;
public:
    UnionFind(int N) {
        setSize.assign(N, 1); numSets = N; rank.assign(N, 0);
        p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; }
    int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
    bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
    void unionSet(int i, int j) { 
        if (!isSameSet(i, j)) { numSets--; 
        int x = findSet(i), y = findSet(j);
        // rank is used to keep the tree short
        if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
        else                   { p[x] = y; setSize[y] += setSize[x];
                                 if (rank[x] == rank[y]) rank[y]++; } } }
    int numDisjointSets() { return numSets; }
    int sizeOfSet(int i) { return setSize[findSet(i)]; }
};

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;
    int arr[n];
    arrinput;
    sort(arr, arr+n);
    int sum = 0;
    arrsum;
    if(sum%10) {
        cout<<sum;
    }
    else {
        for0(i,n) {
            if(arr[i]%10) {
                cout<<sum - arr[i];
                return 0;
            }
        }
        cout<<0;
    }

    return 0;
}      

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

int main(void){
    int a(0), b(0);
    
    std::cin >> a >> b;
    
    if(a%2 != b%2){
        std::cout << "IMPOSSIBLE" << std::endl;
    }else{
        const auto k = (std::pow(a, 2) - std::pow(b, 2)) / (2*(a - b));
        std::cout << static_cast<int>(k) << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using G = vector<vector<int>>;
    
int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        int a;
        cin >> a;
        if((i+1)%2==1 && a%2==1) ans++;
    }

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

Measured memory_bytes: 3584
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=[input().split() for l in range(M)]
tot_1=min(a)+min(b)
lis=[]
for i in range(M):
    tot=a[int(x[i][0])-1]+b[int(x[i][1])-1]-int(x[i][2])
    lis.append(tot)
if tot_1<=min(lis):
    print(tot_1)
else:
    print(min(lis))

Measured memory_bytes: 56952
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};

int main(){
    CIN(N);
    V<I> vec;
    I s;
    REP(a,N){
        CIN(b);
        if(b==0){
            vec.push_back(s);
            s.clear();
        }else{
            s.push_back(b);
        }
    }
    vec.push_back(s);
    LL ans = 0;
    for(int a = 0;a < vec.size();a++){
        I v = vec.at(a);
        ans += accumulate(ALL(v),0LL)/2;
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for (int i=0,_n=(int)(n); i < _n; i++)
template<class T> bool chkmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chkmax(T &a, T b) { return a < b ? (a = b, true) : false; }

typedef long long ll;

int nextInt() {
  int x; scanf("%d", &x); return x;
}

const int MAX_N = 500000 + 10;
int N, D, Q;
int d[MAX_N];
ll A[MAX_N];
ll B[MAX_N];

int main2() {
  N = nextInt();
  D = nextInt();
  for (int i = 1; i <= N; i++) d[i] = nextInt();
  A[0] = D;
  for (int i = 1; i <= N; i++) {
    A[i] = min(A[i-1], abs(A[i-1] - d[i]));
  }
  B[N] = 1;
  for (int i = N-1; i >= 0; i--) {
    if (2 * B[i+1] <= d[i+1])
      B[i] = B[i+1];
    else
      B[i] = B[i+1] + d[i+1];
  }

  // REP(i, N+1) cout << A[i] << " "; cout << endl;
  // REP(i, N+1) cout << B[i] << " "; cout << endl;
  Q = nextInt();
  while (Q-->0) {
    int q = nextInt();
    if (B[q] <= A[q-1])
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

Measured memory_bytes: 11648
//
// Created by kuribohkute on 20/04/2019.
//
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
using namespace std;
#define mp make_pair
#define X first
#define Y second
int md = 998244353;
int n;
int mm[100005];

int Pow(int a, int b) {
    if (b == 0) {
        return 1;
    }
    if (b == 1) {
        return a;
    }
    int tmp = Pow(a, b / 2);
    tmp = (1ll * tmp * tmp) % md;
    if (b % 2) {
        tmp = (1ll * tmp * a) % md;
    }
    return tmp;
}

int main () {
    cin >> n;
    int mx = 0;
    for (int i = 0; i < n; i++) {

        int x;
        cin >> x;
        if (i == 0 && x != 0) {
            cout << 0;
            return 0;
        }
        mm[x]++;
        mx = max(mx, x);
    }
    if (mm[0] != 1) {
        cout << 0;
        return 0;
    }
    int res = 1;
    for (int i = 1; i <= mx; i++) {
        res = (1ll * res * Pow(mm[i - 1], mm[i])) % md;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,s,count;
  s=1;
  count=0;
  cin >> N;
  vector<long long> A(N);
  for(long long i=0;i<N;i++){cin >> A[i];}
  sort(A.begin(), A.end());
  for(long long i=N-1;i>=0;i--){
    if(A[i-1]==A[i]){
      count++; 
      s*=A[i];
      i--;
    }
    if(count==2){
      cout << s << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}

Measured memory_bytes: 1024
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(li[K-1])

Measured memory_bytes: 3316
#include <stdio.h>
#include <math.h>
int main(){
	double a,b,c;
	double PI=acos(-1);
	scanf("%lf %lf %lf",&a,&b,&c);
	c/=180.0;
	c*=PI;
	printf("%lf\n%lf\n%lf\n",a*b*0.5*sin(c),a+b+sqrt(a*a+b*b-2.0*a*b*cos(c)),a*b*sin(c)/a);
	return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    int odd = 1;
    int a;
    for (int i = 0; i < n; i++) {
        cin >> a;
        odd *= a % 2 == 0 ? 2 : 1;
    }
    cout << (int)pow(3, n) - odd << endl;
}


Measured memory_bytes: 384
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

!function () {
  function splitNum(line) {
    return (Array.isArray(line) ? line : line.split(/\s+/)).map(function (n) {
      return parseInt(n);
    });
  }

  function* range(start, end) {
    for (var i = start; i < end; i++) {
      yield i;
    }
  }

  !function (input) {
    var lines = input.split("\n");

    var _splitNum = splitNum(lines[0]),
        _splitNum2 = _slicedToArray(_splitNum, 2),
        N = _splitNum2[0],
        M = _splitNum2[1];

    var X = splitNum(lines[1]).slice(0, M);
    X.sort(function (a, b) {
      return a - b;
    });
    var gaps = Array.from(range(0, M - 1)).map(function (i) {
      return X[i + 1] - X[i];
    });
    gaps.sort(function (a, b) {
      return a - b;
    });
    var answer = gaps.slice(0, Math.max(0, M - 1 - N + 1)).reduce(function (a, b) {
      return a + b;
    }, 0);
    console.log(answer);
  }(require("fs").readFileSync("/dev/stdin", "utf8"));
}();


Measured memory_bytes: 25980
#include<stdio.h>
#define N 44
int main(){
  int n,i,A[N];

  A[0]=1;
  A[1]=1;
  
  scanf("%d",&n);

  for(i=2;i<=N;i++){
    A[i]=A[i-1]+A[i-2];  
  }

  printf("%d\n",A[n]);

  return 0;
}



Measured memory_bytes: 2148
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
	int n, m; 
	cin >> n >> m;
	vector<ll> x(n), y(n), z(n);
	rep(i, n)cin >> x[i] >> y[i] >> z[i];
	int sign[2] = { 1,-1 };
	ll res = 0;
	rep(i, 2)rep(j, 2)rep(k, 2) {
		vector<ll> cakes(n);
		rep(c, n) {
			cakes[c] = x[c] * sign[i] + y[c] * sign[j] + z[c] * sign[k];
		}
		sort(cakes.begin(), cakes.end(), greater<ll>());
		ll tmp = 0;
		rep(c, m)tmp += cakes[c];
		res = max(res, tmp);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,i,p=0,l,r,d;
    cin>>l>>r>>d;
    for(i=l;i<=r;i++){
        if(i%d==0)
        p++;
    }cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    ll x[55], y[55];
    cin >> N >> K;
    rep(i,0,N){
        cin >> x[i] >> y[i];
    }
    ll S = -1;
    rep(i,0,N){
        rep(j,0,N){
            rep(k,0,N){
                rep(l,0,N){
                    if(x[i] > x[j] || y[k] < y[l]) continue;
                    int cnt = 0;
                    rep(m,0,N){
                        if(x[m] >= x[i] && x[m] <= x[j] && y[m] >= y[l] && y[m] <= y[k]){
                            cnt++;
                        }
                    }
                    if(cnt >= K){
                        ll s_tmp = (x[j] - x[i]) * (y[k] - y[l]);
                        if(S == -1){
                            S = s_tmp;
                        }else{
                            S = min(S, s_tmp);
                        }
                    }


                }
            }
        }
    }
    print(S);


}


Measured memory_bytes: 384
k,a,b=map(int,input().split())

k+=1
"""
ans=0
k-=a#最初の連星
k-=1#クッキーを１円に変える
k-=1#１円でクッキーを買う
ans+=b
k-=1
ans-=a
k-=1
ans+=b
k-=b-a
k-=1
k-=1
ans+=b

k+=1
k-=a
print(k)
print((b-a-2))
if k<=(b-a-2):

  
else:
    k=k//(b-a-2)

print(k)
"""

if a+1<b and a+2<=k:
    k-=a
    k-=2
    #print(48518828981938099-(b-a)*(k//2))
    print(  (b-a)*(k//2)+b+k%2)

else:
    print(k)

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

using namespace std;

const int MOD = 1000000007;

int main(){
    int N, Q;
    while(cin >> N >> Q){
        vector<int> A(N);
        for(auto& t : A) cin >> t;
        vector<vector<long long>> dp(N, vector<long long>(N, 0));
        vector<vector<int>> time(N, vector<int>(N, 0));
        vector<long long> pow2(Q+1, 0);
        pow2[0] = 1;
        for(int i=1;i<=Q;i++) pow2[i] = (2*pow2[i-1])%MOD;
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(A[i] > A[j]) ++dp[i][j];
            }
        }
        for(int i=0;i<Q;i++){
            auto getValue = [&](int x, int y){
                return (dp[x][y] * pow2[i - time[x][y]]) % MOD;
            };
            int X, Y; cin >> X >> Y;
            --X; --Y;
            for(int j=0;j<N;j++){
                if(j == X || j == Y) continue;
                auto next = (getValue(X, j) + getValue(Y, j)) % MOD;
                dp[X][j] = dp[Y][j] = next;
                time[X][j] = time[Y][j] = i+1;
                next = (getValue(j, X) + getValue(j, Y)) % MOD;
                dp[j][X] = dp[j][Y] = next;
                time[j][X] = time[j][Y] = i+1;
            }
            {
                auto next = (getValue(X, Y) + getValue(Y, X)) % MOD;
                dp[X][Y] = dp[Y][X] = next;
                time[X][Y] = time[Y][X] = i+1;
            }
        }
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                dp[i][j] = (dp[i][j] * pow2[Q-time[i][j]]) % MOD;
            }
        }
        long long res = 0;
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++) res = (res + dp[i][j]) % MOD;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 107904
S = input()
c = 0
for i in range(len(S)):

    if i % 2 == 0:
        if S[i] in 'RUD':
            c += 1

    elif i % 2 ==1:
        if S[i] in 'LUD':
            c += 1


if c==len(S):
    print('Yes')

else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mxn (int)1e5+10
using namespace std;

int ar[mxn], dp[mxn];

int main() {
    int n; cin >> n;
    for(int i=0; i<n; ++i) cin >> ar[i];
    for(int i=0; i<mxn; ++i) dp[i] = mxn;

    dp[0] = 0;
    dp[1] = abs(ar[1]-ar[0]);

    for(int i=2; i<n; ++i) {
        dp[i] = min(dp[i-2] + abs(ar[i]- ar[i-2]),
                    dp[i-1] + abs(ar[i]- ar[i-1])
                    );
    }

    //for(int i=0; i<n; ++i) cout << dp[i] << ' ';
    cout << dp[n-1] << '\n';
    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python
# encoding: utf-8


class Solution:
    def __init__(self):
        self.count = 0

    def shell_sort(self):
        array_length = int(input())
        array = []
        # array = list(map(int, sys.stdin.readlines()))
        # array_length = 10
        # array = [15, 12, 8, 9, 3, 2, 7, 2, 11, 1]
        for m in range(array_length):
            array.append(int(input()))

        G = [1]
        while True:
            g = G[0] * 3 + 1
            if g > array_length:
                break
            G.insert(0, g)

        g_length = len(G)
        result = []
        for j in range(g_length):
            result = self.insertion_sort(array=array, array_length=array_length, g=G[j])
            # print(result, 'r', G[j])

        print(g_length)
        print(" ".join(map(str, G)))
        print(self.count)
        for k in range(array_length):
            print(result[k])

    def insertion_sort(self, array, array_length, g):
        # write your code here

        for i in range(g, array_length):
            v = array[i]
            j = i - g
            while j >= 0 and array[j] > v:
                array[j + g] = array[j]
                j -= g
                self.count += 1
            array[j + g] = v

        # print(" ".join(map(str, array)))
        return array


if __name__ == '__main__':
    solution = Solution()
    solution.shell_sort()

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

int main() {
  int N;
  int a[100];

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

  int cnt = 0;
  for (int i = 1; i < N; i++) {
    if (a[i-1] == a[i]) {
        cnt++;
        i++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7;

lint N;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	vector<lint> arr(N);
	REP(i, N) {
		cin >> arr[i];
	}
	if (arr[0] != 0) {
		cout << -1 << endl;
		return 0;
	}
	lint prev = 0;
	lint cnt = 0;
	REP(i, N - 1) {
		if (prev >= arr[i + 1]) {
			cnt += prev;
		}
		else {
			if (arr[i + 1] - prev > 1) {
				cout << -1 << endl;
				return 0;
			}
		}
		prev = arr[i + 1];
	}
	cnt += prev;
	cout << cnt << endl;
}


Measured memory_bytes: 1792
package main
import "fmt"
func main(){
    // Your code here!
    var n int64
    fmt.Scan(&n)
    
    var sum int64
    sum = 0
    var i int64
    for i = 1; i <= n; i++{
        if !((i % 3 == 0) || (i % 5 == 0)){
            sum = i + sum
        }
    }
    fmt.Println(sum)
}


Measured memory_bytes: 1752
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	s, k := next(), nextInt()
	n := len(s)

	// 全部同じ文字か
	same := true
	for i := 0; i < n-1; i++ {
		same = same && s[i] == s[i+1]
	}
	if same {
		puts((n * k) / 2)
		return
	}

	a := 0
	for l := 0; l < n; {
		var r int
		for r = l; r+1 < n && s[r+1] == s[l]; r++ {
		}
		a += (r - l + 1) / 2
		l = r + 1
	}

	// 文字列をまたがない
	if s[0] != s[n-1] {
		puts(a * k)
		return
	}

	var head, tail int
	for head = 0; head+1 < n && s[head] == s[head+1]; head++ {
	}
	for tail = 0; tail+1 < n && s[n-1-tail] == s[n-1-(tail+1)]; tail++ {
	}
	b := (head+1)/2 + (tail+1)/2 - (head+1+tail+1)/2
	puts(a*k - b*(k-1))
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 998244353LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
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);
    }
};
ll mpow(ll x, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) {
            res *= x;
            res %= MOD;
        }
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    auto dp = make_v<ll>(n + 10, 300 * (n + 10));
    auto s = make_v<ll>(n + 10, 300 * (n + 10));
    dp[0][0] = 1;
    s[0][0] = 1;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= sum; j++) {
            if(j >= a[i]) {
                dp[i + 1][j] += dp[i][j - a[i]];
                s[i + 1][j] += s[i][j - a[i]];
            }
            dp[i + 1][j] += dp[i][j] * 2LL % MOD;
            s[i + 1][j] += s[i][j] % MOD;
            s[i + 1][j] %= MOD;
            dp[i + 1][j] %= MOD;
        }
    }
    ll ans = mpow(3, n);
    for(ll i = 0; i <= sum; i++) {
        int t = sum - i;
        if(t > i) {
            continue;
        }
        ans -= dp[n][i] * 3LL % MOD;
        ans += MOD;
        ans %= MOD;
    }
    ans %= MOD;
    if(sum % 2 == 0) {
        ans += s[n][sum / 2] * 3LL % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

ll inf =1e9+7;

#define pi 3.14159265358979323846L
bool isprime(ll a)
{
	
	ll cnt=0;	
	for(ll i=1;i*i<a;i++)
	{
		
	 	if(a%i==0)
	 	{
	 		cnt+=2;
		 }
		
		
	}
	
		if(cnt==2)
		return true;
		else
		return false;
		
}
ll mod(ll a)
{
	if(a<inf)return a;
	else
	return a%inf;
}
void solve()
{

string s;
cin>>s;
if(s=="ABC")cout<<"ARC";
else
cout<<"ABC";



}

int main()
{


ios::sync_with_stdio(0); 
	cin.tie(0);

		solve();
	
return 0;

		
	}
	
	
	


Measured memory_bytes: 3616
#C
n, m = map(int, input().split())
k = [] * m
s = [] * m
p = [] * m
for i in range(m):
    ks = list(map(int, input().split()))
    k.append(ks[0])
    s.append(ks[1:])
p = list(map(int, input().split()))
ans=0
# print(k, s, p)
for i in range(2 ** n):
    on = True
    for j in range(m):
        light = 0
        for k in s[j]:
            tmp = i >> (k-1) & 1
            light = (light + tmp) % 2
        if light != p[j]:
            on = False
            break
    ans += int(on)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main (void)
{
 int N;
 cin >> N;
 map <int, int> A;
 for (int i = 0; i < N; i++)
 {
	int e;
 	cin >> e;
 	A [e]++;
 }
 int Q;
 cin >> Q;
 vector <int> B, C;
 B.resize (Q);
 C.resize (Q);
 for (int i = 0; i < Q; i++)
 	cin >> B [i] >> C [i];

 long long tmp = 0;
 for (int j = 0; j < A.size (); j++)
	tmp += (long long) j * (long long)  A [j];

 for (int i = 0; i < Q; i++)
 {
	long long delta = 0;
	delta = (long long) A[B[i]] * (C[i] - B[i]);
	A [C[i]] += A[B[i]];
	A [B[i]] = 0;
	tmp += delta;
	cout << tmp << endl;
 }
return 0;
}

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

long long N, T, A, H[1 << 18];
pair<long long, long long> minx = make_pair(1LL << 60, 0);

int main() {
	cin >> N >> T >> A; T *= 1000LL; A *= 1000LL;
	for (int i = 1; i <= N; i++) {
		cin >> H[i];
		long long r = T - H[i] * 6LL;
		minx = min(minx, make_pair(abs(A - r), 1LL * i));
	}
	cout << minx.second << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
  char s[1024], i, ans = 0;
  scanf("%s",s);
  i = 0;
  while(i <= strlen(s) - 1 - i){
    int a, b;
    a = s[i];
    b = s[strlen(s) - 1 - i];
    if(a != b && !(a == '(' && b == ')') && !(a == ')' && b == '(') || a == '(' && b == '(' || a == ')' && b == ')'){
      ans++;
    }
    i++;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 968
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            var count = 0;

            if (n != input.Length)
            {
                Console.WriteLine("0");
                return;
            }

            bool IsOdd = false;

            int[] intArray = input
                            .Select(int.Parse)
                            .ToArray();
            while (true)
            {
                foreach (var item in intArray)
                {
                    if (item % 2 != 0)
                    {
                        IsOdd = true;
                        break;
                    }
                }

                if (IsOdd == true)
                {
                    break;
                }

                intArray = intArray.Select(i => i / 2).ToArray();
                count++;
            }

            Console.WriteLine(count);
        }
    }
}



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

int main() {
  int n;
  cin>>n;
  int a=n*100/108;
  if((int)(a*1.08)==n)
    cout<<a<<endl;
  else if((int)((a+1)*1.08)==n)
    cout<<(a+1)<<endl;
  else
    cout<<":("<<endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i < (n);++i)
typedef long long ll;
using namespace std;
 
int main(){
  string s;
  cin >> s;
  
  rep(i,3){
  	if(s[i] == '1') s[i] = '9';
    else s[i] = '1';
  }
  
  cout << s << endl;
  
  return 0;
}

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

using namespace std;

typedef long long ll;

int main(){ 
  int N; cin >> N;
  vector<ll> A(N); 
  for(int i = 0; i < N; i++){ cin >> A[i];}
  vector<ll> sum(N+1,0);
  
  for(int i = 0; i < N; i++){ sum[i+1] = sum[i]+A[i];}
  
  map<ll,ll> mp;
  ll ans = 0;
  for(int i = 0; i <= N; i++){
    ans += mp[sum[i]];
    mp[sum[i]]++;
  }
  
  cout << ans << endl;
  
  return 0;
  
}
      
    
  

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

int main(){
	string S, T; cin >> S >> T;
	int max_one = 0;
	for (int i = 0; i < S.length() - T.length() + 1; ++i) {
		int one = 0;
		for (int j = 0; j < T.length(); ++j) {
			if (S[i + j] == T[j])
				++one;
		}
		if (max_one < one)
			max_one = one;
	}
	cout << T.length() - max_one << endl;

}



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

int main() {
    // long long int t;
    // cin >>t ;
    // while(t--)
    // {
        
    // }
    string s ;
    cin >> s ; 
    if(s[1]=='B')
        s[1]='R';
    else
        s[1]='B';
    cout << s ;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int K,S;
    cin >> K >> S;
    int cnt;
    // i <= j <= kにしたい
    for(int i = 0;i <= K;i++){
        for(int j = i;j <= K;j++){
            int k = S - i - j;
            if(k < 0 || k > K || j > k)continue;
            if(i == j && j == k)cnt++;
            else if(i != j && j != k && k != i)cnt += 6;
            else cnt += 3;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 100000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

long path[401][401];
 
void init() {
	long i, j;
	
	for(i=1;i<=400;i++) {
		for(j=1;j<=400;j++) {
			if(i == j) {
				path[i][j] = 0;
			} else {
				path[i][j] = INF;
			}
		}
	}
}

int main() {
	long N, M;
	long a[1001], b[1001], c[1001];
	long i, j, k;
	long tmp;
	long ans;
	
	init();
	
	sl(N); sl(M);
	ans = M;
	for(i=1;i<=M;i++) {
		sl(a[i]); sl(b[i]); sl(c[i]);
		path[a[i]][b[i]] = c[i];
		path[b[i]][a[i]] = c[i];
	}
	
	for(i=1;i<=N;i++)
		for(j=1;j<=N;j++)
			for(k=1;k<=N;k++)
				path[j][k] = MIN(path[j][k], path[j][i] + path[i][k]);
	
	for(k=1;k<=M;k++) {
		/*
		for(i=1;i<=N;i++) {
			if(path[i][a[k]] + c[k] == path[i][b[k]]) {
				ans--;
				break;
			}
		}
		*/
		for(i=1;i<N;i++) {
			for(j=i+1;j<=N;j++) {
				if(path[i][j] == path[i][a[k]] + path[b[k]][j] + c[k]) {
					ans--;
					goto NEXT;
				}
			}
		}
		for(i=N;i>0;i--) {
			for(j=i-1;j>=0;j--) {
				if(path[i][j] == path[i][a[k]] + path[b[k]][j] + c[k]) {
					ans--;
					goto NEXT;
				}
			}
		}
	  NEXT:;
	}
	
	pl(ans);
	
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
int main(){
int n,a,v,i,x,y;
scanf("%d",&n);
x=0;
y=0;
for(i=0;i<n;i++){
scanf("%d %d",&a,&v);
if((y<v)||((y==v)&&(a<x))){
x=a;
y=v;
}
}
if(x==0){
x=1;
y=0;
}
printf("%d %d\n",x,y);
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
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); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> 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<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

ll dp[105][100010];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n, W;
  cin >> n >> W;
  vector<ll> w(n), v(n);
  ll sum = 0;
  REP(i, n) cin >> w[i] >> v[i], sum += v[i];
  
  REP(i, n+1) REP(j, sum+1) dp[i][j] = LLINF;
  dp[0][0] = 0;

  REP(i, n) REP(j, sum+1) {
    if(j >= v[i]) {
      dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
    } else {
      dp[i+1][j] = dp[i][j];
    }
  }

  ll ret = 0;
  REP(i, sum+1) if(dp[n][i] <= W) ret = i;
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 80128
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int A,B,C;
  cin >> A >> B >> C;
  int sum = 0;
  for(int i=0; i<1000; i++){
    if(sum%B == C){
      cout << "YES\n";
      return 0;
    }
    sum += A;
  }
  cout << "NO\n";
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> x(n / 2);
    vector<int> y(n / 2);
    int c = 0, d = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0)
        {
            cin >> x.at(c);
            c++;
        }
        else
        {
            cin >> y.at(d);
            d++;
        }
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    
    int memo=1;
    int aaa=1;
    int amax=1;
    int amax2=1;
    for(int i=1;i<n/2;i++){
        if(x.at(i)==x.at(i-1)){
            memo++;
            aaa=max(aaa,memo);
            if(aaa==memo){
                amax=x.at(i);
            }
        }
        else{
            memo=1;
        }
    }
    int aaa2=1;
    memo=1;
    for(int i=1;i<n/2;i++){
        if(x.at(i)==amax) continue;
        if(x.at(i)==x.at(i-1)){
            memo++;
            aaa2=max(aaa2,memo);
        }
        else{
            memo=1;
        }
    }

    memo=1;
    int bbb=1;
    int bmax=1;
    int bmax2=1;
    for(int i=1;i<n/2;i++){
        if(y.at(i)==y.at(i-1)){
            memo++;
            bbb=max(bbb,memo);
            if(bbb==memo){
                bmax=y.at(i);
            }
        }
        else{
            memo=1;
        }
    }
    int bbb2=1;
    memo=1;
    for(int i=1;i<n/2;i++){
        if(y.at(i)==bmax) continue;
        if(y.at(i)==y.at(i-1)){
            memo++;
            bbb2=max(bbb2,memo);
        }
        else{
            memo=1;
        }
    }

    if(amax==bmax&&n-aaa-bbb==0){
        cout<<n/2<<endl;
    }
    else if(amax!=bmax){
        cout<<n-aaa-bbb<<endl;
    }
    else{
        cout<<n-max(aaa+bbb2,aaa2+bbb)<<endl;
    }
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

static int N = 250;

int main()
{
    int n, tree[N];
    cin >> n;

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

    for (int i = 0 ; i < n; i++)
    {
        cout << "node " << i + 1 << ": "
             << "key = " << tree[i] << ", ";
        if (i > 0)
            cout << "parent key = " << tree[(i-1) / 2] << ", ";
        if (2 * i + 1 < n)
            cout << "left key = " << tree[2 * i + 1] << ", ";
        if (2 * i + 2 < n)
            cout << "right key = " << tree[2 * i + 2] << ", ";
        cout << endl;
    }
}



Measured memory_bytes: 3096
#include <stdio.h>
#include <cmath>
#include <algorithm>

#define NUM 11000001


int main(){
	int* table = new int[NUM];
	int limit,p;
	int* info = new int[2000000];
	p = 0;

	for(int i=0; i < NUM;i++)table[i] = 1;
	table[0] = 0;
	table[1] = 0;

	limit = sqrt(NUM);

	for(int i=2;i<=limit;i++){
		if(table[i] == 1){
			for(int k=2*i;k < NUM; k += i){
				table[k] = 0;
			}
		}
	}

	info[0] = 13;
	p++;
	for(int i = 17; i <= 11000000; i += 2){
		if(table[i] == 1 && table[i-2] == 1 && table[i-6] == 1 && table[i-8] == 1)
			info[p++] = i;
	}

	int n;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i = 0; i < p; i++){
			if(info[i] > n){
				printf("%d\n",info[i-1]);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 45516
local rand = math.random
local read = io.read

math.randomseed(os.time())

local D = read("*n")
local c = {}
for i = 1, 26 do
	c[i] = read("*n")
end
for i = 1, D + 1 do
	read("*l")
end

--[[
local function randNoDuplication(list)
	local num = rand(1, #list)
	for i = 1, #list do
		if list[i] == num then
			return randNoDuplication(list)
		end
	end
	return num
end
]]

for i = 1, D do
	print(rand(1, 26))
end


Measured memory_bytes: 2768
# https://atcoder.jp/contests/abc098/tasks/abc098_a

if ARGV[0]=="LOCAL_DEV"
  define_method("debug") do |var|
    p var
  end
else
  define_method("debug") do |var|
  end
end

A,B=STDIN.gets.strip.split.map(&:to_i)
ans=[A+B, A-B, A*B]
puts ans.max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

#define MAX_N 2000005
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll perm(ll n, ll r) {
  if(n < 0)       return 0;
  else if(n < r)  return 0;
  else            return (fac[n] * finv[n-r]) % mod;
}
ll comb(ll n, ll r) {
  ll ans = 1;
  ans = perm(n, r); // n * (n-1) * ... * (n-r+1)
  ans = (ans * finv[r]) % mod; // フェルマーの小定理
  return ans;
}
ll modpow(ll a, ll N) {
  ll ans = 1;
  ll tmp = a;
  while(N > 0) {
    if(N % 2 == 1) (ans *= tmp) %= mod;
    (tmp *= tmp) %= mod;
    N /= 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll K;
  string S;
  cin >> K >> S;
  ll N = S.size();
  make();
  ll ans = 0;
  rep(i, K+1) {
    ll k = K-i;
    (ans += comb(k+N-1, N-1) * modpow(25, k) % mod * modpow(26, i) % mod) %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 51220
#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 ans =0;
  for(int i=0; i<N-1; i++){
    for(int j=i; j<N; j++){
      ans = max(ans, abs(A.at(i)-A.at(j)));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000

/*
    2019 5.11
    7.2 Partition
*/

int A[MAX], n;

int partition(int p, int r) {
    int x, i, j, t;
    /*
    i は x = A[r] 以下のグループの最後尾，
    つまり　以下のグループの要素の個数（1オリジン）.
    Switchするたびに，i++ してる.
    */
    x = A[r];
    i = p - 1;
    for (j = p; j < r; j++){
        if (A[j] <= x){
            /*
            A A A | B B A B x
                i       j
            A A A   A | B B B x
                    i+1
            */
            i++;
            t = A[i]; A[i] = A[j]; A[j] = t;
        }
    }
    t = A[i+1]; A[i+1] = A[r]; A[r] = t;
    // 最後に，A[r]とそれより大きいグループの先頭を入れ替えている
    return i+1;
}

int main(){
    int i, q;

    scanf("%d", &n);
    for(i = 0; i < n; i++) scanf("%d", &A[i]);

    q = partition(0, n - 1);

    for(i = 0; i < n; i++) {
        if(i) printf(" ");
        if(i == q) printf("[");
        printf("%d", A[i]);
        if(i == q) printf("]");
    }
    printf("\n");

    return 0;
}



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

using namespace std;

double w[] = {48, 51,54, 57, 60, 64, 69, 75, 81, 91};
string c[] = {
    "light fly",
    "fly",
    "bantam",
    "feather",
    "light",
    "light welter",
    "welter",
    "light middle",
    "middle",
    "light heavy",
    "heavy"
};
int main(){
    double n;
    while(cin >> n){
	for(int i = 0;i < 10;i++){
	    if(n <= w[i]){
		cout << c[i] << endl;
		break;
	    }
	    if(i == 9)
		cout << "heavy" << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n;
int a[100100];
int b[100100];
int c[100100];
ll d[100100];
ll sd[100100];
ll e[100100];
ll tot;

ll solve(){
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i) cin >> b[i];
    for(int i = 0; i < n; ++i) cin >> c[i];
    
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);
    
    for(int i = 0, j = 0; j < n; ++j){
        while(i < n && a[i] < b[j]) ++i;
        d[j] = i;
        sd[j] = d[j] + (i > 0 ? sd[j - 1] : 0);
    }
    for(int i = 0, j = 0; j < n; ++j){
        while(i < n && b[i] < c[j]) ++i;
        if(i > 0){
            tot += sd[i - 1];
            e[j] = sd[i - 1];
        }
    }
    
    // for(int i = 0; i < n; ++i) cout << a[i] << " ";
    // cout << "\n";
    // for(int i = 0; i < n; ++i) cout << b[i] << " ";
    // cout << "\n";
    // for(int i = 0; i < n; ++i) cout << c[i] << " ";
    // cout << "\n";

    // for(int i = 0; i < n; ++i) cout << d[i] << " ";
    // cout << "\n";
    // for(int i = 0; i < n; ++i) cout << sd[i] << " ";
    // cout << "\n";
    // for(int i = 0; i < n; ++i) cout << e[i] << " ";
    // cout << "\n";
    
    return tot;
}

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

    cout << solve() << "\n";
    
    return 0;
}

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

int main() {
    int64_t S; cin >> S;
    auto OK = [&](int64_t x) -> bool {
        return x * 1e9 < S;
    };
    int64_t l = 0, r = 1e9;
    while(r - l > 1) {
        int64_t c = (l + r) / 2;
        if(OK(c)) l = c;
        else r = c;
    }
    int64_t x1 = 1e9;
    int64_t y1 = 1;
    int64_t y2 = r;
    int64_t x2 = x1 * y2 - S;

    printf("0 0 %ld %ld %ld %ld\n", x1, y1, x2, y2);
    cerr << x1 * y2 - x2 * y1 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a1,a2,a3,b;
  	scanf("%d%d%d",&a1,&a2,&a3);
  	b=a1+a2+a3;
  	if(b>=22) printf("bust\n");
  	else printf("win");
  	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
    int a[3];
    rep(i, 3) cin >> a[i];
    sort(a, a + 3);

    int ans = 0;

    int i, j, k;
    if(abs(a[0] - a[1]) % 2 == 0)
        i = 0, j = 1, k = 2;
    else if(abs(a[0] - a[2]) % 2 == 0)
        i = 0, j = 2, k = 1;
    else if(abs(a[1] - a[2]) % 2 == 0)
        i = 1, j = 2, k = 0;

    ans += abs(a[i] - a[j]) / 2;
    int m = max(a[i], a[j]);
    a[i] = m, a[j] = m;
    int p = a[i], q = a[k];

    if(p > q){
        if((p - q) % 2 == 0){
            ans += (p - q) / 2;
        }else{
            ans += (p + 1 - q) / 2 + 1;
        }
    }else{
        ans += q - p;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define mod 1000000007
#define int long long

void solve() {
	int n, k;
	cin >> n >> k;
	int a[n];
	int i, j;
	for (i = 0; i < n; i++)cin >> a[i];
	int dp[n] = {0};
	dp[0] = 0;

	for (i = 1; i < n; i++) {
		int val = abs(a[i] - a[i - 1]) + dp[i - 1];
		for (j = 1; j <= k; j++) {
			if (i - j >= 0)val = min(val, abs(a[i] - a[i - j]) + dp[i - j]);
		}
		dp[i] = val;
	}

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

int32_t main() {

	std::ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
	int t = 1;
	// cin >> t;
	while (t--)solve();
	return 0;
}

Measured memory_bytes: 5148