akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll modinv(ll n)    { ll ans=powm(n,mod-2); return ans; }
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

int main()
{
	fast
	ll n;
	cin>>n;

	ll a[n];
	forn(i,0,n)
	cin>>a[i];

	sort(a,a+n);

	double ans = (a[0]+a[1])/2.0;
	forn(i,2,n)
	{
		ans = (ans+(a[i]))/2;
	}
	cout<<fixed<<setprecision(6)<<ans;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> num;
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    cin >> A[i];
    num[A[i]]++;
    ans += A[i];
  }
  int Q;
  cin >> Q;
  for( int q = 0; q < Q; q++ ){
    int B, C;
    cin >> B >> C;
    if( num.count(B) ){
      int kazu = num.at(B);
      ans += kazu*C - kazu*B;
      num.erase(B);
      num[C] += kazu;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 8008
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template <typename T> using order_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T1, typename T2> using order_map = tree <T1, T2, less <T1>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> bool MIN(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> bool MAX(T &a, T b) { return a < b ? (a = b, true) : false; }

#define ll              long long int
#define endl            '\n'
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define mk              make_pair
#define ff              first
#define ss              second
#define all(a)          (a).begin(), (a).end()
#define rall(a)         (a).rbegin(), (a).rend()
#define eb              emplace_back
#define pb              push_back
#define LINE            __LINE__

static const int maxn = 2e5 + 5;
static const int logn = 19;

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

      int k;
      cin >> k;
      string s;
      cin >> s;
      if (s.size() <= k) {
            cout << s << endl;
            return 0;
      }
      while (s.size() > k) {
            s.pop_back();
      }
      cout << s << "..." << endl;

      #ifndef ONLINE_JUDGE
            cerr << endl << "Time : " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
      #endif // ONLINE_JUDGE
}


Measured memory_bytes: 3616
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const int N = 1e5 + 10;
string s;
int n;

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

	int dp[n];
	memset(dp, 0, sizeof dp);
	dp[0] = 0;
	
	for (int i = 1; i < n; ++i) {
		dp[i] = abs(a[i] - a[i - 1]) + dp[i - 1];
		for (int j = i - 1; j >= 0 && j >= i - k; --j) {
			dp[i] = min (dp[i], abs(a[i] - a[j]) + dp[j]);
		}
	}
	cout << dp[n - 1];
}
int main () {
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                  

Measured memory_bytes: 1024
//HOW YOU DOI'N........................JT
//Could this code be more bad..........CB
//I know...............................MG
//Hii..................................RG
//Noooooooo............................RG
//I wish I could but I don't want to...PB

//That's what she said.................MS


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (ll i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vvl vector<vector<ll>>
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;

ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll min(ll a,ll b){if(a>=b)return b;return a;}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 100005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};





// Lets start ...


void solve(){
    
    ll d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)cout<<"Yes";
    else cout<<"No";
    
    
}

int main(){
    //vector<int> primes;
    //Sieve(primes);
    
    fast
    ll tests=1,cnt=0;
    //cin>>tests;
    while(tests--){
        solve();
    }
    

    return 0;
    }

// Done:)




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

using namespace std;

typedef long long ll;

class UnionFindTree {
private:
  int nodeSize;
  vector<int> parent;
  vector<int> rank;
  vector<int> treeSize;

public:
  UnionFindTree(int ns) {
    nodeSize = ns;
    parent = vector<int>(nodeSize);
    rank = vector<int>(nodeSize, 0);
    treeSize = vector<int>(nodeSize, 1);

    for(int i = 0; i < nodeSize; i++) {
      parent[i] = i;
    }
  }

  int find(int x) {
    if (parent[x] == x) {
      return x;
    } else {
      return parent[x] = find(parent[x]);
    }
  }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y) {
      return false;
    }

    if (rank[x] < rank[y]) {
      parent[x] = y;
      treeSize[y] += treeSize[x];
    } else {
      parent[y] = x;
      treeSize[x] += treeSize[y];
      if (rank[x] == rank[y]) {
        rank[x]++;
      }
    }

    return true;
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int getSize(int x) {
    return treeSize[find(x)];
  }
};

int main() {
  int n, m;
  cin >> n >> m;

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

  UnionFindTree uf(n);
  vector<ll> ans;
  ll cnt = (ll)(n - 1) * n / 2;

  for (int i = m - 1; i >= 0; i--) {
    ans.push_back(cnt);

    if (!uf.same(a[i], b[i])) {
      cnt -= (ll)uf.getSize(a[i]) * uf.getSize(b[i]);
      uf.unite(a[i], b[i]);
    }
  }

  for (int i = m - 1; i >= 0; i--) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 4212
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    vector<ll> v(s.size()+1,-1);
    FOR(i,1,s.size()){
        if(s[i-1] == '>' && s[i] == '<') v[i] = 0;
    }
    if(s[0] == '<') v[0] = 0;
    if(s[s.size()-1] == '>') v[s.size()] = 0;
    

    FOR(i,0,s.size()){
        if(s[i] == '<') v[i+1] = max(v[i+1], v[i]+1);
    }
    FORr(i,0,s.size()-1){
        if(s[i] == '>') v[i] = max(v[i], v[i+1]+1);
    }

    ll sum = 0;
//    FOR(i,0,v.size()){
//        cout<<v[i]<<" ";
//    }
//    cout<<endl;
    FOR(i,0,v.size()) sum += v[i];
    cout<<sum<<endl;
    
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[111111][15];

void mod_add(ll &a, ll b){
	a += b;
	a %= MOD;
}

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

	string str;cin >> str;
	dp[0][0] = 1;

	REP(i, str.size()){
		REP(j, 13){
			if(str[i] == '?'){
				REP(ii, 10){
					mod_add(dp[i+1][(j * 10+ii) % 13], dp[i][j]);
				}
			}
			else {
				mod_add(dp[i+1][(j * 10 + (str[i] - '0')) % 13], dp[i][j]);
			}
		}
	}

	cout << dp[str.size()][5] << endl;

	return 0;
}


Measured memory_bytes: 12752
#include <stdio.h>
#include <string.h>
#include <ctype.h>

void roll_N(void);
void roll_E(void);
void spin(void);
int dice[2][6],dice_spin[6],temp;


int main(void)
{
	int i,j;
	int now[6];

	for(i = 0; i < 2; i++)
	{
		scanf("%d %d %d %d %d %d", &dice[i][0],&dice[i][1],&dice[i][2],&dice[i][3],&dice[i][4],&dice[i][5]);
	}
	for(i = 0; i < 6; i++)
	{
		dice_spin[i] = dice[1][i];
		now[i] = dice[0][i];
	}

	for(i = 0; i < 6; i++)
	{
	

		for(j = 0; j < 4; j++)
		{
			roll_N();	

			if (dice_spin[i] == now[0] )
			{
				break;
			}
		}	

		if (dice_spin[i] != now[0])
		{
			for(j = 0; j < 4; j++)
			{
				roll_E();	

				if (dice_spin[i] == now[0])
				{
					break;
				}
			}
		}	
	

		for(j = 0; j < 4; j++)
		{
			spin();
			if (dice_spin[(i+1) % 6] == now[1])
			{
				break;
			}
		}	
	

		if (dice_spin[(i+2)%6] == now[2] && dice_spin[(i+3)%6] == now[3] && dice_spin[(i+4)%6] == now[4] && dice_spin[(i+5)%6] == now[5])
		{
			printf("Yes\n");
			return 0;
		}	

		}

	printf("No\n");

	return 0;
}


void roll_N(void)
{
	temp = dice_spin[4];
	dice_spin[4] = dice_spin[0];
	dice_spin[0] = dice_spin[1];
	dice_spin[1] = dice_spin[5];
	dice_spin[5] = temp;

}

void roll_E(void)
{
	temp = dice_spin[2];
	dice_spin[2] = dice_spin[0];
	dice_spin[0] = dice_spin[3];
	dice_spin[3] = dice_spin[5];
	dice_spin[5] = temp;
}


void spin(void)
{
	temp = dice_spin[3];
	dice_spin[3] = dice_spin[1];
	dice_spin[1] = dice_spin[2];
	dice_spin[2] = dice_spin[4];
	dice_spin[4] = temp;

}

Measured memory_bytes: 580
n=int(input())
s=list(map(int,input().split()))
flag=0
c=0
while (1):
    for i in range(len(s)):
        if s[i]%2==0:
            s[i]=int(s[i]/2)
        else:
            flag=1
    if flag==1:
        break 
    c+=1
    
print(c)     

Measured memory_bytes: 3060
n, k = map(int, input().split())
s = list(input())
if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 17; 
using namespace std;

int n, m, pw[N], sz, w[N][N], g[N][(1 << 17) + 5], h[(1 << 17) + 5], f[(1 << 17) + 5][N], ans, vis[(1 << 17) + 5], sum; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

int lowbit(int x) { return x & (-x); }

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> (), m = read <int> ();
	for(int i = (pw[0] = 1); i <= n; i++) pw[i] = 2 * pw[i - 1];
	for(int i = 0; i <= n; i++) vis[pw[i]] = i; 
	sz = pw[n] - 1; 
	for(int u, v, i = 1; i <= m; i++)
	{
		u = read <int> (), v = read <int> (), w[u][v] = w[v][u] = read <int> (); 
		sum += w[u][v], g[u][pw[v - 1]] = g[v][pw[u - 1]] = w[u][v]; 
	}
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= sz; j++) g[i][j] = g[i][lowbit(j)] + g[i][j ^ lowbit(j)]; 
	for(int u, v, i = 1; i <= sz; i++)
	{
		u = lowbit(i), v = i ^ u, u = vis[u] + 1; 
		h[i] = h[v] + g[u][v]; 
	}
	memset(f, -0x3f, sizeof(f));
	for(int i = 1; i <= sz; i++) if(i & pw[0]) f[i][1] = h[i]; 
	for(int x, s = 1; s <= sz; s++)
		for(int i = 1; i <= n; i++)
			if(s & pw[i - 1])
			{
				for(int j = 1; j <= n; j++)
					if(!(s & pw[j - 1]) && w[i][j])
						f[s | pw[j - 1]][j] = max(f[s | pw[j - 1]][j], f[s][i] + w[i][j]);
				x = sz ^ s; 
				for(int t = x; t; t = (t - 1) & x)
					f[s | t][i] = max(f[s | t][i], f[s][i] + h[t | pw[i - 1]]); 
			}
	for(int i = 0; i <= sz; i++) ans = max(ans, f[i][n]); 
	printf("%d\n", sum - ans); 
	return 0; 
}


Measured memory_bytes: 14020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;
const ll MAX_N=1000010;
const int iNT_MAX=1LL<<30;

ll n,dat[2*MAX_N-1];

void init(ll n_){
    n=1;
    while(n<n_)n*=2;
    rep(i,2*n-1)dat[i]=0;
}

void update(ll k,char a){
    k+=n-1;
    ll x=a-'a';
    dat[k]=1<<x;
    while(k){
        k=(k-1)/2;
        dat[k]=dat[k*2+1]|dat[k*2+2];
    }
}

ll query(ll a,ll b,ll k,ll l,ll r){
    if(r<=a || b<=l)return 0;
    if(a<=l && r<=b)return dat[k];
    else{
        ll vl=query(a,b,k*2+1,l,(l+r)/2);
        ll vr=query(a,b,k*2+2,(l+r)/2,r);
        return vl|vr;
    }
}

int main() {
    ll d;
    cin >> d;
    init(d);
    string s;
    cin >> s;
    rep(i,d){
        update(i,s[i]);
    }
    ll q;
    cin >> q;
    rep(i,q){
        ll t;
        cin >> t;
        if(t==1){
            ll a;
            char c;
            cin >> a >> c;
            a--;
            update(a,c);
        }
        else{
            ll l,r;
            cin >> l >> r;
          	l--;
            ll x=query(l,r,0,0,n);
            cout << __builtin_popcount(x) << endl;
        }
    }

    


}

/*



 */




Measured memory_bytes: 11140
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */
namespace utils{

    class Repeater{
        int st;
        int ed;
        int d;
    public:
        class rep_iterator{
            int i; int d;
        public:
            rep_iterator(int x, int pd) :i(x), d(pd) {}

            int& operator*(){ return i; }
            bool operator==(const rep_iterator& k) const { return i == k.i; }
            bool operator!=(const rep_iterator& k) const { return i != k.i; }
            rep_iterator& operator++(){ i+=d; return *this; }
        };

        explicit Repeater(int N) :st(0), ed(N), d(1) {}
        Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }

        rep_iterator begin() const{ return rep_iterator(st, d); }
        rep_iterator end() const{ return rep_iterator(ed, d); }

    };

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll A, B;
    is >> A >> B;
    if(!is) return;
    cout << (A <= 5 ? 0 : A < 13 ? B/2 : B) << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_A.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256
n = int(input())
x = [float(i) for i in input().split()]
y = [float(i) for i in input().split()]

d = 0
for i in range(n):
    d += abs(x[i] - y[i])
print(d)

d = 0
for i in range(n):
    d += (x[i] - y[i])**2
print(d**0.5)

d = 0
for i in range(n):
    d += (abs(x[i] - y[i]))**3
print(d**(1/3))

print(max([abs(x[i] - y[i]) for i in range(n)]))


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

int main()
{
	int A[128][128], B[128];
	int N, M;
	cin >> N >> M;
	for(int i = 0; i < N; ++i)
	{
		for(int j = 0; j < M; ++j)
		{
			cin >> A[i][j];
		}
	}
	
	for(int i = 0; i < M; ++i)
	{
		cin >> B[i];
	}
	
	int sum = 0;
	for(int i = 0; i < N; ++i)
	{
		sum = 0;
		for(int j = 0; j < M; ++j)
		{
			sum += A[i][j] * B[j];
		}
		cout << sum << endl;
	}

    return 0;
}



Measured memory_bytes: 3132
main = do
    s <- getLine :: IO String
    print . minimum . map (abs . (753 -) . read) $ takeThree s

takeThree :: String -> [String]
takeThree xs = init $ takeThree' xs
takeThree' xs = if length xs < 3
                  then [[]]
                  else take 3 xs : takeThree' (tail xs)

Measured memory_bytes: 508
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
#define int long long
int a[200100],b[200100],n,m,ans;
signed main(){
    int i,j,k;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
      scanf("%lld",&a[i]);
      b[i]=i-a[i];
      if(a[i]-a[i-1]>1||a[i]>=i){
        puts("-1");
        return 0;
      }
    }
    for(i=n;i>0;i--){
      if(i!=n&&b[i]==b[i+1])continue;
      ans+=a[i];
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

long long int gcd(long long int a, long long int b) {
    if(a<b) {
        long long int tmp=a;
        a = b;
        b = tmp;
    }
    
    if(b==0) return a;
    
    long long int r=a%b;
    return gcd(b, r);
}

int main() {
    int N;
    cin >> N;
    
    long long int A[N];
    long long int R[N], L[N];
    for(int i=0; i<N; i++) {
        cin >> A[i];
        if(i==0) {
            L[i] = 0;
        } else {
            L[i] = gcd(A[i-1], L[i-1]);
        }
    }

    long long int ans=0;
    for(int i=N-1; i>=0; i--) {
        if(i==N-1) {
            R[i] = 0;
        } else {
            R[i] = gcd(A[i+1], R[i+1]);
        }
        long long int tt=gcd(L[i], R[i]);
        if(ans<tt) {
            ans = tt;
        }
    }
    
    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n, k, ans;
   cin >> n >> k;
   ll n1 = n / k, n2 = (n - k / 2) / k + 1;

   ans = pow(n1, 3LL);
   if (k % 2 == 0 && k/2 <= n)
   {
      ans += pow(n2, 3LL);
   }

   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
x =[]
y =[]
for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
d ={}
for i in range(1,n+1):
    d[i]=0

for i in range(m):
    d[x[i]] += 1
    d[y[i]] += 1

for i in range(1,n+1):
    print(d[i])




Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007

int main() {
	int n, ans = 0;
	cin >> n;
	string s;
	cin >> s;
	rep(i, n - 2) {
		if (s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i + 2) == 'C') ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n;
    ll a[300010];
    std::cin >> n;
    for (int i = 0; i < n*3; i++) {
        std::cin >> a[i];
    }
    sort(a,a+n*3);
    ll result = 0;
    for (int i = 0; i < n; i++) {
        result += a[n*3-1 -1 -(2*i)];
    }
    std::cout << result << std::endl;
}


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

int wf[10][10];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int H, W;
	cin >> H >> W;
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			cin >> wf[i][j];
		}
	}

	for(int k = 0; k < 10; k++){
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
			}
		}
	}

	ll ans = 0;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			int a;
			cin >> a;
			if(a == -1) continue;
			if(a != 1) ans += wf[a][1];
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
string s; int c;
int main() {
	while(cin >> s) {
		if(c++) printf("\n");
		while(s.size() != 5) s = "0" + s;
		for(int i = 0; i < 5; i++) printf("%c", s[i] < '5' ? '*' : ' '); printf("\n");
		for(int i = 0; i < 5; i++) printf("%c", s[i] > '4' ? '*' : ' '); printf("\n");
		printf("=====\n");
		for(int i = 0; i < 5; i++) {
			for(int j = 0; j < 5; j++) printf("%c", (s[j] - 48) % 5 == i ? ' ' : '*'); printf("\n");
		}
	}
}

Measured memory_bytes: 3180
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

w,h,n=MI()
rect=[0,w,0,h]
for i in range(n):
    a,b,c=MI()
    if c==1:
        rect[0]=max(a,rect[0])
    elif c==2:
        rect[1]=min(a,rect[1])
    elif c==3:
        rect[2]=max(b,rect[2])
    else:
        rect[3]=min(b,rect[3])
print(max(0,rect[3]-rect[2])*max(0,rect[1]-rect[0]))

Measured memory_bytes: 38384
#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 FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

ll ans = 1;
const ll mod = 1e9+7, MAX = 210000;
ll N, M;
ll fac[MAX], finv[MAX], inv[MAX];

void init(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  FOR(i, 2, MAX){
    fac[i] = fac[i-1] * i % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll solve(int n, int k){
  return fac[n+k] * (finv[k] * finv[n] % mod) % mod;
}
int main(){
  init();
  cin >> N >> M;
  int i = 2;
  while(M != 1){
    int cnt = 0;
    while( M % i == 0){
      M /= i;
      cnt++;
    }
    if(cnt){
      // int tmp = solve(N-1, cnt);
      // if(tmp ==0){
      //   cout << i << " " << cnt << endl;
      // }
      ans *= solve(N-1, cnt);
      ans %= mod;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5120
#define _USE_MATH_DEFINES
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<cctype>
#include<iomanip>
#include<cassert>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

class dice{
private:
	int num[6];//各方向の整数

public:
	void go_north(int dice_num[]);
	void go_south(int dice_num[]);
	void go_east(int dice_num[]);
	void go_west(int dice_num[]);
};

void dice::go_north(int dice_num[]){
	int temp;//一時的に格納するための変数
	rep(i, 6){
		num[i] = dice_num[i];
	}

	temp = num[0];
	num[0] = num[1];
	num[1] = num[5];
	num[5] = num[4];
	num[4] = temp;

	rep(i, 6){
		dice_num[i] = num[i];
	}
}

void dice::go_south(int dice_num[]){
	int temp;//一時的に格納するための変数
	rep(i, 6){
		num[i] = dice_num[i];
	}

	temp = num[0];
	num[0] = num[4];
	num[4] = num[5];
	num[5] = num[1];
	num[1] = temp;

	rep(i, 6){
		dice_num[i] = num[i];
	}
}

void dice::go_east(int dice_num[]){
	int temp;//一時的に格納するための変数
	rep(i, 6){
		num[i] = dice_num[i];
	}

	temp = num[0];
	num[0] = num[3];
	num[3] = num[5];
	num[5] = num[2];
	num[2] = temp;

	rep(i, 6){
		dice_num[i] = num[i];
	}
}

void dice::go_west(int dice_num[]){
	int temp;//一時的に格納するための変数
	rep(i, 6){
		num[i] = dice_num[i];
	}

	temp = num[0];
	num[0] = num[2];
	num[2] = num[5];
	num[5] = num[3];
	num[3] = temp;

	rep(i, 6){
		dice_num[i] = num[i];
	}
}

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

	int dice1_num[6];//今回のサイコロの各面の整数を入れる配列
	string str;
	dice dice1;

	//入力
	rep(i, 6){
		cin >> dice1_num[i];
	}
	cin >> str;

	rep(i, str.length()){//文字の数だけループ
		switch (str[i]){
		case 'N':
			dice1.go_north(dice1_num);//ポインタ渡し
			break;
		case 'S':
			dice1.go_south(dice1_num);
			break;
		case 'E':
			dice1.go_east(dice1_num);
			break;
		case 'W':
			dice1.go_west(dice1_num);
			break;
		}
	}

	cout << dice1_num[0] << '\n';

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    map<string, long long int> dic;
    for(int i = 0; i < N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        dic[s]++;
    }
    long long ans = 0;
    for(auto val: dic) {
        long long int value = val.second;
        ans += (value*(value - 1) / 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 11136
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for x in range(1, n+1):
    c = 0
    for j in range(x):
        c += a[0][j]
    for i in range(j, n):
        c += a[1][i]
    ans = max(ans, c)
print(ans)


Measured memory_bytes: 3060
import numpy as np

n,t= list(map(int,input().split()))

cs = []
ts = []
for k in range(n):
    cc, tt = list(map(int,input().split()))
    cs.append(cc)
    ts.append(tt)
    

try:
    print(np.min(np.array(cs)[np.array(ts)<=t]))
except:
    print('TLE')

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

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define show(x) cerr << #x << x << endl

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = 1000000000 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//
//
//  　　┓　　　┏
//  　＊┗┓　┏┛
//  　　　┫　┣　＊
//  　┏┳┻━┻┳┓
//  　┗┫　　　┣┛
//  ＊　┣　　━┃　＊        Merry Christmas!!
//  　┏┛　　〃┃
//  　┃●　　　┣━┳┓
//  　┗┻┳━━┛　┣┛
//  　＊　┃┏┓┣┓┃
//WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

int n;
ll k;
ll p[51], sz[51];

ll dfs(int L, ll x) {
    if (L == 0) {
        if (x <= 0) return 0L;
        else if (x == 1) return 1L;
        else assert(0);
    }
    if (x == 1) return 0L;
    if (x > 1 && x <= sz[L - 1] + 1) return dfs(L - 1, x - 1);
    if (x > sz[L - 1] + 1 && x <= sz[L - 1] + 2) return p[L - 1] + 1;
    if (x > sz[L - 1] + 2 && x <= sz[L - 1] * 2 + 2) return p[L - 1] + 1 + dfs(L - 1, x - sz[L - 1] - 2);
    if (x > sz[L - 1] * 2 + 2 && x <= sz[L - 1] * 2 + 3) return p[L];
    return 0L;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1 = freopen("C:\\Users\\naruse\\CLionProjects\\competitive\\cmake-build-debug\\in.txt", "r", stdin);
    //stream2 = freopen("out.txt", "w", stdout);
    if (stream1 == nullptr) return 0;
    //if (stream2 == NULL) return 0;
#endif
    cin >> n >> k;
    p[0] = 1;
    sz[0] = 1;
    for (int i = 1; i <= n; i++) {
        p[i] =p[i - 1] * 2 + 1;
        sz[i] = sz[i - 1] * 2 + 3;
    }
    cout << dfs(n, k) << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
    return 0;
}

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

int main() {
  
  int a=0;
  string s;
  
  cin >> a;
  cin >> s;
  
  if(a < 3200) {
    
    cout << "red" << endl;
    
  } else if(3200 <= a) {
    
    cout << s << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

int main() {
  int N, ans;
  cin >> N;
  ans=0;
  vector<int> a(N);
  for (int i=0; i<N; i++) {
    cin >> a[i];
  }
  for (int j=0; j<N; j++) {
    if (a[a[j]-1]==j+1) {
      ans=ans+1;
    }
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 3748
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    s_s = input()
    t_s = input()

    ans = 0

    for i in range(len(s_s) - len(t_s) + 1):
        work = 0

        for j in range(len(t_s)):
            if s_s[i + j] == t_s[j]:
                work += 1
        ans = max(ans, work)

    print(len(t_s) - ans)


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """cabacc
abc"""
        output = """1"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """codeforces
atcoder"""
        output = """6"""
        self.assertIO(test_input, output)

    # 自作テストパターン
    def test_original(self):
        pass


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


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

int main(){
    long N, K;
    cin >> N >> K;
    long x = N;
    while (x > min(x, abs(x-K))){
        if(x > K) x %= K;
        else x = min(x, abs(x-K));
    }
    cout << x << endl;
}


Measured memory_bytes: 256
S = input()

S = set(S)
flag = True
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in alphabet:
    if i not in S:
        print(i)
        flag = False
        break
if flag:
    print("None")

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	ll ans=0;
	cin >> s;
	for(ll i=0,j=SIZE(s)-1;i<j;){
		if(s[i]==s[j]){
			i++;
			j--;
		}
		else if(s[i]=='x'){
			i++;
			ans++;
		}
		else if(s[j]=='x'){
			j--;
			ans++;
		}
		else{
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    for (int i = 0; i < N; i++)
    {
        cin >> V[i];
    }

    int ans = 0;
    // get jewellery x times and throw away them K-x times
    // 0 <= x <= N, x >= K-x <=> 2x >= K
    // get jewellery y times from left and x-y times from right
    // O((NlogN)^2)

    for (int x = 1; x <= min(N, K); x++)
    {
        for (int y = 0; y <= x; y++)
        {
            int tmp_ans = 0;
            priority_queue<int, vector<int>, greater<int>> W;
            for (int i = 0; i < y; i++)
            {
                W.push(V[i]);
            }
            for (int i = 0; i < x - y; i++)
            {
                W.push(V[N - 1 - i]);
            }
            while ((!W.empty()) && W.top() < 0 && (x + (x - W.size()) < K))
            {
                W.pop();
            }

            while (!W.empty())
            {
                tmp_ans += W.top();
                W.pop();
            }

            ans = max(ans, tmp_ans);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define PI 3.14159265358979323846

int main(void){
	int n , i;
	double point_x[1001] , point_y[1001] , p_rad;
	point_x[1] = 1;
	point_y[1] = 0;
	for(i=2;i<=1000;i++){
		if(point_x[i-1]==0){
			if(point_y[i-1]>0){
				point_y[i] = point_y[i-1];
				point_x[i] = point_x[i-1] - 1;
			}else{
				point_y[i] = point_y[i-1];
				point_x[i] = point_x[i-1] + 1;
			}
		}else{
			if(point_x[i-1]>0){
				p_rad = PI/2 + atan(point_y[i-1]/point_x[i-1]);
			}else{
				p_rad = PI + PI/2 + atan(point_y[i-1]/point_x[i-1]);
			}
			point_x[i] = point_x[i-1] + cos(p_rad);
			point_y[i] = point_y[i-1] + sin(p_rad);
		}
	}
	while(1){
		scanf("%d" , &n);
		if(n==-1) break;
		printf("%.2f\n%.2f\n" , point_x[n] , point_y[n]);	
	}


	return 0;
}

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

int main() {
  int N;
  long int K;
  int pos=1;
  cin>>N>>K;
  vector<int> A(N);
  for (int i=0;i<N;i++){
    cin>>A.at(i);
  }
  
  if (K<=N){
    for (int i =0;i<K;i++){
          pos=A.at(pos-1);
    }
  }else{
	int K2 =K%N;
    int posN;
    int iCycle;
    pos=1;
    for (int i =0;i<N;i++){
          pos=A.at(pos-1);
    }
    posN=pos;
    for (int i =0;i<K2+N;i++){
      pos=A.at(pos-1);
      if(pos==posN){
        iCycle=i+1;
      }
    }
    int K3= (K-N)%iCycle;
    pos=posN;
    for (int i =0;i<K3;i++){
            pos=A.at(pos-1);
    }
    
    
  }
  cout <<pos;
}
 

Measured memory_bytes: 4052
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;
  int k;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */

for(i=0;i<n;i++){
  scanf("%d",&A[i+1]);
}
for(i=0;i<=VMAX;i++){
  C[i] = 0;
}
for(j=1;j<=n;j++){
  C[A[j]] = C[A[j]]+1;
}
  for(i=1;i<=VMAX;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=1;j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]] = C[A[j]]-1;
}
for(i=1;i<=n;i++){
  if(i>1){
    printf(" ");
  }
   printf("%d",B[i]);
 }
 printf("\n");
  return 0;
}



Measured memory_bytes: 9708
#[allow(dead_code)]
fn read_line(n: usize) -> String {
    let mut ss = String::new();
    for _i in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        ss.push_str(&s);
    }
    ss
}

macro_rules! parse {
    ($s:expr => $($r:tt)*) => {
        let s = $s;
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        parse!{s => $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main()
{
    parse!{
        immut_ss: [i32; 2],
    }
    let mut ss = immut_ss;
    let diff = (ss[0] - ss[1]).abs();
    if diff > 180 {
        if ss[0] > ss[1] {
            ss[0] -= 360;
        }
        else {
            ss[1] -= 360;
        }
    }
    let sum = ss[0] + ss[1];
    let mut ans = sum as f32 / 2.0;
    if ans < 0.0 {
        ans += 360.0;
    }
    println!("{}", ans);
}


Measured memory_bytes: 5044
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n, w;
	cin >> n >> w;
	vector<int> v(n);
	vector<int> ww(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i] >> ww[i];
	}
	vector<int> dp(w+1, 0);
	vector<int> dp2(w+1, 0);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= w; j++) {
			if (j-ww[i] >= 0) {
				dp2[j] = max(dp2[j], dp[j-ww[i]]+v[i]);
			}
		}
		dp = dp2;
	}
	cout << dp[w] << endl;
	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
string S, T,U;
ll A,B;

int main(){
    cin >> S >> T >> A >> B >> U;
    if(S==U){
        printf("%lld %lld", A - 1, B);
    }else{
        printf("%lld %lld", A, B - 1);
    }
    return 0;
}

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


#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int n,t[100000],x[100000],y[100000],f;

main() {
    cin >> n;
    rep1(i,n) {
        int abt,abx,aby;
        cin >> t[i] >> x[i] >> y[i];
        abt = t[i] - t[i-1];
        abx = abs(x[i] - x[i-1]);
        aby = abs(y[i] - y[i-1]);
        if ((abt-abx-aby)%2 || abt-abx-aby < 0) f = 1;
    }
    if (f) cout << "No" << endl;
    else cout << "Yes" << endl;
}



Measured memory_bytes: 2560
import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        boolean first0 = false;
        char[] ans = new char[n];
        for(int i = 0; i < n; i++){
            ans[i] = '0';
        }
        for(int i = 0; i < m; i++){
            int s = sc.nextInt();
            char c = sc.next().charAt(0);
            if(s == 1 && c == '0'){
                first0 = true;
            }
            if(ans[s-1] != '0' && ans[s-1] != c){
                System.out.println(-1);
                return;
            }else{
                ans[s-1] = c;
            }
        }
        if(n != 1 && ans[0] == '0' && first0){
            System.out.println(-1);
            return;
        }else if(n != 1 && ans[0] == '0'){
            ans[0] ='1';
        }
        System.out.println(new String(ans));
    }
}


Measured memory_bytes: 23764
#include<stdio.h>

#define N 100001
long A[N];
long B[N];
int n;
long count;

void init(){
	count = 0;
	return;
}

void input(){
	int i;
	scanf("%d", &n);
	for( i = 1; i <= n; i++ ){
		scanf("%ld %ld", &A[i], &B[i]);
	}
	return;
}

int push(int i){
	if( i <= 0 ){ return 0; }
	int t = B[i] - (A[i]+count) % B[i];
	count += (t==B[i]?0:t);
	push(i-1);
	return 0;
}

int main(){
	init();
	input();
	push(n);
	printf("%ld\n", count);
	return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (a > b){
		printf("a > b\n");
	}
	else if (a < b){
		printf("a < b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 1816
import Control.Monad
import Control.Applicative

main :: IO ()
main = getLine >>= \_ -> fmap ((map read) . lines) getContents >>= \an -> print $ solve 1 an

solve :: Int -> [Int] -> Int
solve _ [] = 0
solve k (a:an)
  | k < a     = if k == 1 then (a-1) + solve (k+1) an else if r == 0 then q - 1 + solve k an else q + solve k an
  | k == a    = solve (k+1) an
  | otherwise = solve k an
  where
    r = a `mod` k
    q = a `div` k

Measured memory_bytes: 4220