akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n;
    cin >> n;
    int y;
    cin >> y;
    y /= 1000;
    int a,b,c;
    a = b = c = -1;
    for(int i = 0; i*10 <= y; i++){
        for(int j = 0; i*10+j*5<=y; j++) {
            int k = n - i - j;
            if(k < 0) continue;
            if(10*i + 5*j + k == y) a=i, b=j, c=k;
        }
    }
    cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 764
s = input()
for i in range(len(s)-2):
	if s[i] == s[i+1]:
		print(i+1, i+2)
		break
	elif s[i] == s[i+2]:
		print(i+1, i+3)
		break
else:
	if s[-2] == s[-1]:
		print(len(s)-1, len(s))
	else:
		print(-1, -1)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int mod = 1000000007;
const int INF = 1001001001;

int main(){
    int h,n;
    cin >> h >> n;
    rep(i,n){
        int a; cin >> a;
        h -= a;
    }
    if(h<=0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

int main(){


  int n;
  long long tmp, cmp;
  int amp = 0;

  cin >> n;

  for (int i = 0; i < n; i++){
    cmp = scanf("%lld", &tmp);

    while(true){
      if (tmp % 2 != 0){
        break;
      }else{
        tmp /= 2;
        amp++;
      }
    }
  }
  cout << amp <<endl;

  return 0;
}


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

using namespace std;

const int md = 1000000007;
const int N = 200005;

int f[N];

int sub(int x, int y) {
  x -= y;
  if (x < 0) x += md;
  return x;
}

int mul(int x, int y) {
  return (int)((long long)x * y % md);
}

int power(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) {
      ans = mul(ans, x);
    }
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}

int inv(int x) {
  return power(x, md - 2);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  f[0] = 1;
  for (int i = 1; i < N; i++) {
    f[i] = mul(i, f[i - 1]);
  }
  int n, a, b;
  cin >> n >> a >> b;
  int ans = power(2, n) - 1;
  
  int _min = min(a, n - a);
  int num = 1;
  for (long long i = max(a, n - a) + 1; i <= n; i++) {
    num = mul(num, i);
  }
  int foo = mul(num, inv(f[_min]));
  
  _min = min(b, n - b);
  num = 1;
  for (long long i = max(b, n - b) + 1; i <= n; i++) {
    num = mul(num, i);
  }
  int bar = mul(num, inv(f[_min]));
  
  ans = sub(ans, foo);
  ans = sub(ans, bar);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 1024
# ABC 126: B – YYMM or MMYY
S = input()
head, tail = S[:2], S[2:]
if 1 <= int(head) <= 12 and 1 <= int(tail) <= 12:
    print('AMBIGUOUS ')
elif 1 <= int(head) <= 12 and not (1 <= int(tail) <= 12):
    print('MMYY')
elif not (1 <= int(head) <= 12) and 1 <= int(tail) <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define NFOR(i,a,b) for(ll i = (ll)(a); i >= (ll)(b); --i)
#define rep(i, a) for (ll i = 0; i < a; i++)
#define endl "\n"
#define fi first
#define se second
#define MOD 1000000007
#define inf 1e12
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

void solve() {
	ll n, k;
	cin >> n >> k;
	vl a(n);
	rep(i, n) cin >> a[i];

	vector<bool> dp(k + 1, false);
	FOR(i, 1, k) {
		bool flg = false;
		rep(j, n) {
			if (i >= a[j] and !dp[i-a[j]]) {
				flg = true;
				break;
			}
		}
		if (flg) dp[i] = true;
	}

	if (dp[k]) cout << "First\n";
	else cout << "Second\n";
}

int main()
{
    fastio;
    ll t  = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

typedef   signed long long int slli;
typedef unsigned long long int ulli;
const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF;
const slli MIN_SLLI = 0x8000000000000000;
const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF;
const ulli MIN_ULLI = 0x0000000000000000;

#define N_TIMES(i, n)     for (ulli i = 0;     i <  n; ++i)
#define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i)

#ifdef __DEBUG__
template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  const std::string delim = ", ";
  typename std::list<T>::const_iterator itr = list.begin();
  while (itr != list.end()) {
    os << *itr;
    ++itr;
    if(itr != list.end()) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  const std::string delim = ", ";
  for (unsigned n = 0; n < v.size(); ++n) {
    os << v[n];
    if((n + 1) < v.size()) os << delim;
  }
  return os;
}
#endif /* __DEBUG__ */

int main()
{
  ulli X, t;
  std::cin >> X >> t;
  
  ulli remain = 0;
  if (t < X) {
    remain = X - t; 
  }
  std::cout << remain << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
str = gets.split
N,M = str[0].to_i, str[1].to_i
S = gets.chomp
a = []
b = N
c = 1
while b > M
    d = M
    while S[-c-d] == "1"
        d -= 1
    end
    if d == 0
        puts "-1"
        exit
    end
    a.push(d)
    b -= d
    c += d
end
a.push(b)
for i in 1..a.size do
    print a.pop
    print " "
end
puts

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

struct point{
    int x, y;
};
bool comp_x(const point a, const point b){
    return a.x < b.x;
}
bool comp_y(const point a, const point b){
    return a.y < b.y;
}

int main(){
    int n;
    cin >> n;
    vector<point> R(n), B(n);
    for(int i=0;i<n;i++){
        cin >> R[i].x >> R[i].y;
    }
    for(int i=0;i<n;i++){
        cin >> B[i].x >> B[i].y;
    }
    sort(R.begin(), R.end(), comp_y);
    sort(B.begin(), B.end(), comp_x);

    for(int i=0;i<n;i++){
        for(int j=R.size()-1;j>=0;j--){
            if(R[j].x < B[i].x && R[j].y < B[i].y){
                R.erase(R.begin()+j);
                break;
            }
        }
    }

    cout << n - R.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll dp[110][100100];

ll solve(int n, int w, vector<int> u, vector<int> v) {
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= w; j++) {
			if (u[i] <= j) {
				dp[i+1][j] = max(dp[i][j], dp[i][j - u[i]] + v[i]);
			} else {
				dp[i+1][j] = dp[i][j];
			}
		}
	}
	return dp[n][w];
}

int main() {
	int n, w;
	cin >> n >> w;
	vector<int> u(n), v(n);
	rep(i,n) cin >> u[i] >> v[i];
	cout << solve(n, w, u, v) << endl;
}

Measured memory_bytes: 89668
from collections import defaultdict
from bisect import bisect_left


def solve(s, t):
    dd = defaultdict(list)
    for i, c in enumerate(s):
        dd[c].append(i)
    inv = 0
    index = 0
    for c in t:
        x = bisect_left(dd[c], index)
        if x == len(dd[c]):
            inv += 1
            if not dd[c]:
                return -1
            index = dd[c][0] + 1
        else:
            index = dd[c][x] + 1
    return len(s) * inv + index


def main():
    s = input()
    t = input()
    print(solve(s, t))


if __name__ == "__main__":
    main()


Measured memory_bytes: 13836
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
4*4 
123
456
789
16頂点がそれぞれ9頂点を選ぶ16-(4*2-1)=9
16*9/2通りの長方形ができる

1こずつ、3個ずつ*2、9個
2個ずつ
1379=2回
2468=3回
5=4回
4個ずつ
1379=1
2468=2
5=4
6個ずつ
1379=2回
2468=3回
5=4回

1 2 3
4 5 6
7 8 9

 9 12  9
12 16 12
 9 12  9

1 2
3 4

4 4
4 4

12
34
56

66
88
66
端にいると、頂点-1)*頂点-1

1
2
3
4

4　うえに１　したに４
6 うえに２したに３　２＊３
6
4

縦のとりかた×横の取り方
うえに何個とれるか、したになんことれるか
自分はぜったいとらなきゃだめ

でもNMは無理なのか
たて
3  1 2 3 よこだけでみると 3 4 3 横のとりかたの総和
4  4 5 6
3  7 8 9

2-1
3-1
4-1
3-2
4-2
4-3
444332-322111
4443-2111じゃない
3回2回1回- 1回2回3回のままのほうが管理しやすい
縦の総和×横の総和

332-211
443-311
=11-5=6
*/
int main(){
  ll N,M,x=0,y=0,MOD=1e9+7; cin>>N>>M;
  vector<ll>X(N+10,0),Y(M+10,0);
  for(ll i=0; i<N; i++) cin>>X[i];
  for(ll i=0; i<M; i++) cin>>Y[i];
  for(ll i=N-1; i>=0; i--){
    ll j=N-1-i;
    (x+=i*X[i]-i*X[j])%=MOD;//123頂点あれば、3-2,3-1,2-1
  }
  for(ll i=M-1; i>=0; i--){
    ll j=M-1-i;
    (y+=i*Y[i]-i*Y[j])%=MOD;//123頂点あれば、3-2,3-1,2-1
  }
  ll ans=x*y;
  ans%=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
using namespace std;

int ketasum(int x){
    int s=x,t,u=0;
    while(s>0){
        t=s%10;
        u+=t;
        s/=10;
    }
    return u;
}

int main(){
    int n;
    cin >> n;
    int res=1000;
    for(int i=1;i<n;i++){
        if(res>ketasum(i)+ketasum(n-i))res=ketasum(i)+ketasum(n-i);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
// 基本テンプレート
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N, P; cin >> N >> P;

    map<int, int> cnt;
    for(int i=2; i*i<=P; i++) {
        while(P % i == 0) {
            cnt[i]++;
            P /= i;
        }
    }
    if(P > 1) cnt[P]++;

    int ans = 1;
    for(auto e : cnt) {
        // fprintf(stderr, "%lld %lld\n", e.first, e.second);
        for(int i=0; i<e.second/N; i++) ans *= e.first;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl
#define inf LLONG_MAX

llong n;

llong f(llong  b, llong  n) {
    if (b < 2)return inf;
    llong ret = 0;
    while (n >= b) {
        ret += n%b;
        n /= b;
    }
    return ret + n;
}



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

    llong s;
    cin >> n >> s;
    if (s > n) {
        cout << -1 << endl;
        return 0;
    }
    else if (n == s) {
        cout << n + 1 << endl;
        return 0;
    }

    //ここから
    
    for (llong b = 2; b*b <= n; b++) {//f()の計算から三桁以上は確定する場合
        if (f(b, n) == s) {
            cout << b << endl;
            return 0;
        }
    }

    llong ans =inf;
    //2桁になる場合は重み以下の範囲で二数の和がｓになる
    //大きいものほど成立しやすいが
    //ほしいのは最小。

    for (llong p = 1; p*p < n; p++) {
        llong b = (n - s) / p + 1;
        if (f(b, n) == s)
            ans = min(ans, b);
    }

    if (ans == inf) {
        cout << -1 << endl;
        return 0;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
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 (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    rep(i,N)cin >> A[i];
    rep(i,N)cin >> B[i];
    vector<int> dif(N);
    LL minsum = 0;
    int ct = 0;
    LL ctsum = 0;
    bool ok = true;
    rep(i,N){
        ctsum += (A[i] - B[i]);
        dif[i] = A[i] - B[i];
        if(dif[i] < 0){
            ok = false;
            minsum += dif[i];
            ct++;
        }
    }

    sort(rall(dif));


    if(ctsum < 0){
        cout << -1 << endl;
    }
    else if(ok){
        cout << 0 << endl;
    }
    else{
        rep(i,N){
            if(abs(minsum) >= dif[i])ct++;
            minsum += dif[i];
            if(minsum >= 0){
                ct++;
                break;
            }
        }
        cout << ct << endl;
    }
}


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

int main(){
    long long n, k, t;
    vector<long long> v;
    cin >> n >> k;
    for(long long i = 0; i < n; i++){
        cin >> t;
        v.push_back(t);
    }
    sort(v.begin(), v.end());
    long long m = 10000000000;
    for(long long i = 0; i < n - k + 1; i++){
        m = min(m, v[i+k-1] - v[i]);
    }
    cout << m << endl;

}

Measured memory_bytes: 1400
S = input()
n = len(S)
up = 0
flag = False

for i, s in enumerate(S):
    if (i == 0) & (s != 'A'):
        break
    if s.isupper():
        up += 1
    if (1 < i) & (i < n-1):
        if s == 'C':
            flag = True

if flag & (up == 2):
    print('AC')
else:
    print('WA')



Measured memory_bytes: 3060
s = input()
l = [int(s[:2]), int(s[2:])]
ans = [0] * 2
for i in range(2):
    if l[i] > 12 or l[i] == 0:
        ans[i] = 1
    elif l[i] == 0:
        ans[i] = 3
sm = sum(ans)
if sm == 2:
    a = "NA"
elif sm == 1 and ans[0] == 0:
    a = "MMYY"
elif sm == 1 and ans[0] == 1:
    a = "YYMM"
elif sm == 3 and ans[0] == 0:
    a = "MMYY"
elif sm == 3 and ans[0] == 1:
    a = "YYMM"
elif sm > 3:
    a = "NA"
else:
    a = "AMBIGUOUS"
print(a)


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

int main(){
int n,k;

cin>>n>>k;

if(n%2==0){
if(n/2>=k){
cout<<"YES";
}
 else{
 cout<<"NO";
 } 
}
if(n%2==1){
if(n/2+1>=k){
cout<<"YES";
}
  else{
  cout<<"NO";
  }
}


  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	vi vec;
	for(int i=0;i<n;i++)
	{
		ll x; cin>>x;
		vec.pb(x);
	}
	ll ans =0;
	sort(vec.begin(),vec.end());
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(int k=j+1;k<n;k++)
			{
				if(vec[i]<vec[j]&&vec[j]<vec[k])
				{
					if(vec[k]<vec[i]+vec[j]) ans++;
				}
			}
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3660
N = int(input())
S = [input() for k in range(N)]
A = "abcdefghijklmnopqrstuvwxyz"
C = [[0 for k in range(26)] for l in range(N)]

for k in range(N):
    for u in S[k]:
        C[k][A.find(u)] += 1

ans = ""
for p in range(26):
    t = 100
    for q in range(N):
        t = min(t,C[q][p])
    ans += A[p]*t
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int n;
ll a[maxn],b[maxn];

int main() {
 // freopen("in.cpp","r",stdin);
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  ll sum=0,ans=0;
  int d=1;
  for(int i=0;i<n;i++){
    b[i]=a[i];
    if(d==1){
      if(sum+a[i]<=0){
        ans+=-(sum+a[i])+1;
        a[i]+=-(sum+a[i])+1;
      }
      sum+=a[i];
      d=-1;
    } else {
      if(sum+a[i]>=0){
        ans+=sum+a[i]+1;
        a[i]-=(sum+a[i]+1);
      }
      sum+=a[i];
      d=1;
    }
  }
  ll ret=ans;
  ans=0,sum=0;
  d=-1;
  for(int i=0;i<n;i++){
    a[i]=b[i];
    if(d==1){
      if(sum+a[i]<=0){
        ans+=-(sum+a[i])+1;
        a[i]+=-(sum+a[i])+1;
      }
      sum+=a[i];
      d=-1;
    } else {
      if(sum+a[i]>=0){
        ans+=sum+a[i]+1;
        a[i]-=(sum+a[i]+1);
      }
      sum+=a[i];
      d=1;
    }
  }
  cout<<min(ret,ans)<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<algorithm>
#include <iomanip> 
#include<vector>
#define fo(i,n) for(ll i=0;i<n;i++)
#define f(i,n) for(ll i=1;i<n;i++)
#define ff(i,k,n) for(ll i=k,i<n;i++)
#define ll long long
/*Elegizip, elegizip otken sol bir shaktar-ai
 Elendeter zamanymnyn otip bara zhatkanny-ai
Umytylmas-Umytylmas Kairan esil shaktar-ai
Zamanymnyn kolyn bulgap otip bara jatkany-ai
 kairan esil , kairan esil shaktar-ai
kolyn bulgap zamanymnyn otip bara jatkany-ai;*/
using namespace std;

int main()
{ios::sync_with_stdio(0);
double n, r=0;
cin>>n;
cout<<2*3.14*n;

}





Measured memory_bytes: 3800
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 507;
const int MOD = 1000000007;

void solve() {
    string s, t;
    cin >> s >> t;
    int n = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {n++;}
    }
    cout << n;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<lint> R(N + 1, 0), G(N + 1, 0), B(N + 1, 0);
    map<char, vector<lint>> mp;
    mp['R'] = vector<lint>(N + 1, 0);
    mp['G'] = vector<lint>(N + 1, 0);
    mp['B'] = vector<lint>(N + 1, 0);
    for (int i = N; 0 < i; i--) {
        // mp[S[i - 1]][i - 1] = mp[S[i - 1]][i] + 1;
        mp['R'][i - 1] = mp['R'][i];
        mp['G'][i - 1] = mp['G'][i];
        mp['B'][i - 1] = mp['B'][i];
        mp[S[i - 1]][i - 1]++;
    }
    // d(S);
    // dump(mp['R']);
    // dump(mp['G']);
    // dump(mp['B']);
    lint ans = 0;
    set<char> se{'R', 'G', 'B'};
    for (int i = 0; i <= N - 3; i++) {
        for (int j = i + 1; j <= N - 2; j++) {
            char c1 = S[i], c2 = S[j];
            int r = j - i;
            // dd(i, j);
            set<char> cp = se;
            if (cp.count(c1) == 1) { cp.erase(c1); }
            if (cp.count(c2) == 1) { cp.erase(c2); }
            if (cp.size() != 1) { continue; }
            char c3 = *cp.begin();
            ans += mp[c3][j + 1];

            if (j + r < N and S[j + r] == c3) ans--;
        }
    }
    // d(ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3764
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define ll long long
#define int long long
#define pii pair <int, int>
#define print(x) for(auto it : x) cout << it << ' ';

using namespace std;

const int N = (int)(1e6) + 322;
const int MAXN = (int)(1e7) + 100;
const int inf = (int)(1e18) + 322;
const int mod = 998244353;
const double eps = 1e-6;
#define endl "\n" // remove

vector <int> getDivs(int x) {
    vector <int> v;
    for(int i = 2; i * i <= x; ++i) {
        if (x % i == 0) {
            v.pb(i);
            if (i * i != x) {
                v.pb(x / i);
            }
        }
    }
    v.pb(x);
    sort(all(v));
    return v;
}

signed main () {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    if (n == 2) {
        cout << 1;
        return 0;
    }
    int cnt = sz(getDivs(n - 1));
    vector <int> divs = getDivs(n);
    for(auto div : divs) {
        int k = n;
//        cout << k << endl;
        while (k >= div) {
            if (k % div == 0) k = k / div;
            else k %= div;
        }
        if (k == 1) {
            cnt++;
        }
    }

    cout << cnt;
    return 0;
}


Measured memory_bytes: 384
h,n=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
#print(l)
weight=[0]*n
value=[0]*n
for i in range(n):
    weight[i],value[i]=l[i][0],l[i][1]
w=h
#print(weight,value)
dp=[[float('inf')]*(w+1) for i in range(n+1)]
for i in range(n):
    for j in range(1,h+1):
        if j<=weight[i]:
            dp[i+1][j]=min(dp[i][j],value[i])
        elif j>=weight[i]:
            dp[i+1][j]=min(dp[i+1][j-weight[i]]+value[i],dp[i][j])
    #print(dp[:i+2])
print(dp[n][w])

Measured memory_bytes: 285448
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
}

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

using namespace std;

typedef long long I64;

const int NMAX = 100;

int N;
int v[2*NMAX+2][NMAX+2];
int used[NMAX+2];
int ans[NMAX+2][NMAX+2];

int main()
{
    int N, A;
    cin >> N >> A;
    if( N % 500 <= A ) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
//Bismillah
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    string s;
    cin>>s;
    int m=0;
    for(int i=0;s[i];i++)
    {
        int c=0;
        while(s[i]=='R')
            c++,i++;
        m=max(m,c);


    }
    cout<<m<<endl;


}
//Alhamdulillah





Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n=0;
  cin>>n;
  vector<long long int> vec(n);
  for(int i=0;i<n;i++){
  cin>>vec[i];
  }
  long long int ans=0;
  for(int i=0;i<n-1;i++){
  if(vec[i]>vec[i+1]){
  ans+=vec[i]-vec[i+1];
    vec[i+1]=vec[i];
  }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(v) (v).begin(),(v).end()
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h, m;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(50, vector<ll>(50, INF));
vector<tuple<ll, ll, ll>> vt;
map<ll, ll> mp;

int main()
{
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
	else cout << "consonant" << endl;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define rep(i,n) for(i=0;i<n;i++)

int in(void){
	int i;
	scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;
	scanf("%lld",&i);
	return i;
}
int cmp(const void *a,const void *b){
	return *(long long *)a-*(long long *)b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long max(long long a,long long b){
	return a>b?a:b;
}

int main(void){
	int a,b,c;
	a=in();
	b=in();
	c=in();
	puts(b-a==c-b?"YES":"NO");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    const int MOD = (int)1e9 + 7;

    static long Fact(int n) {
        long x = 1;
        for (int i = 2; i <= n; i++) {
            x = (x * i) % MOD;
        }
        return x;
    }

    static long Calc(int n, int m) {
        if (Math.Abs(n - m) > 1) return 0;

        if (n == m) {
            long a = Fact(n);
            long b = (a * a) % MOD;
            return (b * 2) % MOD;
        }
        else {
            long a1 = Fact(Math.Min(n, m));
            long a2 = (Math.Max(n, m) * a1) % MOD;
            long b = (a1 * a2) % MOD;
            return b;
        }
    }

    static void Main() {
        var nm = ReadInts();
        int n = nm[0], m = nm[1];
        Console.WriteLine(Calc(n, m));
    }
}

Measured memory_bytes: 13268
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let n: i64 = io.read();
    let x = io.readn::<i64>(n as usize);

    let xav = x.iter().fold(0, |sum, x| sum + x) / n;

    let mut ans = 34243242;
    for i in 0..3 {
        let nw = xav + 1 - i;
        let us = x.iter().fold(0, |sum, x| sum + (x - nw) * (x - nw));
        ans = min(ans, us);
    }
    io.writeln(ans);
}

static MOD: i64 = 1000000007;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
import bisect
import math

n = int(input())
As = list(map(int, input().split()))
As.sort()

# cons = 10 ** 6
# is_prime = [True] * (cons + 1)
# is_prime[0] = False
# is_prime[1] = False
# for i in range(2, int(cons**0.5) + 1):
#     if not is_prime[i]:
#         continue
#     for j in range(i * 2, cons + 1, i):
#         is_prime[j] = False
# Ps = [i for i in range(cons + 1) if is_prime[i]]
def eratosthenes(n):
    is_prime = [0, 0] + [1] * (n - 1)
    for i in range(int(n**0.5) + 1):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = 0
    return [i for i, pi in enumerate(is_prime) if pi == 1]
Ps = eratosthenes(10 ** 6)

def factorize(n):
    primes = set()
    for p in Ps:
        if p * p > n:
            break
        while n % p == 0:
            n //= p
            primes.add(p)
    if n > 1:
        primes.add(n)
    return primes

gcd = As[0]
for a in As:
  gcd = math.gcd(gcd, a)
setwiseFlag = (gcd == 1)

pairwiseFlag = True
target = set()
for a in As:
  primes = factorize(a)
  if len(primes & target) > 0:
    pairwiseFlag = False
  target |= primes

if pairwiseFlag:
  print('pairwise coprime')
elif setwiseFlag:
  print('setwise coprime')
else:
  print('not coprime')


Measured memory_bytes: 196484
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

int n, a[100101], dp[100005], s;

int f(int k)
{
    if (k >= n) return 1e9;
    if (k == n - 1) return 0;
    if (dp[k] != -1) return dp[k];
    int bst = 1e9;
    for (int i = 1; i <= s; ++i)
        bst = min(bst, abs(a[k] - a[k + i]) + f(k + i));
    return dp[k] = bst;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> s;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    memset(dp, -1, sizeof dp);
    cout << f(0);
}


Measured memory_bytes: 5760
#include<iostream>
#include<stack>
#include<cstdlib>
using namespace std;
int main()
{
    int a,b;
    stack<int> s;
    string c;
    while(cin>>c)
    {
        if(c[0]=='+'){a=s.top();s.pop();b=s.top();s.pop();s.push(a+b);}
        else if(c[0]=='-'){a=s.top();s.pop();b=s.top();s.pop();s.push(b-a);}
        else if(c[0]=='*'){a=s.top();s.pop();b=s.top();s.pop();s.push(a*b);}
        else
            s.push(atoi(c.c_str()));//atoi()
    }
    cout<<s.top()<<endl;
    s.pop();
    return 0;
}

Measured memory_bytes: 3156
#include<stdio.h>

int main(){
    long long elements[100],key;
    int n,i,j;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&elements[i]);
    }

    for(j=0;j<n;j++){
        printf("%lld",elements[j]);
        if(j<(n-1)) printf(" ");
    }
    printf("\n");

    for(i=1;i<n;i++){
        key = elements[i];
        j=i-1;
        while(j>=0 && elements[j]>key){
            elements[j+1]=elements[j];
            j--;
        }
        elements[j+1]=key;

        for(j=0;j<n;j++){
            printf("%lld",elements[j]);
            if(j<(n-1)) printf(" ");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 604
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defmacro aif (expr then else)
  `(let ((it ,expr))
     (if it ,then ,else)))

(defmacro awhen (expr &rest then)
  `(aif ,expr (progn ,@then) nil))

(defun comulative (function list &key base)
  (if base
      (comulative function (cons base list))
      (do ((lst (cdr list) (cdr lst))
           (acc (list (car list))))
          ((null lst) (reverse acc))
        (push (funcall function (car acc) (car lst)) acc))))

(defun binary-search (function left right
                      &optional
                        (eps 1)
                        (average-function (lambda (x y) (ash (+ x y) -1))))
  (if (<= (abs (- left right)) eps)
      right
      (let ((mid (funcall average-function left right)))
        (if (funcall function mid)
            (binary-search function left mid eps average-function)
            (binary-search function mid right eps average-function)))))

(defun arithmetic-mean (&rest body)
  (/ (apply #'+ body) (length body)))

(defvar +MOD+ (+ (expt 10 9) 7))

(defun mapa-b (fn a b &optional (step 1))
  (do ((i a (+ i step))
       (result nil))
      ((> i b) (nreverse result))
    (push (funcall fn i) result)))

(defun map0-n (fn n)
  (mapa-b fn 0 n))

(defun map1-n (fn n)
  (mapa-b fn 1 n))

(defun read-string (&optional (stream *standard-input*))
  (labels ((is-empty (x)
             (or (char= x #\space) (char= x #\newline))))
    (loop for char = (read-char stream)
          with result
          when (is-empty char)
            do (return (concatenate 'string (nreverse result)))
          do (push char result))))


(defun main (a b ab x y)
  (labels ((cul-cost (ab-time)
             (+ (* ab-time ab)
                (* (max 0 (- x (ash ab-time -1))) a)
                (* (max 0 (- y (ash ab-time -1))) b))))
    (loop for i from 0 to (* (max x y) 2)
          with res = (expt 10 10)
          do (setf res (min res (cul-cost i)))
          finally (return res))))


(let ((a (read))
      (b (read))
      (ab (read))
      (x (read))
      (y (read)))
  (princ (main a b ab x y)))


Measured memory_bytes: 13884
n,m = map(int,input().split())
a = list(map(int,input().split()))

s = sum(a)
k = 1/(4*m)
c = 0
for i in range(n):
    if a[i]/s >= k:
        c+=1

if c<m:
    ans = 'No'
else:
    ans = 'Yes'
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	bool flag = true;
	for(int i = 0;i < s.size();i++)
	    {
	    	for(int j = i+1;j < s.size();j++)
	    	    {
	    	    	if(s[i] == s[j])flag = false;
				}
		}
	if(flag)
	    {
	    	cout << "yes" << endl;
		}
		else
		    {
		    	cout << "no" << endl;
			} 
	return 0;
}

Measured memory_bytes: 256
n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
# これ必要か？？？？？？？？？？
# -> 意味不明だが必要らしい...
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
for p in range(n + 1):
    for q in range(m + 1):
        if p * (m - q) + q * (n - p) == k:
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define krep(n) for(ll k=0;k<(n);k++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } 

void solve(ll ts){
    ll n; cin>>n; vector<ll> arr(n); rep(n) cin>>arr[i];
    ll su=accumulate(all(arr),(ll)0);
    su%=mod;
    ll prod = (su*su)%mod;
    for(auto i:arr) prod=(prod+mod-(i*i)%mod)%mod;
    cout<<(prod*pw(2,mod-2,mod))%mod<<endl;
} 
int main(){
    ffast
    ll t=1;
//    cin>>t;
    rep(t) solve(i+1);
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 4776
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int r = scan.nextInt();


        os.println(r*r);
    }
}

Measured memory_bytes: 24020
#include <stdio.h>

int main (void)
{
  int x, y, z;
  scanf("%d %d %d", &x, &y, &z);
  int *a[] = {&x, &y, &z};

  if (x, y, z >= 1 && x, y, z <= 10000)
  {
    for (int i = 0; i < 2; i++)
    {
      for (int j = 0; j < 2 - i; j++)
      {
        if (*a[j] > *a[j + 1])
        {
          int temp = *a[j + 1];
          *a[j + 1] = *a[j];
          *a[j] = temp;
        }
      }
    }
    printf("%d %d %d\n", x, y, z);
  }
}


Measured memory_bytes: 2060
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int w[300], dp[301][301];
signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    if(!n)break;

    rep(i, n)scanf("%d", w+i);
    rep(i, n + 1)rep(j, n + 1)dp[i][j] = 0;

    rep(i, n - 1)dp[i][i + 2] = (abs(w[i + 1] - w[i]) <= 1) * 2;

    for(j = 3;j <= n;++j)rep(i, n - j + 1){
      rep(k, j)dp[i][i + j] = max(dp[i][i + j], dp[i][i + k] + dp[i + k][i + j]);
      if(abs(w[i] - w[i + j - 1]) <= 1 && dp[i + 1][i + j - 1] == j - 2)dp[i][i + j] = j;
    }
    //rep(i, n + 1)rep(j, n + 1)if(dp[i][j] > 0)pri3(i, j, dp[i][j]);
    pri(dp[0][n]);

  }
  return 0;
}

Measured memory_bytes: 3468
import java.util.Scanner

object Main {
  def main(args:Array[String]) = {
    val sc = new Scanner(System.in)
    val N,M = sc.nextInt()
    val listX = List.fill(M)(sc.nextInt())
    val s = listX.sortWith((a, b) => a < b)
    val g = s.zip(s.tail).map{
      case (a, b) => (b - a).abs
    }.sortWith((a,b) => a > b).drop(N - 1).sum
    println(g)
  }
}

Measured memory_bytes: 61860
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    V = [int(x) for x in input().split()]
    C = [int(x) for x in input().split()]

    ans = 0
    for i in range(N):
        if (V[i] - C[i]) > 0:
            ans += V[i] - C[i]

    print(ans)



if __name__ == '__main__':
    main()



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

#define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x & -x)
#define FOR(i,a,b)  for(int i=(a); i< (b); ++i)
#define RFOR(i,b,a) for(int i=(b);i>=(a);i--)
#define REP(i,a,b)  for(int i=(a); i<=(b); ++i)
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
template<typename T>
void PrArr(const T a[] , int len){
	for(int i = 0;i <= len; i++)cout << a[i] << " ";
	cout << endl;
}
template<typename T>
void PrVec(const vector<T> a){
	for(auto it : a)cout << it << " ";
	cout << endl;
}
const int MAX = 0x7ffffff;
const int MIN = 0xcf;
const int N = 100005;
int test;
int cnt[N];
void slove()
{
	int n;cin >> n;
	ll sum = 0;
	FOR(i , 0 , n)
	{
		int x = 0;cin >> x;
		cnt[x]++;sum += x;
	}
	int q;cin >> q;
	int b , c;
	while(q--)
	{
		cin >> b >> c;
		sum += (c - b) * cnt[b];
		cnt[c] += cnt[b];
		cnt[b] = 0;
		cout << sum << endl;
	}
}
int main()
{
#ifdef LOCAL
	auto start_time = clock();
	cerr << setprecision(3) << fixed; // 在iomanip中
#endif
	SIS;slove();
#ifdef LOCAL
	auto end_time = clock();
	cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
}

Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
    static final int SIZE = 3;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[][] c = new char[SIZE][SIZE];
        for (int i = 0; i < SIZE; ++i) {
            String line = sc.next();
            for (int j = 0; j < SIZE; ++j) {
                c[i][j] = line.charAt(j);
            }
        }

        System.out.println(solve(c));

        sc.close();
    }

    static String solve(char[][] c) {
        return String.format("%c%c%c", c[0][0], c[1][1], c[2][2]);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		if(A==i+1) a[i]++;
	}
	int t=0;
	for(int i=0;i<n;i++){
		if(a[i]) a[i+1]=0,t++;
	}
	cout<<t<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  double ans=0,N=n;
  int t=1,tmp=n;
  while(n){
    ans+=(double)max(n-k+1,0)/(t*N);
  	n=min(k-1,n);
    k=k/2+k%2;
    t*=2;
    //printf("%f\n",ans);
  }
  printf("%.9f\n",ans);
  return 0;
}

Measured memory_bytes: 256