akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,m,a,b[101010];
bool ac[101010];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>m;
	a=0;
	fo(i,0,m){
		int x;
		string s;
		cin>>x>>s;
		if(s=="AC"){
			if(!ac[x])a++;
			ac[x]=1;
		}else if(!ac[x])b[x]++;
	}
	int g=0;
	fo(i,1,n+1) if(ac[i])g+=b[i];
	cout<<a<<' '<<g<<endl;
	return 0;
}

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

int main(){
  int a,b,c;

  cin >> a >> b >> c;

  if(a != b && b != c && c != a) cout << "3" << endl;
  else if(a == b && b == c && c == a) cout << "1" << endl;
  else cout << "2" << endl;
}


Measured memory_bytes: 256
//本当は間違い。ASSS　とかに対応してない
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
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; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    set<char> s;
    string a; cin >> a;
    rep(i, a.size()) s.insert(a[i]);
    cout << (s.size() == 2 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
N, X, Y = map(int, input().split())
p = [0]*N
for i in range(N-1):
    for j in range(i+1, N):
        d = min(j-i, abs(X-i-1)+1+abs(j-Y+1))
        p[d] += 1
for k in range(1, N):
    print(p[k])


Measured memory_bytes: 46428
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define rep(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

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

  int h,w;cin>>h>>w;
  string s[h+2];

  FOR(i, 1, h+1){
    string tmp;
    cin>>tmp;
    s[i] = "." + tmp + ".";
  }

  FOR(i,1,h+1){
    FOR(j,1,w+1){
      int count = 0;
      if (s[i][j] == '.'){
        for(auto p:{-1,0,1}){
          for(auto q:{-1,0,1}){
            if (s[i+p][j+q]=='#') count++;
          }
        }
        s[i][j] = '0'+count;
      }
    }
  }

  FOR(i, 1, h+1){cout << s[i].substr(1, w) << endl;}

  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
namespace Solve
{
	const int mo=1000000007;
	int qkpow(int a,int k)
	{
		int ret=1,tt=a;
		while(k)
		{
			if(k&1) ret=(long long)ret*tt%mo;
			tt=(long long)tt*tt%mo;
			k>>=1;
		}
		return ret;
	}
	int n,a,b,F[200005];
	void work()
	{
		scanf("%d%d%d",&n,&a,&b);
		int ans=(qkpow(2,n)-1+mo)%mo;
		F[1]=n;int lim=n<=200000 ? n : 200000;
		for(int i=2;i<=lim;i++)
			F[i]=(long long)F[i-1]*(n-i+1)%mo*qkpow(i,mo-2)%mo;
		ans=(ans-F[a]+mo)%mo;
		ans=(ans-F[b]+mo)%mo;
		printf("%d\n",ans);
		return;
	}
}
int main()
{
	#ifdef LOCAL
	freopen("00test.in","r",stdin);
	freopen("00test.out","w",stdout);
	#endif
	Solve::work(); 
	return 0;
}

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

int N, M, Q;
int U[200000], V[200000];
vector< pair< int, int > > graph[100000];
int v[100000], in[100000];
bool live[200000];

void BFS()
{
  memset(v, -1, sizeof(v));
  queue< int > que;
  que.push(0);
  v[0] = 0;
  while(!que.empty()) {
    int p = que.front(); que.pop();
    for(auto to : graph[p]) {
      if(v[to.first] == v[p] + 1) {
        in[to.first]++;
      } else if(v[to.first] < 0) {
        v[to.first] = v[p] + 1;
        in[to.first]++;
        que.push(to.first);
      } 
    }
  }
}

int main()
{
  scanf("%d %d %d", &N, &M, &Q);
  for(int i = 0; i < M; i++) {
    scanf("%d %d", &U[i], &V[i]);
    --U[i], --V[i];
    graph[U[i]].emplace_back(V[i], i);
    graph[V[i]].emplace_back(U[i], i);
  }
  BFS();

  int halt = 0;
  
  for(int i = 0; i < Q; i++) {
    int R;
    scanf("%d", &R);
    live[--R] = true;
    if(v[U[R]] != v[V[R]]) {
      if(v[U[R]] > v[V[R]]) swap(U[R], V[R]);
      if(--in[V[R]] == 0) {
        queue< int > que;
        que.push(V[R]);
        while(!que.empty()) {
          int p = que.front(); que.pop();
          ++halt;
          for(auto to : graph[p]) {
            if(live[to.second]) continue;
            if(v[to.first] == v[p] + 1 && --in[to.first] == 0) {
              live[to.second] = true;
              que.push(to.first);
            }
          }
          v[p] = 114514;
        }
      }    
    }
    printf("%d\n", halt);
  }
}

Measured memory_bytes: 14388
T = input() 
N = T.count("N")
S = T.count("S")
E = T.count("E")
W = T.count("W")

if (N>0 and S==0) or (S>0 and N==0) or (W>0 and E==0) or (E>0 and W==0):  
    print("No")
else:
    print("Yes")


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    int tmp = k;
    REP(i, n-1) tmp *= (k - 1);
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef deque<int> DI;
typedef deque<LL> DLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n);
	LL A[n+1], B[n+1], C[n];
	rep(i, 1, n+1)	A[i] = scanLong();
	rep(i, 1, n+1)	B[i] = scanLong();
	rep(i, 1, n)	C[i] = scanLong();
	LL points = 0;
	rep(i, 1, n+1) {
		points += B[A[i]];
		if(i-1 >= 1 && A[i] == A[i-1]+1)	points += C[A[i-1]];
	}
	pll(points); nl;
}


Measured memory_bytes: 256
#define P(x) cout << #x" = " << x << endl
#define PP(x, y) cout << "("#x", "#y") = (" << x << ", " << y << ")" << endl
#define PPP(x, y, z) cout << "("#x", "#y", "#z") = (" << x << ", " << y << ", " << z << ")" << endl

#include <iostream>
#include <vector>

using namespace std;

int a[3];
int b[3];
int k[] = {1, 2, 3, 4};
int main(){
    for (int i = 0; i < 3; ++i) {
        cin >> a[i] >> b[i];
    }
    bool ans = false;
    do {
        bool all = true;
        for (int i = 0; i < 3; ++i) {
            bool ok = false;
            for (int j = 0; j < 3; ++j) {
                if (a[j] == k[i] && b[j] == k[i + 1]) ok = true;
                if (b[j] == k[i] && a[j] == k[i + 1]) ok = true;
            }
            if (!ok) {
                all = false;
                break;
            }
        }
        if (all) ans = true;
        if (ans) {
            // cout << k[0] << " " << k[1] << " " << k[2] << " " << k[3] << endl;
            break;
        }
    }while(next_permutation(k, k + 4));
    cout << (ans ? "YES" : "NO") << endl;
}

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

const double pi = 3.141592653589793;

double law_cos(int x, int y, double t){
  double z;
  z  = pow(x * x + y * y - 2 * x * y * cos(t), 0.5);
  return z;
}
 
int main(){
  cout << fixed << setprecision(10);
  int a = 3, b = 4, h = 10, m = 40;
  cin >> a >> b >> h >> m;
  
  double angle_h = (h * pi / 6) + (m * pi / 360);
  double angle_m = m * pi / 30;
  
  //cout << angle_h << " " << angle_m << endl;
  
  double angle;
  if(abs(angle_h - angle_m) <= pi) angle = abs(angle_h - angle_m);
  else angle = 2 * pi - (abs(angle_h - angle_m));
  
  //cout << cos(angle) << endl;
  
  cout << law_cos(a, b, angle) << endl;
}

Measured memory_bytes: 4428
import math

def Prime(x):
    c=0
    for i in range(math.floor(math.sqrt(x))):
        if i==0:
            c=0
        elif x%(i+1)==0:
            c=c+1
    if c==0:
        return 1
    else:
        return 0
            
            

X=int(input())
Pm=0
while Pm==0:
    if Prime(X)==1:
        Pm=Pm+1
    else:
        X=X+1
print(X)

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

const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

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

    if (count(a.begin(), a.end(), 0)) {
        cout << 0 << endl;
        return 0;
    }

    __int128 ans = 1;
    for (int i = 0; i < n; i++) {
        ans *= a[i];
        if (ans > (__int128)1e18) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << (ll)ans << endl;
    return 0;
}

Measured memory_bytes: 3996
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    VVI a(n, VI(n));
    REP(i,n) REP(j,n) a[i][j] = in();
    VL dp(1 << n);
    dp[0] = 1;
    REP(mask,1<<n){
        int c = 0;
        REP(i,n) c += ((mask >> i) & 1);
        if (c == n) continue;
        REP(i,n){
            if (!a[c][i] || (mask >> i) & 1) continue;
            (dp[mask | (1 << i)] += dp[mask]) %= mod;
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}


Measured memory_bytes: 16640
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, K;

void MAIN() {
    scanf("%d%d", &N, &K);
    if ((N+1)/2 >= K) {
	puts("YES");
    } else {
	puts("NO");
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  vector<int> dp(100010,mod);
  dp[0] = 0;
  for(int i = 0; i < n; i++) cin >> h[i];
  for(int i = 0; i < n; i++){
    for(int j = 1; j < 3; j++){
      dp[i+j] = min(abs(h[i]-h[i+j])+dp[i],dp[i+j]);
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
SA = input()
SB = input()
SC = input()
turn = "a"
while min(len(SA), len(SB), len(SC)) >= 0:
    if turn == "a":
        if len(SA) == 0:
            print("A")
            break
        else:
            turn = SA[0]
            SA = SA[1:]
    elif turn == "b":
        if len(SB) == 0:
            print("B")
            break
        else:
            turn = SB[0]
            SB = SB[1:]
    else:
        if len(SC) == 0:
            print("C")
            break
        else:
            turn = SC[0]
            SC = SC[1:]

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int N, K;
	cin >> N >> K;
	int x[100010];
	for (int i = 0; i < N; ++i) {
		cin >> x[i];
	}
	int xmax, xmin;
	int ans = INF;
	for (int i = 0; i <= N - K; ++i) {
		int sum = 0;
		xmax = x[i + K - 1];
		xmin = x[i];
		int ans1 = abs(xmin) + abs(xmax - xmin);
		int ans2 = abs(xmax) + abs(xmax - xmin);
		sum += min(ans1, ans2);
		ans = min(sum, ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include<algorithm>
#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
int n;
LL dis,D;
const int N=100010;
int siz[N],X[N],Y[N];
struct dian
{
	LL dis;int id;
	friend bool operator <(const dian &a,const dian &b)
		{return a.dis<b.dis;}
}d[N];
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
		scanf("%lld",&D),d[i]=(dian){D,i},siz[i]=1;
	sort(d+1,d+1+n);
	for(int i=n,pos;i>1;--i)
	{
		D=d[i].dis-n+(siz[i]<<1);
		pos=lower_bound(d+1,d+1+n,(dian){D,0})-d;
		if(d[pos].dis!=D)return puts("-1")==2333;
		X[i]=d[i].id;Y[i]=d[pos].id;
		siz[pos]+=siz[i];dis+=siz[i];
	}
	if(dis!=d[1].dis)return puts("-1")==2333;
	for(int i=2;i<=n;++i)printf("%d %d\n",X[i],Y[i]);
	return 0;
}

Measured memory_bytes: 4096
import numpy as np
import sys
def input():
    return sys.stdin.readline()[:-1]

# S = [int(x) if x!="?" else -1 for x in input()]

# print (S)

# div_num = 1000000007
# arr = np.arange(13, dtype = np.uint64)
# # dp = np.zeros([2, 13], dtype = np.uint64)

# div13_list = [1]
# for ii in range(1, len(S)):
#     n = div13_list[-1] * 10 % 13
#     if n in div13_list:
#         break
#     else:
#         div13_list.append(n)
# div13_mat = np.array([div13_list] * 10, dtype = int)
# div13_mat = (div13_mat * np.arange(10)[:, None] % 13).T

# if S[-1] == -1:
#     dp[0, :10] = 1
# else:
#     dp[0, S[-1]] = 1

# for ii in range(1, len(S)):
#     # ind = -ii-1
#     # tmp = div13_mat[ii%6]
#     # if S[ind] == -1:
#     #     for n in range(10):
#     #         res = np.roll(arr, -tmp[n])
#     #         # dp[1, res] += dp[0, arr]
#     # else:
#     #     res = np.roll(arr, -tmp[S[ind]])
#     #     # dp[1, res] += dp[0, arr]
#     dp[0] = dp[1] % div_num
#     dp[1] = 0


# print (dp[0, 5])

#
# 大きい方の桁からやってく方法
#

MOD = 1000000007;

S = [int(x) if x!="?" else -1 for x in input()]
n = len(S)

# r[i]
# 現在考えてる一つ前の桁数で、余りが i になる整数の個数
r = [0] * 13

# まず一つ目の値が１の位とする
s = S[0]
if (s != -1):
    r[s] = 1
else:
    for i in range(10): r[i] = 1

# 桁を進めながら個数をカウント
for i in range(1, n):
    # dp[j]
    # 現在考えている桁(i)を除く、余りが j となる整数の個数
    dp = [0] * 26

    # 桁が一つ上がるので、一つ前の余りが 10 倍になる
    for j in range(13):
        dp[j*10%13] += r[j] % MOD

    # アクセスを高速にするため２倍の長さとる (dp[i] == dp[i + 13])
    dp[13:26] = dp[0:13]

    r = [0]*13

    s = S[i]
    if (s == -1):
        w = sum(dp[4:14])
        for j in range(13):
            r[j] += w
            w += dp[j + 1]-dp[j + 4]
    else:
        for j in range(13):
            r[j] += dp[13-s+j]
print (r[5]%MOD)


Measured memory_bytes: 15308
#include <stdio.h>

#define ASIZE 200000

int main()
{
  int A[ASIZE+1];
  int q, i, query, num, pos;

  scanf("%d", &q);

  pos = 0;
  for (i = 0; i < q; i++)
  {
    scanf("%d", &query);
    switch (query)
    {
    case 0:
      scanf("%d", &num);
      A[pos++] = num;
      break;
    case 1:
      scanf("%d", &num);
      printf("%d\n", A[num]);
      break;
    case 2:
      pos--;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 2496
#include<stdio.h>
int main(void){
  int i,num;
  int flag=0;
  
  scanf("%d",&num);
  
  for(i=0;i<3;i++) {
    if(num%10==7) {
      flag=1;
    }
    num=num/10;
  }
  if(flag==1){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1704
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

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

    char tmp = 'a';

    while(true){
        if(tmp == 'a'){
            if(a.size() == 0){
                cout << 'A' << endl;
                return 0;
            }
            tmp = a[0];
            a.erase(a.begin() + 0);
           // cout << a << endl;
        }else if(tmp == 'b'){
            if(b.size() == 0){
                cout << 'B' << endl;
                return 0;
            }
            tmp = b[0];
            b.erase(b.begin() + 0);
        }else if(tmp == 'c'){
            if(c.size() == 0){
                cout << 'C' << endl;
                return 0;
            }
            tmp = c[0];
            c.erase(c.begin() + 0);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <cstdio>
#include <queue>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b,c,d,e; cin >> a >> b >> c >> d >> e;
    if(d>=b||abs(a-c)>e*(b-d)){
        printf("NO\n");
    }
    else{
        printf("YES\n");
    }
}

Measured memory_bytes: 3640
N = int(input())

if N == 1 or N == 2:
	print(4)
else:
	m = 0
	while N > 1:
		if N % 2 == 0:
			N = N // 2
		else:
			N = 3 * N + 1
		m += 1
	print(m+2)



Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#define F 1001
using namespace std;
int dp[F][F];
int main(){
	for(int i=1;i<F;i++)for(int j=1;j<F;j++)dp[i][j]=0;
	for(int i=0;i<F;i++)dp[0][i]=1;
	for(int i=0;i<F;i++)dp[i][0]=1;
	for(int i=1;i<F;i++)for(int j=1;j<F;j++)dp[i][j]=(dp[i-1][j]+dp[i][j-1])%100000007;

	int r,e,a,b,c,d,ans;
	cin>>r>>e>>a>>b>>c>>d;
	if(a==c&&b==d){cout<<"1"<<endl;return 0;}
	a-=c,b-=d;
	if(a<0)a=-a;if(b<0)b=-b;
	if(a*2>r)a=r-a;if(b*2>e)b=e-b;
	ans=dp[a][b];
	if(a*2==r)ans*=2;if(b*2==e)ans*=2;
	cout<<ans%100000007<<endl;
	return 0;
}

Measured memory_bytes: 6952
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>

#define REP(i, n) for(int i=0;i<n;i++)
#define llong long long
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;

int main(){

  llong n, m;
  scanf("%lld %lld", &n, &m);

  llong res = 0;
  if(n <= m / 2){
    res += n;
    m -= n * 2;
    res += m / 4;
  }else{
    res += m / 2;
  }

  printf("%lld\n", res);

  return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


// import here
typedef vector<vector<int>> Edge;

void checkAndAdd(vector<string>& m, Edge& edge, int v1, int v2){
    int c = m[0].size();
    if(m[v1/c][v1%c] == '*') return;
    if(m[v2/c][v2%c] == '*') return;
    edge[v1].push_back(v2);
    edge[v2].push_back(v1);
}

// for bipertiteMatching()
bool pathArgument(const Edge& edge, int cur, vector<int>& match_to, vector<int>& visited){
    if(cur < 0) return true;
    for(int to: edge[cur]){
        if(visited[to]) continue;
        visited[to] = 1;
        if(pathArgument(edge, match_to[to], match_to, visited)){
            match_to[cur] = to;
            match_to[to] = cur;
            return true;
        }
    }
    return false;
}

// O(E * V_left)
vector<pair<int,int>> bipertiteMatching(Edge& edge, int left_cnt = -1){
    int n = edge.size();
    if(left_cnt < 0) left_cnt = n; // もし左右に分かれていなければすべて増加道を探す
    vector<int> match_to(n, -1);
    for(int i = 0; i < left_cnt; ++i){
        vector<int> visited(n);
        if(match_to[i] == -1) pathArgument(edge, i, match_to, visited);
    }
    vector<pair<int,int>> res;
    for(int i = 0; i < n; ++i){
        if(match_to[i] < 0) continue;
        if(i > match_to[i]) continue;
        res.emplace_back(i, match_to[i]);
    }
    return res;
}

int main(){
    LL n;
    cin >> n;
    vector<pair<LL,LL>> p(n*2);
    for(int i = 0; i < n*2; ++i){
        cin >> p[i].first >> p[i].second;
    }
    
    Edge edge(n*2);
    for(int i = 0; i < n; ++i){
        for(int j = n; j < n*2; ++j){
            if(p[i].first < p[j].first && p[i].second < p[j].second){
                edge[i].push_back(j);
                edge[j].push_back(i);
            }
        }
    }
    vector<pair<int,int>> match = bipertiteMatching(edge);
    cout << match.size() << endl;
    return 0;
}


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

int main()
{
	int q;
	scanf("%d", &q);
	set<int> st;
	while (q--) {
		int com, x;
		scanf("%d%d", &com, &x);
		if (com == 0) {
			st.insert(x);
			printf("%d\n", st.size());
		}
		else {
			puts(st.count(x) ? "1" : "0");
		}
	}
	return 0;
}



Measured memory_bytes: 12472
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
using namespace std;
const int N=1e5+5;
int n;
bool visit[N];
deque<pii>q;
void bfs()
{
	q.push_back(mp(1,1));
	while(true)
	{
		pii p=q.front();q.pop_front();
		if(visit[p.F])continue;
		visit[p.F]=true;
		if(p.F==0)
		{
			cout<<p.S<<endl;
			return;
		}
		q.push_front(mp(p.F*10%n,p.S));
		q.push_back(mp((p.F+1)%n,p.S+1));
	}
}
signed main()
{
	cin>>n;
	bfs();
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  P a[n];
  rep(i,n) cin >> a[i].F >> a[i].S;
  sort(a,a+n);
  double ans=0,cnt=0;
  do {
    double sum=0;
    rep(i,n-1) {
      sum+=sqrt((a[i].F-a[i+1].F)*(a[i].F-a[i+1].F)+(a[i].S-a[i+1].S)*(a[i].S-a[i+1].S));
    }
    ans+=sum;
    cnt++;
  } while(next_permutation(a,a+n));
  pd(ans/cnt);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main { //m-solutions2019 B -
	
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] in = br.readLine().toCharArray();
		int xs = 0;
		for(char c: in){
			if(c == 'x') xs++;
		}
		System.out.println(xs >= 8? "NO": "YES");
	}

}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
#define int long long
int h;
void maxHeapify(int *A,int i){
  int l=i*2+1;
  int r=i*2+2;
  int largest;
  if(l<h&&A[l]>A[i]) largest=l;
  else largest=i;
  if(r<h&&A[r]>A[largest]) largest=r;
  if(largest!=i){
    swap(A[i],A[largest]);
    maxHeapify(A,largest);
  }
}
void buildMaxHeap(int *A){
  for(int i=h/2;i>=0;i--)
    maxHeapify(A,i);
}
signed main(){
  cin>>h;
  int A[h];
  for(int i=0;i<h;i++) cin>>A[i];
  buildMaxHeap(A);
  for(int i=0;i<h;i++) cout<<" "<<A[i];
  cout<<endl;
  return 0;
}

Measured memory_bytes: 6928
#include<stdio.h>
int max(int a, int b)
{
	if (a > b)return a;
	else return b;
}
int main()
{
	int n;
	scanf("%d", &n);
	int a, b, c;
	int i;
	int a1, a2, b1, b2, c1, c2;
	a1 = a2 = b1 = b2 = c1 = c2 = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d %d %d", &a, &b, &c);
		a2 = a + max(b1, c1);
		b2 = b + max(a1, c1);
		c2 = c + max(a1, b1);
		a1 = a2;
		b1 = b2;
		c1 = c2;
	}
	printf("%d\n", max(a1, max(b1, c1)));
	return 0;
}

Measured memory_bytes: 128
def main():
    N = int(input())
    C = list(input())

    lw, rr = -1, -1
    for i, c in enumerate(C):
        if lw == -1 and c == "W":
            lw = i
        elif c == "R":
            rr = i
    if lw == -1 or rr == -1:
        print(0)
        return
    ans = 0
    while rr > lw:
        C[lw] = "R"
        C[rr] = "W"
        ans += 1
        while lw < N:
            lw += 1
            if C[lw] == "W":
                break
        while rr >= 0:
            rr -= 1
            if C[rr] == "R":
                break
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 10804
/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline int read(){
	int x=0,f=1;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar())	if (ch=='-')    f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar())	x=(x<<1)+(x<<3)+ch-'0';
	return x*f;
}
inline void print(int x){
	if (x>=10)     print(x/10);
	putchar(x%10+'0');
}
const int N=50;
const int dx[4]={0,0,-1,1};
const int dy[4]={-1,1,0,0};
char map[N+10][N+10];
int hx[N*N+10],hy[N*N+10];
bool vis[N+10][N+10];
int n,m;
bool in_map(int x,int y){return x>0&&x<=n&&y>0&&y<=m;}
bool bfs(int x,int y){
	int head=1,tail=1;
	hx[1]=x,hy[1]=y,vis[x][y]=1;
	for (;head<=tail;head++){
		int Nx=hx[head],Ny=hy[head];
		for (int k=0;k<4;k++){
			int tx=Nx+dx[k],ty=Ny+dy[k];
			if (!in_map(tx,ty)||vis[tx][ty]||map[tx][ty]=='.')	continue;
			hx[++tail]=tx,hy[tail]=ty;
			vis[tx][ty]=1;
		}
	}
	return tail!=1;
}
int main(){
	n=read(),m=read();
	bool can=1;
	for (int i=1;i<=n;i++)	scanf("%s",map[i]+1);
	for (int i=1;i<=n;i++)	for (int j=1;j<=m;j++)	if (map[i][j]=='#'&&!vis[i][j])	can&=bfs(i,j);
	if (!can){
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, cnt1;

int main() {

	cin >> n;

	REP(i, 1, n + 1){
		if (i % 2 == 0)continue;
		int cnt = 0;
		REP(j, 1, i + 1){
			if (i % j == 0)cnt++;
		}
		if (cnt == 8)cnt1++;
	}
	cout << cnt1 << endl;

	return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>

typedef long double ld;
typedef long long ll;

#define EPS 0.000000001

using namespace std;

ll a, b;
string s;

int main() {
	cin >> a >> s;
	b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
	cout << (a * b) / 100;

	return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x = sc.nextInt();

		if(500 * k >= x) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

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

int M, N, K;
vector<int> u, v;

int a[33];

int main()
{
    cin >> N >> M;
    for (int i = 0; i < N; i++)
    {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++)
        {
            int p;
            cin >> p;
            a[p]++;
        }
    }
    int ans = 0;
    for (int i = 0; i <= M; i++)
    {
        if (a[i] == N)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[1000010] , ar[1000100] , n , k ;
ll frog(ll i)
{
    if(i == n) return 0 ;
    if(dp[i]!=-1)return dp[i] ;
   // ll &kk = dp[i] ;
    ll l = 0 , a = 0 , f = 1 , kk = 0 ;
    kk = frog(i+1)+abs(ar[i]-ar[i+1]) ;
    for(ll j = 2 ; j <= k ; j++)
    {
        if(j+i <= n)
        {
            kk = min(kk , frog(i+j)+abs(ar[i]-ar[i+j])) ;
        }
    }
  //  cout<<i<<" "<<kk<<endl ;
    return dp[i] = kk ;
}
int main()
{
    memset(dp,-1,sizeof(dp)) ;
    cin>>n>>k ;
    for(ll i = 1 ; i <= n ; i++) cin>>ar[i] ;
    ll kk  = frog(1) ;
  //  for(ll i = 1 ; i <= n ; i++) cout<<dp[i]<<" " ;
 //   cout<<endl ;
    cout<<kk<<endl ;
}


Measured memory_bytes: 15232
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    # n, m = [int(x) for x in input().split()]
    n = -int(input())
    if n == 0:
        print(0)
        return
    ans = []
    while n != 0:
        n, m = divmod(n, -2)
        ans.append(-m)

    ans.reverse()
    print(''.join([str(x) for x in ans]))

        


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

"""


Measured memory_bytes: 9892
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;

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

  cin >> N;
  vector<int> D(N);
  rep(i, N) cin >> D[i];

  sort(ALL(D));
  int cnt = 1;
  int now = D[0];
  rep(i, N){
    if (now != D[i]){
      cnt++;
      now = D[i];
    }
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;

int main(){
  int a,b,c=0,d=0,e,n,m,x,y;
  cin>>n>>m;
  int aa[m]={};
  rep(i,0,n){
    c(a);
    rep(j,0,a){
      c(b);
      aa[b-1]++;
    }
  }
  rep(i,0,m){
    if(aa[i]==n) c++;
  }
  co(c);
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int n, a, ans;

int cnt(int x){
	int res = 0;
	while(x % 2 == 0){
		x /= 2;
		res++;
	}
	return res;
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a);
		ans += cnt(a);
	}
	printf("%d\n", ans);
	return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    vector<LL> a(N+1), sum(N+1, 0), plsum(N+1, 0);
    for(int i = 1;i <= N;i++)   cin >> a[i];
    for(int i = 1;i <= N;i++)   sum[i] = sum[i-1]+a[i];
    for(int i = 1;i <= N;i++)    plsum[i] = plsum[i-1]+max(0LL, a[i]);
    LL ans = 0;
    for(int i = 1;i+K-1 <= N;i++){
        LL an = 0;
        an += max(0LL, sum[i+K-1]-sum[i-1]);
        an += plsum[N]-plsum[i+K-1];
        an += plsum[i-1]-plsum[0];
        ans = max(ans, an);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, M, x;
    cin >> N >> x;
    M = 2 * N - 1;
    if(2 <= x && x <= M - 1) { // exists
        vector<int> ans(M);
        set<int> numbers;
        ans[N - 1] = x;
        int sgn = 2 < x ? -1 : 1;
        numbers.insert({x - 1, x, x + 1, x + sgn * 2});
        ans[N] = x + sgn * 1;
        if(N > 2) ans[N + 1] = x + sgn * 2;
        ans[N - 2] = x - sgn * 1;
        for(int i = 0, j = 1; i < M; i++) {
            if(N - 2 <= i && i <= N + 1) continue;
            while(numbers.count(j)) j++;
            ans[i] = j;
            numbers.insert(j++);
        }
        cout << "Yes" << endl;
        for(int i = 0; i < M; i++) {
            cout << ans[i] << endl;
        }
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 11648
n=int(input())
da=list(map(int,input().split()))
co=0
no=-1
ko=0
ans=0
while co<n:
    if no==da[co]:
        ko+=1
    else:
        ans+=ko//2
        no=da[co]
        ko=1
    co+=1
ans+=ko//2
print(ans)
    


Measured memory_bytes: 38256
// NEVER GIVE UP //

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<bitset>
#include<iterator>


#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()

int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;

    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
int binomialCoeff(int n,int k)
{
    int dp[k+1];
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=min(i,k);j>0;j--)
        dp[j]=(dp[j]+dp[j-1])%mod;
    }
    return dp[k]%mod;

}
/*

void input()
{
    int n;
    for0(i,n)
        for0(j,n)
            cin>>adj[i][j];

}


void dfs(int s){
    visited[s]=true;
    for(auto u:adj[s]){
        if(!visited[u]){
            //parent[u]=s;
            dis[u]=dis[s]+1;
            dfs(u);
        }
    }
}

void bfs(int s){
    queue<int> q;
    q.push(s);
    visited[s]=true;
    dis[s]=0;
    while(!q.empty()){
        auto u=q.front();
        q.pop();
        for(auto x:adj[u]){
            if(!visited[x]){
                //parent[x]=u;
                visited[x]=true;
                dis[x]=dis[u]+1;
                q.push(x);
            }
        }
    }
}
*/

using namespace std;

main()
{
    // JAY SHREE KRISHNA
    //int dp[100000][100000];

    int n;
    cin >> n;
    if(n)cout<<"0"<<endl;
    else cout<<"1"<<endl;

    return 0;
}


Measured memory_bytes: 3636
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N, K;
   cin >> N >> K;

   VI A(N+1);
   FOR(i, 1, N)
      cin >> A[i];

   FOR(i, K+1, N) {
      if (A[i] > A[i-K])
         cout << "Yes\n";
      else
         cout << "No\n";
   }

   return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using ul = unsigned long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
source:
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) { cin >> a[i]; }
    rep(i, n) { a[i] = -a[i]; }

    ll dp[n];
    rep(i, n) { dp[i] = mod; }
    rep(i, n) { *upper_bound(dp, dp + n, a[i]) = a[i]; }
    ll ans = (lower_bound(dp, dp + n, mod) - dp);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define reg register
using namespace std;
typedef long long ll;
int n;
int ansid;
double ansd=1e18,T,A;
int main(){
	scanf("%d%lf%lf",&n,&T,&A);
	for(reg int i=1,x;i<=n;i++){
		scanf("%d",&x);reg double delta=T-(double)x*.006;
		if(fabs(delta-A)<fabs(ansd-A))ansd=delta,ansid=i;
	}printf("%d\n",ansid);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include <fstream>
#include<math.h>
#include <numeric>
#include<algorithm>

using namespace std;

int main(){
    int a,b,c;
    int ans = 0;
    cin >> a >> b >> c;
    if (b/a > c){
        cout << c << endl;
    }
    else{
        cout << b/a << endl;
    }
 }


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int N, K;
    cin >> N >> K;

    cout << N-K+1 << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
n=int(input())
num=["3","5","7"]
l=["0"]#pythonの仕様上、初期値は"0"
i=0
while True:#3,5,7のどれかのみを含む値を文字列としてlに追加していく
    for j in num:
        l.append(l[i]+j)
    i+=1
    if len(l[-1])==11:
        break
#print(l)
L=[]
for j in range(len(l)):#3,5,7をそれぞれ１つ以上含むものだけを整数型にしてLに収納
    if "3" in l[j] and "5" in l[j] and "7" in l[j] and int(l[j])<10**9:
        L.append(int(l[j]))
L.sort()
#print(L)
ans=0
for k in range(len(L)):
    if L[k]<=n:
        ans+=1
    else:
        break
print(ans)

Measured memory_bytes: 12088
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
#include<bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll

ll mod=1e9+7;
ll mod1=1e9+5;
 
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
 
// using namespace __gnu_pbds;
// #define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solutions

int32_t main()
{
    IOS


 	string s;
 	cin>>s;
 	int n=s.length();
 	if(n%2)
 	{
 		cout<<"No";
 		return 0;
 	}
 	for(int i=0;i<n;i+=2)
 	{
 		if(s[i]!='h')
 		{
 			cout<<"No";
 			return 0;
 		}
 		if(s[i+1]!='i')
 		{
 			cout<<"No";
 			return 0;
 		}
 	}
 	cout<<"Yes";

}       

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int count = 0;
		for(int i = 0 ; i < n - 2 ; i++) {
			String s2 = s.substring(i, i + 3);
			if(s2.equals("ABC"))
				count++;
		}

		sc.close();
		System.out.println(count);

	}
}



Measured memory_bytes: 35700
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, mm, kk, tt, ans = 0;
	cin >> nn >> mm >> kk;
	vector<int64> aa(nn + 1, 0), bb(mm + 1, 0);
	for(int64 ii = 1;ii <= nn;ii++)
	{
		cin >> aa[ii];
		aa[ii] += aa[ii-1];
	}
	for(int64 ii = 1;ii <= mm;ii++)
	{
		cin >> bb[ii];
		bb[ii] += bb[ii-1];
	}
	for(int64 ii = 0;ii <= nn;ii++)
	{
		tt = aa[ii];
		if(tt > kk)
		{
			break;
		}
		int64 jj, uu = mm + 1, dd = -1, oo;
		while(uu - dd > 1)
		{
			oo = (uu + dd) / 2;
			if(tt + bb[oo] <= kk)
			{
				dd = oo;
			}
			else
			{
				uu = oo;
			}
		}
		ans = max(ans, ii + dd);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6380
import heapq
from typing import List, TypeVar, Generic
T = TypeVar('T', int, float)


class Edge(Generic[T]):
    def __init__(self, dst: int, weight: T) -> None:
        self.dst: int = dst
        self.weight: T = weight

    def __lt__(self, e: 'Edge') -> bool:
        return self.weight > e.weight


class Graph(Generic[T]):
    def __init__(self, V: int) -> None:
        self.V: int = V
        self.E: List[List[Edge[T]]] = [[] for _ in range(V)]

    def add_edge(self, src: int, dst: int, weight: T) -> None:
        self.E[src].append(Edge(dst, weight))


class Node(Generic[T]):
    def __init__(self, v: int, cost: T) -> None:
        self.v: int = v
        self.cost: T = cost

    def __lt__(self, n: 'Node') -> bool:
        return self.cost < n.cost


class ShortestPath(Generic[T]):
    def __init__(self, G: Graph[T], inf: T = 10**9) -> None:
        self.G: Graph[T] = G
        self.inf: T = inf
        self.dist: List[T] = [self.inf] * self.G.V  # distance from start
        self.prev: List[int] = [-1] * self.G.V  # prev vertex of shortest path

    def run(self, start: int, goal: int = -1) -> None:
        que: List[Node] = list()
        self.dist[start] = 0
        heapq.heappush(que, Node[T](start, 0))

        while que:
            node: Node[T] = heapq.heappop(que)
            if self.dist[node.v] < node.cost:
                continue
            if goal != -1 and node.v == goal:
                return
            for edge in self.G.E[node.v]:
                if self.dist[node.v] + edge.weight < self.dist[edge.dst]:
                    self.dist[edge.dst] = self.dist[node.v] + edge.weight
                    heapq.heappush(que, Node(edge.dst, self.dist[edge.dst]))
                    self.prev[edge.dst] = node.v

    def getPath(self, end: int) -> List[int]:
        path: List[int] = [end]
        while self.prev[end] != -1:
            end = self.prev[end]
        return path[::-1]

def main() -> None:
    V, E, start = map(int, input().split())
    graph = Graph[int](V)
    for _ in range(E):
        s, t, d = map(int, input().split())
        graph.add_edge(s, t, d)
    inf = int(1e10)
    sp = ShortestPath[int](graph, inf)
    sp.run(start)
    for i in range(V):
        print(sp.dist[i] if sp.dist[i] != inf else "INF")

if __name__ == '__main__':
    main()



Measured memory_bytes: 157896