akhauriyash/Code-Regression huggingface dataset:
def dp(T, R, S, P):
    r, s, p = 0, 0, 0
    for t in T:
        r, s, p = max(s, p), max(r, p), max(r, s)
        if t == 'r':
            p += P
        elif t == 's':
            r += R
        else:
            s += S
    return max(r, p, s)

def main():
    N, K = map(int, input().split())
    R, S, P = list(map(int, input().split()))
    T = input()
    m = 0
    for i in range(K):
        m += dp(T[i::K], R, S, P)
    print(m)


main()


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a >=13) {
			System.out.println(b);
		}else if ( a >= 6) {
			System.out.println(b/2);
		}else {
			System.out.println(0);
		}
		
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>

using namespace std;

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

	set<char> alpha;
	for (char c: s) {
		alpha.insert(c);
	}

	string ans = "None";
	for (char c = 'a'; c <= 'z'; c++) {
		if (alpha.count(c) == 0) {
			ans = c;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> data(6);
  for (int i = 0; i < 5; i++) cin >> data.at(i);
  data.at(5) = data.at(4);
  int k;
  cin >> k;
  bool answer = true;
  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 6; j++) {
      if (data.at(j) - data.at(i) > k || data.at(i) - data.at(j) > k)  answer = false;
    }
  }
  if(answer) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        
        if (n % 2 == 0) {
            for (int i = n-1; i >= 0; i -= 2) {
                System.out.print(array[i]);
                System.out.print(" ");
            }
            
            for (int i = 0; i < n; i += 2) {
                System.out.print(array[i]);
                
                if (i == n-2) {
                    System.out.println();
                } else {
                    System.out.print(" ");
                }
            }
        } else {
            for (int i = n-1; i >= 0; i -= 2) {
                System.out.print(array[i]);
                System.out.print(" ");
            }
            
            for (int i = 1; i < n; i += 2) {
                System.out.print(array[i]);
                
                if (i == n-2) {
                    System.out.println();
                } else {
                    System.out.print(" ");
                }
            }
        }
    }
}


Measured memory_bytes: 91904
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::range;
using boost::irange;
using boost::math::gcd;
using boost::math::lcm;

using ll = int64_t;
constexpr char LN = '\n';
template<class T> bool chmax(T& a, const T& b) {if(a<b){a=b;return true;}else{return false;}}
template<class T> bool chmin(T& a, const T& b) {if(b<a){a=b;return true;}else{return false;}}

#ifdef LOCAL
template<class H> void dump_(const char* s, H h) {cout<<s<<"="<<h<<LN; }
template<class H, class... T> void dump_(const char* s, H h, T... t) {for(;*s!=',';++s){cout<<*s;}cout<<"="<<h<<",";dump_(++s,t...);}
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#endif

struct init_ {init_(){cin.tie(nullptr);ios::sync_with_stdio(false);}} init_;

template<class C> C scan(size_t n) {C c(n);for(auto& v:c){cin>>v;}return c;}
template<class C> C scan(size_t n, size_t m) {C vss(n);for(auto& vs:vss){vs.resize(m);for(auto& v:vs){cin>>v;}}return vss;}

template<class R> struct Joined { const R& r; const char* s; };
template<class R> Joined<R> joined(const R& r, const char* s = " ") {return{r,s};}
template<class R> ostream& operator<<(ostream& out, Joined<R> j) {bool f=true;for(const auto& v:j.r){if(f){f=false;}else{out<<j.s;}out<<v;}return out;}

template<class T> using matrix = vector<vector<T>>;
template<class T> matrix<T> make_matrix(size_t n, size_t m, const T& init = T()) {matrix<T> vss(n);for(auto& vs:vss){vs.resize(m,init);}return vss;}
template<class T> ostream& operator<<(ostream& out, Joined<matrix<T>> j) {bool a=true;for(const auto& vs:j.r){if(a){a=false;}else{out<<LN;}bool f=true;for(const auto& v:vs){if(f){f=false;}else{out<<j.s;}out << v;}}return out;}

template<class T> void show_(const T& t) {cout<<t;}
template<class T> void show_(const vector<T>& v) {cout<<joined(v);}
void show_(bool b) {cout<<(b?"Yes":"No");}
void show_(double d) {cout<<fixed<<setprecision(12)<<d;}
template<class T, class... TS> void show_(const T& t, TS... ts) {show_(t);cout<<' ';show_(ts...);}
template<class T> void show(const T& t) {show_(t);cout<<LN;}
template<class T, class... TS> void show(const T& t, TS... ts) {show_(t, ts...);cout<<LN;}

int main() {
    uint64_t N;
    cin >> N;
    if (N % 2 != 0) {
        show(0);
        return 0;
    }
    uint64_t count = 0;
    N /= 2;
    while (N >= 5) {
        N /= 5;
        count += N;
    }
    show(count);
}


Measured memory_bytes: 256
// Last Change: 09/03/2019 21:16:32.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const double pie = 3.14159265358979323846264338327950288;
const double EPS = 1e-13;

struct Coordinate {
  ll x, y;
  double theta;
  void thetaInit() {
    if (x == 0 and y == 0) {
      theta = -1;
    } else {
      theta = atan2(y, x);
      if (theta < 0) {
        theta += 2 * pie;
      }
    }
  }
  Coordinate() : x(0), y(0) {
    //
  }
  Coordinate(ll a, ll b) : x(a), y(b) {
    thetaInit();
  }
  bool operator<(const Coordinate &another) const {
    return this->theta < another.theta;
  }
};

double getTheta(Coordinate &a, Coordinate &b) {
  ll dot = a.x * b.x + a.y * b.y;
  double normA = sqrt(a.x * a.x + a.y * a.y);
  double normB = sqrt(b.x * b.x + b.y * b.y);
  return static_cast<double>(dot) / normA / normB;
}

int main() {
  ll N;
  cin >> N;
  vector<Coordinate> S(N);
  for (auto &&e : S) {
    cin >> e.x >> e.y;
    e.thetaInit();
  }

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

  //全探索(N**3)
  //個数で計算
  ll ans = S[0].x * S[0].x + S[0].y * S[0].y;
  for (ll i = 0; i < N; ++i) {
    for (ll j = 1; j <= N; ++j) {
      ll X = 0, Y = 0;
      for (ll k = 0; k < j; ++k) {
        X += S[(i + k) % N].x;
        Y += S[(i + k) % N].y;
      }
      ans = max(ans, X * X + Y * Y);
    }
  }
  cout << fixed << setprecision(20) << sqrt(ans) << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a, b, k, i;
    cin >> a >> b >> k;
    for(int i = a; i <= min(b, a + k - 1); i++)
        cout << i << " ";
    for(int i = max(b - k + 1, a + k); i <= b; i++)
        cout << i << " ";
    return 0;
}

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

int h,w,a,b;
const int mod=1e9+7;
const int nax=3e5+5;
ll s[nax];

void pre()
{
    s[0]=1;
    for(int i=1;i<nax;i++)
    {
        s[i]=s[i-1]*i;
        s[i]%=mod;
    }
}

ll pp(ll a,ll b)
{
    if(b==0) return 1;
    ll res=pp(a,b/2);
    res*=res;
    res%=mod;
    if(b%2==1) res*=a;
    res%=mod;
    return res;
}

ll inv(ll a)
{
    return pp(a,mod-2);
}

ll nk(ll n,ll k)
{
    ll res=s[n];
    res*=inv(s[k]);
    res%=mod;
    res*=inv(s[n-k]);
    res%=mod;
    return res;
}

int main()
{
    cin>>h>>w>>a>>b;
    ll res=0;
    pre();
    for(int i=1;i<=h-a;i++)
    {
        ll akt=0;
        akt=nk(b-1+i-1,b-1);
        akt*=nk(h-i+w-1-b,h-i);
        res+=akt;
        res%=mod;
    }
    cout<<res;
    return 0;
}


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

int main() {
  char b;
  cin >> b;

  switch (b) {
    case 'A':
      cout << 'T' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
    default:
      break;
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.awt.geom.Point2D;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[]$){
        Scanner sc = new Scanner(in);
        int h=sc.nextInt();
        int w=sc.nextInt();
        char[][] f=new char[h][w];
        for (int i = 0; i <h ; i++) {
            String s=sc.next();
            for (int j = 0; j < w; j++) {
                f[i][j]=s.charAt(j);
            }
        }
        Point p=new Point(0,0);
        //→,↓
        int[] dx={-1,0,1,0};
        int[] dy={0,-1,0,1};
        Deque<Point> stack=new ArrayDeque<>();
        stack.addFirst(p);
        int k=1;
        while(stack.size()>0){
            k++;
            Point t=stack.pollFirst();
            for (int i = 0; i <4 ; i++) {
                int x=t.x+dx[i],y=t.y+dy[i];
                if(D(h,w,x,y)){
                    if(f[y][x]=='#') {
                        if (i == 2 || i == 3) {
                            stack.addFirst(new Point(x , y ));
                            f[t.y][t.x]='0';
                        } else {
                            out.println("Impossible");
                            exit(0);
                        }
                    }
                }
            }
            if(stack.size()>1){
                out.println("Impossible");
                exit(0);
            }
        }
        out.println("Possible");
    }
    static boolean D(int h,int w,int x,int y){
        return 0<=x&&x<w&&0<=y&&y<h;
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	
	int n;cin >> n;
	
	int ans = 0;
	int num = 0;
	int cou = 0;
	REP(i,n)
	{
		int a,b;cin >> a >> b;
		if(num < a)
		{
			num = a;
			cou = b;
		}
	}
	
	cout << num+cou << endl;
	
	return 0;
}


Measured memory_bytes: 256
<?php

$input_line = intval(fgets(STDIN));
$n = $input_line;

while ($n != 0) {
    $m1 = [];
    $m2 = [];
    for($i = 0; $i < $n; $i++){
        $numbers = preg_split("/[\s,]+/", rtrim(fgets(STDIN)));
        $m1[] = $numbers[0];
        $m2[] = $numbers[1];
    }
    // var_dump($m2);
    
    $input_line = intval(fgets(STDIN));
    $nn = $input_line;
    
    // 文字列げ都合　’’と.=が必要
    $answer = '';
    for($i = 0; $i < $nn; $i++){
        $numbers = rtrim(fgets(STDIN));
        $l = $numbers;
        $index = array_search($l, $m1);
        // print $index;
        if($index !== false){
            // echo 'hit';
            $answer .= $m2[$index];
            // echo $m2[$index];
            // echo "\n";
        } else {
            $answer .= $l;
        }
    }
    
    echo $answer;
    echo "\n";
    $input_line = intval(fgets(STDIN));
    $n = $input_line;

}


Measured memory_bytes: 9428
// B - Minesweeper
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int dy[]{-1, 1, 0, 0, -1, 1, -1, 1};
	int dx[]{ 0, 0,-1, 1, -1, 1,  1,-1};
	int H,W; cin>>H>>W;
	string S[H];
	rep(i, H) cin>>S[i];
	vvi A(H, vi(W, -1));
	rep(h, H)
		rep(w, W){
			if(S[h][w] == '#') continue;
			A[h][w] = 0;
			rep(k, 8){
				int y = h + dy[k], x = w + dx[k];
				if(y<0 || H<=y || x<0 || W<=x) continue;
				if(S[y][x] == '#') A[h][w]++;
			}
		}
	rep(h, H){
		rep(w, W)
			if(A[h][w] < 0) cout<<"#"; else cout<<A[h][w];
		puts("");
	}
}


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

int main() {
    int n, m;
    while (cin >> n >> m && n) {
        vector<int> p(n);
        for (int i=0; i<n; ++i) {
            cin >> p[i];
        }
        sort(p.begin(), p.end());
        
        int res = accumulate(p.begin(), p.end(), 0);
        for (int i=n%m; i<n; i+=m) {
            res -= p[i];
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3052
#include <stdio.h>

int main(void)
{
	int n;
	int d[100];
	int i, j;
	int max = 1, x = 0;

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

	for (i = 0;i < n;i++)
		if (d[i] > max) max = d[i];

	for (i = max;i > 0;i--)
	{
		for (j = 0;j < n;j++)
		{
			if (d[j] == i)
			{
				x++;
				break;
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vvl = vector<vl>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    int abc[3], k, ans = 0, t;
    int n[3] = { 1, 0, -1 };
    cin >> abc[0] >> abc[1] >> abc[2] >> k;
    auto f = [&](int ind) {
        t = min(abc[ind], k);
        ans += t*n[ind];
        ind -= t; k -= t;
    };
    f(0); f(1); f(2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 1000100
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N],ans;
char s[N];
bool type;
int C(int n,int m){
	if(n==m||!m)return 1;
	if(n<m)return 0;
	return C(n&1,m&1)*C(n>>1,m>>1);
}
int main(){
	n=read();
	scanf("%s",s+1);
	type=false;
	for(int i=1;i<=n;++i){
		a[i]=s[i]-'1';
		type|=a[i]&1;
	}
	if(!type){
		for(int i=1;i<=n;++i){
			a[i]>>=1;
		}
	}
	for(int i=1;i<=n;++i){
		if(a[i]&1)ans^=C(n-1,i-1);
	}
	if(!type)ans<<=1;
	printf("%d\n",ans);
	return 0;
}



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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(BE(a));
	if(a[0] == 5 && a[1] == 5 && a[2] == 7)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

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

int main(){
    int a, b, c, k, ans;
    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &k);
    if(a == max({a,b,c})){
        ans = (int)pow(2.0, k) * max({a,b,c}) + b + c;
    }else if(b == max({a,b,c})){
        ans = (int)pow(2.0, k) * max({a,b,c}) + a + c;
    }else{
        ans = (int)pow(2.0, k) * max({a,b,c}) + a + b;
    }
    printf("%d", ans);
}

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

using namespace std;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    cout << min(a * x + b * y,
            min(2 * (x < y ? x : y) * c + (x < y ? y - x : x - y) * (x < y ? b : a),
                    2 * (x < y ? y : x) * c)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inv(x) Power(x, mod - 2)
#define N 3005

using namespace std;
typedef long long ll;

int n, mod;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }

inline int Power(int x, int y, int M = mod) {
	int res = 1;
	while (y) {
		if (y & 1) res = (ll) res * x % M;
		x = (ll) x * x % M, y >>= 1;
	} return res;
}

int fac[N], ifac[N];
void init(int n) {
	fac[0] = ifac[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = (ll) fac[i - 1] * i % mod;
	ifac[n] = inv(fac[n]);
	for (int i = n - 1; i; --i) ifac[i] = (ll) ifac[i + 1] * (i + 1) % mod;
}

int C(int x, int y) {
	if (x < y || y < 0) return 0;
	return (ll) fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}

int g[N][N];
int f[N];

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> mod, init(n);
	
	for (int i = 0; i <= n; ++i) {
		g[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			g[i][j] = add(g[i - 1][j - 1], (ll) g[i - 1][j] * (j + 1) % mod);
	}
	
	for (int i = 0; i <= n; ++i) {
		ll tmp = Power(2, Power(2, n - i, mod - 1)), tmpb = Power(2, n - i);
		for (int j = 0, Pow = 1; j <= i; ++j, Pow = tmpb * Pow % mod)
			inc(f[i], (ll) Pow * g[i][j] % mod);
		f[i] = (ll) f[i] * tmp % mod;
	}
		
	
	ll ans = 0;
	for (int i = 0, flag = 1; i <= n; ++i, flag ^= 1) {
		ll c = C(n, i);
		if (!flag) c = mod - c;
		ans += c * f[i] % mod;
	}
	
	printf("%lld\n", ans % mod);
	return 0;
}

Measured memory_bytes: 34304
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100010
int f[MAXN*2],n,m,vis[MAXN];
int Adj[MAXN],V[MAXN*2],nxt[MAXN*2],c;
void AddEdge(int u,int v)
{
	c++;V[c]=v,nxt[c]=Adj[u];Adj[u]=c;
}
int check(int u)
{
	for(int i=Adj[u];i;i=nxt[i])
		if(!vis[V[i]])
			return V[i];
	return -1;
}
int main()
{
	int u,v;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u,&v);
		AddEdge(u,v);
		AddEdge(v,u);
	}
	int l=MAXN,r=MAXN+1;
	f[MAXN]=u,f[MAXN+1]=v;
	vis[u]=vis[v]=1;
	while(1)
	{
		u=check(f[l]);
		if(u==-1) break;
		vis[u]=1;
		f[--l]=u;
	}
	while(1)
	{
		u=check(f[r]);
		if(u==-1) break;
		vis[u]=1;
		f[++r]=u;
	}
	printf("%d\n%d",r-l+1,f[l]);
	for(int i=l+1;i<=r;i++)
		printf(" %d",f[i]);
	printf("\n");
}

Measured memory_bytes: 3456
def select(S):
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if int(S[j][1]) < int(S[minj][1]):
                minj = j
        (S[i], S[minj]) = (S[minj], S[i])
    return S

def bubble(B):
    flag = True
    while flag:
        flag = False
        for j in reversed(range(1, n)):
            if int(B[j][1]) < int(B[j-1][1]):
                (B[j-1], B[j]) = (B[j], B[j-1])
                flag = True
    return B

def isStable(inA, out):
    for i in range(0, n):
        for j in range(i+1, n):
            for a in range(0, n):
                for b in range(a+1, n):
                    if inA[i][1] == inA[j][1] and inA[i] == out[b] and inA[j] == out[a]:
                        return "Not stable"
    return "Stable"



n = int(input())
A = input().split(' ')

B = bubble(A[:])
print(" ".join(B))
print(isStable(A, B))
S = select(A[:])
print(" ".join(S))
print(isStable(A, S))

Measured memory_bytes: 7764
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split(' ');
        var n = long.Parse(nm[0]);
        var m = long.Parse(nm[1]);

        if (1 < n) n -= 2;
        if (1 < m) m -= 2;

        Console.WriteLine(n * m);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  while(1) {
    c -= b;
    if (c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if (a <= 0) {
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3624
// Aizu 2101: Perfect Number
// 2017.9.20 bal4u@uu

#include <stdio.h>
#include <math.h>

int ptbl[] = {
         3,   5,   7,  11,  13,  17,  19,  23,  29,
   31,  37,  41,  43,  47,  53,  59,  61,  67,  71,
   73,  79,  83,  89,  97, 101, 103, 107, 109, 113,
  127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
  179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
  233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
  283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
  353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
  419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
  467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
  547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
  607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
  739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
  811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
  877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
  947, 953, 967, 971, 977, 983, 991, 997, 0 };

int pseudo_factorization(int n)
{
	int s, i, d, p, sw;
	int *pp;

	 s = 1;
	 if ((n & 1) == 0) {
	    p = 2;  
		do n >>= 1, p <<= 1;
	    while ((n & 1) == 0);
		s *= p-1;
	}
	if (n <= 1) return s;
	for (pp = ptbl; *pp > 0; pp++) {
		if (n % *pp) continue;
		p = d = *pp;  
		do n /= d, p *= d;
		while (n % d == 0);
		s *= (p-1) / (d-1);
	}
	if (n > 1) {
		int b = (int)sqrt((double)n);
		for (i = 1009, sw = 0; n > 1; ) {
			if (i > b) { s *= (n+1); break; }
			if (n % i == 0) {
				p = i;  
				do n /= i, p *= i;
				while (n % i == 0);
				s *= (p-1)/(i-1);
			}
			if (sw) i += 2, sw = 0;
			else    i += 4, sw = 1;
		}
	}
	return s;
}

int main()
{
	int n, d;
	char *ans[3] = { "abundant number", "perfect number", "deficient number" };

	while (scanf("%d", &n) && n) {
		d = (n << 1) - pseudo_factorization(n);
		if (d > 0) d = 1; else if (d < 0) d = -1;
		puts(ans[d+1]);
	}
	return 0;
}

Measured memory_bytes: 1812
#include <stdio.h>

int main(void)
{
  int a,i;
  int s = 0;
  
  scanf("%d", &a);
  
  for(i=0;i<3;i++) {
     if(a%10==7) 
       s=1;
     a=a/10;
  } 
  
  if(s==1)
    printf("Yes");
  else
    printf("No");
  
  return 0;
}

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

int main(){
  int n; cin >> n;
  string s; cin >> s;
  vector<char> out;
  int a = 0, b = 0;
  int aout = 0, bout = 0;
  int tmp = 0;
  for(int i = 0; i < n; i++){
    if(s.at(i) == '(') tmp++;
    if(s.at(i) == ')'){
      if(tmp == 0){
        aout++;
      }else{
        tmp--;
      }
    }
  }
  bout = tmp;
  for(int i = 0; i < aout; i++) cout << '(';
  for(int i = 0; i < n; i++) cout << s.at(i);
  for(int i = 0; i < bout; i++) cout << ')';
}

Measured memory_bytes: 256
from collections import deque
n, m = [int(e) for e in input().split()]
AB = [[] for _ in range(n+1)]
for i in range(m):
    A,B = [int(e) for e in input().split()]
    AB[A].append(B)
    AB[B].append(A)

ans = [0]*(n+1)
visited = [0]*(n+1)
root = 1
visited[root] = 1
q = deque([root])

while q:
    v = q.popleft()
    for w in AB[v]:
        if visited[w]==0:
            ans[w]=v
            visited[w] +=1
            q.append(w)
        
print('Yes')
for i in ans[2:]:
    print(i)

Measured memory_bytes: 35380
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Pohe {
    static void Main() {
	var p = (from x
		 in ReadLine().Split()
		 select int.Parse(x)).ToArray();
	var n = p[0];
	var m = p[1];

	WriteLine("{0}", m * Pow(m - 1, n - 1));
    }
}


Measured memory_bytes: 2904
#include<stdio.h>

int main(){
  	int S[4];
  	//int n[4];
  	for(int i = 0; i < 4; i++){
    	scanf("%1d\n",&S[i]);
    }
  	for(int i = 0; i < 3; i++){
    	if(S[i] == S[i+1]){
        	printf("Bad\n");
          	return 0;
        }
    }
  	printf("Good\n");
	return 0;
}

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

int main(){
    int x,y;
    cin >> x >> y;
    bool ans=false;
    for(int i=0;i<=x;i++){
        if(i*4+(x-i)*2==y){
            ans=true;
        }
    }
    if(ans) cout << "Yes" << endl;
    if(!ans) cout << "No" << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	ll arr[n+1];
	for(int i = 1; i <= n;++i){
		cin >> arr[i];
	}
	ll suf[n+1];
	suf[n] = arr[n];
	for(int i = n-1; i > 0;--i){
		suf[i] = suf[i+1] + arr[i];
	}
	ll ans = 0;
	for(int i = 1; i < n;++i){
		ans = (ans + ((arr[i]%MOD) * (suf[i+1]%MOD))%MOD)%MOD;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 6724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.begin(), v.end(), greater<ll>()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main() {
    ll n;
    cin >> n;
    vl a(n);
    for(auto &it: a) cin >> it;
    vector<vector<ll>> arr(n, vl(65));
    for(int j = 0; j <= 62; ++j) {
        if((1ll << j)&a[0]) {
            arr[0][j] = 1;
        }
    }
    for(int i = 1; i < n; ++i) {
        ll num = a[i];
        for(int j = 0; j <= 62; ++j) {
            if((1ll << j)&num) {
                arr[i][j] = arr[i - 1][j] +  1;
            }
            else {
                arr[i][j] = arr[i - 1][j];
            }
        }
    }
    ll ans = 0;
    vl pow2(63);
    pow2[0] = 1;
    for(int i = 1; i <= 62; ++i) {
        pow2[i] = pow2[i - 1]*2 % mod;
    }
    for(int i = 1; i < n; ++i) {
        ll num = a[i];
        for(int j = 0; j <= 62; ++j) {
            if((1ll << j)&num) {
                ans = (ans%mod + ((i + 1 - arr[i][j])*pow2[j]%mod))%mod;
            }
            else {
                ans = (ans%mod + (arr[i][j]*pow2[j]%mod))%mod;
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 164352
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

LL L, A, B, M;

long long modPow(long long x, long long y){
    long long r=1, a=x%M;
    while(y > 0){
        if((y&1) == 1) r = (r*a) % M;
        a = (a*a) % M;
        y /= 2;
    }
    return r;
}

long long _Pow(long long x, long long y){
    long long r=1, a=x;
    while(y > 0){
        if((y&1) == 1) r = r*a;
        a = a*a;
        y /= 2;
    }
    return r;
}

int disit(LL n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

LL term(LL a, LL b, LL i) {
  return a + b*i;
}

LL hoge(LL len, LL p) {
  // 1 + p + p^2 + ... + p^(len-1)
  if (len == 1) return 1;
  if (len % 2 == 0) {
    return (hoge(len/2, p) * (1+modPow(p, len/2)%M)%M) % M;
  } else {
    return (hoge(len-1, p) + modPow(p, len-1)%M) % M;
  }
}

LL hoge2(LL len, LL p) {
  // 1*p^(len-1) + 2*p^(len-2) + ... + (len-1)*p + len*1
  // 6 + 500 + 40000 + 3000000 + 200000000 + 10000000000
  if (len == 0) return 0;
  if (len == 1) return 1;
  if (len % 2 == 0) {
    return hoge2(len/2, p)*(1+modPow(p, len/2)%M)%M + (len/2)%M*hoge(len/2, p)%M;
  } else {
    return (len + p*hoge2(len-1, p)%M) % M;
  }
}

void solve() {
  cin >> L >> A >> B >> M;
  LL res = 0;

  LL i = L-1;
  LL zeros = 1;
  while(i >= 0) {
    LL start = term(A, B, i);
    int d = disit(start);
    LL len = min(i+1, (start-_Pow(10, d-1))/B + 1);
    i = i-len+1;
    LL end = term(A, B, i);
    i--;

    LL tmp = (end%M)*hoge(len, modPow(10, d))%M;
    tmp = (tmp + B%M*hoge2(len-1, modPow(10, d))%M) % M;

    res = (res + (tmp*zeros)%M) % M;

    // zeros = zeros * modPow(10, d)%M * modPow(10, len) % M;
    zeros = zeros * modPow(modPow(10, d), len) % M;
  }

  cout << res << endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,n;
	int sum;
	sum = 100000;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		sum *= 1.05;
	if(sum%1000 != 0)
		{
			sum/=1000;sum += 1; sum*= 1000;
		}
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 592
#!python3

from collections import deque

LI = lambda: list(map(int, input().split()))

# input
N, M = LI()
S = input()

INF = 10 ** 6


def main():
    w = [(INF, INF)] * (N + 1)
    w[0] = (0, 0)
    # (cost, index)
    dq = deque([(0, 0)])
    for i in range(1, N + 1):
        if i - dq[0][1] > M:
            dq.popleft()
        if len(dq) == 0:
            print(-1)
            return
        if S[i] == "0":
            w[i] = (dq[0][0] + 1, i - dq[0][1])
            dq.append((w[i][0], i))

    ans = []
    x = N
    while x > 0:
        d = w[x][1]
        ans.append(d) 
        x -= d
    ans = ans[::-1]
    print(*ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 17668
#include <iostream>
#include <cstdio>
#include <complex>
using namespace std;

const double EPS = 1.0e-6;

int main()
{
	double xa,ya,xb,yb,xc,yc,xd,yd;
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd) > 0){
		//printf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",xa,ya,xb,yb,xc,yc,xd,yd);
		complex<double> v[4];
		v[0] = complex<double>(xb-xa, yb-ya);
		v[1] = complex<double>(xc-xb, yc-yb);
		v[2] = complex<double>(xd-xc, yd-yc);
		v[3] = complex<double>(xa-xd, ya-yd);
		
		int p = 0;
		int m = 0;
		for(int i=0; i<4; i++){
			if( imag(conj(v[i])*v[(i+1)%4]) < 0){
				m++;
			} else {
				p++;
			}
		}
		if(m==4||p==4) cout<<"YES";
		else           cout<<"NO";
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;
//using System.Collections;
//using System.Collections.Generic;


namespace ABC171_2
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            long[] inputNKArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long[] inputPArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long sum = 0;

            Array.Sort(inputPArray);

            for(int i = 0; i < inputNKArray[1]; i++)
            {
                sum += inputPArray[i];
            }

            Console.WriteLine(sum);

        }
    }
}

Measured memory_bytes: 28420
use input::Input;
use std::collections::HashMap;

fn main() {
    let mut input = Input::default();

    let mut m = HashMap::new();

    let n = input.parse();
    let mut ans = 0u64;
    for _ in 0..n {
        let a = input.parse::<u64>();
        let e = m.entry(a).or_insert(0u64);
        *e += 1;
        ans += a;
    }

    let q = input.parse();
    for _ in 0..q {
        let b = input.parse();
        let c = input.parse();
        if let Some(x) = m.remove(&b) {
            let e = m.entry(c).or_insert(0u64);
            *e += x;
            ans -= b * x;
            ans += c * x;
        }
        println!("{}", ans);
    }
}

#[allow(dead_code)]
pub mod input {
    #[derive(Default)]
    pub struct Input(Vec<String>);

    impl Input {
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok().expect("read error");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            let x = if let Some(x) = self.0.pop() {
                x
            } else {
                let s = self.read_line();
                self.0 = s.split_whitespace().map(String::from).rev().collect();
                self.0.pop().expect("reached EOF")
            };
            x.parse().ok().expect("parse error")
        }
    }
}


Measured memory_bytes: 9740
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int m, k;
    cin >> m >> k;
    int sz = 1;
    for(int i = 0; i < m + 1; ++i)  sz <<= 1;
    int bound = sz >> 1;
    if(k == 0){
        for(int i = 0; i < bound; ++i){
            cout << i << ' ' << i;
            cout << ((i == bound - 1) ? '\n' : ' ');
        }
        return 0;
    }
    int XorSum = 0;
    for(int i = 0; i < bound; ++i){
        if(i == k)  continue;
        XorSum ^= i;
    }
    if(XorSum != k){
        cout << -1 << endl;
        return 0;
    }
    vector<int> ans;
    for(int i = 0; i < bound; ++i){
        if(i == k)  continue;
        ans.emplace_back(i);
    }
    ans.emplace_back(k);
    for(int i = bound - 1; i >= 0; --i){
        if(i == k)  continue;
        ans.emplace_back(i);
    }
    ans.emplace_back(k);
    for(int i = 0; i < sz; ++i){
        cout << ans[i];
        cout << ((i == sz - 1) ? '\n' : ' ');
    }
}

Measured memory_bytes: 2932
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			if(n==0) {
				break;
			}
			int[] sum = new int[n+1];
			for(int i=1;i<=n;i++) {
				sum[i] = sum[i-1] + sc.nextInt();
			}
			int ans = 0;
			for(int i=1;i<=n-k+1;i++) {
				ans = max(ans,sum[i+k-1]-sum[i-1]);
			}
			System.out.println(ans);
		}
		sc.close();
	}
	static private int max(int a, int b) {
		return a > b ? a : b;
	}
}

Measured memory_bytes: 64028
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int sum(int x) {
    int ret = 0;
    while (x > 0) {
        ret += x % 10;
        x /= 10;
    }
    return ret;
}

int main() {
    int n; cin >> n;
    int ans = INF;
    for (int a = 1; a < n; a++) {
        int b = n - a;
        chmin(ans, sum(a) + sum(b));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

typedef struct PLIST{
	struct PLIST *pre;
	struct PLIST *next;
	int key;
}plist;

plist *head;
plist *tail;

int compStr(char *str0, char *str1){
	int i = 0;
	for( i = 0; str0[i] != '\0' || str1[i] != '\0'; i++ ){
		if( str0[i] != str1[i] ){ return 0; }
	}
	if( str0[i] != str1[i] ){ return 0; }
	return 1;
}

void insert(plist *p, plist *next){
	if( p == NULL ){ return; }
	if( next != NULL ){
		p->pre = NULL;
		p->next = next;
		next->pre = p;
	}else{
		p->pre = NULL;
		p->next = NULL;
		tail = p;
	}
	head = p;
	return;
}

void delete(plist *p){
	if( p == NULL ){ return; }
	if( p->pre != NULL ){
		p->pre->next = p->next;
	}else{
		head = p->next;
	}
	if( p->next != NULL ){
		p->next->pre = p->pre;
	}else{
		tail = p->pre;
	}
	free(p);
	return;
}

int main(){
	int i = 0;
	int n = 0;
	char com[1024];
	int x = 0;
	scanf("%d", &n);
	plist *temp;
	for( i = 0; i < n; i++ ){
		scanf("%s", com);
		if( compStr(com, "insert\0") ){
			scanf("%d", &x);
			temp = (plist*)malloc(sizeof(plist));
			temp->key = x;
			if( head != NULL ){
				insert(temp, head);
			}else{
				insert(temp, NULL);
			}
		}
		if( compStr(com, "delete\0") ){
			scanf("%d", &x);
			temp = head;
			while( temp != NULL ){
				if( temp->key == x ){ break; }
				temp = temp->next;
			}
			delete(temp);
		}
		if( compStr(com, "deleteFirst\0") ){
			delete(head);
		}
		if( compStr(com, "deleteLast\0") ){
			delete(tail);
		}
		/*
		temp = head;
		if( temp != NULL ){ printf("%d", temp->key); }
		while( (temp = temp->next) != NULL ){ printf(" %d", temp->key); }
		printf("\n");
		*/
	}
	temp = head;
	if( temp != NULL ){ printf("%d", temp->key); }
	while( (temp = temp->next) != NULL ){ printf(" %d", temp->key); }
	printf("\n");
	return 0;
}

Measured memory_bytes: 31788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	rep(i,50010){
		int now=i*1.08;
		if(now==n){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
}

Measured memory_bytes: 256
extern crate core;

use std::fmt;
macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
#[derive(Copy, Clone)]
struct Lab {
    l: f64,
    a: f64,
    b: f64
}
impl Lab {
    fn distance(&self, other: &Lab) -> f64 {
        (self.l - other.l) * (self.l - other.l) + (self.a - other.a) * (self.a - other.a) + (self.b - other.b) * (self.b - other.b)
    }
}
fn max_distances(lab: &Vec<Lab>, n: usize, k: usize, prev: &mut Vec<Lab>) -> f64 {
    if k == 0 {
        let mut result = 0_f64;
        for i in 0 .. prev.len() {
            for j in 0 .. i {
                result += prev[i].distance(&prev[j]);
            }
        }
        result
    }else if n < k {
        0_f64
    }else {
        let mut max = 0_f64;
        for i in k - 1 .. n {
            prev.push(lab[i]);
            let result = max_distances(lab, i, k - 1, prev);
            if max < result {
                max = result
            }
            prev.pop();
        }
        max
    }
}
fn main() {
    let_all!(n: usize, m: usize);
    let mut lab = Vec::<Lab>::with_capacity(n);
    for _ in 0 .. n {
        let_all!(l: f64, a: f64, b: f64);
        lab.push(Lab{l: l, a: a, b: b});
    }
    println!("{:.*}", 20, max_distances(&lab, n, m, &mut Vec::new()))
}


Measured memory_bytes: 5076
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int T = sc.nextInt();
		// スペース区切りの整数の入力
		int X = sc.nextInt();
		double t = (double)T/X;
		System.out.println(t);
	}
}

Measured memory_bytes: 23764
while true
    a,b,c=gets.split(" ")
     case b
        when "+"
            puts"#{a.to_i+c.to_i}"
        when "-"
            puts"#{a.to_i-c.to_i}"
        when "/"
            puts"#{a.to_i/c.to_i}"
        when "*"
            puts"#{a.to_i*c.to_i}"
        when "?"
            break
    end
end


Measured memory_bytes: 6872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	string A,B; cin>>A>>B;
	A+=B;
	int a = stoi(A);
	int b = sqrt(a);
	if(b*b == a){
		ote("Yes");
	}
	else{
		ote("No");
	}
}


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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

typedef long long ll;

int main()
{
    int n, ans, a[100010];
    map<int, bool> num;
    cin >> n;

    ans = 0;
    REP(i, n)
    {
        cin >> a[i];
        if (num[a[i]])
        {
            num[a[i]] = false;
            ans--;
        }
        else
        {
            num[a[i]] = true;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,i,j;
char r[1010][1010],b[1010][1010],a[1010][1010];
int main(){
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	 for(j=1;j<=m;j++)r[i][j]=b[i][j]='.';
	for(i=1;i<=n;i++){
		scanf("%s",a[i]+1);
		for(j=1;j<=m;j++)if(a[i][j]=='#')r[i][j]=b[i][j]='#';
	}
	for(i=1;i<=n;i+=2)
	 for(j=2;j<m;j++)r[i][j]=b[i+1][j]='#';
	for(i=1;i<=n;i++)r[i][1]=b[i][m]='#';
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++)printf("%c",r[i][j]);puts("");
	}
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++)printf("%c",b[i][j]);puts("");
	}
}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner stdin =new Scanner(System.in);
		int n=stdin.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		int c[]=new int[n];
		int d[]=new int[n];



		int i,j,k;
		int friend=0;
		for(i=0;i<n;i++){
			a[i]=stdin.nextInt();
			b[i]=stdin.nextInt();
		}
		for(i=0;i<n;i++){
			c[i]=stdin.nextInt();
			d[i]=stdin.nextInt();
		}
		for(i=0;i<n;i++){
			int minblueindex=300;
			int minbluevalue=300;
			for(j=0;j<n;j++){
				if(minbluevalue>c[j]){
					minbluevalue=c[j];
					minblueindex=j;
				}
			}
			int maxredindex=-1;
			int maxredvalue=-1;
			for(j=0;j<n;j++){
				if(a[j]<c[minblueindex] &&b[j]<d[minblueindex]){

					if(maxredvalue<b[j]){
						maxredvalue=b[j];
						maxredindex=j;
					}
				}
			}
			c[minblueindex]=300;
			d[minblueindex]=300;
			if(maxredindex!=-1){
				friend++;
				a[maxredindex]=-1;
				b[maxredindex]=-1;
			}
		}
		System.out.println(friend);
	}
}

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


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

    }
    for(int i=n-1; i>=0; i--){
        if(i==0){
            cout << a[i] << endl;
            break;
        }
        cout << a[i] << " ";
    }

}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct number{
	short a[5001000];
	int sum;
	void check(){
		sum=0;
		for(int i=0;i<5000000;i++)
			if(a[i]>9) a[i+1]+=a[i]/10,a[i]%=10;
		for(int i=0;i<5000000;i++) sum+=a[i];
	}
	void mul(int val){
		for(int i=0;i<5000000;i++) a[i]*=val;
		check();
	}
	void add(int val){
		a[0]+=val;sum+=val;
		int now=0;
		while(a[now]>9){
			sum-=9;
			a[now+1]++,a[now++]-=10;
		}
	}
	int S(){return sum;}
}num;
int main(){
	string st;
	cin>>st;
	for(int i=0;i<st.length();i++)
		num.a[st.length()-i-1]=st[i]-'0';
	num.check();
	num.mul(9);
	for(int ans=0;;ans++){
		//cerr<<num.S()<<' '<<ans<<'\n';
		if(num.S()<=ans*9){cout<<ans<<'\n';return 0;}
		num.add(9);
	}
	return 0;
}


Measured memory_bytes: 10628
#include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);


ll test[1234][1234];
signed main() {
	
	ll D, c, s; cin >> D;
	for (int h = 0; h < 26; h++) {
		cin >> c;
	}
	for (int i = 0; i < D; i++) {
		for (int h = 0; h < 26; h++) {
			cin >> test[i][h];
		}
	}
	vector<ll> ng;
	for (int h = 0; h < D - 26; h++) {
		if (h % 26 == 0) { ng.clear(); }
		ll a = 0, ans1 = 0, ans2 = 0;
		for (int i = 0; i < 26; i++) {
			if (a != ng.size() && i == ng[a]) { a++; continue; }
			if (ans1 < test[h][i]) {
				ans1 = test[h][i]; ans2 = i;
			}
		}
		cout << ans2 + 1 << endl;
		sort(ng.begin(), ng.end());
	}
	for (int h = 0; h < 26; h++) {
		cout << h + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 5112
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1000000000;
const int MOD = 1000000007;

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

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

  if("ABC" == s) cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}


Measured memory_bytes: 3624