akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 1e9 + 7;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

void pri(int x, set<int>&primes) {
	int prex = x;
	for (int i = 2; i*i <= x; i++) {
		while (x%i == 0) {
			primes.insert(i);
			x /= i;
		}
	}
	primes.insert(x);
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll A, B;
	cin >> A >> B;
	set<int>stA, stB;
	for (int i = 1; i*i <= A; i++) {
		if (A%i == 0) {
			stA.insert(i);
			stA.insert(A / i);
		}
	}
	for (int i = 1; i*i <= B; i++) {
		if (B%i == 0) {
			stB.insert(i);
			stB.insert(B / i);
		}
	}
	set<int>st;
	for (auto x : stA) {
		if (stB.find(x) != stB.end()) {
			st.insert(x);
		}
	}
	set<int>primes;
	for (auto x : st) {
		//pe(x);
		pri(x, primes);
	}//cout << endl;
	primes.insert(1);
	int ans = primes.size();
	print(ans);
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  bool ok = true;

  set<string> vis;
  string s; cin >> s;
  vis.insert(s);
  REP(i, N-1) {
    string t; cin >> t;
    if (s.back() != t.front()) ok = false;
    if (vis.count(t) > 0) ok = false;
    vis.insert(t);
    s = t;
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
/*    string inp = "4"
"1 2 3 4"
"3"
"1 2"
"3 4"
"2 4";
    istringstream iss(inp);
    cin.rdbuf(iss.rdbuf());*/

    int N;
    cin >> N;
    map<long, long> cnts;
    long sum=0;
    for(int i=0;i<N;i++){
        long A;
        cin >> A;
        cnts[A]++;
        sum += A;
    }
    int Q;
    cin >> Q;
    for(int i=0;i<Q;i++){
        long B, C;
        cin >> B >> C;
        if(cnts.count(B) != 0){
            sum += (C-B)*cnts[B];
            cnts[C]+=cnts[B];
            cnts[B]=0;
        }
        cout << sum << endl;
    }
    return 0;
}


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

int main () {
  
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y")
    {
     cout << "Four" << endl;
      return 0;
    }
  }
      cout << "Three" << endl;
    return 0;
}

      


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;

int main() {
    int N, C;
    cin >> N >> C;

    int D[40][40];
    for (int i = 1; i <= C; i++) {
        for (int j = 1; j <= C; j++) {
            cin >> D[i][j];
        }
    }

    int c[510][510];
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            cin >> c[i][j];
        }
    }

    int t[3][30];
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            t[(i+j)%3][c[i][j]]++;
        }
    }
    
    ll res = 1e10;
    for (int X = 1; X <= C; X++) {
        for (int Y = 1; Y <= C; Y++) {
            if (X != Y) for (int Z = 1; Z <= C; Z++) {
                if (Z != X && Z != Y) {
                    ll tmp = 0;
                    for (int l = 1; l <= C; l++) tmp += D[l][X] * t[0][l];
                    for (int l = 1; l <= C; l++) tmp += D[l][Y] * t[1][l];
                    for (int l = 1; l <= C; l++) tmp += D[l][Z] * t[2][l];

                    res = min (res, tmp);
                }
            }
        }
    }
    
    cout << res << endl;

}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a <= b) {
		for (int c = 1; c <= b; c++) {
			cout << a;
		}
	}
	else {
		for (int d = 1; d <= a; d++) {
			cout << b;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

int main() {
    int n, K; cin >> n >> K;
    vint a(n), b(n);
    rep(i,n) cin >> a[i] >> b[i];
    set<int> zeros;
    ll ans = -1;
    for (int i = 30; i >= 0; i--) {
        ll sum = 0;
        if (i == 0) {
            if (!(K>>i&1)) zeros.insert(0);
            rep(j,n) {
                bool ok = true;
                rep(k,30) if (a[j]>>k&1 && zeros.count(k)) ok = false; 
                if (ok) sum += b[j];
            }
        } else if (K >> i & 1) {
            rep(j,n) {
                bool ok = true;
                if (a[j] >> i & 1) ok = false;
                rep(k,30) if (a[j]>>k&1 && zeros.count(k)) ok = false; 
                if (ok) sum += b[j];
            }
        } else zeros.insert(i);
        ans = max(ans,sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3956
#define _USE_MATH_DEFINES_
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

typedef long long ll;

ll Q,H,S,D,N;

int main(){
	cin>>Q>>H>>S>>D>>N;
	S=min({Q*4,H*2,S});
	D=min(S*2,D);
	ll ans=N/2*D;
	if (N%2){
		ans+=S;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int D; cin>>D;
  if(D==25){
    cout<<"Christmas"<<endl;
  }
  if(D==24){
    cout<<"Christmas Eve"<<endl;
  }
  if(D==23){
    cout<<"Christmas Eve Eve"<<endl;
  }
  if(D==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
}


Measured memory_bytes: 256
s = input() + "T"
x, y = map(int, input().split())
N = len(s)



for i in range(N):
    if s[i] == "F":
        x -= 1
    else:
        cnt_Y = True
        index = i + 1
        break

steps_X = []
steps_Y = []

while index < N:
    cnt = 0
    for j in range(index, N):
        if s[j] == "F":
            cnt += 1
        else:
            if cnt_Y and cnt != 0:
                steps_Y.append(cnt)
            elif not cnt_Y and cnt != 0:
                steps_X.append(cnt)
            cnt_Y = not cnt_Y
            index = j
            break
    index += 1
    
K = 10000
dp = [set() for _ in range(K)]
dp[0].add(0)

for i, t in enumerate(steps_X):
    for tmp in dp[i]:
        dp[i+1].add(tmp+t)
        dp[i+1].add(tmp-t)

# print(dp[len(steps_X)])
if x not in dp[len(steps_X)]:
    print("No")
    import sys
    sys.exit()

dp = [set() for _ in range(K)]
dp[0].add(0)
for i, t in enumerate(steps_Y):
    for tmp in dp[i]:
        dp[i+1].add(tmp+t)
        dp[i+1].add(tmp-t)

if y not in dp[len(steps_Y)]:
    print("No")
    import sys
    sys.exit()


print("Yes")


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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++) cin >> A[i];
    ll ans = 0;
    for (ll i = 1; i < N; i++) {
        if (A[i - 1] <= A[i]) continue;
        ll h = A[i - 1] - A[i];
        A[i] += h;
        ans += h;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4832
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <deque>
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <iomanip>
#include <utility>
#include <functional>
using namespace std;
//orz hxr
#define ll long long
#define ull unsigned ll
const int N=100005;
int n, h[N];
ll A, B;
ll tmp[N];
bool check(int mid) {
	for (int i=0; i<n;i++)
		tmp[i]=h[i]-mid*B;
	int cnt=0;
	for (int i=0; i<n; i++) {
		if (tmp[i]<=0)
			continue;
		cnt+=(tmp[i]+A-1)/A;
		if (cnt>mid)
			return false;
	}
	if (cnt>mid)
		return false;
	return true;
}
int main() {
	scanf("%d%lld%lld", &n, &A, &B);
	A-=B;
	for (int i=0; i<n; i++)
		scanf("%lld", &h[i]);
	int l=1, r=1000000010;
	while (l<r) {
		int mid=(l+r)/2;
		if (check(mid))
			r=mid;
		else
			l=mid+1;
	}
	printf("%d\n", r);
	return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	int sum = 0;
	string s;

	cin >> s;

	for (int i = 0; i < 6; i++) {
		if (s[i] == '1') {
			sum++;
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 764
#include <cstdio>
#include <algorithm>

char S[100032], T[100032];

int main() {
	int N, M;
	scanf("%d%d%s%s",&N,&M,S,T);
	int d = std::__gcd(N,M), n = N/d, m = M/d;
	for (int i = 0, j = 0; i < N; i += n, j += m)
		if (S[i] != T[j]) {puts("-1"); return 0;}
	printf("%lld\n",(long long)N / d * M);
	return 0;
}


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

double D;

int main() {
    int N;
    double x, y;
    int sum = 0;
    scanf("%d%lf", &N, &D);
    for(int i = 1; i <= N; i++) {
        scanf("%lf%lf", &x, &y);
        //cout << x*x + y*y << endl;
        if((x*x + y*y) <= D*D)
            sum++;
    }
    printf("%d\n", sum);
    return 0;
}


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

public class Main {

	static BufferedReader reader;
	final static boolean MODE_DEBUG = false;
	//static field here
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		reader = new BufferedReader(new InputStreamReader(System.in));
		//code here
		char[] S = readLine()[0].toCharArray();
		
		if(S[0]=='7'||S[1]=='7'||S[2]=='7')print("Yes");
		else
		print("No");
		//String[] s = readLine();
		//print(num);
	}
	
	//functions here
	//note that all methods should be STATIC


	private static <T> int arraySearch(T needle, T[] heystack) {
		for(int i=0;i<heystack.length;i++) {
			if(needle.equals(heystack[i])) {
				return i;
			}
		}
		return -1;
	}
	private static String[] readLine(){
		try{
			return reader.readLine().split(" ");
		}catch(Exception e){
			e.printStackTrace();
			return new String[]{e.getMessage()};
		}
	}
	private static int[] readLineInt(){
		try{
			String[] s = readLine();
			int[] ints = new int[s.length];
			for(int i=0;i<ints.length;i++) {
				ints[i] = Integer.parseInt(s[i]);
			}
			return ints;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static byte[] readLineByte(){
		try{
			String[] s = readLine();
			byte[] bytes = new byte[s.length];
			for(int i=0;i<bytes.length;i++) {
				bytes[i] = Byte.parseByte(s[i]);
			}
			return bytes;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static char[] readLineChar(){
		try{
			String[] s = readLine();
			char[] chars = new char[s.length];
			for(int i=0;i<chars.length;i++) {
				chars[i] = (char)Integer.parseInt(s[i]);
			}
			return chars;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	private static void print(Object o){
		System.out.println(o);
	}
	private static void print(){
		System.out.println();
	}
	private static void printd(Object o){
		if(MODE_DEBUG)System.err.println(o);
	}
	private static void printd(){
		if(MODE_DEBUG)System.err.println();
	}
}


Measured memory_bytes: 32668
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
        int n,d;cin>>n>>d;
        vector<vector<int>> x(n,vector<int>(d));
        rep(i,n)rep(j,d)cin>>x[i][j];
        int res = 0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                int sum = 0;
                rep(k,d){
                    sum += pow(x[i][k]-x[j][k],2);
                }
                int r = pow(sum,0.5);
                if(r*r==sum)res++;
            }
        }
        cout<<res;
    }
    


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	double v[51];
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	sort(v, v + n);
	double ans = v[0] / pow(2.0, n - 1);
	for(int i = 1; i < n; i++){
		ans += v[i] / pow(2.0, n - i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	ll ans = 0;
	FOR(i, 1, n+1){
		FOR(j, 1, n+1){
			FOR(k, 1, n+1){
				ans += gcd(gcd(i, j), k);
			}
		}
	}
	printf("%lld\n", ans);
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

pll A[105];
ll M[105];
ll dp[105][10005];

int main() {
    ll N, W;
    cin >> N >> W;
    REP(i, N) {
        cin >> A[i].first >> A[i].second >> M[i];
    }
    memset(dp, 0, sizeof(dp));
    REP(i, N) {
        REP(j, W + 1) {
            dp[i + 1][j] = dp[i][j];
        }
        REP(j, A[i].second) {
            priority_queue<pll, vector<pll>, function<bool(pll, pll)>>
                    q([](pll a, pll b) { return a.first < b.first; });
            ll last = (W - j) / A[i].second;
            for (ll w = j; w <= W; w += A[i].second) {
                ll index = (w - j) / A[i].second;
                q.push(pll(dp[i + 1][w] + (last - index) * A[i].first, index));
                while (index - q.top().second > M[i]) {
                    q.pop();
                }
                pll t = q.top();
                ll v = t.first + (index - last) * A[i].first;
                dp[i + 1][w] = std::max(dp[i + 1][w], v);
            }
        }
    }

    ll max = 0;
    REP(i, W + 1) {
        max = std::max(max, dp[N][i]);
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 11572
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(void){
    int n;
    ll inf = 1e9 + 7;
    
    cin >> n;
    
    ll dp[105][64];
    // AA, AC, AG, AT, CA, CC, CG, CT, GA, GC, GG, GT, TA, TC, TG, TT;
    // AC: 1,  AG: 2,  GA: 8 + 16k
    // A_G: 2, 6, 10, 14  AG_: 8, 9, 10, 11 <10>
    for (int i = 0; i < 64; i++) dp[3][i] = 1;
    for (int i = 0; i < 64; i++) {
        for (int j = 4; j <= n; j++) dp[j][i] = 0;
    }
        
    for (int i = 3; i < n; i++) {
        
            dp[i][6] = 0;
            dp[i][9] = 0;
            dp[i][33] = 0;
            
        for (int j = 0; j < 16; j++) {
            ll sum = dp[i][j] + dp[i][j + 16] + dp[i][j + 32] + dp[i][j + 48];
            
            for (int k = 0; k < 4; k++) {
                if ((4 * j + k) % 16 == 9) dp[i + 1][4 * j + k] = sum - dp[i][j];
                else if (4 * j + k == 33) dp[i + 1][4 * j + k] = sum - dp[i][8];
                else if (4 * j + k == 37) dp[i + 1][4 * j + k] = sum - dp[i][9];
                else if (4 * j + k == 41) dp[i + 1][4 * j + k] = sum - dp[i][10];
                else if (4 * j + k == 45) dp[i + 1][4 * j + k] = sum - dp[i][11];
                else dp[i + 1][4 * j + k] = sum;
                
                dp[i + 1][4 * j + k] %= inf;
            }
            
        }
    }
    dp[n][6] = 0;
    dp[n][9] = 0;
    dp[n][33] = 0;
    
    ll ans = 0;
    for (int i = 0; i < 64; i++) ans += dp[n][i];
    
    cout << ans % inf << endl;
    
}


Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding("utf8");
let input = "";
process.stdin.on("data", function(chunk) {input += chunk;});
process.stdin.on("end", function() {main(input.split("\n"));});
 
const C_MAX = 10001;

function main(lines){
	let n = Number(lines[0]);
	let A = lines[1].split(" ").map(Number);
	let C = [];

	for (let i = 0; i < C_MAX; i++) C[i] = 0;

	for (let i = 0; i < n; i++) {
		let a = A[i];
		C[a]++;
	}

	let p = 0;
	let B = [];
	for (let i = 0; i < C_MAX; i++) {
		let c = C[i];
		for (let j = 0; j < c; j++) {
			B[p] = i;
			p++;
		}
	}

	console.log(B.join(" "));
}



Measured memory_bytes: 288832
#include<iostream>
#include<cstdio>
#include<map>

using namespace std;

string str,lst;
int n;
map<string,bool> m;

int main(){
	scanf("%d",&n);
	cin>>lst;m[lst]=true;
	for(int i=2;i<=n;++i){
		cin>>str;
		if(str.front()!=lst.back()){
			puts("No");
			return 0;
		}
		if(m[str]){
			puts("No");
			return 0;
		}
		m[str]=true;
		lst=str;
	}
	puts("Yes");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    string n;
    in>>n;
    int d{},D{1},nd,ND;
    for(auto&c:n){
        c-='0';
        nd=min(d+c,D+10-c);
        ND=min(d+c+1,D+10-c-1);
        swap(d,nd);
        swap(D,ND);
    }
    cout<<d<<endl;
}

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

int main(){
  int a,b,m[1000010],max;
  while(1){
    cin >> a>> b;
    if(a==0&&b==0)break;
    for(int i=0;i<a+b;i++)cin >> m[i];
    m[a+b]=0;
    sort(m,m+a+b+1);
    max=0;
    for(int i=1;i<a+b+1;i++){
      if(m[i]-m[i-1]>max)max=m[i]-m[i-1];
    }
    cout << max<< endl;

  }
  return 0;
}

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



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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    
    ll n,t;
    cin>>n>>t;

    vector<ll> ti(n);

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

    ll c=0,time=0;

    for(int i=0;i<n-1;i++){
        if(ti[i]+t>ti[i+1]){
            time+=ti[i+1]-ti[i];
        }else{
            time+=t;
        }
    }

    cout<<time+t<<endl;

}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(ll i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(ll i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d||abs(a-b)<=d&&abs(b-c)<=d){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)



void solve() 
{
    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else
    {
        cout<<"No";
    }
    
    
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int tc =1 ; 
    //cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}


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

int64_t N,M,Z=1,A=0,B=0;
vector<vector<int>> G;
vector<int> seen;
void dfs(int a,int b){
  seen[a]=b;
  if(b==0){
    A++;
  }
  else{
    B++;
  }
  for(int x:G[a]){
    if(seen[x]==-1){
      dfs(x,(b+1)%2);
    }
    else if(seen[x]==b){
      Z=0;
    }
  }
}

int main() {
  cin>>N>>M;
  G.resize(N);
  seen.resize(N);
  for(int i=0;i<N;i++){
    seen[i]=-1;
  }
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(0,0);
  if(Z){
    cout<<A*B-M<<endl;
  }
  else{
    cout<<N*(N-1)/2-M<<endl;
  }
}

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

int main(){
  int N;
  cin >> N;
  vector<int64_t> A(N),v1(N,2),v2(N,2);
  v1.front()=1;
  v1.back()=1;
  v2.front()=1;
  v2.back()=1;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if(i%2==0){
      v1.at(i)*=-1;
    }else{
      v2.at(i)*=-1;
    }
  }
  sort(A.begin(),A.end());
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  int64_t sum1=0;
  int64_t sum2=0;
  for(int i=0;i<N;i++){
    sum1+=A.at(i)*v1.at(i);
    sum2+=A.at(i)*v2.at(i);
  }
  cout << max(sum1,sum2) << endl;
  return 0;
}


Measured memory_bytes: 5616
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
	int sum;
	foreach (line; stdin.byLine) {
		sum += line.chomp.to!int;
	}
	writeln(sum/60);
	writeln(sum%60);
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main() {
  int x,a,b,kyori;
  cin >> x >> a >> b;
  kyori = abs(x - a) - abs(x - b);
 
  if (kyori > 0) {
    cout << "B" << endl;
  }else{
      cout << "A" << endl;
  }

}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using ll=long long; 
using ld=long double; 
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int mod=1e9+7; 
int main()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout); 
  #endif
  int x; cin>>x; if(x)cout<<0; else cout<<1; 
}

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

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => ({
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    })
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    )
}

// End Snippet

fn main() {
    println!("{}", solve(stdin!()));
}

fn solve(src: String) -> String {
    input!{
        source = src,
        n: usize, q: usize,
        s: chars,
        lr: [(usize, usize); q]
    }
    let mut ans = String::new();
    let mut counts = vec![0; n+1];

    for i in 1..n {
        counts[i] = counts[i-1] + if s[i-1] == 'A' && s[i] == 'C' {
            1
        } else {
            0
        }
    }

    for i in 0..q {
        let (l, r) = lr[i];
        let count = counts[r-1] - counts[l-1];
        ans.push_str(&count.to_string());
        ans.push_str("\n");
    }
    ans.to_string()
}

test! {
r"8 3
ACACTACG
3 7
2 3
1 8
"
=>
r"2
0
3
"
}


Measured memory_bytes: 10492
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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; }

vll A;

class aida
{
public:
    int left;
    int right;
    ll score;

    aida(int l, int r)
    {
        this->left = l;
        this->right = r;
        score = min(A[l], A[r]);
    };
};


bool operator< (const aida& lhs, const aida& rhs) {
    return lhs.score < rhs.score;
};

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

    int N;
    cin >> N;

    A.resize(N);
    rep(i, N) cin >> A[i];

    sort(all(A), greater<ll>());

    ll ans = 0;

    priority_queue<aida> q;
    q.emplace(0, 1);
    ans += A[0];

    repl(i, 2, N)
    {
        auto a = q.top();
        if (q.size() > 1) q.pop();

        ans += min(A[a.left], A[a.right]);

        q.emplace(a.left, i);
        q.emplace(i, a.right);
    }

    cout << ans << endl;

    return 0;
}


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

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

  if (b<=9){
    n=10*a+b;
  }
  
  if (10<=b and b<=99){
    n=100*a+b;
  }
  
  if (b==100){
    n=1000*a+b;
  }

  int answer=1;
  
  while (answer*answer<n){
    answer+=1;
  }
  
  if (answer*answer==n){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
  
    
  
  
}

  













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

int main(){
    int n;
    cin >> n;
    int maze[2][101] = {0};
    for(int i=0; i < 2; i++){
        for(int j=0; j < n; j++) cin >> maze[i][j];
    }

    int v = 0;
    int temp = 0;
    int max_v = -1;
    for(int i=0; i < n; i++){
        temp += maze[0][i];
        for(int j=i ; j < n; j++){
            v += maze[1][j];
        }
        v += temp;
        max_v = max(max_v, v);
        v = 0;
    }

    cout << max_v << endl;

    return 0;
}


Measured memory_bytes: 256
a = int(input())
fanwei = []

for i in range(a):
    one = input().split()
    one = [int(i) for i in one]
    two = [one[0] - one[1], one[0] + one[1]]
    fanwei.append(two)

fanwei = sorted(fanwei, key=lambda student: student[0] + 100000000000000000000 * student[1])

now = -100000000000000000000
ans = 0
for i in fanwei[:]:
    down = i[0]
    if down >= now:
        ans += 1
        now = i[1]


print(ans)


Measured memory_bytes: 72312
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int A = line[0];
            int B = line[1];
            int ans = A + B;
            Console.WriteLine(ans < 24 ? ans : ans - 24);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double eps = 1e-10;
struct P{ 
  ll x,y; 
  P(ll a=0,ll b=0): x(a),y(b) {}
};


int n;
ll w,h,x,y,r,W,H;
P A,V;
P t[20];

 
double calc(P p){
  double vx=V.x;
  double vy=V.y;
  double px=p.x-A.x;
  double py=p.y-A.y;
  double dot=vx*px+vy*py;
  if(dot<0)return 1.0/0.0;
  double cross= abs(px*vy-vx*py);
  return cross/sqrt(vx*vx+vy*vy);
}

double calc2(P p){
  double ax=A.x;
  double ay=A.y;
  double px=p.x;
  double py=p.y;
  return (ax-px)*(ax-px)+(ay-py)*(ay-py);
}


void func(){
  double xx=(double)(W-A.x) / (double)V.x;
  double yy=(double)(H-A.y) / (double)V.y;
  if( xx < yy - eps ){
    for(int i=0;i<n;i++)t[i].x=W+W-(t[i].x);
    W+=w;
  }else if( yy < xx - eps ){
    for(int i=0;i<n;i++)t[i].y=H+H-(t[i].y);
    H+=h;
  }else{
    for(int i=0;i<n;i++){
      t[i].x=W+w-t[i].x;
      t[i].y=H+h-t[i].y;
    }
    W+=w;
    H+=h;
  }
}

int solve(){
  for(int I=0;I<100000;I++){

    double mini=1e9;
    int id;
    
    for(int i=0;i<n;i++){
      double dist=calc(t[i]);
      if(dist>r+r)continue;
      double dist3=sqrt(abs( 4.0*(double)r*(double)r-dist*dist ));
      double dist4=sqrt(abs(calc2(t[i])-dist*dist))-dist3;
      if(dist4<mini)mini=dist4,id=i;
    }
    
    if(mini<1e9){
      if(mini>10000.0)break;
      /*
      cout<<mini<<endl;
      cout<<A.x<<' '<<A.y<<endl;
      cout<<t[0].x<<' '<<t[0].y<<endl;
      double dist=calc(t[0]);
      double dist3=sqrt(abs(4.0*(double)r*(double)r-dist*dist));
      double dist4=sqrt(abs(calc2(t[0])-dist*dist))-dist3;
      cout<<dist<<' '<<calc2(t[0])<<' '<<dist3<<' '<<dist4<<endl;
      */
      return id+2;
    }
    func();
  }
  return -1;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    n--;
    cin>>w>>h>>r;
    W=w;H=h;
    cin>>V.x>>V.y>>A.x>>A.y;
    for(int i=0;i<n;i++)cin>>t[i].x>>t[i].y;
    if(V.x<0){
      V.x*=-1;
      for(int i=0;i<n;i++)t[i].x=w-t[i].x;
      A.x=w-A.x;
    }
    if(V.y<0){
      V.y*=-1;
      for(int i=0;i<n;i++)t[i].y=h-t[i].y;
      A.y=h-A.y;
    }
    W-=r;
    H-=r;
    h-=r;   h-=r;
    w-=r;   w-=r;

    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 1172
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0011&lang=jp
  * Drawing Lots
  */
object Main {
  def main(args: Array[String]): Unit = {
    val w = io.StdIn.readInt()
    val n = io.StdIn.readInt()
    val hLines = Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).take(n)
      .map(_.split(",").map(_.toInt)).map { case Array(a, b) => (a, b) }
      .toList
    val vLines = 1 to w
    val playedVLines = playAmida(vLines, hLines)
    playedVLines.foreach(println)
  }

  def playAmida(vLines: Seq[Int], hLines: Seq[(Int, Int)]): Seq[Int] = {
    hLines.foldLeft(vLines) {
      case (v, h) => v.updated(h._1 - 1, v(h._2 - 1)).updated(h._2 - 1, v(h._1 - 1))
    }
  }

}

Measured memory_bytes: 44232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int A, B, res;
int main(int argc, char **argv) {
    cin >> A >> B;

    if(A <= 9 && B <= 9) {
        res = A * B;
    } else {
        res = -1;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
M=10**9+7;n,k=map(int,input().split());a=c=p=1
for i in range(1,min(n,k+1)):c=c*(n-i+1)*(n-i)%M;p=p*i*i%M;a+=c*pow(p,M-2,M)
print(a%M)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if(a>b){
    int t;
    t=a;
    a=b;
    b=t;
  }
  if(b>c){
    int t;
    t=b;
    b=c;
    c=t;
  }
  if(a>b){
    int t;
    t=a;
    a=b;
    b=t;
  }
  int d,e;
  d=b-a;
  e=c-b;
  cout<<d+e<<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

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

  int cnt = n * 2;
  REP(i, n) {
    if (s[i] == t[0]) {
      if (i == n - 1) {
        cnt--;
        break;
      }
      int cont = 0;
      REP(j, n - i) {
        if (s[i + j] == t[j]) {
          cont++;
        }
      }
      if (cont == n - i) {
        cnt -= cont;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll k, s;
    cin >> k >> s;

    ll ans = 0;
    exrep(x, 0, k) {
        exrep(y, 0, k) {
            if(s-k <= x+y && x+y <= s) {
                ans++;
            }
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 764
/*My CSP has exploded*/
/*ABC146*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<vector>
#include<queue>
using namespace std;

#define LL long long
#define DB double
#define MAXN 35000
#define MAXK 50
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL 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<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}

int n,a[MAXN+5],ans;
int A,B,C;
string s;
int main()
{
    cin>>s;
    if(s=="SUN")printf("7");
    if(s=="MON")printf("6");
    if(s=="TUE")printf("5");
    if(s=="WED")printf("4");
    if(s=="THU")printf("3");
    if(s=="FRI")printf("2");
    if(s=="SAT")printf("1");
}


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

int main()
{
	int w;
	cin >> w;
	int n;
	cin >> n;
	vector<int> StartingPoint(w);
	for(int i = 0; i < w; i++){
		StartingPoint[i] = i+1;
	}
	for(int i = 0; i < n; i++){
		int HorizonalLineLeft;
		int HorizonalLineRight;
		char Dummy;
		cin >> HorizonalLineLeft >> Dummy >> HorizonalLineRight;
		swap(StartingPoint[HorizonalLineLeft-1], StartingPoint[HorizonalLineRight-1]);
	}
	for(int i = 0; i < w; i++){
		cout << StartingPoint[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
//Zory-2019
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
#include<deque>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define double long double
	const int INF=0x3f3f3f3f;
	ll qread()
	{
		ll ans=0;char c=getchar();int f=1;
		while(c<'0' or c>'9') {if(c=='-') f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) {num=-num;putchar('-');}
		if(num>9) write(num/10);
		putchar('0'+num%10);
	}
	void writeln(int num){write(num);puts("");}
	#define FR first
	#define SE second
	#define MP make_pair
	#define pr pair<int,int>
	#define PB push_back
	inline void chmax(ll &x,ll y) {x=x>y?x:y;}
	inline void chmin(ll &x,ll y) {x=x<y?x:y;}

	int bin[30],ct[1<<21];
	vector<int> ans[30];
	int lowbit(int x) {return x&-x;}
	void solve(int mask,int a,int b)
	{
		int len=ct[mask];
		ans[len].resize(0);
		if(len==1){ans[len].PB(a&mask);ans[len].PB(b&mask);return;}
		int k=lowbit((a^b)&mask),c=a^lowbit(mask^k);
		solve(mask^k,a,c);for(int t=0;t<(int)ans[len-1].size();t++) ans[len].PB(ans[len-1][t]^(a&k));
		solve(mask^k,c,b);for(int t=0;t<(int)ans[len-1].size();t++) ans[len].PB(ans[len-1][t]^(b&k));
	}
	void main()
	{
		bin[0]=1;for(int i=1;i<=20;i++) bin[i]=bin[i-1]<<1;
		for(int i=1;i<=bin[20];i++) ct[i]=ct[i>>1]+(i&1);

		int n,a,b;scanf("%d%d%d",&n,&a,&b);
		if((ct[a]&1)==(ct[b]&1)) {puts("NO");return;}
		puts("YES");solve(bin[n]-1,a,b);
		for(int t=0;t<(int)ans[n].size();t++) printf("%d ",ans[n][t]);
 	}
};
int main()
{
	srand(time(0));
	mine::main();
}


Measured memory_bytes: 8376
h,w = map(int,input().split())
s = [list(str(input())) for i in range(h)]
dp = [[10 ** 10] * w for i in range(h)]
if s[0][0] == "#":dp[0][0] = 1
else:dp[0][0] = 0
for i in range(w):
    for j in range(h):
        if s[j][i] == "#":
            s[j][i] = 1
        else:
            s[j][i] = 0
for i in range(1,h+w-1):
    for j in range(i+1):
        if 0 < j < h and 0 <= i-j < w:
            dp[j][i-j] = min(dp[j-1][i-j]+(s[j][i-j]&~s[j-1][i-j]),dp[j][i-j])
        if 0 < i-j < w and 0 <= j < h:
            dp[j][i-j] = min(dp[j][i-j-1]+(s[j][i-j]&~s[j][i-j-1]),dp[j][i-j])
print(dp[h-1][w-1])

Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define N 100003
#define M 100003

int main() {
  ll n, m;
  ll p[M];
  ll a[N], b[N], c[N];
  cin >> n >> m;
  rep(i, m) {
    cin >> p[i];
    --p[i];
  }
  rep(i, n-1) cin >> a[i] >> b[i] >> c[i];
  ll cnt[N];
  rep(i, n) cnt[i] = 0;
  rep(i, m-1) {
    if(p[i] < p[i+1]) {
      ++cnt[p[i]];
      --cnt[p[i+1]];
    } else {
      ++cnt[p[i+1]];
      --cnt[p[i]];
    }
  }
  ll ans = 0, csum = 0;
  rep(i, n-1) {
    csum += cnt[i];
    ans += mind(csum*a[i], (c[i] + csum*b[i]));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5064
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.math.BigDecimal;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            out.print(s.charAt(0));
            out.print(s.length()-2);
            out.println(s.charAt(s.length()-1));
            
        }
    }


    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1e9 + 7;
const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; 
lli bpow(lli baseee, lli exponenttt) {
	if(exponenttt < 0) return 0;
	lli res = 1;
	baseee %= MOD;
	while (exponenttt > 0) {
		if ((exponenttt & 1) == 1) res = (res*baseee) % MOD;
		baseee = (baseee*baseee) % MOD;
		exponenttt >>= 1;
	}
	return res;
}
lli multInverse(lli a) {//if_mod_is_prime
	return bpow(a, MOD - 2);
}
lli divm(lli a, lli b) {//if_mod_is_prime
	return (a * multInverse(b)) % MOD;
}
lli multm(lli a, lli b) {
	return (a * b) % MOD;
}
lli subm(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli addm(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){double sum=0;
  int N, M;
  cin>>N>>M;
  int A[N];
  for (int i=0; i<N; i++) cin>>A[i];
  for (int i=0; i<N; i++) {
      sum+=A[i];}
  int counter=0;
  for (int i=0; i<N; i++) {
    if (A[i]<sum/(4*M)){
      counter++;
    }
  }
  if (N-counter>=M) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	long long n;
	cin >> n;

	if ((n - 1) % 11 > 5) {
		cout << (n + 10) / 11 * 2 << endl;
	}
	else {
		cout << n / 11 * 2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256