akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "[";
    for (auto it = mp.begin(); it != mp.end(); ++it) {
        if (it != mp.begin()) {
            os << ", ";
        }
        os << *it;
    }
    return os << "]";
}

// edit

void solve() {
    ll N;
    cin >> N;

    vector<ll> yaku(N + 1, 2);
    yaku[0] = 0;
    yaku[1]--;

    for (ll i = 2; i <= N; ++i) {
        for (ll j = i * 2; j <= N; j += i) {
            yaku[j]++;
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= N; ++i) {
        ll tmp = yaku[i] * i;
        ans += tmp;
    }

    cout << ans << endl;


}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 81028
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code,
  unused_macros
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
use std::collections::*;
macro_rules! debug {
  ($($a:expr),* $(,)*) => {
      #[cfg(debug_assertions)]
      eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*);
  };
}
fn main() {
  input! {
     H:usize,
     W:usize,
     C:(Usize1, Usize1),
     D:(Usize1, Usize1),
     S:[Chars;H]
  }
  let C: (usize, usize) = (C.0 + 2, C.1 + 2);
  let D: (usize, usize) = (D.0 + 2, D.1 + 2);
  let S: Vec<Vec<char>> = S;
  let mut kabe = vec![vec![true; W + 10]; H + 10];
  for x in 0..H {
    for y in 0..W {
      if S[x][y] == '.' {
        kabe[x + 2][y + 2] = false;
      }
    }
  }
  let kabe: Vec<Vec<bool>> = kabe;
  // Cを基準に幅優先探索。
  // (n=ワープ回数, 位置)
  let mut h = BinaryHeap::new();
  //訪問済み
  let mut v = vec![vec![false; W + 10]; H + 10];
  // ワープ回数
  let mut d = vec![vec![std::u64::MAX; W + 10]; H + 10];
  v[C.0][C.1] = true;
  d[C.0][C.1] = 0;
  h.push((Reverse(0), C.0, C.1));

  while let Some((Reverse(c), x, y)) = h.pop() {
    let mut mv = |c: u64, x: usize, y: usize| {
      if !kabe[x][y] {
        if kabe[x][y] == false {
          if d[x][y] > c {
            d[x][y] = c;
            h.push((Reverse(c), x, y));
          }
        }
      }
    };
    mv(c, x - 1, y);
    mv(c, x + 1, y);
    mv(c, x, y - 1);
    mv(c, x, y + 1);
    let c = c + 1;
    mv(c, x - 2, y - 2);
    mv(c, x - 2, y - 1);
    mv(c, x - 2, y);
    mv(c, x - 2, y + 1);
    mv(c, x - 2, y + 2);
    mv(c, x - 1, y - 2);
    mv(c, x - 1, y - 1);
    mv(c, x - 1, y + 1);
    mv(c, x - 1, y + 2);
    mv(c, x, y - 2);
    mv(c, x, y + 2);
    mv(c, x + 1, y - 2);
    mv(c, x + 1, y - 1);
    mv(c, x + 1, y + 1);
    mv(c, x + 1, y + 2);
    mv(c, x + 2, y - 2);
    mv(c, x + 2, y - 1);
    mv(c, x + 2, y);
    mv(c, x + 2, y + 1);
    mv(c, x + 2, y + 2);
  }
  let ans = d[D.0][D.1];
  if ans < std::u64::MAX {
    println!("{}", ans);
  } else {
    println!("-1");
  }
}


Measured memory_bytes: 17332
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？
bool f(string S) {
    string SS = S;
    reverse(SS.begin(), SS.end());
    return SS == S;
}
int main () {
    string S;
    cin >> S;
    string T = "", U = "";
    int N = S.size();
    for (int i = 0; i < (N-1)/2; i++) {
        T += S[i];
    }
    for (int i = (N+3)/2-1; i < N; i++) {
        U += S[i];
    }
    if (f(S) && f(T) && f(U)) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
   string str,s;cin>>str>>s;
   cout<<s<<str<<endl;
return 0;
}


Measured memory_bytes: 4992
# Author: cr4zjh0bp
# Created: Thu Mar 12 19:34:40 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

m = nsn(3)

print(m[0][0] + m[1][1] + m[2][2])

Measured memory_bytes: 3064
N = int(input())
S = input()
d = {'R': 0, 'G': 0, 'B': 0}
for i in range(N):
    d[S[i]]+=1
tot = d['R']*d['G']*d['B']

counter = 0
for i in range(N):
    width = 1
    tmp = i+2
    while tmp < N:
        if S[i] != S[i+width] and S[i] != S[i+2*width] and S[i+width] != S[i+2*width]:
            counter += 1
        width += 1
        tmp = i + 2 * width
print(tot-counter)

Measured memory_bytes: 73316
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int X;
    cin >> X;
    if (X == 3 || X == 5 || X == 7)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def solve():
    n, a, b, c, d = map(int, input().split())
    s = input()
    if c<d:
        for i in range(a-1, d-1):
            if s[i]=='#' and s[i+1]=='#':
                return False
        if s[c-1]=='#' or s[d-1]=='#':
            return False
        return True
    elif c==d:
        return False
    else:
        flag = False
        for i in range(a-1, c-1):
            if s[i]=='#' and s[i+1]=='#':
                return False
            if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.' and b-1<=i<=d-1:
                flag = True
        if s[c-1]=='#' or s[d-1]=='#':
            return False
        if not flag:
            return False
    return True
if solve():
    print('Yes')
else:
    print('No')

Measured memory_bytes: 40432
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    int S[12][12];
    for(int i = 0; i <= 9; i++) {
        for(int j = 0; j <= 9; j++){
            S[i][j] = 0;
        }
    }
    for(int i = 1; i <= N; i++) {
        int value = i;
        int a[6];
        int k = 0;
        while(value/=10 > 0) {
            a[k] = (value % 10); value /= 10;
            k++;
        }
        int sentou = a[0];
        int matubi = a[k-1];
        S[sentou][matubi]++;
    }    
    ll ans = 0;
    for(int i = 0; i <= 9; i++) {
        for(int j = 0; j <= 9; j++){
            ans += S[i][j] * S[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def solve():
    N = int(input())
    S = input()

    # print(N, S)

    x, ans = 0, 0
    for i in range(N):
        f = S[i]
        if f == "I":
            x += 1
        else:
            x -= 1
        ans = max(ans, x)

    return ans


if __name__ == '__main__':
    res = solve()
    print(res)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    if(n%2==1)cout << b[n/2]-a[n/2]+1 << endl;
    else cout << b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1 << endl;
}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

ll manhdist(pair<ll, ll> xy0, pair<ll, ll> xy1)
{
  ll x0 = xy0.first, y0 = xy0.second;
  ll x1 = xy1.first, y1 = xy1.second;
  return abs(x1 - x0) + abs(y1 - y0);
}

int main()
{
  ll H, W, D;
  cin >> H >> W >> D;
  vector<pair<ll, ll>> P(H * W);
  for (ll i = 0; i < H; i++)
  {
    for (ll j = 0; j < W; j++)
    {
      ll A;
      cin >> A;
      A--;
      P.at(A) = make_pair(i, j);
    }
  }

  vector<ll> acd(H * W, 0);
  for (ll i = D; i < H * W; i++)
  {
    acd.at(i) = acd.at(i - D) + manhdist(P.at(i), P.at(i - D));
  }

  ll Q;
  cin >> Q;
  for (ll i = 0; i < Q; i++)
  {
    ll L, R;
    cin >> L >> R;
    L--, R--;

    ll ans = acd.at(R) - acd.at(L);
    cout << ans << endl;
  }
}

Measured memory_bytes: 3200
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
a.sort()
for i in range(n):
    ai = a[i]
    if i==n-1:
        if ai==x:
            ans+=1
        else:
            pass
        break
    if ai<=x:
        ans+=1
        x-=ai
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn =2e5+5;
const int mod=10000019;
const int inf=0x3f3f3f;
ll a[maxn];
ll b[maxn];
int main()
{
    ll n,d;
    scanf("%lld%lld",&n,&d);
    for(int i=0; i<n; i++)
        scanf("%lld%lld",&a[i],&b[i]);
    ll t=d*d;
    int num=0;
    for(int i=0; i<n; i++)
        if(a[i]*a[i]+b[i]*b[i]<=t)num++;
    printf("%d\n",num);
    return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  int ans = n/3;

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


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
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> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  vector<ll> res;
  rep(i, n) {
    ll sum = 0;
    FOR(j, i, n) {
      sum += a[j];
      res.push_back(sum);
    }
  }
  ll ans = 0;
  repr(i, 50) {
    vector<ll> nxt;
    rep(j, res.size()) {
      if (res[j] & (1LL << i)) {
        nxt.push_back(res[j]);
      }
    }
    if (nxt.size() >= k) {
      ans += (1LL << i);
      res = nxt;
    }
  }
  cout << ans << '\n';



  
  return 0;
}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 4000;
double a, b, h, m;
P<double, double> f(double l, double t){
  t = t/180*acos(-1);
  return mp(l*cos(t), l*sin(t));
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b >> h >> m;
  P<double, double> c = f(a, h*30+m*0.5);
  P<double, double> d = f(b, m*6);
  double ans = sqrt((c.fi-d.fi)*(c.fi-d.fi) + (c.se-d.se)*(c.se-d.se));
  printf("%.12f\n", ans);
}

Measured memory_bytes: 4076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main(){
    ll n,k;
    cin>>n>>k;
    ll dp[k+1],ans=0;
    for(ll i=k;i>=1;i--){
        dp[i]=power(k/i,n);
        for(ll j=2*i;j<=k;j+=i) dp[i]-=dp[j];
        ans=(ans+i*dp[i]%mod)%mod;
    }
    cout<<(ans+mod)%mod;
    return 0;
}


Measured memory_bytes: 4396
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Measured memory_bytes: 9492
a,b,k = map(int, raw_input().split())
li = [i for i in xrange(a,b+1)] if (b-a+1)/2 < float(k) else [i for i in xrange(a,a+k)]+[i for i in xrange(b-k+1,b+1)]
for i in sorted(list(set(li))):
    print i



Measured memory_bytes: 2568
#include <stdio.h>

char s[5001], t[6];
int sl, tl;
int k, i, iM, j;
char c[6];
inline int strin() {
  i = 0;
  iM = sl - tl;
  while (i <= iM) {
    for (j = 0; j < tl; ++j) {
      if (s[i + j] != t[j]) goto continue_while;
    }
    return 1;
  continue_while:
    ++i;
  }
  return 0;
}
void solve() {
  if (!strin()) return;
  if (k == 0) {
    printf("%s\n", t);
    k = -1;
    return;
  }
  --k;
  ++tl;
  for (c[tl] = 'a'; c[tl] <= 'z'; ++c[tl]) {
    t[tl - 1] = c[tl];
    solve();
    if (k < 0) return;
  }
  --tl;
  t[tl] = 0;
}
int main() {
  scanf("%s", s);
  sl = 5000;
  while (sl - i > 1) {
    j = (sl + i) >> 1;
    if (s[j]) {
      i = j;
    } else {
      sl = j;
    }
  }
  scanf("%d", &k);
  solve();
}


Measured memory_bytes: 1668
#include<stdio.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d", &n);
    char w[102][11];
    int i;
    for (i = 0; i < n; i++)
        scanf("%s", w[i]);
    for (i = 0; i < n - 1; i++)
        if (w[i][strlen(w[i]) - 1] != w[i + 1][0])
        {
            printf("No\n");
            return 0;
        }
    int j;
    for(i=1;i<n;i++)
        for(j=0;j<i;j++)
            if (strcmp(w[i], w[j]) == 0)
            {
                printf("No\n");
                return 0;
            }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
string a[10010];
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	  cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++)
	  cout<<a[i];
	cout<<endl;
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;

int main() {
	int a,b;
	cin >> a >> b;
	int res = max(a + b, a - b);
	res = max(res, a*b);
	pv(res)
	return(0);
}

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

#define ll long long
#define NIL 0
#define INF 1e18
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n;
vi *g;
vb sn;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    int h[n][3];
    rep(i,n) rep(j,3) cin>>h[i][j];
    vvl dp(n,vl(3,0));
    
    rep(i,3) dp[0][i] = h[0][i];
    REP(i,n-1) {
        rep(j,3) {
            rep(k,3) {
                if(k==j)continue;
                dp[i][j] = max(dp[i][j], dp[i-1][k]+h[i][j]);
            }
        }
    }
    ll res = 0;
    rep(i,3) res= max(res, dp[n-1][i]);
    cout<<res<<endl;
    
}
    
    
    

Measured memory_bytes: 9784
#include <iostream>

using namespace std;

int main(){
	int a;
	int b;
	cin >> a;
	cin >> b;
	if(a*b<=0){
		if(0<b){
			cout << a+b;
		}else{
			cout << a-b;
		}
	}else{
		if(a==1||b==1){
			cout << a+b;
		}else{
			cout << a*b;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int S = sc.nextInt();
		int h = S / 3600;
		int m = S % 3600 / 60;
		int s = S % 3600 % 60;
		
		System.out.println(h + ":" + m  + ":" + s);
		
		sc.close();
	}
}


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

#define int int64_t

const int INF = 1e18 + 13;

void ckmax (int &a, int x) {
	a = max(a, x);
}

void ckmin (int &a, int x) {
	a = min(a, x);
}

signed main () {
	int n, m, s, amax = -INF;
	cin >> n >> m >> s;
	vector < vector < pair < int, pair < int, int > > > > g(n + 1);
	for (int i = 0; i < m; ++i) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		g[u].push_back(make_pair(v, make_pair(a, b)));
		g[v].push_back(make_pair(u, make_pair(a, b)));
		ckmax(amax, a);
	}
	vector < pair < int, int > > xchange(n + 1);
	for (int i = 1; i <= n; ++i)	
		cin >> xchange[i].first >> xchange[i].second;
	if (s > (n - 1) * amax)
		s = (n - 1) * amax;
	vector < vector < int > > d(n + 1, vector < int > ((n - 1) * amax + 1, INF));
	set < pair < int, pair < int, int > > > dset;
	d[1][s] = 0;
	dset.insert(make_pair(d[1][s], make_pair(1, s)));
	while (!dset.empty()) {
		int u = (dset.begin() -> second).first, c = (dset.begin() -> second).second;
		dset.erase(dset.begin());
		if (d[u][c] + xchange[u].second < d[u][min((n - 1) * amax, c + xchange[u].first)]) {
			dset.erase(make_pair(d[u][min((n - 1) * amax, c + xchange[u].first)], make_pair(u, min((n - 1) * amax, c + xchange[u].first))));
			d[u][min((n - 1) * amax, c + xchange[u].first)] = d[u][c] + xchange[u].second;
			dset.insert(make_pair(d[u][min((n - 1) * amax, c + xchange[u].first)], make_pair(u, min((n - 1) * amax, c + xchange[u].first))));
		}
		for (auto neigh: g[u]) {
			int v = neigh.first, w = neigh.second.first, t = neigh.second.second;
			if (c >= w && d[u][c] + t < d[v][c - w]) {
				dset.erase(make_pair(d[v][c - w], make_pair(v, c - w)));
				d[v][c - w] = d[u][c] + t;
				dset.insert(make_pair(d[v][c - w], make_pair(v, c - w)));
			}
		}
	}
	for (int i = 2; i <= n; ++i) {
		int ans = INF;
		for (int j = 0; j <= (n - 1) * amax; ++j)
			ckmin(ans, d[i][j]);
		cout << ans << '\n';
	}
}


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

using namespace std;

const int N = (int)1e5 + 5;

int son[N];
vector <pair<int, int> > es[N];

long long dfs(const int& u, const int& f) {
  long long ret = 0;
  son[u] = 1;
  for (auto i : es[u]) {
    int v = i.first;
    if (v == f)
      continue;
    ret += dfs(v, u);
    son[u] += son[v];
    ret += (long long)i.second * son[v];
  }
  return ret;
}

int getRoot(const int& n) {
  int r = 1, f = -1;
  while (true) {
    int newR = -1;
    for (auto i : es[r]) {
      int v = i.first;
      if (v == f)
        continue;
      if (son[v] >= (n + 1) / 2) {
        newR = v;
        break;
      }
    }
    if (newR == -1)
      break;
    f = r;
    r = newR;
  }
  return r;
}

int main()
{
  ios::sync_with_stdio(false);
  int n, a, b, c;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b >> c;
    es[a].emplace_back(b, c);
    es[b].emplace_back(a, c);
  }
  dfs(1, -1);
  int r = getRoot(n);
  long long ans = 0;
  if ((n & 1) || son[r] != n / 2) {
    int minE = (int)1e9;
    for (auto i : es[r]) {
      ans += 2LL * dfs(i.first, r);
      ans += 2LL * i.second * son[i.first];
      minE = min(minE, i.second);
    }
    ans -= minE;
  } else {
    int rr, e;
    for (auto i : es[r]) {
      if (son[i.first] >= n / 2) {
        rr = i.first;
        e = i.second;
        break;
      }
    }
    ans = (long long)e * n - e;
    ans += 2 * dfs(r, rr);
    ans += 2 * dfs(rr, r);
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

const int INF = 1e9;
char s[10];

int main(){
	int res = 0;
	char lt = 0;
	
	for(int i = 0; ; i++){
		if(i % 2 == 0){
			int x;
			scanf("%d", &x);
			
			if(i != 0){
				if(lt == '+')
				res += x;
				else if(lt == '-')
				res -= x;
				else if(lt == '*')
				res *= x;
				else if(lt == '/')
				res /= x;
			}
			else
			res = x;
		}
		else{
			scanf("%s", s);
			lt = s[0];
			
			if(lt == '=') return 0 * printf("%d\n", res); 
		}
	}
}



Measured memory_bytes: 3232
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 3e5 + 10;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl
struct L
{
    int l,r,len;
    bool operator < (const L &y)
    {
        return len<y.len;
    }
}line[maxn];
int ans[maxn];
struct T
{
    int l,r,mid;
    int add;
}tree[maxn<<2];
void down(int rt)
{
    if(tree[rt].add)
    {
        int tmp=tree[rt].add;
        tree[rt<<1].add+=tmp;
        tree[rt<<1|1].add+=tmp;
        tree[rt].add=0;
    }
}
void build(int rt,int l,int r)
{
    tree[rt].l=l;
    tree[rt].r=r;
    tree[rt].add=0;
    if(l==r) return ;
    int mid=tree[rt].mid=l+r>>1;
    build(rt<<1,l,mid);
    build(rt<<1|1,mid+1,r);
}
void update(int rt,int l,int r,int val)
{
    if(tree[rt].l>r||tree[rt].r<l) return;
    if(tree[rt].l>=l&&tree[rt].r<=r)
    {
        tree[rt].add+=val;
        return ;
    }
    down(rt);
    if(tree[rt].mid>=l) update(rt<<1,l,r,val);
    if(tree[rt].mid<r) update(rt<<1|1,l,r,val);
}
int query(int rt,int pos)
{
    if(tree[rt].l==tree[rt].r) return tree[rt].add;
    down(rt);
    if(tree[rt].mid>=pos) return query(rt<<1,pos);
    else return query(rt<<1|1,pos);
}
int main() {
    //freopen(".in", "r", stdin);
    int n,m;scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&line[i].l,&line[i].r);
        line[i].len=line[i].r-line[i].l+1;
    }
    build(1,1,m);
    sort(line+1,line+1+n);
    for(int i=1;i<=n;i++) update(1,line[i].l,line[i].r,1);
    int pos=n;
    for(int i=m;i>=1;i--)
    {
        while(pos>=1&&line[pos].len>=i)
        {
            update(1,line[pos].l,line[pos].r,-1);
            pos--;
        }
        ans[i]+=(n-pos);
        for(int j=i;j<=m;j+=i) ans[i]+=query(1,j);
    }
    for(int i=1;i<=m;i++) printf("%d\n",ans[i]);
    return 0;
}



Measured memory_bytes: 12032
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU
import Data.Bool (bool)

main :: IO ()
main = do
  [a, b, q] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  contents <- unsafeTextToVectorInt <$> T.getContents :: IO (VU.Vector Int)
  let
    ss = VU.slice 0 a contents :: VU.Vector Int
    ts = VU.slice a b contents :: VU.Vector Int
    xs = VU.slice (a + b) q contents :: VU.Vector Int
    dist :: Int -> Int
    dist x = minimum [x - min sL tL, min (x - sL) (tR - x) + (tR - sL), min (x - tL) (sR - x) + (sR - tL), max sR tR - x]
      where
        (sL, sR) = case binaryMaxIndex (< x) ss of
                     Nothing -> (-10 ^ 11, ss VU.! 0)
                     Just i  -> (ss VU.! i, bool (10 ^ 11) (ss VU.! succ i) (i < pred a))
        (tL, tR) = case binaryMaxIndex (< x) ts of
                     Nothing -> (-10 ^ 11, ts VU.! 0)
                     Just i  -> (ts VU.! i, bool (10 ^ 11) (ts VU.! succ i) (i < pred b))
  VU.mapM_ (print . dist) $ xs

binaryMaxIndex :: VU.Unbox a => (a -> Bool) -> VU.Vector a -> Maybe Int
binaryMaxIndex p = binaryMaxInt <$> ((p .) . (VU.!)) <*> (,) 0 . pred . VU.length
{-# INLINE binaryMaxIndex #-}

binaryMaxInt :: (Int -> Bool) -> (Int, Int) -> Maybe Int
binaryMaxInt p = check
  where
    check :: (Int, Int) -> Maybe Int
    check ij@(i, _) | not (p i) = Nothing
                    | otherwise = Just $ unsafeBinaryMaxInt p ij
{-# INLINE binaryMaxInt #-}

unsafeBinaryMaxInt :: (Int -> Bool) -> (Int, Int) -> Int
unsafeBinaryMaxInt p = check
  where
    check :: (Int, Int) -> Int
    check ij@(_, j) | p j       = j
                    | otherwise = search ij
    search :: (Int, Int) -> Int
    search = fst . until ((==) <$> fst <*> pred . snd) halve
      where
        halve :: (Int, Int) -> (Int, Int)
        halve (i, j) | p m       = (m, j)
                     | otherwise = (i, m)
          where
            m = (i + j) `div` 2
{-# INLINE unsafeBinaryMaxInt #-}

unsafeTextToVectorInt :: T.Text -> VU.Vector Int
unsafeTextToVectorInt = VU.unfoldr next
  where
    next :: T.Text -> Maybe (Int, T.Text)
    next s | T.null s  = Nothing
           | otherwise = Just . either undefined (T.stripStart <$>) . T.signed T.decimal $ s
{-# INLINE unsafeTextToVectorInt #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 26492
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

int main(){
	int n,k;
	int c[2002],g[2002];
	
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d",&c[i],&g[i]);
	}
	
	int dp[12][2002] = {};
	
	rep1(i,10){
		
		vector<int> vec;
		rep(j,n){
			if(g[j] == i){
				vec.pb(c[j]);
			}
		}
		sor(vec);
		rev(vec);
		rep(j,vec.size()){
			if(j > 0){
				vec[j] += vec[j-1];
			}
		}
		rep(j,vec.size()){
			vec[j] += j * (j+1);
		}
		
		/*printf("%d:\n",i);
		rep(j,vec.size()){
			printf("%d ",vec[j]);
		}
		puts("");*/
		
		rep(j,n+1){
			dp[i][j] = dp[i-1][j];
			rep(l,min((int)vec.size(),j)){
				dp[i][j] = max ( dp[i][j] , dp[i-1][j-l-1] + vec[l] );
			}
		}
	}
	
	/*rep1(i,10){
		rep(j,n+1){
			printf("%d ",dp[i][j]);
		}
		puts("");
	}*/
	
	printf("%d\n",dp[10][k]);
}

Measured memory_bytes: 1324
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int A, B;
    cin >> A >> B;

    if (A == 1 && B == 1) {
        cout << "Draw" << endl;
    }
    else if (A == 1) {
        cout << "Alice" << endl;
    }
    else if (B == 1) {
        cout << "Bob" << endl;
    }
    else {
        cout << (A > B ? "Alice" : (A < B ? "Bob" : "Draw")) << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

const int MAXN = 10;

int N, M;
char mat[MAXN][MAXN];

int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++)
    scanf("%s", mat[i]);
  
  int pos = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < pos; j++)
      if (mat[i][j] == '#') {
        puts("Impossible");
        return 0;
      }
    if (mat[i][pos] !=  '#') {
      puts("Impossible");
      return 0;
    }
    for (; pos < M && mat[i][pos] == '#'; pos++);
    pos--;
    for (int j = pos + 1; j < M; j++)
      if (mat[i][j] == '#') {
        puts("Impossible");
        return 0;
      }
  }
  
  puts("Possible");
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && b==c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N (5009)
#define MOD (1000000007)
using namespace std;

int n,m,f[N][N];
char s[N];

int Qpow(int a,int b)
{
	int ans=1;
	while (b)
	{
		if (b&1) ans=1ll*ans*a%MOD;
		a=1ll*a*a%MOD; b>>=1;
	}
	return ans;
}

int main()
{
	cin>>n>>s;
	m=strlen(s);
	f[0][0]=1;
	for (int i=0; i<=n; ++i)
		for (int j=0; j<=i; ++j)
		{
			(f[i+1][j+1]+=f[i][j]*2%MOD)%=MOD;
			(f[i+1][max(j-1,0)]+=f[i][j])%=MOD;
		}
	cout<<1ll*f[n][m]*Qpow(Qpow(2,m),MOD-2)%MOD;;
}

Measured memory_bytes: 96512
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, w = 0, ans = 0, count = 0;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> n;
  vlli d(n);
  rep(i, 0, n)
  {
    cin >> d[i];
  }
  SORTR(d);
  rep(i, 1, n)
  {
    ans += d[i / 2];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4728
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double dot(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double det(const P &a, const P &b) {
	return (conj(a) * b).imag();
}



int contains(const vector<P> &ps, P q) {
	int n = ps.size();
	int res = -1;
	
	rep (i, n) {
		P a = ps[i] - q, b = ps[(i + 1) % n] - q;
		if(a.imag() > b.imag()) swap(a, b);
		if(a.imag() < EPS && b.imag() > EPS && det(a, b) > EPS) res = -res;
		if(fabs(det(a, b)) < EPS && dot(a, b) < EPS) return 0;
	}
	return res;
}

int main(){
	for (double x1, y1, x2, y2, x3, y3, xp, yp; cin>> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp; ) {
		vector<P> ps;
		ps.pb(P(x1, y1));
		ps.pb(P(x2, y2));
		ps.pb(P(x3, y3));
		P q(xp, yp);
		cout << (contains(ps, q) == 1 ? "YES" : "NO" ) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }

int main(){
    ll A, B, C;
    cin >> A >> B >> C;
    ll res = 1e18;
    REP(ab, 30) {
        REP(bc, 30) {
            REP(ca, 30) {
                REP(a, 30) {
                    REP(b, 30) {
                        REP(c, 30) {
                            ll an = A + ab + ca + a*2;
                            ll bn = B + ab + bc + b*2;
                            ll cn = C + bc + ca + c*2;
                            if (an==bn && an==cn) chmin(res, ab+bc+ca+a+b+c);
                        }
                    }
                }
            }
        }
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long calc(long long x){
    
    long long result = 0;
    
    long long start = (x/4) * 4;
    
    for (long long i = start; i <= x; i++) result ^= i;
    
    return result;
}

int main(){
    long long a, b;
    cin >> a >> b;
    
    long long ans = calc(b) ^ calc(a-1);
    cout << ans << endl;
    return 0;
}








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

Measured memory_bytes: 1024
//
//  main.cpp
//  Exercise
//
//

#include <algorithm>
#include <iostream>
#include <limits>
#include <math.h>
#include <tuple>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "string.h"
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <array>
#include <set>

using namespace std;

using int_t = long long;

int main() {
    int x;
    scanf("%d", &x);
    
    int m = 1;
    for (int i = 2; i <= x; i++) {
        for (int p = 2; true ;p++) {
            int n = pow(i, p);
            if (n <= x) {
                m = max(m, n);
            } else {
                break;
            }
        }
    }
    
    printf("%d", m);
    
//    unordered_map<int, int> facts;
//    facts.reserve(100);
//    int i = 2;
//    while (i <= x) {
//        if (x % i == 0) {
//            auto it = facts.find(i);
//            if (it == facts.end()) {
//                facts[i] = 1;
//            } else {
//                facts[i] = facts[i] + 1;
//            }
//            x /= i;
//        } else {
//            i++;
//        }
//    }
    
    printf("\n");
    return 0;
}


Measured memory_bytes: 384
s=input()
n=len(s)
#dp[i]:=s[0]~s[i]までの時の最大分割数
dp=[0]*(n)
dp[0]=1
if n==1:
    print(1)
    exit()
if n==2:
    if s[0]==s[1]:
        print(1)
    else:
        print(2)
    exit()
if s[0]==s[1]:
    dp[1]=1
    dp[2]=2
else:
    dp[1]=2
    if s[2]!=s[1]:
        dp[2]=3
    else:
        dp[2]=2
for i in range(3,n):
    if s[i]!=s[i-1]:
        dp[i]=dp[i-1]+1
    else:
        dp[i]=dp[i-3]+2
print(dp[n-1])

Measured memory_bytes: 11240
#include<stdio.h>
typedef struct Node{
  int parent,left,right;
}Node;  
Node T[100000];
int n,D[100000];
void print(int p){
  int i,s;
  printf("node %d: parent = %d, depth = %d, ", p, T[p].parent, D[p]);
  if(T[p].parent == -1)
    printf("root, [");
  else if(T[p].left == -1)
    printf("leaf, [");
 else
    printf("internal node, [");
  s = T[p].left;
  for(i = 0; s != -1; i++, s = T[s].right){
    if(i)
      printf(", "); 
    printf("%d", s);
  } 
  printf("]\n");
} 
int depth(int x, int y){
  D[x] = y;
  if(T[x].right != -1)
    depth(T[x].right, y);
  if(T[x].left != -1)
    depth(T[x].left, y+1);
}
int main(){
  int a,b,c,left,right,i,j;
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    T[i].parent = T[i].left = T[i].right = -1;   
  for(i = 0; i < n; i++){
    scanf("%d%d", &a, &b);    
    for(j = 0; j < b; j++){
      scanf("%d", &c); 
      if(j == 0)
	T[a].left = c;    
      else
	T[left].right = c;  
      left = c;
      T[c].parent = a;
    }
  }
  for(i = 0; i < n; i++){
    if(T[i].parent == -1)
      right = i;
  }
  depth(right, 0);
  for(i = 0; i < n; i++)
    print(i);
  return 0;
}



Measured memory_bytes: 6368
/* 

И пусть меня погубит, то к чему я
Бегу, не жалея ног.
И если мне суждено сгореть на восходе,
Я буду идти вперёд.

*/

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()

using namespace std;

const bool dbg_flg = 0;
#define debug(x) if (dbg_flg) cerr << #x << ' ' << x << '\n'
#define debug_pair(x) if (dbg_flg) cerr << #x << ' ' << x.F << ' ' << x.S << '\n' 

const int inf = 1e9 + 7;
const int MAXN = 1e5 + 5;


void solve() {
	string s;

	cin >> s;

	for (int i = 1; i <= sz(s); i++) {
		cout << 'x';
	}

}

int main() {
	
	//~ freopen(".in", "r", stdin);
	//~ freopen(".out", "w", stdout);
	
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
 
int main(void)
{
  int n = 0;
  std::cin >> n;
  
  int buffer = 0;
  for(int count = 0; n > count; ++count)
  {
    std::cin >> buffer;
    if(0 != buffer % 2)
    {
      continue;
    }
    if(0 != buffer % 3 && 0 != buffer % 5)
    {
      std::cout << "DENIED" << std::endl;
      return 0;
    }
  }
  std::cout << "APPROVED" << std::endl;
}

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

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

#ifdef DEBUG
    #define cek(x) cout<<x
#else
    #define cek(x) if(false){}
#endif // DEBUG

#define fi first
#define se second
#define INF 1000000000
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define PI acos(-1.0)
#define pb push_back
#define TC() while(tc--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORN(i,n) for(int i=0;i<=n;i++)
#define REP(i,a,b,c) for(int i=a;i<b;i+=c)
#define REPN(i,a,b,c) for(int i=a;i<=b;i+=c)
#define reset(a,b) memset(a,b,sizeof(a))
#define sc(x) scanf("%d",&x)

vi adjList[100010];
int col[100010];

int main(void){
	int n,m;
	sc(n);sc(m);
	FOR(i,m){
		int fr, to;
		sc(fr);sc(to);
		adjList[fr].pb(to);
		adjList[to].pb(fr);
	}

	int solo = 0;
	int bip, nobip;
	bip = nobip = 0;
	reset(col, -1);

	for(int i = 1;i<=n;i++){
		if(col[i] != -1)continue;
		if(adjList[i].empty()){
			solo++;
			continue;
		}

		queue<int> q;
		q.push(i);
		col[i] = 0;
		bool valid = true;
		while(!q.empty()){
			int node = q.front();
			q.pop();
			for(int nxt : adjList[node]){
				if(col[nxt] == -1){
					q.push(nxt);
					col[nxt] = 1 ^ col[node];
				}else{
					if(col[nxt] == col[node])valid = false;
				}
			}
		}
		if(valid)bip++;
		else nobip++;
	}
	// cout << bip << " " << nobip << endl;
	ll tot = 0;
	tot += 2LL * n * solo - (1LL * solo * solo);
	tot += 2LL * bip * bip;
	tot += 2LL * bip * nobip;
	tot += 1LL * nobip * nobip;

	cout << tot << "\n";

    return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////

int main()
{
    string S, T;
    io >> S >> T;

    int ans = 9999;
    for (size_t i = 0; i <= S.size() - T.size(); i++)
    {
        int ans_i = 0;
        for (size_t j = 0; j < T.size(); j++)
        {
            if (S[i+j] != T[j]) ans_i++;
        }
        ans = min(ans, ans_i);
    }
    cout << ans << BR;
}

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

using namespace std;

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    long long n;

    cin >> n;

    long long r;

    cin >> r;

    if(n<10)

        cout << r + (100*(10-n)) << '\n';

    else

        cout << r << '\n';

    return 0;

}



Measured memory_bytes: 3592