akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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 (b<a) { a=b; return 1; } return 0; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    //lでソートして二分,rでソートして二分，一番デカイ範囲とそれ以外の3つのmax
    ll ans=0;
    int n;cin>>n;
    vector<pair<ll,ll>> v,vv;
    rep(i,n){
        ll l,r;cin>>l>>r;
        v.push_back(make_pair(l,r));
        vv.push_back(make_pair(r,l));
    }
    sort(ALL(v));sort(ALL(vv));
    
    {
        vector<ll> lmax(n),rmin(n);
        lmax[0]=v[0].first;rmin[0]=v[0].second;
        for(int i=1;i<n;i++){
            lmax[i]=max(lmax[i-1],v[i].first);
            rmin[i]=min(rmin[i-1],v[i].second);
        }
        ll L=0,R=LINF;
        for(int i=n-1;i>0;i--){
            L=max(L,v[i].first);
            R=min(R,v[i].second);
            ll con1=max(0ll,R-L+1);
            ll con2=max(0ll,rmin[i-1]-lmax[i-1]+1);
            // cout<<con1<<' '<<con2<<' ';
            // cout<<con1+con2<<endl;
            chmax(ans,con1+con2);
        }
    }
    {
        vector<ll> lmax(n),rmin(n);
        lmax[0]=vv[0].second;rmin[0]=vv[0].first;
        for(int i=1;i<n;i++){
            lmax[i]=max(lmax[i-1],vv[i].second);
            rmin[i]=min(rmin[i-1],vv[i].first);
        }
        ll L=0,R=LINF;
        for(int i=n-1;i>0;i--){
            L=max(L,vv[i].second);
            R=min(R,vv[i].first);
            ll con1=max(0ll,R-L+1);
            ll con2=max(0ll,rmin[i-1]-lmax[i-1]+1);
            // cout<<con1<<' '<<con2<<' ';
            // cout<<con1+con2<<endl;
            chmax(ans,con1+con2);
        }
    }
    //一番デカイのだけとってあとは合わせるだけ
    ll con1=0;
    int bigi;
    rep(i,n){
        if(chmax(con1,v[i].second-v[i].first+1)){
            bigi=i;
        }
    }
    ll con2=0;
    {
        ll L=0,R=LINF;
        rep(i,n){
            if(i==bigi) continue;
            L=max(L,v[i].first);
            R=min(R,v[i].second);
        }
        con2=max(0ll,R-L+1);
    }
    chmax(ans,con1+con2);

    cout<<ans<<endl;
    return 0;
}
/*
4
1 10
2 3
4 11
9 11
*/


Measured memory_bytes: 5472
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    ll n, k; cin >> n >> k;
    ll a[n];
    rep(i, n){
        cin >> a[i];
    }

    sort(a, a + n);
    cout << accumulate(a, a + k, 0LL) << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <assert.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define F first
#define S second
#define qq queue
#define dq deque
#define vc vector
#define INF ((int)(2e9))
#define LINF ((int)(1e18))
// NO "fir0x()"!
#define pb push_back
#define mp make_pair
#define _tp template
#define _tyn typename
#define pf push_front
#define itor iterator
#define mp make_pair
#define sint short int
#define ull unsigned long long
#define pq priority_queue
#define pii pair<int,int>
#define uint unsigned int
#define ll long long
#define B cout << "BreakPoint\n";
#define read(_nowans) scanf("%d",&_nowans)
#define ms(_data) memset(_data,0,sizeof(_data))
#define fin(_filename) freopen(_filename,"r",stdin)
#define fout(_filename) freopen(_filename,"w",stdout)
#define read2(_nowans1,_nowans2) scanf("%d %d",&_nowans1,&_nowans2)
#define msn(_data,_nowans) memset(_data,_nowans,sizeof(_data))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define read3(_nowans1,_nowans2,_nowans3) scanf("%d %d %d",&_nowans1,&_nowans2,&_nowans3)
using namespace std;
_tp<_tyn T>void mymax( T &_a , T _b ){ if( _a < _b ) _a = _b; }
_tp<_tyn T>void mymin( T &_a , T _b ){ if( _a > _b ) _a = _b; }
void print( int _x ){ printf("%d\n",_x); }
_tp<_tyn T>void print( T _data[] , int _size ){
	for( int i = 1 ; i <= _size ; i++ )
		cout << _data[i] << " ";
	cout << endl;
}

int n , k;
bool cannot[12];

bool ok( int x ){
	if( !x )
		return cannot[0] ^ 1;
	while( x ){
		if( cannot[ x % 10 ] ) return 0;
		x /= 10;
	}
	return 1;
}
int main(){
	//fin( "C.txt" );
	ms( cannot );

	read2( n , k );
	for( int i = 1 ; i <= k ; i++ ){
		int x;
		read( x );
		cannot[x] = 1;
	}

	int ans = n;
	while( !ok( ans ) ) ans++;

	print( ans );

	return 0;
}


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

using namespace std;
using Integer = long long;

Integer min_i (Integer H, Integer W) {
  return min(H, W);
}

Integer min_t (double H, double W) {
  Integer h1 =  ceil( W * H / ( W + floor(W / 2) ) );
  Integer h2 = floor( W * H / ( W +  ceil(W / 2) ) );
  return min(
    h1 * ceil(W / 2) - W * (H - h1),
    W * (H - h2) - h2 * floor(W / 2)
  );
}

int main () {
  Integer H, W;
  cin >> H >> W;

  Integer ans = (H % 3 == 0 || W % 3 == 0)
    ? 0
    : min(min_i(H, W), min(min_t(H, W), min_t(W, H)));

  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, tmp;
    cin >> a >> b;
    while(a!=0){
        if(a>=b){
            tmp = b;
            b = a;
            a = tmp;
        }
        tmp = a;
        a = b % a;
        b = tmp;
    }
    cout << b << endl;
}


Measured memory_bytes: 3096
N = int(input())
A = list(map(int,input().split()))

a = list(set(A))

ans = "No"

if a == [0]:
    ans = "Yes"
elif len(a) == 2:
    if N % 3 == 0 and A.count(0) == N//3:
        ans = "Yes"
elif len(a) == 3:
    if a[0] ^ a[1] == a[2] and N % 3 == 0 and A.count(a[0]) == A.count(a[1]) == N//3:
        ans = "Yes"

print(ans)

Measured memory_bytes: 14116
use proconio::input;
use std::collections::HashMap;

fn main() {
  input! {
    n: usize,
    mut vals: [usize;n]
  }
  vals.sort();
  
  let mut total = 0;
  for i in 0..vals.len() {
    for ii in i+1..vals.len() {
      for iii in ii+1..vals.len() {
        if vals[i] + vals[ii] <= vals[iii]
        || vals[i] == vals[ii]
        || vals[ii] == vals[iii]
        || vals[iii] == vals[i]
        {
          continue
        }
        total += 1;
      }
    }
  }
  
  println!("{}", total);
}

Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int dx[]={1,2,3,-1,-2,-3,0,0,0,0,0,0};
int dy[]={0,0,0,0,0,0,1,2,3,-1,-2,-3};
int main(){
  int n;
  cin>>n;
  r(pp,n){
    string s[8];
    r(i,8)cin>>s[i];
    int x1,y1;
    cin>>x1>>y1;x1--;y1--;
    int a[8][8]={};
    a[y1][x1]++;
    r(o,10)r(i,8)r(j,8){
      if(a[i][j]&&s[i][j]=='1')
        r(k,12){
          int x=j+dx[k],y=i+dy[k];
          if(x>=0&&y>=0&&y<8&&x<8)
            a[y][x]=1;
        }
    }
    
    r(i,8)r(j,8)if(a[i][j])s[i][j]='0';
    cout<<"Data "<<pp+1<<':'<<endl;
    r(i,8)cout<<s[i]<<endl;
  }
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=(n-1);i>0;i--)
    {
        if(a[i-1]>a[i])
        {
            a[i-1]--;
            if(a[i-1]>a[i])
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

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

  if (b * 2 < a) { // カーテンの長さが窓より小さい時
    cout << a - (b * 2) << endl;
  } else if (b * 2 >= a) { // カーテンの長さが窓より大きい, または同じ時
    cout << '0' << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
    int a[5];
    int b[5];
    for(int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    int k = 10;
    int m = 0;
    int n = 0;
    for(int i = 0; i < 5; i++) {
        n = a[i] % 10;
        if (n < k && n != 0) {
            m = i;
            k = n;
        }
        if (n != 0) {
            n =  10 - n;
        }
        b[i] = a[i] + n;
    }
    int sum = 0;
    for(int i = 0; i < 5; i++) {
        sum += b[i];
    }
    sum -= b[m];
    sum += a[m];
    cout << sum << endl;
    return 0;
}


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

#define int long long

int memo[1010][(1 << 12)];

int a[1010];
int c[1010];

int n, m;
int dp(int i, int j){
    if(i == m){
        if(j == ((1 << n) -1)){
            return 0;
        }else{
            return INT_MAX;
        }
    }

    if(memo[i][j] != -1){
        return memo[i][j];
    }

    return memo[i][j] = min(dp(i+1, j), dp(i+1, j | c[i]) + a[i]);

}


signed main(){
    cin >> n >> m;

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

        int aa;
        for(int j = 0;j < b;j++){
            cin >> aa;
            c[i] |= (1 << (aa-1));
        }
    }

    memset(memo, -1, sizeof(memo));

    int ans = dp(0, 0);

    if(ans < INT_MAX){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 32640
#include<bits/stdc++.h>
using namespace std;
int top, Stack[1000];
int pop(){
  return Stack[top--];
  //--top;
  //return Stack[top+1];
}
void push(int n){
  Stack[++top] = n;
}

int main(){
  char s[100];
  top = 0;
  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+'){
      int a = pop();
      int b = pop();
      push( a+b);
    }
    else if( s[0] == '*'){
      int a = pop();
      int b = pop();
      push( a*b);
    }
    else if( s[0] == '-'){
      int b = pop();
      int a = pop();
      push( a-b);
    }
    else if( s[0] == '/'){
      int b = pop();
      int a = pop();
      push( a/b);
    }
    else push( atoi(s) );
  }
  cout << pop() <<endl;
  return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n;
    cin >> n;
    vector<ll> v;
    for(ll i = 0; i < n; i++)
    {

        ll x;
        cin >> x;
        v.pb(x);
    }
    ll ans = v[0];
    for(ll  i= 1; i < n; i++)
    {

        if(v[i-1] < v[i]) ans+=v[i]-v[i-1];
    }
    cout << ans;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>

using namespace std;

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;

int main() {
  int n;
  scanf("%d", &n);
  int64 a = 1, b = 1;
  for (int i = 0; i < n; ++i) {
    int64 x, y;
    scanf("%lld%lld", &x, &y);
    int64 d = max((a + x - 1) / x, (b + y - 1) / y);
    a = x * d;
    b = y * d;
  }
  printf("%lld\n", a + b);
  return 0;
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    s:Chars,
    t:Chars,
    }

    let mut cnt = 1000;
    for i in 0..(s.len() - t.len() + 1) {
        let mut t_cnt = 0;
        for j in 0..t.len() {
          if s[i + j] != t[j]{
            t_cnt +=1;
          }
        }
        cnt = min!(cnt, t_cnt);
    }

     println!("{}", cnt);
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
const ll MOD = 1000000007;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    bool ans = 0;
    if(a == b && a != c) ans = 1;
    if(b == c && a != b) ans = 1;
    if(a == c && a != b) ans = 1;
    if(ans) {
        cout << "Yes";
    }else {
        cout << "No";
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
X, K, D = map(int, input().split())
X = abs(X)
ret = 0
if K*D <= X:
    ret = abs(X - K*D)
else:
    t = X // D
    X -= t * D
    K -= t # 残りの回数
    if K % 2 == 0:
        ret = abs(X)
    else:
        ret = abs(X-D)


print(ret)


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

int main(){
    int n;
    cin >> n;
    ll h[n],dp[n];
    for(int i = 0;i < n;i ++){
        cin >> h[i];
    }
    dp[0]=0;dp[1]=abs(h[1]-h[0]);
    for(int i = 2;i < n;i ++){
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
def main():
    n, k = [int(x) for x in input().split()]
    scores = [int(x) for x in input().split()]

    for remover, new_commer in zip(scores, scores[k:]):
        if remover < new_commer:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef vector<int> vi;

inline vi normarize(const vi &v)
{
    vector<vi> r(4);
    rep(i,4)
    {
        vi t(4);
        rep(j,4) t[j]=v[(i+j)%4];
        r[i]=t;
    }
    sort(all(r));
    return r[0];
}

inline ll DIM(const vi &v)
{
    if(v[0]==v[1] && v[1]==v[2] && v[2]==v[3]) return 4;
    if(v[0]==v[2] && v[1]==v[3]) return 2;
    return 1;
}

int main()
{
    ll P[401][5]={0};
    for(int i=1; i<=400; ++i)
    {
        P[i][1]=i;
        for(int j=2; j<=min(4,i); ++j) P[i][j]=P[i][j-1]*(i-j+1);
    }

    ll POW[5][5];
    rep(i,5)
    {
        POW[i][0]=1;
        for(int j=1; j<5; ++j) POW[i][j]=POW[i][j-1]*i;
    }

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

    vector<vi> c(n,vi(4));
    rep(i,n)rep(j,4) scanf(" %d", &c[i][j]);

    map<vi,int> ct;
    rep(i,n)
    {
        c[i]=normarize(c[i]);
        if(ct.find(c[i])==ct.end()) ct[c[i]]=1;
        else ++ct[c[i]];
    }

    ll ans=0;
    // 上面i, 下面j, 下面の向きを設定
    rep(i,n)rep(j,i)rep(k,4)
    {
        vi u(4);
        rep(x,4) u[x]=c[j][(k+x)%4];
        swap(u[1],u[3]);

        vector<vi> sides(4);
        rep(x,4)
        {
            vi t(4);
            t[0]=c[i][(x+1)%4];
            t[1]=c[i][x];
            t[2]=u[x];
            t[3]=u[(x+1)%4];
            sides[x]=normarize(t);
        }
        sort(all(sides));

        ll add=1;
        int idx=0, st=0;
        while(1)
        {
            while(idx<4 && sides[st]==sides[idx]) ++idx;
            vi key=sides[st];
            int value=idx-st;

            // 使ってないタイルのうち当てはめられる個数
            int num=ct[key];
            if(c[i]==key) --num;
            if(c[j]==key) --num;

            if(num<value)
            {
                add=0;
                break;
            }

            // 選び方、向き、位置
            add*=P[num][value]*POW[DIM(key)][value];

            if(idx==4) break;
            st=idx;
        }
        ans+=add;
    }

    // 向かい合う面の個数ぶん重複する
    cout << ans/3 << endl;
    return 0;
}


Measured memory_bytes: 35200
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll INF=1e15+4;
const int Nmax=2e5+1;
const int Nd=61;



int main(){
  int n,k; cin>>n>>k;
  vector<bool> kirai(n,false);
  rep(i,k){
    int d;
    cin>>d;
    kirai[d]=true;
  }
  bool ok=true;
  n--;
  while(ok){
    n++;
    int k10=1;
    ok=false;
    rep(keta,6){
      int x =(n/k10)%10;
      if(kirai[x]) {
        ok=true;
        break;
      }
      k10*=10;

      if(k10>n) break;
    }

  }

  cout<<n<<endl;

  return 0;
}


Measured memory_bytes: 3608
#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>;

int main()
{
  int k;
  cin >> k;
  int x = 7 % k;
  int cnt = 1;
  set<int> s;
  while (s.count(x) == 0)
  {
    if (x == 0)
    {
      cout << cnt << endl;
      return 0;
    }
    s.insert(x);
    x = (x * 10 + 7) % k;
    cnt++;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 50484
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=len(s);
    if(n==2){
      cout<<s[0]<<s[1]<<endl;
    }else{
      cout<<s[2]<<s[1]<<s[0]<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const* argv[]) {
	unsigned long long a, b, k;
	cin >> a >> b >> k;

	if (a >= k) {
		a = a - k;
		k = 0;
	} else {
		k = k - a;
		a = 0;
	}

	if (b >= k) {
		b = b - k;
	} else
		b = 0;

	cout << a << " " << b << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define p pair<ll,ll>
#define fi first
#define se second
#define opti ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll N = 1e6+6;
ll t,i,j,k,n,m,q;

int main()
{
    opti
    cin>>m;
    ll ans = 24 + (24-m);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn f(p: i64, i: i64) -> i64 {
    if p % i == 0 {
      1 + f(p / i, i)
    } else {
      0
    }
}

fn main() {
    // 入力
    let (N, P) = get!(i64, i64);

    // 素因数分解した結果を用いて解を求める
    let (ans, _) = if N == 1 {
        (P, 1)
    } else {
        let Q = ((P as f64).sqrt().ceil() as i64) + 1;
        (2..Q).fold(
            (1, P),
            |(acc, p), i| (
              acc * i.pow((f(p, i) / N) as u32),
              p / i.pow((f(p, i)) as u32)
            )
        )
    };

    // 出力
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define EFOR(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  int h, w; cin >> h >> w;
  VVI s(h + 2, VI(w + 2, 0));
  REP(i, h) {
    string in; cin >> in;
    REP(j, in.size()) {
      if (in[j] == '#') s[i + 1][j + 1] = -1;
    }
  }
  EFOR(i, 1, h) {
    EFOR(j, 1, w) {
      if (s[i][j] == -1) continue;
      EFOR(y, -1, 1) {
        EFOR(x, -1, 1) {
          if (x == 0 and y == 0) continue;
          else if (s[i + y][j + x] == -1) s[i][j]++;
        }
      }
    }
  }
  EFOR(i, 1, h) {
    EFOR(j, 1, w) {
      if (s[i][j] == -1) cout << '#';
      else cout << s[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int m, ans, N, num;
    cin >> N;       cin >> num;
    m = num;        cin >> num;
    ans = num - m;  m = min(m, num);
    for(int i = 2; i < N; ++i){
        cin >> num;
        ans = max(ans, num - m);
        m = min(m, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3104
#include <stdio.h>
int main(void){
  int n;
  int i;
  long sum=0;
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    if((i%3)!=0&&(i%5)!=0)
      sum=sum+i;
  }
  printf("%ld",sum);
  return 0;
}
    

Measured memory_bytes: 1732
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    ll H;
    cin >> H;
    ll tmp = 1;
    ll ans = 0;
    while(H > 0){
        ans += tmp;
        H /= 2;
        tmp *= 2;
    }
    cout << ans  << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  int N;
  cin >> N;
  set<int> st;
  REP(i,N){
    int a;
    cin >> a;
    if(st.find(a) == st.end()){
      st.insert(a);
    }else{
      st.erase(a);
    }
  }
  cout << st.size() << endl;
}



Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
using pi = pair<int, int>;

const int M=1e9+7;
bool sortbysec(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second<b.second;
}

long long mod(long long x){
    return ((x%M + M)%M);
}

long long add(long long a, long long b){
    return mod(mod(a)+mod(b));
}

long long mul(long long a, long long b){
    return mod(mod(a)*mod(b));
}

long long minu(long long a, long long b){
    return mod(mod(a)-mod(b));
}

ll modPow(ll a, ll b){
    if(b==0)
        return 1LL;
    if(b==1)
        return a%M;
    ll res=1;
    while(b){
        if(b%2==1)
            res=mul(res,a);
        a=mul(a,a);
        b=b/2;
    }
    return res;
}


int main()
{
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<pair<int, int> > vec;
        int flag = 0, mx = 0;
        for(int i = 0; i < n; i++)
        {
            int x, y;
            cin >> x >> y;
            vec.pb({x, y});
            if(x == y)
            {
                flag++;
            }
            else
            {
                mx = max(flag, mx);
                flag = 0;
            }
        }
        mx = max(flag, mx);
        if(mx >= 3)cout<< "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 3596
#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>;

int main(){
    string s;
    cin >> s;
    string a0 = "";
    string a1 = "";
    int k = 0;
    rep(i, s.size()){
        a0 += ('0'+(k%2));
        k++;
        a1 += ('0'+(k%2));
    }
    int ans0 = 0;
    int ans1 = 0;
    rep(i, s.size()){
        if(s.at(i) != a0.at(i)) ans0++;
        if(s.at(i) != a1.at(i)) ans1++;
    }
    cout << min(ans0, ans1) << endl;
    return 0;
}

Measured memory_bytes: 768
a, b, c, d = map(int, input().split())

if a%d == 0:
    tcnt = a//d
else:
    tcnt = a//d + 1

if c%b == 0:
    acnt = c//b
else:
    acnt = c//b + 1
    

if tcnt >= acnt:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  if(a >= d || b <= c)System.out.println("0");
  else if(a <= c && d <= b)System.out.println(d-c);
  else if(c <= a && b <= d)System.out.println(b-a);
  else if(a <= c && c <= b && b <= d)System.out.println(b-c);
  else if(c <= a && a <= d && d <= b)System.out.println(d-a);
}}


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

using namespace std;
using ll = long long;

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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << (n + x - 1) / x * t << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	int a, b, flag=0;
	cin >> a >> b;
	string s;
	cin >> s;
	rep(i,a){
		if(!(s[i]>='0' && s[i]<='9')) flag++; 
	}
	if(s[a] != '-') flag++;
	loop(i, a+1, s.length()){
		if(!(s[i]>='0' && s[i]<='9')) flag++;
	}
	if(flag == 0) puts("Yes");
	else puts("No");
	return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

string s;

int main(void) {
  // Here your code !
  cin >> s;

  int n = s.size() + 1;

  vector<ll> base(n, -1L);

  if (s[0] == '<') base[0] = 0;

  if (s.back() == '>') base[n - 1] = 0;

  for (int i = 1; i < s.size(); ++i) {
    if (s[i - 1] == '>' && s[i] == '<') {
      base[i] = 0;
    }
  }

  s.insert(0, s[0] == '<' ? "_" : ">");

  for (int i = 0; i < n; ++i) {
    if (base[i] != 0) continue;

    for (int j = i + 1; j < n; ++j) {
      if (s[j] == '>') break;
      base[j] = max(base[j], (ll)(j - i));
    }

    for (int j = i - 1; j >= 0; --j) {
      if (s[j] == '<') break;
      base[j] = max(base[j], (ll)(i - j));
    }
  }

  for (int i = 0; i < n; ++i) {
    if (s[i] == '<' && s[i + 1] == '>') {
      if (base[i] <= base[i + 1]) base[i] = base[i + 1] + 1;
    }
  }

  ll ans = 0;

  for (auto &e : base) {
    ans += e;
  }

  printf("%lld\n", ans);

  return 0;
}


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

#define MAX_N 55

struct Result {
    long long sum;
    long long count;
};

Result dp[2][MAX_N];

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

    for (int i=0; i<MAX_N; i++) {
        dp[0][i].sum = -1;
        dp[1][i].sum = -1;
    }
    dp[0][0] = Result{0,1};

    for (int i=0; i<N; i++) {
        long long v;
        cin >> v;

        int curr = i % 2;
        for (int k=0; k<MAX_N; k++) {
            // vi を選ばないとき
            dp[curr^1][k] = dp[curr][k];
            
            // vi を選ぶとき
            if (k > 0 && dp[curr][k-1].sum != -1) {
                if (dp[curr^1][k].sum < dp[curr][k-1].sum + v) {
                    dp[curr^1][k] = Result{ dp[curr][k-1].sum + v, dp[curr][k-1].count };
                } else if (dp[curr^1][k].sum == dp[curr][k-1].sum + v) {
                    dp[curr^1][k].count += dp[curr][k-1].count;
                }
            }
        }
    }

    // [A,B] で、最大平均を探す
    vector<Result> vs;
    long long p = 0;
    long long r = 0;
    double ad = 0;
    for (int i=A; i<=B; i++) {
        if (p < dp[N%2][i].sum / i || (p == dp[N%2][i].sum/i && dp[N%2][i].sum%i > r)) {
            p = dp[N%2][i].sum / i;
            r = dp[N%2][i].sum % i;
            ad = (double)dp[N%2][i].sum / (double)i;
        }
    }
    printf("%f\n", ad);

    long long cnt = 0;
    for (int i=A; i<=B; i++) {
        if (p == dp[N%2][i].sum/i && r == dp[N%2][i].sum%i) {
            cnt += dp[N%2][i].count;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    N,K = map(int,input().split())
    XY = [list(map(int,input().split())) for _ in [0]*N]
    
    iX = [x for x,y in XY]
    iY = [y for x,y in XY]
    iX.sort()
    iY.sort()
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1]
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j in range(N):
            ci1[j+1] += ci[j+1]

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = K-1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while 1:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:
                    r+=1
                    if r==N:break

    print(ans)
main()

Measured memory_bytes: 3188
import math
a,b,h,m = map(int, input().split())
# A: 360 / 720 [degree/min]
# B: 360/ 60 [degree/min]
r_a = 30*h + 0.5 * m
r_b = 6 * m
rad = math.pi * (r_a-r_b)/180
ans = math.sqrt(a**2+b**2-2*a*b*math.cos(rad))
print(ans)

Measured memory_bytes: 9552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  mint ans = 0;
  combination c(n + 1);
  rep(ri, 2){
    for(int i = 1; i < n; ++i){
      mint cur = a[i];
      if(ri == 1) cur  = -cur;
      ans += cur * c(i , k - 1);
    }
    reverse(a.begin(), a.end());
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

const int SIZE=17;

const ll MOD=1e9+7;

void add(int &lhs,int rhs){
    lhs=(lhs+rhs);
    if(lhs>=MOD) lhs-=MOD;
}
int dp[41][1<<SIZE];
int isAccept[1<<SIZE];
int mypow10[40];

int main(){
    int n;
    cin>>n;
    int xyz[3];
    for(int i=0;i<3;i++) cin>>xyz[i];

    
    dp[0][(1<<SIZE)-1]=1;

    

    for(int bit=0;bit<(1<<SIZE);bit++){
        int st=0;
        int buf=0;
        for(int i=0;i<SIZE;i++){
            buf++;
            if(!((bit>>i)&1) && xyz[st]==buf){
                st++;
                buf=0;
                if(st==3){
                    isAccept[bit]=true;
                    break;
                }
            }
        }
    }

    
    mypow10[0]=1;
    for(int i=0;i+1<n;i++) mypow10[i+1]=ll(mypow10[i])*10%MOD;

    ll res=0;
    int mask=(1<<SIZE)-1;
    for(int i=0;i<n;i++){
        for(int bit=0;bit<(1<<SIZE);bit++){
            if(dp[i][bit]==0) continue;
            for(int v=1;v<=7;v++){
                int nex=(bit<<v)+(1<<(v-1))-1;
                nex&=mask;
                add(dp[i+1][nex],dp[i][bit]);
            }
            add(dp[i+1][mask],(3LL*dp[i][bit])%MOD);
        }
        for(int bit=0;bit<(1<<SIZE);bit++){
            if(isAccept[bit]){
                ll r=mypow10[n-1-i];
                res+=r*dp[i+1][bit];
                res%=MOD;   
                dp[i+1][bit]=0;
            }
        }
    }

    cout<<res<<endl;
    
    
    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Dice{
public:
	array<int,6> F;
	array<map<int,int>,6> R;
	map<int,int> L;
	Dice(){
		R[0][1]=2;
		R[0][2]=4;
		R[0][4]=3;
		R[0][3]=1;

		R[1][0]=3;
		R[1][3]=5;
		R[1][5]=2;
		R[1][2]=0;

		R[2][0]=1;
		R[2][1]=5;
		R[2][5]=4;
		R[2][4]=0;

		R[3][0]=4;
		R[3][4]=5;
		R[3][5]=1;
		R[3][1]=0;

		R[4][0]=2;
		R[4][2]=5;
		R[4][5]=3;
		R[4][3]=0;

		R[5][1]=3;
		R[5][3]=4;
		R[5][4]=2;
		R[5][2]=1;
	}
	void Roll(char ch){
		int temp;
		switch(ch){
		case 'W':
			temp = F[0];
			F[0] = F[2];
			F[2] = F[5];
			F[5] = F[3];
			F[3] = temp;
			break;
		case 'E':
			temp = F[0];
			F[0] = F[3];
			F[3] = F[5];
			F[5] = F[2];
			F[2] = temp;
			break;
		case 'N':
			temp = F[0];
			F[0] = F[1];
			F[1] = F[5];
			F[5] = F[4];
			F[4] = temp;
			break;
		default:
			temp = F[0];
			F[0] = F[4];
			F[4] = F[5];
			F[5] = F[1];
			F[1] = temp;
		}
	}
};

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

	auto X=vecin(6);
	Dice D;
	REP(i,6){
		D.F[i] = X[i];
		D.L[X[i]] = i;
	}
	int N=in();
	REP(i,N){
		int u=in(),v=in();
		out(D.F[D.R[D.L[u]][D.L[v]]]);
	}

	return 0;
}



Measured memory_bytes: 3200
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

LL a,b;

int main(){
	scanf("%lld%lld" , &a , &b);
	if(a<b) swap(a,b);
	printf("%s\n" , a-b<2 ? "Brown" : "Alice");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll x[MAX];
ll y[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>x[i];
        x[i]+=x[i-1];
    }
    for(int i=1; i<=n; i++)
        cin>>y[i];
    for(int i=n; i>0; i--)
    {
        y[i]+=y[i+1];
    }
    ll ans=0;
    for(int i=1; i<=n; i++)
    {
        ans=max(ans,x[i]+y[i]);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
int main()
{
  int x,y,a,b;

  scanf("%d%d",&x,&y);
  if(x<y){
   a=x;
   x=y;
   y=a;
  }
  while(y>0){
   b=x%y;
   x=y;
   y=b;
  }

   printf("%d\n",x);
   return 0;
}

Measured memory_bytes: 592
"use strict";
function main(input) {
  const n = parseInt(input[0]);
  const s = input[1].trim().split("");
  const rgb = { "R":0, "G":0, "B":0 };

  for(let i of s){
    rgb[i]++;
  }

  let sum = rgb.R * rgb.G * rgb.B;

  for(let i=1;i<n;i++){
    for(let j=i;j<=n-i;j++){
      let checker = [s[j-i], s[j], s[j+i]].sort(); 
      if(checker.join("") === "BGR"){
        sum--;
      }
    }
  }
  console.log(sum);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

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

#define endl '\n'

int main() {
  long long n;
  cin >> n;
  vector <char> v;
  while(n) {
    int r = n % 26;
    if(r == 0) {
      v.push_back('z');
      n = (n / 26) - 1;
    }
    else {
      v.push_back(char('a'+r-1));
      n /= 26;
    }
  }
  reverse(v.begin(), v.end());
  for(auto e : v) cout << e;
  return 0;
}


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

using namespace std;

int main(){
    int N;
    int diff = 0;
    int minimum = 0;
    cin >> N;
    for(int i=0;i<N;i++){
        int num;
        cin >> num;
        if(i == 0){
            minimum = num;
        }else{
            if(num - minimum > diff || i == 1){
                diff = num - minimum;
            } 
            if(minimum > num){
                swap(minimum,num);
            }
            
        }
        
    }
    cout << diff << endl;
    return 0;
}


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

#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))


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

template <class T> inline T gcd(T a, T b) { while (b) { a = a%b; swap(a, b); } return a; }

using namespace std;


int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;

	int k;
	cin >> k;

	for (int i = 0; i < n; i++) {
		if (s[k - 1] != s[i]) {
			s[i] = '*';
		}
		cout << s[i];
	}
	cout << endl;



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,m,k,ans=0;
  int a[33];
  bool isa[33];
  for(int i=0; i<33; i++){
    isa[i]=false;
  }
  
  cin>>n>>m;
  cin>>k;
  for(int i=0; i<k; i++){
    cin>>a[i];
    isa[a[i]]=true;
  }
  for(int i=1; i<n; i++){
    cin>>k;
    for(int j=0; j<k; j++){
      cin >> a[j];
    }
    sort(a,a+k);
    for(int j=0,h=0; j<k; j++){
      for(int g=h; g<a[j]; g++){
        isa[g]=false;
      }
      if(isa[a[j]]){
        h=a[j]+1;
      }else{
        h=a[j];
      }
      if(j==k-1){
        for(int g=h; g<=m; g++){
          isa[g]=false;
        }
      }
    }
  }
  for(int i=1; i<=m; i++){
    if(isa[i])ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define int long long
const int N=1003,S=20003;
struct block{int w,s,v;}a[N];
inline bool Cmp(const block&a,const block&b){return a.s+a.w<b.s+b.w;}
int dp[N][S],n,ans;
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld%lld%lld",&a[i].w,&a[i].s,&a[i].v);
	std::sort(a+1,a+1+n,Cmp);
	for(int i=1;i<=n;i++)
	  for(int j=0;j<S;j++){
		dp[i][j]=dp[i-1][j];
		if(j>=a[i].w&&a[i].s>=j-a[i].w)
		  dp[i][j]=std::max(dp[i][j],dp[i-1][j-a[i].w]+a[i].v);
		if(i==n)ans=std::max(ans,dp[i][j]);
	  }
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 156416
import qualified Data.Map as Map

solve :: String -> String
solve str = map convFunc str
	where
		convMap = Map.fromList $ (zip ['a'..'z'] ['A'..'Z']) ++ (zip ['A'..'Z'] ['a'..'z'])
		convFunc c = case Map.lookup c convMap of
			Just value -> value
			Nothing -> c

main = do
	line <- getLine
	putStrLn $ solve line

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

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;

  
int main(){
  int a,b;
  cin >> a >> b;
  
  int c = a+b;
  
  if(c == 3)
    cout << 3 << endl;
  else if(c == 4)
    cout << 2 << endl;
  else if(c == 5)
    cout << 1 << endl;
}





Measured memory_bytes: 256
// Contest: AtCoder Beginner Contest 144 (https://atcoder.jp/contests/abc144)
// Problem: F: Fork in the Road (https://atcoder.jp/contests/abc144/tasks/abc144_f)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, a, b; cin >> n >> m;
    vvi adj(n);
    rep(i, m)
        cin >> a >> b, adj[a-1].push_back(b-1);

    ld mn = INFL;
    rep(i, n - 1) {
        vector<ld> dp(n, 0);
        for (int j = n - 2; j >= 0; --j) {
            ld sum = 0, mx = 0;
            trav(k, adj[j])
                sum += dp[k], mx = max(mx, dp[k]);
            int d = sz(adj[j]);
            if (i == j && d > 1)
                sum -= mx, --d;
            dp[j] = 1 + sum / d;
        }
        mn = min(mn, dp[0]);
    }

    cout << setprecision(20) << mn << '\n';
    return 0;
}


Measured memory_bytes: 1408
#include<cstdio>
int main(){
    int n;
    scanf("%d",&n);
    int a=100000;

    for(int i=0;i<n;i++)
    {
        a*=1.05;
        if(a%1000!=0){
            a=(a/1000)*1000;
            a+=1000;
        }
    }
    printf("%d\n",a);
    return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

//#include <set>
//#include <unordered_map>
//#include <stack>

using namespace std;

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

#define max_n 100
int X;


int main() {

	cin >> X;

	int Xmax = X / 100;
	int Xd = X % 100;

	if (Xmax >= 20) { cout << "1" << endl; return 0; }

	int dp[110];
	rep(i, 110)dp[i] = 100;

	rep(i, 11)dp[i] = 0;

	rep(i,100){
		rep(j, 5)dp[i + 10] = min(dp[i + 10], dp[i + 9 - j] + 1);
	}

	if (dp[Xd + 10] > Xmax)cout << "0" << endl;
	else cout << "1" << endl;

	return 0;
}


Measured memory_bytes: 256
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

long long gcd(long long b, long long c) {
	long long r = b % c;
	while (r!=0)
	{
		b = c;
		c = r;
		r = b%c;
	}
	return c;
}

int main() {
	long long a[2];
	long long tmp;
	long long GCD = 1;
	long long LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		GCD = gcd(a[0], a[1]);

		// ????°???¬?????°????¨????
		LCM = a[0] * a[1] / GCD;

		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

Measured memory_bytes: 2988