akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#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)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#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

ll cnt(ll a, ll b){
	ll ans = 0;
	while(a){
		a /= b;
		ans += a;
	}
	return ans;
}

int main(){
	ll n; scanf("%lld", &n);
	ll ans = 0;
	if(n%2) {
		ans = 0;
	} else {
		ans = min(
				n/2 + cnt(n/2, 2),
				cnt(n/2, 5)
				);
	}
	printf("%lld\n", ans);
}


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

int main(void) {
    int R,G,B,N;cin>>R>>G>>B>>N;
    int result = 0;
    for (int r = 0; r <= N / R; r++) {
        for (int g = 0; g <= N / G; g++) {
            if (R * r + G * g > N) break;
            if ((N - r * R - g * G) % B == 0) result++;
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 100000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define BLACK 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    string o, e;
    cin >> o >> e;
    ll i;
    string ans;
    
    
    for(i=0; i<e.size(); i++) {
        ans+=o[i];
        ans+=e[i];
    }
    
    if((o.size()+e.size())%2==1)
        ans+=o[o.size()-1];
    
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#!/usr/bin/ruby
t=0
while(n=gets.to_i)>0
	puts "Case #{t+=1}:"
	a=[]
	x=1
	c=1
	1.step(n){|i|
		b=[]
		1.step(i){b<<x;x+=1}
		b.reverse! if c>0
		c^=1
		a<<b
	}
	(n-1).step(1,-1){|i|
		b=[]
		1.step(i){b<<x;x+=1}
		b.reverse! if c>0
		c^=1
		a<<b
	}
	n.times{|i|
		n.times{|j|
			printf("%3d",a[i+j].shift)
		}
		puts
	}
end

Measured memory_bytes: 5336
import sys
n = int(input())
s = input()

for ans in [["S", "S"], ["S", "W"], ["W", "S"], ["W", "W"]]:
    for i in range(n-1):
        if s[(i+1)] == "o":
            if ans[i+1] == "S":
                if ans[i] == "S":
                    ans.append("S")
                else:
                    ans.append("W")
            else:
                if ans[i] == "S":
                    ans.append("W")
                else:
                    ans.append("S")
        if s[(i+1)] == "x":
            if ans[i+1] == "S":
                if ans[i] == "S":
                    ans.append("W")
                else:
                    ans.append("S")
            else:
                if ans[i] == "S":
                    ans.append("S")
                else:
                    ans.append("W")

    if ans[0] == ans[-1]:
        ans.pop()
        flag = 0
        if s[0] == "o":
            if ans[0] == "S":
                if ans[-1] == ans[1]:
                    flag = 1
            else:
                if ans[-1] != ans[1]:
                    flag = 1
        else:
            if ans[0] == "W":
                if ans[-1] == ans[1]:
                    flag = 1
            else:
                if ans[-1] != ans[1]:
                    flag = 1
        if flag == 1:
            print("".join(ans))
            sys.exit()
print(-1)


Measured memory_bytes: 6644
#include <bits/stdc++.h>
#define fi first
#define se second
#define maxn 300001
#define mod 1000000007
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> pi;

int N,r,c,n,m,ans;
int cnt,cntx,cnty;
int ar[maxn][2];
set<pi> s;
bool mxRow[maxn];
bool mxCol[maxn];
map<int,int> cntr;
map<int,int> cntc;
vector<pi> vr,vc;

int main() {
	scanf("%d%d%d",&r,&c,&N);
	for( int i = 0 , x,y ; i < N ; i++ ) {
		scanf("%d%d",&x,&y);
		ar[i][0] = x;
		ar[i][1] = y;
		cntr[x]++;
		cntc[y]++;
		s.insert(pi(x,y));
	}
	map<int,int>::iterator it;
	for( it = cntr.begin() ; it != cntr.end() ; it++ )
		vr.pb(pi(it->se,it->fi));
	for( it = cntc.begin() ; it != cntc.end() ; it++ )
		vc.pb(pi(it->se,it->fi));
	n = vr.size();
	m = vc.size();
	sort(vr.begin(),vr.end());
	sort(vc.begin(),vc.end());
	ans = vr[n-1].fi + vc[m-1].fi - 1;
	for( int i = n-1 ; i >= 0 ; i-- )
		if(vr[i].fi == vr[n-1].fi) {
			cntx++;
			mxRow[vr[i].se] = true;
		}
		else
			break;
	for( int i = m-1 ; i >= 0 ; i-- )
		if(vc[i].fi == vc[m-1].fi) {
			cnty++;
			mxCol[vc[i].se] = true;
		}
		else
			break;
	for( int i = 0 ; i < N ; i++ ) {
		int x = ar[i][0];
		int y = ar[i][1];
		if(mxRow[x] && mxCol[y])
			cnt++;
	}
	if(cnt < (LL)cntx*cnty)
		ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 56176
inline = list(input())
inline.reverse()

a1 = list("dream")
a2 = list("erase")
a3 = list("dreamer")
a4 = list("eraser")
a1.reverse()
a2.reverse()
a3.reverse()
a4.reverse()
i = 0
key = 0
while i < len(inline):
    if inline[i] == "m":
        if inline[i+1] == a1[1] and inline[i+2] == a1[2] and inline[i+3] == a1[3] and inline[i+4] == a1[4]:
            i+=5
        else:
            key += 1
            break
    elif inline[i] == "r" and inline[i+1] == "e":
        if inline[i+2] == a3[2] and inline[i+3] == a3[3] and inline[i+4] == a3[4] and inline[i+5] == a3[5] and inline[i+6] == a3[6]:
            i+=7
        elif inline[i+2] == a4[2] and inline[i+3] == a4[3] and inline[i+4] == a4[4] and inline[i+5] == a4[5]:
            i+= 6
        else :
            key += 1
            break

    elif inline[i] == "e":
        if inline[i+1] == a2[1] and inline[i+2] == a2[2] and inline[i+3] == a2[3] and inline[i+4] == a2[4]:
            i+=5
        else:
            key += 1
    else:
        key += 1
        break


if key >= 1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 4212
#include<stdio.h>
int main(){
  int X[]={0,1,0,-1};
  int Y[]={-1,0,1,0};
  int n;
  int h,i,j,k,d,c,x,y;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    if(i!=0)printf("\n");
    scanf("%d",&h);
    int m[102][102]={0};
    x=1;
    y=h;
    c=1;
    d=0;
    while(1){
       m[y][x]=1;
     if(x+X[d]==0||y+Y[d]==0||x+X[d]==h+1||y+Y[d]==h+1){
       if(c>1){
	 d++;
	 c=0;
	 if(d==4)d=0;
       }
       else break;
     }
     else if(m[y+2*Y[d]][x+2*X[d]]==1){//printf("a");
	if(c>1){
	  d++;
	  c=0;
	  if(d==4)d=0;
	}
	else break;
     }
     else{
       c++;	
       x+=X[d];
       y+=Y[d];
     }
    }
    for(k=1;k<=h;k++){
      for(j=1;j<=h;j++){
	if(m[k][j]==1)printf("#");
	else          printf(" ");
      }
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 616
a, b, c, x, y = map(int, input().split())
ans = x*a+y*b
for i in range(max(x, y) + 1):
    p = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b
    ans = min(ans, p)
print(ans)


Measured memory_bytes: 39280
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n)cout<<a[i]<<'\n'
#define pri3(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int n,m,_,x,y,q;
string s,sb;
bool ok;

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

  cin>>n; int a[n],b[n]={}; rep(i,n)cin>>a[i]; Int ans=0;
  rep(i,n-1){
    if(a[i+1]>a[i]){
      if(a[i+1]-a[i]>1){pri1(-1); return 0;}
    }else{
      ans+=a[i+1]-1;
    }
    ans++;
  }
  if(a[0]){pri1(-1); return 0;}
  END
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a;
map<ll,int> m;
vl e;

int main() {
	cin >> n;
	rep(i,n) {
		cin >> a;
		m[a]++;
	}
	// 同じ長さの棒が2本以上あるならその棒を辺として使える
	// 一番長い棒が4本以上ある場合それだけで正方形作るのが最善なので2回入れておく
	each(itr,m) {
		if (itr.se >= 4) e.pb(itr.fi);
		if (itr.se >= 2) e.pb(itr.fi);
	}
	sort(e.rbegin(), e.rend());
	// 使える棒のペアが2個未満なら長方形は作れない 2個以上あるなら一番長いやつ2個組み合わせればok
	if (e.size()<2) cout << 0 << ln;
	else cout << e[0]*e[1] << ln;
}

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

int main()
{
    ll a, b, n;
    cin >> a >> b >> n;
    ll f, tar;
    tar = min(b - 1, n);
    f = (a * tar) / b - a * (tar / b);
    cout << f << endl;
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#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 mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define ll long long
int main() {
    int W,H,x,y;
    cin>>W>>H>>x>>y;
  double r=double(W)*double(H)/2*(1.0);
  int c=0;
  if(x*2==W && y*2==H) c=1;
  cout<<fixed<<setprecision(6)<<r<<" "<<c<<endl;
}

Measured memory_bytes: 3780
#include<iostream>

using namespace std;

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

    int ans = 0;
    for(int i=1;i<3;i++){
        if(a>b){
            ans += a;
            a--;
        }else{
            ans += b;
            b--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
#include <stdio.h>

int main(void)
{
    int a, b, total, dig;

    while(scanf("%d%d", &a, &b)!=EOF){
        dig=0; total = a+b;
        while(total){
            dig++;
            total /= 10;
        }
        printf("%d\n", dig);
    }
    return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<algorithm>
#define N 100000
using namespace std;
int n,a[N+5],ans;
struct node { int i,cnt; } b[2][N+5];
bool cmp(node p,node q) { return p.cnt>q.cnt; }
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=N;i++) b[0][i].i=b[1][i].i=i;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		b[i%2][a[i]].cnt++;
	}
	sort(b[0]+1,b[0]+N+1,cmp);
	sort(b[1]+1,b[1]+N+1,cmp);
	if(b[0][1].i==b[1][1].i) ans=min(n-b[0][2].cnt-b[1][1].cnt,n-b[0][1].cnt-b[1][2].cnt);
	else ans=n-b[0][1].cnt-b[1][1].cnt;
	printf("%d\n",ans);
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define N 3002
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
vector<P> G[N];
bool num[N];
int n,m,K;

double dijkstra(){
  int D[N];
  for(int i=0;i<N;i++) D[i] = 1e9;
  
  vector<int>pre[N];
  priority_queue<PP,vector<PP>,greater<PP> >Q;
  for(int i=0;i<n;i++)if(num[i]) Q.push(PP(0,P(i,-1))),D[i] = 0;
  
  
  while(!Q.empty()){
    PP t = Q.top();Q.pop();
    int cost = t.first;
    int pos = t.second.first;
    int ppos = t.second.second;
    
    if(D[pos]<cost) continue;
    if(ppos>=0)pre[pos].push_back(ppos);
    
    for(int i=0;i<G[pos].size();i++){
      int npos = G[pos][i].first;
      int ncost = cost+G[pos][i].second;
      if(D[npos]<ncost) continue;
      Q.push(PP(ncost,P(npos,pos)));
      D[npos] = ncost;
    }
  }


  double res = 0;
  for(int i=0;i<n;i++){
    res = max(res,D[i]/2.0);
    if(pre[i].size()>=2) res = max(res,(double)D[i]);

    for(int j=0;j<(int)G[i].size();j++){
      int npos = G[i][j].first;
      int ncost = G[i][j].second;
      res = max(res,(D[i]+D[npos]+ncost)/2.0);
    }
  }
  return res;
   
}
 
int main(){
  cin>>n>>m>>K;
  for(int i=0,a,b,c;i<m;i++){
    cin>>a>>b>>c;
    G[a-1].push_back(P(b-1,c));
    G[b-1].push_back(P(a-1,c));
  }
 
  for(int i=0,a;i<K;i++)cin>>a,num[a-1]=1;
  printf("%d\n",(int)(dijkstra()+0.5));
  return 0;
}

Measured memory_bytes: 6212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, 0, n) {
        cin >> a[i];
    }
    int now = 1;
    rep(i, 0, n) {
        if (a[i] == now) now++;
    }
    if (now == 1) {
        cout << -1 << endl;
        return 0;
    }
    cout << n - (now - 1) << endl;
    return 0;
}


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

int main() {
    int N, A, B;
    string S;
    cin >> N >> A >> B >> S;
    int ab = 0, b = 0, AB = A + B;
    for (int i = 0; i < N; i++) {
        if (S.at(i) == 'a') {
            cout << (ab++ < AB ? "Yes" : "No") << endl;
        }
        else if (S.at(i) == 'b') {
            if (ab < AB && b < B) {
                cout << "Yes" << endl;
                ab++;
                b++;
            }
            else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 896
N, M = map(int, input().split())
UV = [list(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())

if 0 == M:
	print(-1)
	exit()

graph = [set() for _ in range(N)]
for u, v in UV:
	graph[u - 1] |= {v - 1}

INF = 10 ** 12
depths = [[INF, INF, INF] for _ in range(N)]

def bfs(start, end):
	depth = 0
	nodes = {start}
	while nodes:
		if (0 == depth % 3) and (end in nodes):
			return depth // 3
		next_nodes = set()
		for node in nodes:
			if depths[node][depth % 3] <= depth:
				continue
			depths[node][depth % 3] = depth
			next_nodes |= graph[node]
		nodes = next_nodes
		depth += 1
	return -1

print(bfs(S - 1, T - 1))


Measured memory_bytes: 70336
n = gets.to_i
xs = gets.split.map(&:to_i)

ans = 10**20

min = xs.min
max = xs.max

(min..max).each do |p|
  t_ans = 0
  xs.each do |x|
    t_ans += (x - p)**2
  end
  ans = [ans, t_ans].min
end

puts ans


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

using ll = long long;

// 3,5,7のみからなる整数(多分9桁以内全て?)をxに格納
vector<ll> x;
void dfs(ll i) {
  if(i != 0){
    x.push_back(i);
  }
  if(i < 1e8){
    dfs(10 * i + 3);
    dfs(10 * i + 5);
    dfs(10 * i + 7);
  }
  return;
}

// 3,5,7をそれぞれ1つ以上含むか判断
bool judge(ll i) {
  bool a, b, c;
  a = b = c = false;
  ll j;
  while(i > 0){
    j = i % 10;
    i /= 10;
    if(j == 3) a = true;
    if(j == 5) b = true;
    if(j == 7) c = true;
  }
  return (a & b & c);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  dfs(0);
  
  sort(x.begin(), x.end());
  
  int ans = 0;
  for(int i = 0; i < x.size(); i++){
    if(x.at(i) > n) break;
    if(judge(x.at(i))) ans++;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 640
S = input()
score = 0
g = 0
for s in S:
    if s == 'g':
        if g > 0:
            g -= 1
            score += 1
        else:
            g += 1
    else:
        if g > 0:
            g -= 1
        else:
            g += 1
            score -= 1
print(score)

Measured memory_bytes: 3316
#include <stdio.h>

void leap_year(int x, int y)
{
    int z = 0;
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
            z += 1;
        }
        x += 1;
    }
    if (z == 0) {
        printf("NA\n");
    }       
}

int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (!(a == 0 && b == 0)) { 
        leap_year(a, b);
        }
    scanf("%d %d", &a, &b);
    while(!(a == 0 && b == 0)) {
        printf("\n");
        leap_year(a, b);
        scanf("%d %d", &a, &b);
    }
    return 0;
}

Measured memory_bytes: 1044
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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


Measured memory_bytes: 256
<?php

$input = explode(" ",trim(fgets(STDIN)));
$items = $input[0];
$target = $input[1];

$list = explode(" ",trim(fgets(STDIN)));

$count = 0;
$sum = 0;
foreach($list as $value) {
  $sum+=$value;
}

$limit = $sum * (1 / (4 * $target));

foreach($list as $value) {
  if ($value >= $limit) {
    $count++;
  }
}
echo $target <= $count ? "Yes" : "No";

Measured memory_bytes: 4604
n = int(input())
li = list(map(int,input().split()))

cnt = 0
t = 0

while True:
    for i in range(t,n):
        if li[i] % 2 == 0:
            li[i] //= 2
            t = i
            cnt += 1
            break
    else:
        break

print(cnt)

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

int main(void)
{
    // input
    int N, K, Q;
    cin >> N >> K >> Q;

    int playerScore[N];
    for (int i = 0; i < N; i++) {
        playerScore[i] = K - Q;
    }

    int A;
    for (int i = 0; i < Q; i++) {
        cin >> A;
        playerScore[A-1]++;
    }

    for (int i = 0; i < N; i++) {
        if (playerScore[i] <= 0) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}

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

typedef long long ll;

ll a[100010];

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin>>n;

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

	sort(a, a+n);

	ll ans = 0;

	ll cnt = 1;
	for(ll i=1;i<n;i++) {
		if(a[i] == a[i-1]) cnt++;
		else {
			ans += cnt % 2;
			cnt = 1;
		}
	}
	ans += cnt % 2;

	cout<<ans<<endl;
	
}

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

const int INF = 1e9;
const int MOD = 998244353;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

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

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

struct segtree {
    int size;
    vector<ll> dat;
    ll init = -1;

    segtree(int N)
    {
        size = 1;
        while (size < N)
            size *= 2;
        dat = vector<ll>(2 * size - 1, init);
    }

    ll op(ll a, ll b)
    {
        return max(a, b);
    }

    void update(int i, ll x)
    {
        i += size - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;
            dat[i] = op(dat[2 * i + 1], dat[2 * i + 2]);
        }
        return;
    }

    ll query(int a, int b)
    {
        return query(a, b, 0, 0, size);
    }

    ll query(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l)
            return init;
        if (a <= l && r <= b)
            return dat[k];
        ll lv, rv;
        lv = query(a, b, 2 * k + 1, l, (l + r) / 2);
        rv = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return op(lv, rv);
    }
};

int main()
{
    int n;
    cin >> n;
    vector<pair<ll, ll>> vpll(n);
    REP(i, n)
    {
        cin >> vpll[i].first >> vpll[i].second;
    }
    sort(ALL(vpll));
    segtree lastidx(n);
    REPD(i, n)
    {
        auto it = lower_bound(ALL(vpll), (pair<ll, ll>) { vpll[i].first + vpll[i].second, 0LL });
        if ((int)(it - vpll.begin()) - 1 == i)
            lastidx.update(i, i);
        else {
            lastidx.update(i, lastidx.query(i + 1, (int)(it - vpll.begin())));
        }
    }
    vector<int> dp(n);
    dp[n - 1] = 1;
    vector<int> dp2(n, 1);

    REPD(i, n - 1)
    {
        dp[i] = dp[i + 1] + dp2[i + 1];
        dp[i] %= MOD;
        if (lastidx.dat[i+lastidx.size-1] == i)
            dp2[i] = dp[i];
        else
            dp2[i] = dp2[lastidx.dat[i+lastidx.size-1]];
        dp2[i] %= MOD;
    }
    cout << (dp[0] + dp2[0]) % MOD << endl;
}

Measured memory_bytes: 11956
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
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 long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	long long N;
	cin >> N;

	vector<deque<int> > vdA(N);
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != N - 1; ++j) {
			int tmp = 0;
			cin >> tmp;
			tmp = tmp - 1;
			vdA[i].push_back(tmp);
		}
	}

	int cnt = 0;
	while (1) {
		bool allempty = true;
		for (int i = 0; i != N; ++i) {
			if (!vdA[i].empty()) {
				allempty = false;
				break;
			}
		}

		if (allempty) {
			break;
		}

		vector<pair<int, int> > vpair;
		for (int i = 0; i != N; ++i) {
			if (!vdA[i].empty()) {
				int nextoppo = vdA[i][0];
				if (nextoppo < i) {
					continue;
				}

				if (i == vdA[nextoppo][0]) {
					vpair.push_back(make_pair(i, nextoppo));
//					vdA[i].pop_front();
//					vdA[nextoppo].pop_front();
				}
			}
		}

		for (int i = 0; i != vpair.size(); ++i) {
			vdA[vpair[i].first].pop_front();
			vdA[vpair[i].second].pop_front();
		}

		if (vpair.empty()) {
			cout << "-1" << endl;
			return 0;
		}
		cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 6784
#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;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	ll x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1) cout << "Brown";
	else cout << "Alice";
}


Measured memory_bytes: 3660
#include <stdio.h>
int main(void){
	int A[1000];
	int n,m,i,num,sum;
	char str[100];

	while(1){
		sum=0;
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d",&num);
		if(num==0) return 0;	
		for(i=0;i<12;i++){
			fgets(str,sizeof(str),stdin);
			sscanf(str,"%d %d",&n,&m);
			A[i] = n-m;			
		}
		for(i=0;i<12;i++){
			sum+=A[i];
			if(sum>=num){
				printf("%d\n",i+1);
				break;
			}
			else if(i==11 && sum < num)
				printf("NA\n");
		}
	}
	return 0;
}			

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

int main(){

 int x,y,ans = 0;
 cin >> x >> y;
  
  if(x == 1){
ans += 300000;
}
if(x == 2){
ans += 200000;
}
if(x == 3){
ans += 100000;
}
  if(y == 1){
ans += 300000;
}
if(y == 2){
ans += 200000;
}
if(y == 3){
ans += 100000;
}
  
  if(x == 1 && y == 1){
  ans += 400000;
  }
  
  cout << ans << endl;
  
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
while(cin >> n,!cin.eof()){
vector<int> prime;
prime.push_back(2);//ôðÈ­½ß2ÍÅÉüêÄ¨­
bool flag;
for(int x=3;x<=n;x+=2){
flag=true;
for(int y=0;prime[y]*prime[y]<=x;y++){
if(!(x%prime[y])){
flag=!flag;
break;
}
}
if(flag)prime.push_back(x);
}
int r = (n<=1)?(0):(prime.size());
cout << r << endl;
prime.clear();
}
return 0;
}

Measured memory_bytes: 1416
s = gets.chomp.split('')
c_even = 0
c_odd = 0
z_even = 0
z_odd = 0
n_even = s.size / 2
if s.size.odd?
  n_odd = s.size / 2 + 1
else
  n_odd = s.size / 2
end
s.each_index do |i|
  if s[i] == '1'
    if i.even?
      c_even += 1
    else
      c_odd += 1
    end
  else
    if i.even?
      z_even += 1
    else
      z_odd += 1
    end
  end
end
puts [n_even - z_even + n_odd - c_odd, n_even - c_even + n_odd - z_odd].min


Measured memory_bytes: 9468
#include <stdio.h>
#include <string.h>

void roll_N(void);
void roll_E(void);
void spin(void);
int now;
int dice[6],temp;
int men[24][2];

int main(void)
{
	int i,j;
	int q;

	for(i = 0; i < 6; i++)
	{
		scanf("%d", &dice[i]);
	}

	scanf("%d", &q);
	for(i = 0; i < q; i++)
	{
		scanf("%d %d", &men[i][0], &men[i][1]);
	}



	for(i = 0; i < q; i++)
	{
		for(j = 0; j < 4; j++)
		{
			roll_N();
			if (dice[0] == men[i][0] )
			{
				break;
			}

		}

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

				if (dice[0] == men[i][0] )
				{
					break;
				}

			}
		}

		for(j = 0; j < 4; j++)
		{
			spin();
			if (dice[1] == men[i][1])
			{
				printf("%d\n", dice[2]);
				break;
			}
		}

	}


	return 0;
}



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

}

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


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

}

Measured memory_bytes: 592
/*
 * main.c
 *
 *  Created on: 2019/01/13
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char moji[101] = {0};

int main()
{
    int length = 0;
    char keyence[8] = {0};
    char answer[8] = "keyence\n";
    int i = 0;

    scanf("%s",&moji[0]);
    length = strlen(moji);
//    printf("length=%d moji=%s\n", length, moji);


    for (i = 0; i < 8; i++) {
 	    strncpy(&keyence[0], &moji[0], 7 - i);
//   		printf("%s\n", &moji[0]);
        if (i == 0) {

        } else if ( i == 7) {
            strncpy(&keyence[0], &moji[length - i], i);
//       		printf("%s\n", &moji[length - i]);
        } else {
            strncpy(&keyence[7 - i], &moji[length - i], i);
//       		printf("%s %d\n", &moji[length - (i) ], length - (i));
        }

   	    if (strncmp(answer, keyence, 7) == 0) {
//    		printf("%s\n", keyence);
    		printf("YES\n");
    		return 0;
    	} else {
//       		printf("--%s\n", keyence);
    	}
   	    memset(keyence,0, 7);
    }

	printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()

def odd(A):
    oddi=np.array(A[::2],dtype=np.int64)
    eveni=np.array(A[1::2],dtype=np.int64)
    left=np.cumsum(oddi[:-1]-eveni)
    left=np.insert(left,0,0)
    right=np.cumsum(oddi[:0:-1]-eveni[::-1])[::-1]
    right=np.append(right,0)
    tmp=np.max(np.maximum.accumulate(left)+right)
    return tmp+np.sum(eveni)

def even(A):
    left=np.array([0]+A[::2],dtype=np.int64)
    right=np.array(A[1::2]+[0],dtype=np.int64)[::-1]
    return np.max(left.cumsum()+right.cumsum()[::-1])

def main():
    n=int(input())
    A=list(map(int, input().split()))
    if n%2==1:
        print(odd(A))
    else:
        print(even(A))


if __name__ == '__main__':
    main()

Measured memory_bytes: 50744
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

#define debug() fprintf(stderr, "#%d\n", __LINE__);

template<typename T>
using RQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;

struct Tree {
   Tree(Int n)
      : ps(n, -1) {}
   std::vector<Int> ps;
   Int root(Int x) {
      if( ps[x] == -1 ) return x;
      return ps[x] = root(ps[x]);
   }
   void connect(Int parent, Int child) {
      parent = root(parent), child = root(child);
      if( parent == child ) return;
      ps[root(child)] = root(parent);
   }
};

int main() {
   Int v, e, r;
   std::cin >> v >> e >> r;
   std::vector<Int> ss(e), ts(e), ws(e);
   rep(i, e) std::cin >> ss[i] >> ts[i] >> ws[i];
   std::vector<RQ<std::pair<Int,Int>>> qs(v);
   std::vector<Int> os(v);
   rep(i, e) {
      Int s = ss[i], t = ts[i], w = ws[i];
      qs[t].emplace(w, s);
   }
   std::vector<Int> xs(v);
   xs[r] = 2;
   Tree tree(v);
   bool fail = false;
   Int res = 0;
   rep(i, v) {
      Int a = tree.root(i);
      assert( xs[a] == 0 or xs[a] == 2 );
      guard( xs[a] == 0 );
      std::vector<std::pair<Int,Int>> ps(v);// p->i (cost, p)
      std::vector<Int> ys;
      while( xs[a] != 2 ) {
         ys.emplace_back(a);
         xs[a] = 1;
         if( qs[a].empty() ) {
            fail = true;
            break;
         }
         Int w, p;
         do {
            std::tie(w, p) = qs[a].top(); qs[a].pop();
            w += os[a];
            p = tree.root(p);
         } while( tree.root(a) == tree.root(p) );
         ps[a] = std::make_pair(w, p);
         res += w;
         if( xs[p] != 1 ) {
            a = p;
         }
         else {
            Int nr = a;
            Int b = a;
            do {
               if( qs[nr].size() < qs[b].size() ) nr = b;
               b = ps[b].second;
            } while( b != a );
            os[nr] -= ps[nr].first;
            b = a;
            do {
               if( nr != b ) {
                  tree.connect(nr, b);
                  while( not qs[b].empty() ) {
                     Int w2, p2; std::tie(w2, p2) = qs[b].top(); qs[b].pop();
                     Int nw = w2 + os[b] - ps[b].first - os[nr];
                     // p2 = tree.root(p2);
                     qs[nr].emplace(nw, p2);
                  }
               }
               b = ps[b].second;
            } while( b != a );
            a = nr;
         }
      }
      if( fail ) break;
      for(Int y : ys) {
         xs[y] = 2;
      }
   }
   printf("%ld\n", res);
}



Measured memory_bytes: 3296
n,m = map(int, input().split())
l = []
for i in range(n):
    tmp = list(map(int,input().split()))
    l.append(tmp)

if m==0:
    print(0)
    exit()

ans=-10**9
from itertools import *
for tmp in list(product([True,False], repeat=3)):
    lis=[]
    for x in l:
        sm=0
        if tmp[0]:
            sm+=x[0]
        else:
            sm-=x[0]
        if tmp[1]:
            sm+=x[1]
        else:
            sm-=x[1]
        if tmp[2]:
            sm+=x[2]
        else:
            sm-=x[2]

        lis.append(sm)

    lis.sort()

    sm=sum(lis[-m:])
    if ans < sm:
        ans=sm
print(ans)

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

int main(){
  int X, Y;
  cin >> X >> Y;
  
  int sum;
  
  for (int i = 0; i <= X; i++){
    sum = 2 * i + 4 * (X - i);
    if (sum == Y){
      cout << "Yes";
      return 0;
    }
  }
  
  cout << "No";
  return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VECINT;
typedef vector<ll> VECLL;

int main() {
  VECINT vals(3);
  REP(i,3) cin>>vals[i];
  int K;cin>>K;
  sort(ALL(vals));
  REP(i,K) vals[2] *= 2;
  OUT(accumulate(ALL(vals),0));

  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc154/tasks/abc154_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

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

  V<double> ps(N);
  rep(i, N) cin >> ps[i];

  V<double> es(N);
  rep(i, N) { es[i] = (ps[i] + 1) / 2; }

  double res = 0;
  double cur = 0;

  rep(i, N) {
    cur += es[i];

    if (i + 1 > K) {
      cur -= es[i - K];
    }

    chmax(res, cur);
  }

  cout << fixed << setprecision(12) << res << endl;
}

void solve2() {
  ll N, K;
  cin >> N >> K;

  V<double> ps(N);
  rep(i, N) cin >> ps[i];

  V<double> es(N);
  rep(i, N) { es[i] = (ps[i] + 1) / 2; }

  ld res = 0;
  ld cur = 0;
  queue<ld> q;

  rep(i, N) {
    cur += es[i];
    q.push(es[i]);

    if (q.size() > K) {
      ld v = q.front();
      q.pop();
      cur -= v;
    }

    if (q.size() == K) {
      chmax(res, cur);
    }
  }

  cout << fixed << setprecision(12) << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i = 0; i < n; ++ i) cin >> a[i];
	int ans = 1e9; 
	for(int i = 0; i < n - k + 1; ++ i) ans = min(ans, abs(a[i]) + a[i + k - 1] - a[i]);
	for(int i = n - 1; i >= k - 1; -- i) ans = min(ans, abs(a[i]) + a[i] - a[i - k + 1]);
	cout << ans << '\n';
}
	


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    double A,B,H,M;
    cin>>A>>B>>H>>M;
    double a,b;
    a=30*H+M/2;
    b=6*M;
    double p=acos(-1);
    a*=p/180;
    b*=p/180;
    double l2=(A*cos(a)-B*cos(b))*(A*cos(a)-B*cos(b))+(A*sin(a)-B*sin(b))*(A*sin(a)-B*sin(b));
    l2=sqrt(l2);
    cout<<fixed<<setprecision(10);
    cout<<l2<<endl;
}

Measured memory_bytes: 4164
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 100000000000000
#define MAX_V 101


int V;
LL d[MAX_V][MAX_V];

void wf(){
	REP(k,V)REP(i,V)REP(j,V){
		d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}

int main(){
	int E;
	cin>>V>>E;
	REP(i,V)REP(j,V)d[i][j]=(i==j)?0:INF;
	REP(i,E){
		int a,b,c;
		cin>>a>>b>>c;
		d[a][b]=c;
	}
	wf();
	REP(i,V)if(d[i][i]<0){
		cout<<"NEGATIVE CYCLE"<<endl;
		return 0;
	}
	REP(i,V){
		REP(j,V){
			if(d[i][j]>2*10e9)cout<<"INF";
			else cout<<d[i][j];
			if(j!=V-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1236
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var s string

func main() {
	sc.Split(bufio.ScanWords)

	s = nextStr()
	start, end := -1, -1

	for i := 0; i < len(s); i++ {
		if string(s[i]) == "A" && start == -1 {
			start = i
			continue
		}
		if string(s[i]) == "Z" && start > -1 {
			end = i
		}
	}

	fmt.Println(end - start + 1)

}


Measured memory_bytes: 1408
N, K = map(int, input().split())

A = [0] * 10**5

for i in range(N):
    a, b = map(int, input().split())
    A[a-1] += b

c = 0

for i in range(10**5):
    c += A[i]
    if c >= K:
        break

print(i+1)


Measured memory_bytes: 5748
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  ll k;
  cin >> k;
  ll alu = k / 50;
  ll am = k % 50;
  vector<ll> ans(50, 0);
  rep(i, 50){
    if(i < am){
      ans.at(i)++;
    }
    ans.at(i) += 49 + alu;
  }
  rep2(i, am, 50){
    ans.at(i) -= am;
  }
  cout << ans.size() << endl;
  rep(i, ans.size()){
    if(i != 0) cout << " ";
    cout << ans.at(i);
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      char[] N = sc.next().toCharArray();
      String result = "No";
      if (N[0] == '7' || N[1] == '7' || N[2] == '7')
        result = "Yes";
      System.out.println(result);
    }
  }
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s;
int n, ans;

bool f(int l) {
	if(l % 2 != 0) { return false; }
	l /= 2;
	inc(i, l) { if(s[i] != s[l + i]) { return false; } }
	return true;
}

int main() {
	cin >> s;
	n = s.size();
	
	dec(i, n) { if(f(i)) { ans = i; break; } }
	
	cout << ans << endl;
	
	return 0;
}


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

#define FOR(i, a, b)  for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << "\n"
#define _ << " _ " <<
#define ll long long
#define pil pair <int, ll>
#define pii pair <int, int>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);

  ll a, b;
  cin >> a >> b;
  ll out = min(a, b / 2);
  a -= out;
  b -= 2 * out;

  while (b >= 4) {
    out++;
    b -= 4;
  }

  cout << out << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};
/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/

int main(){
    string s,t; cin >> s >> t;
    int ans = 0;
    if (s[0] == t[0]) ans++;
    if (s[1] == t[1]) ans++;
    if (s[2] == t[2]) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256