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

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int P = scanner.nextInt();
		int Q = scanner.nextInt();
		int R = scanner.nextInt();
		
		int x = P + Q;
		int y = Q + R;
		int z = R + P;
		
		int min = x;
		
		int[] data = { x, y, z};
        // 最小値を求める
        for(int i = 0; i < data.length; i++)
                min = Math.min(min,data[i]);
        System.out.println(min);
	}
}

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {

        public static int[] ReadIntArr()
        {
            return Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), (x) => Convert.ToInt32(x));
        }

        public static int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }

        static void Main(string[] args)
        {
            var N = ReadInt();
            var reds = new List<int[]>();
            var blues = new List<int[]>();

            for (int i = 0; i < N; i++)
                reds.Add(ReadIntArr());
            for (int i = 0; i < N; i++)
                blues.Add(ReadIntArr());

            reds.Sort((x, y) => (x[0].CompareTo(y[0])));
            blues.Sort((x, y) => (x[0].CompareTo(y[0])));

            int cnt = 0;
            for (int i = 0; i < N; i++)
            {
                var maxY = 0;
                var maxAt = -1;
                for (int k = reds.Count - 1; k >= 0; k--)
                {
                    if (reds[k][0] < blues[i][0] && reds[k][1] < blues[i][1])
                    {
                        if (maxY <= reds[k][1])
                        {
                            maxY = reds[k][1];
                            maxAt = k;
                        }
                    }

                }

                if (maxAt >= 0)
                {
                    cnt++;
                    //Console.WriteLine("{0},{1}:{2},{3}", reds[maxAt][0], reds[maxAt][1], blues[i][0], blues[i][1]);
                    reds.RemoveAt(maxAt);
                }
            }


            Console.WriteLine(cnt);

        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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 ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,m;cin >> h >> w >> m;
    vector<int> r(h),c(w);
    map<pair<int,int>,bool> mp;
    REP(i,m){
        int x,y;cin >> x >> y;
        x--,y--;
        mp[{x,y}]=true;
        r[x]++,c[y]++;
    }
    int ans=0;
    int mh=0,mw=0;
    vector<int> hh,ww;
    REP(i,h){
        if(mh==r[i]){
            hh.push_back(i);
        }
        else if(mh<r[i]){
            mh=r[i];
            hh.clear();
            hh.push_back(i);
        }
    }
    REP(i,w){
        if(mw==c[i]){
            ww.push_back(i);
        }
        else if(mw<c[i]){
            mw=c[i];
            ww.clear();
            ww.push_back(i);
        }
    }
    for(int i:hh){
        for(int j:ww){
            if(!mp[{i,j}]){
                cout << mh+mw << endl;
                return 0;
            }
        }
    }
    cout << mh+mw-1 << endl;
}


Measured memory_bytes: 28496
n, *a = map(int, open(0).read().split())

isInc = False
isDec = False
cnt = 1
bef_a = a[0]

for ai in a:
    if isInc and bef_a > ai:
        cnt += 1
        isInc = False
    elif isDec and bef_a < ai:
        cnt += 1
        isDec = False
    elif isInc == False and isDec == False:
        if bef_a < ai:
            isInc = True
        elif bef_a > ai:
            isDec = True
    bef_a = ai
print(cnt)

Measured memory_bytes: 20048
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll x, y, z;
        cin >> x >> y >> z;
        ll l = 0, ans = 0;
        while (l <= x) {
            l += (y + z);
            if (l + z > x) break;
            ans++;
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 384
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod7=1000000007LL;
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add(LL _x, LL _y, LL _mod=mod7){
  _x+=_y;
  return _x>=_mod ? _x-_mod : _x;
}
inline LL sub(LL _x, LL _y, LL _mod=mod7){
  _x-=_y;
  return _x<0 ? _x+_mod : _x;
}
inline LL mul(LL _x, LL _y ,LL _mod=mod7){
  _x*=_y;
  return _x>=_mod ? _x%_mod : _x;
}
LL mypow(LL _a, LL _x, LL _mod){
  if(_x == 0) return 1LL;
  LL _ret = mypow(mul(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=mul(_ret, _a, _mod);
  return _ret;
}
LL mymul(LL _a, LL _x, LL _mod){
  if(_x == 0) return 0LL;
  LL _ret = mymul(add(_a, _a, _mod), _x>>1, _mod);
  if(_x & 1) _ret=add(_ret, _a, _mod);
  return _ret;
}
void sleep(double sec = 1021){
  clock_t s = clock();
  while(clock() - s < CLOCKS_PER_SEC * sec);
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
const int N=111;
void build(){

}
int n;
vector<int> v[N];
void init(){
  scanf("%d", &n);
  for(int i=1; i<n; i++){
    int ui, vi;
    scanf("%d%d", &ui, &vi);
    v[ui].push_back(vi);
    v[vi].push_back(ui);
  }
}
int ac;
LL ans;

int mx[N], ddep;
void go(int now, int prt, int dep){
  ddep=max(ddep, dep);
  int cnt_son=0;
  for(int son: v[now]){
    if(son == prt) continue;
    go(son, now, dep+1);
    cnt_son++;
  }
  mx[dep]=max(mx[dep], cnt_son);
}
void check(int bns){
  if(ddep + 1 > ac) return;
  int tac = ddep+1;
  LL tans = 1;
  for(int j=0; j<ddep; j++)
    tans *= mx[j];
  tans *= bns;
  if( make_pair(tac, tans)<
      make_pair(ac, ans))
    ac=tac, ans= tans;
}
void solve(){
  ac=N; ans=0;
  for(int i=1; i<=n; i++){
    for(int j=0; j<=n; j++) mx[j]=1;
    ddep=0;
    go(i, i, 0);
    check(1);
  }
  for(int i=1; i<=n; i++)
    for(int x: v[i]){
      for(int j=0; j<=n; j++) mx[j]=1;
      ddep=0;
      go(i, x, 0);
      go(x, i, 0);
      //printf("a=%d b=%d\n", i, x);
      check(2);
    }
  printf("%d %lld\n", ac, ans);
}
int main(){
  build();
  //__ = getint();
  while(__ --){
    init();
    solve();
  }
}


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

int sack[101][10001];
int v[100],w[100];
int N,W;

int DP(int i,int j){
  /*cout << endl;
  for(int k=0;k<N+1;k++){
    for(int l=0;l<W+1;l++){
      cout << sack[k][l]  <<" ";
    }
    cout << endl;
  }
  */
  if(sack[i][j]!=-1){
    return sack[i][j];
  }
  int res;
  if(i==N){
    res=0;
  }else if(j < w[i]){
    res = DP(i+1,j);
  }else{
    res = max(
      DP(i+1,j),
      DP(i+1,j-w[i])+v[i]
    );
  }
  return sack[i][j]=res;
}

int main(){
  for(int i=0;i<101;i++){
    for(int j=0;j<10001;j++){
      sack[i][j]=-1;
    }
  }
  cin >> N >> W;
  for(int i=0;i<N;i++){
    cin >> v[i] >> w[i];
  }
  cout << DP(0,W) << endl;
}
  

Measured memory_bytes: 5108
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int n,a[N],x;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		x^=a[i];
	}
	for(int i=1;i<=n;i++)
		printf("%d ",a[i]^x);
	return 0;
}

Measured memory_bytes: 4520
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  vector<int> d(n);
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  d[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++){
    d[i]=min(d[i-2]+abs(h[i]-h[i-2]),d[i-1]+abs(h[i]-h[i-1]));
  }
  cout << d[n-1] << endl;
}

Measured memory_bytes: 1024
//Guidebook

#include <bits/stdc++.h>
using namespace std;

int main()
{

  int N;
  cin >> N;
  vector<tuple<string, int, int>> a(N);

  for (int i = 0; i < N; i++)
  {
    string S;
    int P;
    cin >> S >> P;
    P = -P; //点数を大きい順にするため
    a.at(i) = make_tuple(S, P, i + 1);
  }

  sort(a.begin(), a.end());

  for (int i = 0; i < N; i++)
  {
    string S;
    int p;
    int id;
    tie(S, p, id) = a[i];
    cout << id << endl;
  }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001

int main(void) {
	int n,k; cin >> n >> k;
	vi p(n); rep(i,n) cin >> p[i];
	double ans = 0;
	int sum = 0;
	rep(i,k) sum += p[i]+1;
	ans = max(ans,0.5*sum);
//	cout16 << ans << endl;
	for(int l=1; l-1+k<n; l++){
		sum += p[l-1+k]-p[l-1];
		ans = max(ans,0.5*sum);
//		cout16 << 0.5*sum << endl;
	}
	cout16 << ans << endl;
}




Measured memory_bytes: 1024
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  
  char c;cin>>c;
  c++;
  cout << c << endl;

}

Measured memory_bytes: 256
x, y = map(int, input().split())
a = 2000000000
if y >= x:
  a = y - x
if -y >= x:
  b = -x - y + 1
  if b < a:
    a = b
if y >= -x:
  b = x + y + 1
  if b < a:
    a = b
if -y >= -x:
  b = x - y + 2
  if b < a:
    a = b
print(a)

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

int main() {
  int a, b, flag = 0;
  cin >> a >> b;
  for(int num = a;num <= b;num++) {

 /* 変数 */
 int reverse = 0;
 int remaind;
 int tmp;

 tmp = num;
 while(tmp!=0)
 {
   /* 1桁ずつ数値を切り出す */
   remaind = tmp % 10;

   /* 数値を反転 */
   reverse = reverse * 10 + remaind;

   /* 次の桁へシフト */
   tmp /= 10;
 }

 /* 反転した数値と元の数値を比較 */
 if( reverse == num )
   flag++;
 }

 cout << flag << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<int> v(n), c(n);
  for (auto& vi: v) scanf("%d", &vi);
  for (auto& ci: c) scanf("%d", &ci);

  int res = 0;
  for (size_t i = 0; i < n; ++i)
    res += std::max(0, v[i]-c[i]);

  printf("%d\n", res);
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		sc.close();

		int ans = 0;

		for (int a = 0; a <= 9; a++) {
			int ia = S.indexOf(String.valueOf(a));
			if (ia == -1) {
				continue;
			}
			for (int b = 0; b <= 9; b++) {
				int ib = S.indexOf(String.valueOf(b), ia + 1);
				if (ib == -1) {
					continue;
				}

				for (int c = 0; c <= 9; c++) {
					int ic = S.indexOf(String.valueOf(c), ib + 1);
					if (ic != -1) {
						ans++;
					}
				}
			}
		}

		out.println(ans);
	}

//	//愚直
//	public void _main(String[] args) {
//		Scanner sc = new Scanner(in);
//
//		int N = sc.nextInt();
//		String S = sc.next();
//
//		sc.close();
//
//		Set<List<Character>> ans = new HashSet<>();
//
//		for(int a=0;a<N-2;a++) {
//			for(int b=a+1;b<N-1;b++) {
//				for(int c=b+1;c<N;c++) {
//					ans.add(Arrays.asList(S.charAt(a), S.charAt(b), S.charAt(c)));
//				}
//			}
//		}
//
//		out.println(ans.size());
//	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 24276
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;cin>>n>>k;
  vector<ll> rsp(3);cin>>rsp[0]>>rsp[1]>>rsp[2];
  string srsp="rsp";
  string t;cin>>t;
  ll res=0;
  rep(re,k){
    string tt;
    for(int i=re;i<n;i+=k){
      tt+=t[i];
    }
    //cout<<tt<<endl;
    ll tl=tt.length();
    vector<ll> dp(3);
    rep(i,tl){
      auto tdp=dp;
      rep(j,3){
        tdp[j]=0;
        ll gain=0;
        if(srsp[(j+1)%3]==tt[i])gain+=rsp[j];
        rep(k,3){
          if(k==j)continue;
          chmax(tdp[j],dp[k]+gain);
        }
      }
      dp=tdp;
    }
    res+=max({dp[0],dp[1],dp[2]});
  }

  cout<<res<<endl;



  return 0;

}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
 
int main() {
	int N, K, C;
	string S;
	cin >> N >> K >> C >> S;
	vector<int> V;
	int NOW = 0;
	while (1) {
		if (S[NOW] == 'o') V.push_back(NOW), NOW += C + 1;
		else NOW++;
		if (NOW >= N) break;
	}
	if (V.size() > K) {
		return 0;
	}
	else {
		vector<bool> B(N, false);
		for (int i = 0; i < V.size(); i++) B[V[i]] = true;
		V.clear();
		NOW = N - 1;
		while (1) {
			if (S[NOW] == 'o') V.push_back(NOW), NOW -= C + 1;
			else NOW--;
			if (NOW < 0) break;
		}
		reverse(V.begin(), V.end());
		for (int i = 0; i < V.size(); i++) {
			if (B[V[i]]) cout << V[i] + 1 << endl;
		}
	}
}

Measured memory_bytes: 2552
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long
#define PI 3.14159265358979323846

int N;
std::vector < std::vector < std::pair<int, int>>> v;

bool check(int& bit) {
    for (int i = 0; i < N; ++i) {
        if (!(bit & (1 << i)))
            continue;
        for (auto& r : v[i]) {
            if ((r.second == 1 && !(bit & (1 << r.first)))
                || (r.second == 0 && (bit & (1 << r.first)))) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    std::cin >> N;
    v.resize(N);
    for (int i = 0; i < N; ++i) {
        int a; std::cin >> a;
        v[i].resize(a);
        for (int j = 0; j < a; ++j) {
            std::cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first;
        }
    }
    int ans = 0;
    for (int bit = 0; bit < (1 << N); ++bit) {
        if (check(bit)) {
            int count = 0;
            for (int i = 0; i < N; ++i) {
                if (bit & (1 << i))
                    ++count;
            }
            ans = std::max(ans, count);
        }
    }
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3644
from collections import defaultdict

N, _A, Q, *val = [[*map(int, line.split())] for line in open(0)]
N = N[0]
Q = Q[0]

A = defaultdict(int)
for _a in _A:
    A[_a] += 1

ans = sum(_A)
for v in val:
    if v[0] in A.keys():
        num = A[v[0]]
        A[v[0]] = 0
        A[v[1]] += num
        ans += (v[1] - v[0]) * num
    print(ans)


Measured memory_bytes: 36388
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    double a,b,c,degree,S;
    scanf("%lf %lf %lf",&a,&b,&degree);
    S = (0.5)*a*b*sin(M_PI*degree/180);
    c = sqrt(a*a+b*b-2*a*b*cos(M_PI*degree/180));
    printf("%.8lf\n",S);
    printf("%.8lf\n",a+b+c);
    printf("%.8lf\n",2*S/a);
}


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

int main()
{
	string s;
	cin >> s;
	bool isYes = true;

	for (int i = 0; i < s.size(); i++)
	{
		if ((i + 1) % 2 == 0)
		{
			if (s.at(i) == 'R')
			{
				isYes = false;
				break;
			}
		}
		else
		{
			if (s.at(i) == 'L')
			{
				isYes = false;
				break;
			}
		}
	}

	if (isYes)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


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

public class Hoge{
public static void Main()
{
	var n = int.Parse(System.Console.ReadLine());
	if(n==0){}
	var cardsLine = System.Console.ReadLine().Split(' ');
	
	var bubbleSortedList = BubbleSort((string[])cardsLine.Clone());
	System.Console.WriteLine( String.Join(" ", bubbleSortedList.ToArray()));
	var stable = IsStable(cardsLine, bubbleSortedList.ToArray());
	System.Console.WriteLine("Stable");
	
	var selectionSortedList = SelectionSort((string[])cardsLine.Clone());
	System.Console.WriteLine( String.Join(" ", selectionSortedList.ToArray()));
	stable = IsStable(bubbleSortedList.ToArray(), selectionSortedList.ToArray());
	System.Console.WriteLine(stable ? "Stable": "Not stable");
}

// Define other methods and classes here

public static List<string> BubbleSort(string[] C)
{
	for (int i = 0; i < C.Length; i++)
	{
		for (int j = C.Length -1 ; i < j; j--)
		{
			if(int.Parse((C[j]).ToCharArray()[1].ToString()) < int.Parse((C[j-1]).ToCharArray()[1].ToString())){
				var tmp = C[j];
				C[j] = C[j-1];
				C[j-1] = tmp;
			}
		}
	}
	return C.ToList();
}

public static List<string> SelectionSort(string[] C)
{
	for (int i = 0; i < C.Length; i++)
	{
		var minj = i;
		for (int j = i; j < C.Length; j++)
		{
			if(int.Parse(C[j].ToCharArray()[1].ToString()) < int.Parse(C[minj].ToCharArray()[1].ToString())){
				minj = j;
			}
		}
		var tmp = C[i];
		C[i] = C[minj];
		C[minj] = tmp;
	}
	
	return C.ToList();
}

public static bool IsStable(string[] IN, string[] OUT){
	for (int i = 0; i < IN.Length; i++)
	{
		if(!IN[i].Equals(OUT[i])) return false;
	}
	return true;
}
}

Measured memory_bytes: 20040
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

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

		int N =sc.nextInt();
		Integer A[]= new  Integer[N];

		for(int i = 0;i<N;i++){
			A[i]= sc.nextInt();
			}
		Arrays.sort(A,Collections.reverseOrder());
		A[0] /=2;
		int ans =0;
		for(int i =0;i<N;i++){
			ans += A[i];

		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 22996
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        int day = 0;
        int ans = 0;

        for(int i = 0; i<m; i ++){
            day += sc.nextInt();
        }

        ans = n-day;

        if(n<day){
            ans = -1;
        }

        System.out.println(ans);
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	double pi = 3.141592653589793;
	double a, b, h, m, ax, ay, bx, by, d;
	cin>> a >> b >> h >> m;

	cout << fixed << setprecision(11);

	ax=a*cos(2*pi*(h/12.0+m/720.0));
	ay=a*sin(2*pi*(h/12.0+m/720.0));
	bx=b*cos(2*pi*(m/60.0));
	by=b*sin(2*pi*(m/60.0));
	d=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

/*cout<< ax <<endl;
cout<< ay <<endl;
cout<< bx <<endl;
cout<< by <<endl;*/
	cout<< d <<endl;
 
	return 0;
}

Measured memory_bytes: 4128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

//code by lynmisakura.wish to be accepted!
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

class BIronBarCutting {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        ioboost;
        ll n;cin >> n;
        vector<ll> a(n);
        rep(i,n)cin >> a[i];
        vector<ll> c(n+1,0LL);
        rep(i,n)c[i+1] = c[i] + a[i];

        ll ans = LONG_MAX;
        for(int i = 0;i < n;i++){
            //i番目の奴をなんとかする
            ll bef,lat;
            bef = c[i+1];
            lat = c[n] - c[i+1];
            /*if(bef == lat){
                cout << 0 << endl;
                return;
            }
            if(lat > bef){
                mins(ans,lat - bef);
            }else{
                if(bef - lat > i+1)continue;
                else{
                    mins(ans,bef-lat);
                }
            }*/
            mins(ans,abs(bef-lat));
        }
        cout << ans << endl;
    }
};

int main() {
	BIronBarCutting solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
 
int main()
{
long long int t,a,b; 
    cin>>t>>a>>b; 
  long long  int seen; 
  long long  int div; 
    if(a==0 && b==0)
    {
        cout<<0;
    }
    else 
    {
        div=t%(a+b); 
    if(div>=a)
      seen=a; 
    else 
        seen=div; 
    cout<<(t/(a+b))*a+seen; 
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/soundhound2018-summer-qual/tasks/soundhound2018_summer_qual_b>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
string solve(){
    string res;
    string S; ll w; cin >> S >> w;
    for(ll i = 0; i < S.length();i+=w) res += S[i];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))
P = []
for i in range(N):
    P.append((X[i], i))

P = sorted(P)
med = [P[N // 2 - 1][0], P[N // 2][0]]
ans = [0] * N
for i in range(N):
    if P[i][0] <= med[0]:
        ans[P[i][1]] = P[N // 2][0]
    else:
        ans[P[i][1]] = P[N // 2 - 1][0]

for i in ans:
    print(i)



Measured memory_bytes: 38052
#include <iostream>
using namespace std;
int main() {
	int a, b, m;
	cin >> a >> b;
	int t = a + b;
	int h = a - b;
	int k = a * b;
	if (t > h) {
		if (t > k) {
			m = t;
		}
		else {
			m = k;
		}
	}
	else {
		if (h > k) {
			m = h;
		}
		else {
			m = k;
		}
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 5

int main() {
  int dish[MAX];
  int digit_1 = 9;
  int lastorder;
  int time = 0;
  int i;

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

  for(i = 0; i < MAX; i++) {
    if(dish[i] % 10 != 0 && dish[i] % 10 < digit_1 + 1) {
      digit_1 = dish[i] % 10;
      lastorder = i;
    }
  }

  for(i = 0; i < MAX; i++) {
    if(i != lastorder) {
      time += dish[i];
      if(time % 10 != 0) {
        time /= 10;
        time = time * 10 + 10;
      }
    }
  }
  time += dish[lastorder];

  printf("%d\n", time);

  return 0;
}


Measured memory_bytes: 128
N = int(input())
inputs = [input() for _ in range(N)]
compare_inputs = [inputs[0]]

for n in range(1, N):
    if inputs[n] in compare_inputs:
        print('No')
        break
    else:
        if not inputs[n][0] == inputs[n-1][-1]:
            print('No')
            break
    compare_inputs.append(inputs[n])
else:
    print('Yes')


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

using namespace std;

const int mod = 1000000007;
int dp[100000][2];
vector <int> v[100000];

int dfs(int x, int y, int z) {
    int i;
    long long ans1 = 1, ans2 = 1;
    
    if (dp[x][z] > 0) return dp[x][z];
    
    for (i = 0; i < v[x].size(); i++) {
        if (v[x][i] == y) continue;
        
        ans1 = ans1 * dfs(v[x][i], x, 0) % mod;
    }
    
    if (z == 1) return dp[x][z] = ans1;
    
    for (i = 0; i < v[x].size(); i++) {
        if (v[x][i] == y) continue;
        
        ans2 = ans2 * dfs(v[x][i], x, 1) % mod;
    }
    
    return dp[x][z] = (ans1 + ans2) % mod;
}

int main() {
    int n, i;
    
    scanf("%d", &n);
    
    for (i = 0; i < n - 1; i++) {
        int x, y;
        
        scanf("%d %d", &x, &y);
        
        x--;
        y--;
        
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    printf("%d\n", dfs(0, -1, 0));
    
    return 0;
}


Measured memory_bytes: 13440
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
	long long K;
	cin >> K;

	long long A[50];
	for (int i = 0; i < 50; i++) A[i] = i + K / 50;

	for (int i = 0; i < K % 50; i++) {
		A[i] += 51;
		for (int j = 0; j < 50; j++) {
			A[j]--;
		}
	}

	cout << 50 << endl;
	for (int i = 0; i < 50; i++) {
		cout << A[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int main(){
  string s;
  int n;
  while(cin>>n){
    while(n--){
      char train[61];
      for(int i=0;i<61;i++)train[i]='*';
      cin>>s;
      int pos=30;
      train[pos]=s[0];
      for(int i=3;i<s.size();i+=3){
        if(s[i-1]=='-')pos--;
        else pos++;
        train[pos]=s[i];
      }
      for(int i=0;i<61;i++){
        if(train[i]!='*'){
          while(1){
            cout<<train[i];
            i++;
            if(train[i]=='*')break;
          }
          cout<<endl;
          break;
        }
      }
    }
  }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int X,N;
	cin>>X>>N;
	
	int ans = 100000;
	int mini = 100000;
	set<int> S;
	for(int i=0;i<N;i++){
		int p;
		cin>>p;
		S.insert(p);
	}
	
	for(int i=-100;i<=300;i++){
		if(S.count(i))continue;
		if(mini>abs(X-i)){
			mini = abs(X-i);
			ans = i;
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}

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

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

	int coin = 0;
	for (int i = 0; i < 2; i++) {
		if (a >= b) {
			coin += a;
			a--;
		}
		else {
			coin += b;
			b--;
		}
	}

	cout << coin << endl;

	return 0;
}

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

int main(int argc, char const* argv[])
{
	int d, n;
  cin >> d >> n;
  	if (n == 100){
      n = 101;
    }
  
  cout << n * (int)pow(100,d) << endl;
  
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char s[3],ch;
	int i,count=0;
	scanf("%s",s);
	ch=s[0];
	for(i=1;i<3;i++)
	{
		if(s[i]==ch)
		count++;
	}
	if(count==2)
	printf("No\n");
	else
	printf("Yes\n");
	return 0;
}

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

char F[102][102];

void DFS(int H,int W,char a){
	if(F[H][W]!=a)
	return;

	F[H][W]='.';

	DFS(H-1,W  ,a);
	DFS(H  ,W+1,a);
	DFS(H+1,W  ,a);
	DFS(H  ,W-1,a);
}


int main(){
	int N,M;
	while(1){

		cin >> N >> M;

		if(N==0&&M==0)
			return 0;

		for(int h=1; h<=N; h++)
			for(int w=1; w<=M; w++)
				cin>>F[h][w];

		int cnt=0;
		for(int h=1; h<=N; h++)
			for(int w=1; w<=M; w++)
				if(F[h][w]=='@'){
					cnt++;
					DFS(h,w,'@');
				}else if(F[h][w]=='#'){
					cnt++;
					DFS(h,w,'#');
				}
				else if(F[h][w]=='*'){
					cnt++;
					DFS(h,w,'*');
				}
				
		cout << cnt <<endl;

	}

}

Measured memory_bytes: 1476
#include<stdio.h>
 
int main()
{
int x,n,cou;
cou=0;
while(1)
{
    cou=0;
scanf("%d",&n);scanf("%d",&x);
if(x==0&&n==0)break;
for(int i=1;i<=n-2;i++){
for(int j=i+1;j<=n-1;j++){
for(int k=j+1;k<=n;k++)
{
if(i+j+k==x)cou++;
}}}
printf("%d\n",cou);
}
return 0;
}

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

int main()
{
    int s, w;
    cin >> s >> w;

    if (w >= s)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3644
import sys
readline = sys.stdin.readline
write = sys.stdout.write
ans = []
while 1:
    M = int(readline())
    if M == 0:
        break
    P = [list(map(int, input().split())) for i in range(M)]
    memo = {}
    def dfs(i, rest):
        if i == M:
            return rest == 0
        key = (i, rest)
        if key in memo:
            return memo[key]
        res = 0
        a, b = P[i]
        for j in range(0, b+1):
            if rest - j*a < 0:
                break
            res += dfs(i+1, rest - j*a)
        memo[key] = res
        return res
    G = int(input())
    for i in range(G):
        ans.append(str(dfs(0, int(input()))))
write("\n".join(ans))
write("\n")


Measured memory_bytes: 6116
#include <iostream>
using namespace std;
int n,k,ans=0;
int A[100000];
int main(){
    cin>>n>>k;
for(int i=0;i<n;i++){
    cin>>A[i];
}
if((n-1)%(k-1)==0){
    ans=(n-1)/(k-1);
}else{
    ans=(n-1)/(k-1)+1;
}
cout<<ans<<endl;
return 0;
}

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

#define coutv(v) for (int i = 0; i < (v).size(); ++i) cout << v[i] << ' '; cout << endl;
#define coutvv(v) for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cout << v[i][j] << ' '; cout << endl;}
#define debugv(v) {for (int i = 0; i < (v).size(); ++i) cerr << v[i] << ' '; cerr << endl;}
#define debugvv(v) {for (int i = 0; i < (v).size(); ++i) {for (int j = 0; j < (v[i]).size(); ++j) cerr << v[i][j] << ' '; cerr << endl;}}
#define stringtovector(s, v) {for (int i = 0; i < (s).size(); ++i) v.push_back(s[i]);};
#define TC int TESTCASE; cin >> TESTCASE; while (TESTCASE--)
typedef long long ll;
const int mod = 1000000007;




int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll cnt = 0;
    for (int i = 1; i < n; i++) {
        cnt += (a[i] - a[i-1] < 0 ? a[i-1] - a[i] : 0);
        a[i] = max(a[i], a[i-1]);
    }
    cout << cnt;
}





Measured memory_bytes: 4012
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return a % 1000000007;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  string s; cin >> s; ll count = 0;
  
  for(ll i=0; i < s.size() - 1; i++){
    if(s[i] != s[i+1]) count++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 512
def read_int():
    return int(input())

def read_int_map():
    return map(int,input().split(' '))

def read_int_list():
    return list(map(int,input().split(' ')))

def read_s_list_loop(n):
    return [input() for _ in range(n)]

S = input()
print(S[0:3])

Measured memory_bytes: 61620
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m,mn=100000,ans=0;
	ans=0;
	cin>>n>>m;
	vl a(m),b(m);
	rep(i,m){
		cin>>a[i]>>b[i];
		chmin(mn,a[i]);
		ans+=max(0,n-a[i]);
	}
	ans-=max(0,n-mn);
	cout<<ans<<endl;
}



Measured memory_bytes: 3148
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		Scanner stdIn = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

			String[] A = stdIn.nextLine().split("[,. ]");
			String tmp = "";
			boolean F = false;
			for(int i = 0; i < A.length; i++) {
				
				if(A[i].length() >= 3 && A[i].length() <= 6) {
					out.print(tmp + A[i]);
					if(!F) {
						tmp = " ";
						F = true;
					}
					
				}
			}
			out.println();
		out.flush();

	}
	static void R(int[] a) {
		int tmp = a[7];
		for(int i = 7; i >= 1; i--) {
			a[i] = a[i-1];
		}
		a[0] = tmp;
	}
	
	static int K(int[] a) {
		int ret = 0;
		for(int i = 0; i < 8; i++) {
			ret += a[i] * Math.pow(10, 8-i);
		}
		return ret;
	}
}
//------------------------------//
//-----------//
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
    	return (int)nextLong();
    }
    

}

Measured memory_bytes: 17176
#include <iostream>

using namespace std;

int main(){
  int N; cin>>N;
  int ans[4];
  for(int i=0;i<4;i++){
    ans[i]=N%10;
    N/=10;
  }

  if(ans[0]==ans[1]&&ans[1]==ans[2]) cout<<"Yes";
  else if(ans[1]==ans[2]&&ans[2]==ans[3]) cout<<"Yes";
  else cout<<"No";
  
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>

typedef int moe;
typedef long lolita;
typedef char cuffs;
typedef float frill;
typedef double ruffle;
typedef void voile;
typedef unsigned tasogare;

#define katyusya const
#define apron volatile
#define pleats static
#define fancy virtual

using namespace std;

#define YUU 1000000

voile make_prime(moe n_prime[]){
  pleats moe is_prime[YUU];

  for( moe ai = 0; ai < YUU; ++ai )
    is_prime[ai] = 1;

  is_prime[0] = 0;
  is_prime[1] = 1;
  is_prime[2] = 1;

  for( moe ai = 2; ai < YUU; ++ai )
    if( is_prime[ ai ] )
      for( moe mai = 2; ai * mai < YUU; ++mai)
	is_prime[ ai * mai ] = 0;

  for( moe ai = 0; ai < YUU; ++ai )
    n_prime[ ai ] = 0;

  for( moe ai = 2; ai < YUU; ++ai ){
    n_prime[ ai ] = n_prime[ ai - 1 ];
    if( is_prime[ ai ] )
      n_prime[ ai ]++;
  }
}

moe main(){
  tasogare yuu;
  pleats moe n_prime[YUU];

  make_prime( n_prime );
  while(true){
    cin >> yuu;
    if( yuu == 0 || cin.eof() ) break;
    cout << n_prime[ yuu ] << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

bool pal(string a){
    string p = "";
    for(int i = a.size() - 1;i >= 0;i--){
	p += a[i];
    }
    return p == a;
}

int main(){
    string str;
    int res = 0;
    while(cin >> str){
	if(pal(str))res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1200
#define _USE_MATH_DEFINES


#include <iostream>
#include <vector>
#include <stdio.h>

#include <cmath>

using namespace std;

int main() {
	double r;
	cin >> r;

	printf("%.6lf %.6lf\n", M_PI * r * r, 2 * M_PI * r);

	return 0;
}



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

int main(){
	int x, y, z, w;
	cin >> x >>y >> z >> w;
	int tot = 0;
	for( int i = 0; i <= x; i++ ){
		for( int j = 0; j <= y; j++ ){
			for( int k = 0; k <= z; k++ ){
				if( i*500 + j*100 + k*50 == w ){
					tot++;
				}
			}
		}
	}
	cout << tot << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string s; cin >> s;
    int n = s.size();
    int l = 0, r = n - 1; int ans = 0;
    while(l <= r) {
        if(s[l] == s[r]) { l++; r--; continue; }
        if(s[l] == 'x') { l++; ans++; continue; }
        if(s[r] == 'x') { r--; ans++; continue; }
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;   
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static BufferedReader reader;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		String[] strings = readLine();
		int A = Integer.parseInt(strings[0]);
		strings = readLine();
		int B = Integer.parseInt(strings[0]);
		boolean[] abc = new boolean[] {true,true,true};
		abc[A-1] = false;
		abc[B-1] = false;
		if(abc[0]) {print("1");}
		if(abc[1]) {print("2");}
		if(abc[2]) {print("3");}
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC

	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
}


Measured memory_bytes: 20948
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	int w,s;
	int answ,anss;
	answ=100;
	anss=0;
	for(int i=0;i<=f/100/a;++i){
		for(int j=0;j<=(f-100*a)/100/b;++j){
		w=a*i+b*j;
			for(int k=0;k<=min((f-w)/c,w*e);++k){
					for(int l=0;l<=min((f-w-k*c)/c,w*e-c*k);++l){
					s=c*k+d*l;
					if(100*w+s<=f&&w*e>=s&&s*(anss+100*answ)>=(100*w+s)*anss){anss=s;answ=w;}
				}
			}
		}
	}
	cout<<answ*100+anss<<" "<<anss<<endl;
	return 0;
}

Measured memory_bytes: 256